diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 30583de..c4906cf 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -3,6 +3,11 @@ name: Build and Release # Every push to master builds the module and publishes a release, tagged with # the build date. Pushing a v* tag by hand publishes under that tag instead. # +# A pull request runs the same build but stops short of publishing, which is +# how a risky change gets verified without leaving half-working commits on +# master. Nothing here can be built or tested on Linux, so CI is the only +# feedback available before merging. +# # This does not recurse. The tag created below is pushed with GITHUB_TOKEN, and # GitHub deliberately does not start a new workflow run for events raised by # that token — so "push to master -> create v* tag" does not re-enter the @@ -11,30 +16,35 @@ on: push: branches: [master] tags: ['v*'] + pull_request: + branches: [master] workflow_dispatch: # The date-based sequence number is derived from tags that already exist, so # two runs racing each other could pick the same number. Keep runs serialised # and let queued ones finish rather than cancelling them — every push is meant -# to produce its own release. +# to produce its own release. Pull requests get their own group per branch so +# that iterating on a PR does not queue up behind unrelated runs. concurrency: - group: build-and-release - cancel-in-progress: false + group: build-and-release-${{ github.event_name == 'pull_request' && github.ref || 'master' }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} permissions: contents: write # create tags and releases env: - SOLUTION: ImageStore.sln + PROJECT: ImageStore/ImageStore.csproj CONFIGURATION: Release - BUILD_OUTPUT: ImageStore\bin\Release + # dotnet publish, not build: it gathers the full runtime dependency set into + # one directory, which is what a PowerShell module folder has to contain. + BUILD_OUTPUT: publish # Date-based tags follow this timezone rather than the runner's UTC clock, so # a tag reads the same date the commit was authored in. TAG_TIMEZONE: China Standard Time jobs: build: - # .NET Framework 4.8.1 + Windows Forms — this cannot be built on Linux. + # net10.0-windows + Windows Forms — this cannot be built on Linux. runs-on: windows-latest steps: @@ -48,8 +58,17 @@ jobs: - name: Resolve version id: version shell: pwsh + env: + PR_NUMBER: ${{ github.event.pull_request.number }} run: | - if ($env:GITHUB_REF -like 'refs/tags/*') { + if ($env:GITHUB_EVENT_NAME -eq 'pull_request') { + # Never published, so it gets a name that cannot be mistaken for a + # release if the artifact is downloaded and passed around. + $tag = "pr$($env:PR_NUMBER)-$($env:GITHUB_SHA.Substring(0, 7))" + $tagExists = 'false' + Write-Host "Pull request build, not a release: $tag" + } + elseif ($env:GITHUB_REF -like 'refs/tags/*') { # A human pushed a tag — publish under it verbatim. $tag = $env:GITHUB_REF -replace '^refs/tags/', '' $tagExists = 'true' @@ -84,39 +103,33 @@ jobs: Add-Content -Path $env:GITHUB_OUTPUT -Value "tag=$tag" Add-Content -Path $env:GITHUB_OUTPUT -Value "tag_exists=$tagExists" - - name: Set up MSBuild - uses: microsoft/setup-msbuild@v3 - - - name: Set up NuGet - uses: nuget/setup-nuget@v4 - - - name: Restore NuGet packages - shell: pwsh - # Legacy csproj with a PackageReference (Microsoft.PowerShell.5.ReferenceAssemblies); - # restore has to run before msbuild. - run: nuget restore $env:SOLUTION + - name: Set up .NET + uses: actions/setup-dotnet@v6 + with: + dotnet-version: '10.0.x' - - name: Build + - name: Build and publish shell: pwsh run: | - msbuild $env:SOLUTION ` - /p:Configuration=$env:CONFIGURATION ` - '/p:Platform=Any CPU' ` - /m /nologo /verbosity:minimal + dotnet publish $env:PROJECT ` + --configuration $env:CONFIGURATION ` + --output $env:BUILD_OUTPUT ` + --nologo - name: Verify build output shell: pwsh run: | # Import-Module fails at load time if any of these is missing from the # module folder, so publishing without them would ship a broken release. + # The BCL packages the 4.8.1 build needed (System.Buffers, System.Memory, + # System.Numerics.Vectors, System.Runtime.CompilerServices.Unsafe) are + # part of the framework on .NET 10 and no longer appear here. $required = @( 'ImageStore.dll' + 'ImageStore.deps.json' 'Shipwreck.Phash.dll' 'Shipwreck.Phash.Bitmaps.dll' - 'System.Buffers.dll' - 'System.Memory.dll' - 'System.Numerics.Vectors.dll' - 'System.Runtime.CompilerServices.Unsafe.dll' + 'Microsoft.Data.SqlClient.dll' ) $missing = $required | Where-Object { -not (Test-Path (Join-Path $env:BUILD_OUTPUT $_)) } if ($missing) { @@ -124,19 +137,42 @@ jobs: exit 1 } - # And the opposite check. Reference assemblies have no method bodies - # and must never be shipped — the PowerShell host supplies the real - # System.Management.Automation at run time. ExcludeAssets=runtime in - # the csproj keeps it out of the output; this is the net that catches - # a regression there, since a merely-too-large zip looks fine. - $banned = @('System.Management.Automation.dll') - $leaked = $banned | Where-Object { Test-Path (Join-Path $env:BUILD_OUTPUT $_) } + # SqlClient's native SNI library lives in a runtimes\ subdirectory. A + # module missing it loads fine and then fails on the first connection, + # so check it separately from the flat files above. + if (-not (Get-ChildItem $env:BUILD_OUTPUT -Recurse -File -Filter 'Microsoft.Data.SqlClient.SNI.dll')) { + Write-Error "Native SNI library missing from $($env:BUILD_OUTPUT)\runtimes" + exit 1 + } + + # And the opposite check: nothing belonging to the PowerShell host may + # ship. System.Management.Automation.dll is a reference assembly with no + # method bodies, and the native payload beside it is the host's own + # (including Linux and macOS libraries, in a Windows-only module). + # ExcludeAssets="runtime;native" in the csproj keeps them out; this is + # the net for a regression, since an oversized package still looks fine. + # Recursive, because the native files sit under runtimes\\native. + $banned = @( + 'System.Management.Automation.dll' + 'pwrshplugin.dll' + 'PowerShell.Core.Instrumentation.dll' + 'libpsl-native.*' + 'getfilesiginforedist.dll' + ) + $leaked = $banned | + ForEach-Object { Get-ChildItem $env:BUILD_OUTPUT -Recurse -File -Filter $_ } | + Select-Object -ExpandProperty Name -Unique if ($leaked) { - Write-Error "Reference assembly leaked into $($env:BUILD_OUTPUT): $($leaked -join ', ')" + Write-Error "PowerShell host payload leaked into the package: $($leaked -join ', ')" exit 1 } - Get-ChildItem $env:BUILD_OUTPUT | Format-Table Name, Length, LastWriteTime + # Recursive: Microsoft.Data.SqlClient carries a native SNI library under + # runtimes\win-*\native, and that layout has to survive into the package. + Get-ChildItem $env:BUILD_OUTPUT -Recurse -File | + Select-Object @{n='Path';e={$_.FullName.Substring((Resolve-Path $env:BUILD_OUTPUT).Path.Length + 1)}}, Length | + Sort-Object Path | + Format-Table -AutoSize - name: Package id: package @@ -149,11 +185,16 @@ jobs: run: | $tag = $env:TAG - # The module: dlls only — the .pdb is not part of a release. + # The module: the whole publish output minus debug symbols. Copied + # wholesale rather than picking out *.dll, because the tree matters — + # ImageStore.deps.json drives dependency resolution, and SqlClient's + # native SNI library lives under runtimes\win-*\native. Flattening it + # produces a module that loads and then fails on first connect. $moduleStage = Join-Path $env:RUNNER_TEMP 'module' $moduleZip = "ImageStore-$tag.zip" New-Item -ItemType Directory -Path $moduleStage -Force | Out-Null - Copy-Item "$env:BUILD_OUTPUT\*.dll" -Destination $moduleStage + Copy-Item "$env:BUILD_OUTPUT\*" -Destination $moduleStage -Recurse -Force + Get-ChildItem $moduleStage -Recurse -Include '*.pdb' | Remove-Item -Force Compress-Archive -Path "$moduleStage\*" -DestinationPath $moduleZip -Force # The database: shipped as its own asset. It is a one-time download @@ -180,6 +221,9 @@ jobs: if-no-files-found: error - name: Publish release + # Pull requests stop here: they have proved the build and produced a + # downloadable artifact, which is the whole point of the PR run. + if: github.event_name != 'pull_request' shell: pwsh env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CLAUDE.md b/CLAUDE.md index 48b872d..eafff49 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -17,39 +17,50 @@ Duplicate detection has two independent pipelines: - **Same File** — byte-identical files, detected via SHA-1 (`SameFile` table). - **Similar File** — visually similar images, detected via pHash - ([Shipwreck.Phash](https://github.com/scegg/phash), a fork of pgrho/phash) (`SimilarFile` table). + ([Shipwreck.Phash](https://github.com/pgrho/phash)) (`SimilarFile` table). ## Build and toolchain | | | |---|---| -| Target | .NET Framework **4.8.1**, `AnyCPU`, `OutputType=Library` | -| UI | Windows Forms (`System.Windows.Forms`, `System.Drawing`) | -| Project style | **Legacy (non-SDK) csproj**, ToolsVersion 15.0 | -| Build | Visual Studio 2017+ or `msbuild ImageStore.sln` on **Windows** | +| Target | `net10.0-windows`, `OutputType=Library` | +| UI | Windows Forms (`UseWindowsForms`) | +| Project style | SDK-style csproj (`Microsoft.NET.Sdk`) | +| Build | `dotnet build` / `dotnet publish ImageStore/ImageStore.csproj -c Release` | +| Host | **PowerShell 7.6+** only. 7.6 is the first release built on .NET 10; Windows PowerShell 5.1 cannot load the module at all. | | Root namespace | `SecretNest.ImageStore` (assembly name `ImageStore`) | | Tests | None. There is no test project. | -| CI | `.github/workflows/build-and-release.yml` — builds on `windows-latest` and publishes a release on every push to `master`. | +| CI | `.github/workflows/build-and-release.yml` — builds on `windows-latest`, publishes a release on every push to `master`, builds without publishing on pull requests. | -**The project cannot be built on Linux/macOS.** `dotnet build` will not work — this is a legacy -csproj targeting .NET Framework with WinForms. On a non-Windows machine, restrict work to source -edits, review, and documentation; do not claim a change compiles unless it was actually built on -Windows. +**It builds on Linux**, which is worth knowing because the WinForms target suggests otherwise: -**Adding or removing a source file requires editing `ImageStore/ImageStore.csproj` by hand.** -Legacy csproj has no glob includes. A new `.cs` file that is not listed in a `` -item is silently excluded from the build. WinForms files need the matching structure too: - -```xml -Form -MyForm.cs -MyForm.cs ``` +dotnet build ImageStore/ImageStore.csproj -c Release -p:EnableWindowsTargeting=true +dotnet publish ImageStore/ImageStore.csproj -c Release -o /tmp/out -p:EnableWindowsTargeting=true +``` + +That compiles and produces a complete publish tree, so compile errors, analyzer errors and the +exact package contents can all be checked locally. It cannot be *run* there — use it to verify +the build, then rely on CI or a Windows box for anything behavioural. + +Dependencies come from NuGet; nothing is committed to the repo: -Third-party assemblies (`Shipwreck.Phash*.dll`, `System.Memory.dll`, `System.Buffers.dll`, -`System.Numerics.Vectors.dll`, `System.Runtime.CompilerServices.Unsafe.dll`) are **committed to the -repo** under `ImageStore/` and referenced by `HintPath`, not by NuGet. Only -`Microsoft.PowerShell.5.ReferenceAssemblies` comes from a `PackageReference`. +| Package | Note | +|---|---| +| `Shipwreck.Phash`, `Shipwreck.Phash.Bitmaps` | Upstream. A fork used to be vendored here for extra `GetCrossCorrelation` overloads; upstream 0.5.0 has them. | +| `Microsoft.Data.SqlClient` | Replaces `System.Data.SqlClient`, which has no .NET 10 story. | +| `System.Management.Automation` | `ExcludeAssets="runtime;native"` — see below. | + +**`ExcludeAssets` on `System.Management.Automation` must keep both `runtime` and `native`.** +The PowerShell host supplies that assembly at run time, and the package's managed dll is a +reference assembly with no method bodies. Excluding only `runtime` still drags the host's *native* +payload into the output — `pwrshplugin.dll`, `PowerShell.Core.Instrumentation.dll`, and +`libpsl-native.so`/`.dylib` for Linux and macOS, in a Windows-only module. That mistake costs +~36 files and is invisible unless the package is opened. + +Use `dotnet publish`, not `dotnet build`, when producing something to ship: the module needs its +full dependency closure, `ImageStore.deps.json`, and `runtimes/win-*/native/Microsoft.Data.SqlClient.SNI.dll`. +A package missing SNI loads fine and then fails on the first database connection. ## Repository layout @@ -98,7 +109,9 @@ one connection is reused for the whole operation. Neither setting survives a Pow ### ADO.NET conventions -Raw `System.Data.SqlClient` throughout — no ORM, no EF, no async. The consistent shape is: +Raw `Microsoft.Data.SqlClient` throughout — no ORM, no EF, no async. Only the namespace differs +from the old `System.Data.SqlClient`; the type names are the same, and `SqlDbType` is still +`System.Data.SqlDbType`. The consistent shape is: ```csharp var connection = DatabaseConnection.Current; @@ -169,8 +182,9 @@ careful about adding per-file state to those structures. `Select-ImageStoreSameFile` and `Resolve-ImageStoreSimilarFiles` call `Application.EnableVisualStyles()` in `BeginProcessing` and then `ShowDialog()`. There is no -message loop of the module's own — the dialogs rely on the host thread being STA (the default in -the Windows PowerShell console host). The heaviest UI is +message loop of the module's own — the dialogs rely on the host thread being STA. `pwsh` is STA by +default on Windows (restored in 7.0-preview.3 precisely so WinForms and WPF work), but VS Code's +PowerShell Integrated Console is MTA, where these two cmdlets misbehave. The heaviest UI is `SimilarFile/SimilarFileInGroupManager.cs`; `DoubleBufferedDataGridView` / `DoubleBufferedListView` exist to keep large lists from flickering. @@ -214,8 +228,8 @@ wipes both the pair table and those thresholds. ## CI and releases -`.github/workflows/build-and-release.yml` runs on `windows-latest` (the only option — see -build constraints above) and does restore → build → verify → package → release. +`.github/workflows/build-and-release.yml` runs on `windows-latest` and does +publish → verify → package → release. **Every push to `master` publishes a real release.** The tag is date-based, `v.`, where `n` continues from the highest tag already published that day; the date is stamped in @@ -223,24 +237,27 @@ where `n` continues from the highest tag already published that day; the date is publishes under that tag verbatim instead. Because the sequence number is derived from existing tags, the workflow is serialised with a `concurrency` group — do not remove that. -Each release carries two assets: `ImageStore-.zip` (every `.dll` from `ImageStore\bin\Release`) -and `ImageStore-Database-.zip` (the empty `.mdf`/`.ldf` and `CreateDatabase.txt`). The database -is deliberately separate — its contents are identical in every release and are only needed once, -when setting up a project. +**A pull request runs the same build but skips publishing** (`if: github.event_name != 'pull_request'` +on the last step) and labels its artifact `pr-` so it cannot be mistaken for a release. +Use it for anything risky: nothing here can be *run* outside Windows, so CI is the only behavioural +feedback before merging. + +Each release carries two assets: `ImageStore-.zip` (the whole publish tree minus `.pdb`) and +`ImageStore-Database-.zip` (the empty `.mdf`/`.ldf` and `CreateDatabase.txt`). The database is +deliberately separate — its contents are identical in every release and are only needed once, when +setting up a project. The module archive is copied wholesale rather than as flat `*.dll`, because +`deps.json` and `runtimes/win-*/native/` have to keep their layout. The "Verify build output" step guards the package in both directions: -- **Nothing missing.** The six third-party dlls must sit next to `ImageStore.dll`, because - `Import-Module` fails at load time if any is absent. They reach the output through `` - CopyLocal, *not* through their `` entries (those carry no `CopyToOutputDirectory` and - copy nothing) — so switching a dependency to a plain `` item would silently stop - packaging it. -- **Nothing extra.** `System.Management.Automation.dll` must not appear. It comes from the - `Microsoft.PowerShell.5.ReferenceAssemblies` package and is a *reference assembly* — metadata - only, no method bodies — and the PowerShell host supplies the real one at run time. - `runtime` on that `PackageReference` keeps it out of the output; - the check is the net for a regression, since an oversized zip otherwise looks perfectly healthy. - v2026.08.15.1 shipped with it by mistake. +- **Nothing missing.** `ImageStore.dll`, `ImageStore.deps.json`, both `Shipwreck.Phash*` dlls, + `Microsoft.Data.SqlClient.dll`, and — checked recursively — the native SNI library. +- **Nothing extra.** No `System.Management.Automation.dll`, `pwrshplugin.dll`, + `PowerShell.Core.Instrumentation.dll`, `libpsl-native.*` or `getfilesiginforedist.dll`. These + belong to the PowerShell host and are kept out by `ExcludeAssets="runtime;native"`; the check is + the net for a regression, since an oversized package otherwise looks perfectly healthy. Both + halves of this have already caught a real mistake — v2026.08.15.1 shipped the reference assembly, + and the native payload leaked in during the .NET 10 upgrade. The workflow does not touch `AssemblyInfo.cs`: the dll stays at `1.0.0.0` and the version lives only in the tag, release title, and asset name. diff --git a/ImageStore/Database/CompressDatabaseCmdlet.cs b/ImageStore/Database/CompressDatabaseCmdlet.cs index ff31091..3d9211b 100644 --- a/ImageStore/Database/CompressDatabaseCmdlet.cs +++ b/ImageStore/Database/CompressDatabaseCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/DatabaseShared/DatabaseConnection.cs b/ImageStore/DatabaseShared/DatabaseConnection.cs index 5513cb5..d1e05fd 100644 --- a/ImageStore/DatabaseShared/DatabaseConnection.cs +++ b/ImageStore/DatabaseShared/DatabaseConnection.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/ImageStore/DatabaseShared/WhereCauseBuilder.cs b/ImageStore/DatabaseShared/WhereCauseBuilder.cs index 5dd5e28..a9cf85c 100644 --- a/ImageStore/DatabaseShared/WhereCauseBuilder.cs +++ b/ImageStore/DatabaseShared/WhereCauseBuilder.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/ImageStore/Extension/AddExtensionCmdlet.cs b/ImageStore/Extension/AddExtensionCmdlet.cs index b0ad180..abf5c37 100644 --- a/ImageStore/Extension/AddExtensionCmdlet.cs +++ b/ImageStore/Extension/AddExtensionCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/Extension/ExtensionHelper.cs b/ImageStore/Extension/ExtensionHelper.cs index d557b74..a346a83 100644 --- a/ImageStore/Extension/ExtensionHelper.cs +++ b/ImageStore/Extension/ExtensionHelper.cs @@ -1,7 +1,7 @@ using SecretNest.ImageStore.Extension; using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/ImageStore/Extension/FindExtensionCmdlet.cs b/ImageStore/Extension/FindExtensionCmdlet.cs index bb6c8fe..7c4bbc6 100644 --- a/ImageStore/Extension/FindExtensionCmdlet.cs +++ b/ImageStore/Extension/FindExtensionCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/Extension/GetExtensionCmdlet.cs b/ImageStore/Extension/GetExtensionCmdlet.cs index df6158f..d415780 100644 --- a/ImageStore/Extension/GetExtensionCmdlet.cs +++ b/ImageStore/Extension/GetExtensionCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/Extension/RemoveExtensionCmdlet.cs b/ImageStore/Extension/RemoveExtensionCmdlet.cs index dc5ec4d..8e8e999 100644 --- a/ImageStore/Extension/RemoveExtensionCmdlet.cs +++ b/ImageStore/Extension/RemoveExtensionCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Management.Automation.Runspaces; diff --git a/ImageStore/Extension/SearchExtensionCmdlet.cs b/ImageStore/Extension/SearchExtensionCmdlet.cs index d4742b1..5aaa02f 100644 --- a/ImageStore/Extension/SearchExtensionCmdlet.cs +++ b/ImageStore/Extension/SearchExtensionCmdlet.cs @@ -1,7 +1,7 @@ using SecretNest.ImageStore.DatabaseShared; using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/Extension/UpdateExtensionCmdlet.cs b/ImageStore/Extension/UpdateExtensionCmdlet.cs index d547e7b..2cc076c 100644 --- a/ImageStore/Extension/UpdateExtensionCmdlet.cs +++ b/ImageStore/Extension/UpdateExtensionCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/File/AddFileCmdlet.cs b/ImageStore/File/AddFileCmdlet.cs index dbeb275..6367f42 100644 --- a/ImageStore/File/AddFileCmdlet.cs +++ b/ImageStore/File/AddFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/File/FileHelper.cs b/ImageStore/File/FileHelper.cs index 0b3e9e9..addad1b 100644 --- a/ImageStore/File/FileHelper.cs +++ b/ImageStore/File/FileHelper.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/ImageStore/File/FindFileCmdlet.cs b/ImageStore/File/FindFileCmdlet.cs index 80cf621..ab4b999 100644 --- a/ImageStore/File/FindFileCmdlet.cs +++ b/ImageStore/File/FindFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/File/GetFileCmdlet.cs b/ImageStore/File/GetFileCmdlet.cs index 3f74159..0778f45 100644 --- a/ImageStore/File/GetFileCmdlet.cs +++ b/ImageStore/File/GetFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/File/MeasureFileCmdlet.cs b/ImageStore/File/MeasureFileCmdlet.cs index f79fb8b..b6c3c51 100644 --- a/ImageStore/File/MeasureFileCmdlet.cs +++ b/ImageStore/File/MeasureFileCmdlet.cs @@ -3,7 +3,7 @@ using Shipwreck.Phash; using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/File/MeasureFileHelper.cs b/ImageStore/File/MeasureFileHelper.cs index f30db67..557b0b9 100644 --- a/ImageStore/File/MeasureFileHelper.cs +++ b/ImageStore/File/MeasureFileHelper.cs @@ -14,7 +14,9 @@ namespace SecretNest.ImageStore.File { class MeasureFileHelper : IDisposable { - SHA1Managed sha1 = new SHA1Managed(); + //SHA1.Create() rather than new SHA1Managed(): the derived crypto types + //are obsolete on .NET 5+ (SYSLIB0021). Same algorithm, same output. + SHA1 sha1 = SHA1.Create(); byte[] ComputeSha1Hash(FileStream stream) { diff --git a/ImageStore/File/MeasureFilesCmdlet.cs b/ImageStore/File/MeasureFilesCmdlet.cs index 1b11447..fba40f5 100644 --- a/ImageStore/File/MeasureFilesCmdlet.cs +++ b/ImageStore/File/MeasureFilesCmdlet.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/File/MoveFileCmdlet.cs b/ImageStore/File/MoveFileCmdlet.cs index db77000..186509a 100644 --- a/ImageStore/File/MoveFileCmdlet.cs +++ b/ImageStore/File/MoveFileCmdlet.cs @@ -1,7 +1,7 @@ using SecretNest.ImageStore.Folder; using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/File/RemoveDirectoryCmdlet.cs b/ImageStore/File/RemoveDirectoryCmdlet.cs index 0519953..3c03971 100644 --- a/ImageStore/File/RemoveDirectoryCmdlet.cs +++ b/ImageStore/File/RemoveDirectoryCmdlet.cs @@ -1,7 +1,7 @@ using SecretNest.ImageStore.Folder; using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.IO; using System.Linq; using System.Management.Automation; diff --git a/ImageStore/File/RemoveFileCmdlet.cs b/ImageStore/File/RemoveFileCmdlet.cs index 36b860c..4eb3421 100644 --- a/ImageStore/File/RemoveFileCmdlet.cs +++ b/ImageStore/File/RemoveFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/File/RenameFileCmdlet.cs b/ImageStore/File/RenameFileCmdlet.cs index 214d5cc..8a105c9 100644 --- a/ImageStore/File/RenameFileCmdlet.cs +++ b/ImageStore/File/RenameFileCmdlet.cs @@ -1,7 +1,7 @@ using SecretNest.ImageStore.Extension; using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/File/SearchFileCmdlet.cs b/ImageStore/File/SearchFileCmdlet.cs index df582fe..fdbab20 100644 --- a/ImageStore/File/SearchFileCmdlet.cs +++ b/ImageStore/File/SearchFileCmdlet.cs @@ -1,7 +1,7 @@ using SecretNest.ImageStore.DatabaseShared; using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/File/UpdateFileCmdlet.cs b/ImageStore/File/UpdateFileCmdlet.cs index bfb27eb..d1a03ec 100644 --- a/ImageStore/File/UpdateFileCmdlet.cs +++ b/ImageStore/File/UpdateFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/Folder/AddFolderCmdlet.cs b/ImageStore/Folder/AddFolderCmdlet.cs index f9dad56..b6e1ab1 100644 --- a/ImageStore/Folder/AddFolderCmdlet.cs +++ b/ImageStore/Folder/AddFolderCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/Folder/FindFolderCmdlet.cs b/ImageStore/Folder/FindFolderCmdlet.cs index 1a69cd4..3b1f965 100644 --- a/ImageStore/Folder/FindFolderCmdlet.cs +++ b/ImageStore/Folder/FindFolderCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/Folder/FolderHelper.cs b/ImageStore/Folder/FolderHelper.cs index 817b549..deb9637 100644 --- a/ImageStore/Folder/FolderHelper.cs +++ b/ImageStore/Folder/FolderHelper.cs @@ -1,7 +1,7 @@ using SecretNest.ImageStore.Folder; using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/ImageStore/Folder/GetFolderCmdlet.cs b/ImageStore/Folder/GetFolderCmdlet.cs index 6c46c68..ae32628 100644 --- a/ImageStore/Folder/GetFolderCmdlet.cs +++ b/ImageStore/Folder/GetFolderCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/Folder/RemoveFolderCmdlet.cs b/ImageStore/Folder/RemoveFolderCmdlet.cs index 26b14c8..0cd0193 100644 --- a/ImageStore/Folder/RemoveFolderCmdlet.cs +++ b/ImageStore/Folder/RemoveFolderCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Management.Automation.Runspaces; diff --git a/ImageStore/Folder/SearchFolderCmdlet.cs b/ImageStore/Folder/SearchFolderCmdlet.cs index 9af3fd1..b24d616 100644 --- a/ImageStore/Folder/SearchFolderCmdlet.cs +++ b/ImageStore/Folder/SearchFolderCmdlet.cs @@ -1,7 +1,7 @@ using SecretNest.ImageStore.DatabaseShared; using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/Folder/SyncFolderCmdlet.cs b/ImageStore/Folder/SyncFolderCmdlet.cs index 88fbe92..4e1fecf 100644 --- a/ImageStore/Folder/SyncFolderCmdlet.cs +++ b/ImageStore/Folder/SyncFolderCmdlet.cs @@ -4,7 +4,7 @@ using SecretNest.ImageStore.IgnoredDirectory; using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.IO; using System.Linq; using System.Management.Automation; diff --git a/ImageStore/Folder/UpdateFolderCmdlet.cs b/ImageStore/Folder/UpdateFolderCmdlet.cs index ab9b74b..85400b8 100644 --- a/ImageStore/Folder/UpdateFolderCmdlet.cs +++ b/ImageStore/Folder/UpdateFolderCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/IgnoredDirectory/AddIgnoredDirectoryCmdlet.cs b/ImageStore/IgnoredDirectory/AddIgnoredDirectoryCmdlet.cs index 35b3711..c4f4d25 100644 --- a/ImageStore/IgnoredDirectory/AddIgnoredDirectoryCmdlet.cs +++ b/ImageStore/IgnoredDirectory/AddIgnoredDirectoryCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/IgnoredDirectory/FindIgnoredDirectoryCmdlet.cs b/ImageStore/IgnoredDirectory/FindIgnoredDirectoryCmdlet.cs index dfe2fc2..ed6784c 100644 --- a/ImageStore/IgnoredDirectory/FindIgnoredDirectoryCmdlet.cs +++ b/ImageStore/IgnoredDirectory/FindIgnoredDirectoryCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/IgnoredDirectory/GetIgnoredDirectoryCmdlet.cs b/ImageStore/IgnoredDirectory/GetIgnoredDirectoryCmdlet.cs index c64d0c0..9cf85ee 100644 --- a/ImageStore/IgnoredDirectory/GetIgnoredDirectoryCmdlet.cs +++ b/ImageStore/IgnoredDirectory/GetIgnoredDirectoryCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/IgnoredDirectory/IgnoredDirectoryHelper.cs b/ImageStore/IgnoredDirectory/IgnoredDirectoryHelper.cs index 6db74d9..dd222c6 100644 --- a/ImageStore/IgnoredDirectory/IgnoredDirectoryHelper.cs +++ b/ImageStore/IgnoredDirectory/IgnoredDirectoryHelper.cs @@ -1,7 +1,7 @@ using SecretNest.ImageStore.IgnoredDirectory; using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/ImageStore/IgnoredDirectory/RemoveIgnoredDirectoryCmdlet.cs b/ImageStore/IgnoredDirectory/RemoveIgnoredDirectoryCmdlet.cs index 3dcfa7a..2dc6e77 100644 --- a/ImageStore/IgnoredDirectory/RemoveIgnoredDirectoryCmdlet.cs +++ b/ImageStore/IgnoredDirectory/RemoveIgnoredDirectoryCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/IgnoredDirectory/SearchIgnoredDirectoryCmdlet.cs b/ImageStore/IgnoredDirectory/SearchIgnoredDirectoryCmdlet.cs index 9ba11d7..2d517a3 100644 --- a/ImageStore/IgnoredDirectory/SearchIgnoredDirectoryCmdlet.cs +++ b/ImageStore/IgnoredDirectory/SearchIgnoredDirectoryCmdlet.cs @@ -1,7 +1,7 @@ using SecretNest.ImageStore.DatabaseShared; using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/IgnoredDirectory/UpdateIgnoredDirectoryCmdlet.cs b/ImageStore/IgnoredDirectory/UpdateIgnoredDirectoryCmdlet.cs index 59112a2..bacc2ba 100644 --- a/ImageStore/IgnoredDirectory/UpdateIgnoredDirectoryCmdlet.cs +++ b/ImageStore/IgnoredDirectory/UpdateIgnoredDirectoryCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/ImageStore.csproj b/ImageStore/ImageStore.csproj index 8085b5a..e5e5eec 100644 --- a/ImageStore/ImageStore.csproj +++ b/ImageStore/ImageStore.csproj @@ -1,276 +1,46 @@ - - - + + - Debug - AnyCPU - {8FA09B96-6FA3-4BBF-9E30-CC720D43C041} + net10.0-windows + true Library - Properties SecretNest.ImageStore ImageStore - v4.8.1 - 512 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - + + true - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + + + + ImageStore + ImageStore + SecretNest.info + Copyright © SecretNest.info 2018 + 1.0.0.0 + 1.0.0.0 - - - False - .\Shipwreck.Phash.dll - - - False - .\Shipwreck.Phash.Bitmaps.dll - - - - False - .\System.Buffers.dll - - - - - False - .\System.Memory.dll - - - False - .\System.Numerics.Vectors.dll - - - False - .\System.Runtime.CompilerServices.Unsafe.dll - - - - - - - - - - - - - - - - - - - - Component - - - Component - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - True - Resources.resx - - - - - - - - - - - Form - - - SameFileManager.cs - - - - - - - - - - - - UserControl - - - DoublePictureBox.cs - - - - - - - - - - - - - - - - - - UserControl - - - SimilarFileCheck.cs - - - - Form - - - SimilarFileInGroupManager.cs - - - Form - - - SimilarFileOneManager.cs - - - Form - - - SimilarFilesManager.cs - - - - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 - false - - - - - - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SameFileManager.cs - - - DoublePictureBox.cs - - - SimilarFileCheck.cs - - - SimilarFileInGroupManager.cs - - - SimilarFileOneManager.cs - - - SimilarFilesManager.cs - - - - - 1.1.0 - - runtime - - - - \ No newline at end of file + + + + + + + + + + + + + diff --git a/ImageStore/Properties/AssemblyInfo.cs b/ImageStore/Properties/AssemblyInfo.cs index 6f017d5..7ef64b8 100644 --- a/ImageStore/Properties/AssemblyInfo.cs +++ b/ImageStore/Properties/AssemblyInfo.cs @@ -1,18 +1,8 @@ -using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ImageStore")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("SecretNest.info")] -[assembly: AssemblyProduct("ImageStore")] -[assembly: AssemblyCopyright("Copyright © SecretNest.info 2018")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] +// Titles, versions and copyright now live in ImageStore.csproj and are emitted +// by the SDK. Only the COM attributes remain here, because there are no MSBuild +// properties for them. // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -21,16 +11,3 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8fa09b96-6fa3-4bbf-9e30-cc720d43c041")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ImageStore/SameFile/ClearSameFileObsoletedGroupsCmdlet.cs b/ImageStore/SameFile/ClearSameFileObsoletedGroupsCmdlet.cs index f0594d4..4b94c9f 100644 --- a/ImageStore/SameFile/ClearSameFileObsoletedGroupsCmdlet.cs +++ b/ImageStore/SameFile/ClearSameFileObsoletedGroupsCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/SameFile/CompareSameFilesCmdlet.cs b/ImageStore/SameFile/CompareSameFilesCmdlet.cs index 627bc8d..16bb491 100644 --- a/ImageStore/SameFile/CompareSameFilesCmdlet.cs +++ b/ImageStore/SameFile/CompareSameFilesCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Runtime.InteropServices; diff --git a/ImageStore/SameFile/GetSameFileCmdlet.cs b/ImageStore/SameFile/GetSameFileCmdlet.cs index cd8faaf..4496054 100644 --- a/ImageStore/SameFile/GetSameFileCmdlet.cs +++ b/ImageStore/SameFile/GetSameFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/SameFile/HideSameFileCmdlet.cs b/ImageStore/SameFile/HideSameFileCmdlet.cs index c851aa5..87b2e33 100644 --- a/ImageStore/SameFile/HideSameFileCmdlet.cs +++ b/ImageStore/SameFile/HideSameFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/SameFile/IgnoreSameFileHelper.cs b/ImageStore/SameFile/IgnoreSameFileHelper.cs index 6680629..53eb9ef 100644 --- a/ImageStore/SameFile/IgnoreSameFileHelper.cs +++ b/ImageStore/SameFile/IgnoreSameFileHelper.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/ImageStore/SameFile/RemoveSameFileCmdlet.cs b/ImageStore/SameFile/RemoveSameFileCmdlet.cs index d6e0bdc..41f0ee9 100644 --- a/ImageStore/SameFile/RemoveSameFileCmdlet.cs +++ b/ImageStore/SameFile/RemoveSameFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/SameFile/RemoveSameFileGroupCmdlet.cs b/ImageStore/SameFile/RemoveSameFileGroupCmdlet.cs index 7cd4d6d..93579af 100644 --- a/ImageStore/SameFile/RemoveSameFileGroupCmdlet.cs +++ b/ImageStore/SameFile/RemoveSameFileGroupCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/SameFile/SearchSameFileCmdlet.cs b/ImageStore/SameFile/SearchSameFileCmdlet.cs index 870668c..49343de 100644 --- a/ImageStore/SameFile/SearchSameFileCmdlet.cs +++ b/ImageStore/SameFile/SearchSameFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/SameFile/SelectSameFileCmdlet.cs b/ImageStore/SameFile/SelectSameFileCmdlet.cs index 8e4ad0b..7ce269a 100644 --- a/ImageStore/SameFile/SelectSameFileCmdlet.cs +++ b/ImageStore/SameFile/SelectSameFileCmdlet.cs @@ -3,7 +3,7 @@ using SecretNest.ImageStore.Folder; using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Drawing; using System.Linq; using System.Management.Automation; diff --git a/ImageStore/SameFile/ShowSameFileCmdlet.cs b/ImageStore/SameFile/ShowSameFileCmdlet.cs index 4f277aa..b113da3 100644 --- a/ImageStore/SameFile/ShowSameFileCmdlet.cs +++ b/ImageStore/SameFile/ShowSameFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/SameFile/UpdateSameFileCmdlet.cs b/ImageStore/SameFile/UpdateSameFileCmdlet.cs index 135a091..1988c82 100644 --- a/ImageStore/SameFile/UpdateSameFileCmdlet.cs +++ b/ImageStore/SameFile/UpdateSameFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/Shipwreck.Phash.Bitmaps.dll b/ImageStore/Shipwreck.Phash.Bitmaps.dll deleted file mode 100644 index b9b2664..0000000 Binary files a/ImageStore/Shipwreck.Phash.Bitmaps.dll and /dev/null differ diff --git a/ImageStore/Shipwreck.Phash.dll b/ImageStore/Shipwreck.Phash.dll deleted file mode 100644 index bfc6266..0000000 Binary files a/ImageStore/Shipwreck.Phash.dll and /dev/null differ diff --git a/ImageStore/SimilarFile/CompareSimilarFileHelper.cs b/ImageStore/SimilarFile/CompareSimilarFileHelper.cs index 5b340a1..cb298fd 100644 --- a/ImageStore/SimilarFile/CompareSimilarFileHelper.cs +++ b/ImageStore/SimilarFile/CompareSimilarFileHelper.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Management.Automation.Runspaces; diff --git a/ImageStore/SimilarFile/CompareSimilarFilesCmdlet.cs b/ImageStore/SimilarFile/CompareSimilarFilesCmdlet.cs index bf77067..d2c388f 100644 --- a/ImageStore/SimilarFile/CompareSimilarFilesCmdlet.cs +++ b/ImageStore/SimilarFile/CompareSimilarFilesCmdlet.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/SimilarFile/DoublePictureBox.cs b/ImageStore/SimilarFile/DoublePictureBox.cs index 443b47d..7b073e0 100644 --- a/ImageStore/SimilarFile/DoublePictureBox.cs +++ b/ImageStore/SimilarFile/DoublePictureBox.cs @@ -17,6 +17,8 @@ internal partial class DoublePictureBox : UserControl Guid loadedFileId1, loadedFileId2; bool _autoResizePictures; + //See the note in SimilarFileCheck: set from code, not the designer (WFO1000). + [DefaultValue(false)] public bool AutoResizePictures { get => _autoResizePictures; diff --git a/ImageStore/SimilarFile/GetSimilarFileCmdlet.cs b/ImageStore/SimilarFile/GetSimilarFileCmdlet.cs index ae64430..0d280c5 100644 --- a/ImageStore/SimilarFile/GetSimilarFileCmdlet.cs +++ b/ImageStore/SimilarFile/GetSimilarFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/SimilarFile/HideSimilarFileCmdlet.cs b/ImageStore/SimilarFile/HideSimilarFileCmdlet.cs index c981838..a0388e3 100644 --- a/ImageStore/SimilarFile/HideSimilarFileCmdlet.cs +++ b/ImageStore/SimilarFile/HideSimilarFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/SimilarFile/IgnoreSimilarFileHelper.cs b/ImageStore/SimilarFile/IgnoreSimilarFileHelper.cs index 6cedc6c..65c493c 100644 --- a/ImageStore/SimilarFile/IgnoreSimilarFileHelper.cs +++ b/ImageStore/SimilarFile/IgnoreSimilarFileHelper.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/ImageStore/SimilarFile/RemoveSimilarFileCmdlet.cs b/ImageStore/SimilarFile/RemoveSimilarFileCmdlet.cs index 123c337..9d5ab41 100644 --- a/ImageStore/SimilarFile/RemoveSimilarFileCmdlet.cs +++ b/ImageStore/SimilarFile/RemoveSimilarFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/SimilarFile/ResetSimilarFilesCmdlet.cs b/ImageStore/SimilarFile/ResetSimilarFilesCmdlet.cs index 6dbe612..1bd2295 100644 --- a/ImageStore/SimilarFile/ResetSimilarFilesCmdlet.cs +++ b/ImageStore/SimilarFile/ResetSimilarFilesCmdlet.cs @@ -1,7 +1,7 @@ using SecretNest.ImageStore.Folder; using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/SimilarFile/ResolveSimilarFilesCmdlet.cs b/ImageStore/SimilarFile/ResolveSimilarFilesCmdlet.cs index 6c709d8..14eb402 100644 --- a/ImageStore/SimilarFile/ResolveSimilarFilesCmdlet.cs +++ b/ImageStore/SimilarFile/ResolveSimilarFilesCmdlet.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; diff --git a/ImageStore/SimilarFile/SearchSimilarFileCmdlet.cs b/ImageStore/SimilarFile/SearchSimilarFileCmdlet.cs index 74b0235..9c4a198 100644 --- a/ImageStore/SimilarFile/SearchSimilarFileCmdlet.cs +++ b/ImageStore/SimilarFile/SearchSimilarFileCmdlet.cs @@ -1,7 +1,7 @@ using SecretNest.ImageStore.DatabaseShared; using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/SimilarFile/SetThumbprintCacheFolderCmdlet.cs b/ImageStore/SimilarFile/SetThumbprintCacheFolderCmdlet.cs index 2be9839..d1702c2 100644 --- a/ImageStore/SimilarFile/SetThumbprintCacheFolderCmdlet.cs +++ b/ImageStore/SimilarFile/SetThumbprintCacheFolderCmdlet.cs @@ -3,7 +3,6 @@ using System.IO; using System.Linq; using System.Management.Automation; -using System.Reflection; using System.Text; using System.Threading.Tasks; @@ -18,10 +17,10 @@ public class SetThumbprintCacheFolderCmdlet : Cmdlet protected override void ProcessRecord() { - Assembly assembly = typeof(SetThumbprintCacheFolderCmdlet).Assembly; - var path = new Uri(assembly.CodeBase).LocalPath; - var assemblyFolder = System.IO.Path.GetDirectoryName(path); - LoadImageHelper.cachePath = System.IO.Path.Combine(assemblyFolder, Path); + //Assembly.CodeBase is obsolete on .NET 5+ and throws for single-file + //publishes. AppContext.BaseDirectory gives the module folder directly, + //without the Uri round-trip. + LoadImageHelper.cachePath = System.IO.Path.Combine(AppContext.BaseDirectory, Path); Directory.CreateDirectory(LoadImageHelper.cachePath); } } diff --git a/ImageStore/SimilarFile/ShowSimilarFileCmdlet.cs b/ImageStore/SimilarFile/ShowSimilarFileCmdlet.cs index 3b4ea36..02d4343 100644 --- a/ImageStore/SimilarFile/ShowSimilarFileCmdlet.cs +++ b/ImageStore/SimilarFile/ShowSimilarFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/SimilarFile/SimilarFileCheck.cs b/ImageStore/SimilarFile/SimilarFileCheck.cs index 98020bc..55e926a 100644 --- a/ImageStore/SimilarFile/SimilarFileCheck.cs +++ b/ImageStore/SimilarFile/SimilarFileCheck.cs @@ -12,12 +12,17 @@ namespace SecretNest.ImageStore.SimilarFile { internal partial class SimilarFileCheck : UserControl { + //DefaultValue tells the WinForms designer these need no serialization + //unless changed from the default (WFO1000). They are set from code, not + //the designer. + [DefaultValue(false)] public bool AutoResizePictures { get => doublePictureBox1.AutoResizePictures; set => doublePictureBox1.AutoResizePictures = value; } + [DefaultValue(false)] public bool AutoMoveNext { get; set; } public SimilarFileCheck() diff --git a/ImageStore/SimilarFile/UpdateSimilarFileCmdlet.cs b/ImageStore/SimilarFile/UpdateSimilarFileCmdlet.cs index 98550da..fd55e48 100644 --- a/ImageStore/SimilarFile/UpdateSimilarFileCmdlet.cs +++ b/ImageStore/SimilarFile/UpdateSimilarFileCmdlet.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Linq; using System.Management.Automation; using System.Text; diff --git a/ImageStore/System.Buffers.dll b/ImageStore/System.Buffers.dll deleted file mode 100644 index f2d83c5..0000000 Binary files a/ImageStore/System.Buffers.dll and /dev/null differ diff --git a/ImageStore/System.Memory.dll b/ImageStore/System.Memory.dll deleted file mode 100644 index 5d19470..0000000 Binary files a/ImageStore/System.Memory.dll and /dev/null differ diff --git a/ImageStore/System.Numerics.Vectors.dll b/ImageStore/System.Numerics.Vectors.dll deleted file mode 100644 index 0865972..0000000 Binary files a/ImageStore/System.Numerics.Vectors.dll and /dev/null differ diff --git a/ImageStore/System.Runtime.CompilerServices.Unsafe.dll b/ImageStore/System.Runtime.CompilerServices.Unsafe.dll deleted file mode 100644 index de9e124..0000000 Binary files a/ImageStore/System.Runtime.CompilerServices.Unsafe.dll and /dev/null differ diff --git a/README.md b/README.md index deb1db5..e91ddbb 100644 --- a/README.md +++ b/README.md @@ -4,21 +4,31 @@ Image deduplication tool, optimized for large amount of pictures and CG librarie This tool is built as PowerShell cmdlets, providing user a flexible way to deal with large amount of image files (~1 million). Specially, it is optimized for CG libraries storing by allowing user to suppress the comparing among files in the same folder. +# Requirements + * Windows. + * [PowerShell 7.6](https://github.com/PowerShell/PowerShell/releases) or later. The module targets .NET 10, and 7.6 is the first PowerShell release built on it. + * Sql Server 2017. See [Database](#database) below. + +*Note: Windows PowerShell 5.1 — the ```powershell.exe``` that ships with Windows — cannot load this module, because it runs on .NET Framework. Use ```pwsh```. The last release that works under 5.1 is [v2026.08.15.2](https://github.com/SecretNest/ImageStore/releases/tag/v2026.08.15.2).* + # Image Hashing Arithmetic -This tool use a [forked version](https://github.com/scegg/phash) of [priHash](https://github.com/pgrho/phash), which added methods optimized for ImageStore calling. -priHash is a C# Implementation of pHash (http://phash.org). Based on phash-0.9.4 for Windows. +This tool use [priHash](https://github.com/pgrho/phash), a C# Implementation of pHash (http://phash.org), based on phash-0.9.4 for Windows. In this tool, [difference degree](doc/concept/DifferenceDegree.md) is based on the calculation of priHash. # Use Module in PowerShell To use any module from dll in PowerShell, you just need 3 steps: -1. Start PowerShell. Usually it is placed as ```C:\windows\System32\windowspowershell\v1.0\powershell.exe``` in Windows. +1. Start PowerShell by running ```pwsh```. 2. Use command ```Import-Module``` to load module from dll file. The parameter of this command is the path of the dll file. ```Import-Module C:\ImageStore.dll``` will load the module file named as ImageStore.dll and placed in the root folder of drive C. ```Import-Module .\ImageStore.dll``` will load the module file named as ImageStore.dll from the current directory. 3. Use [cmdlets](doc/cmdlet/cmdlets.md). +Unpack the whole release archive into one folder and load ImageStore.dll from there. The other files beside it are its dependencies, and the module will not work without them. + Also, you can combine the step 1 and 2 as one, by passing the command as a parameter while starting PowerShell. -```C:\windows\System32\windowspowershell\v1.0\powershell.exe -noexit -command "Import-Module .\ImageStore.dll"``` +```pwsh -noexit -command "Import-Module .\ImageStore.dll"``` + +*Note: [Select-ImageStoreSameFile](doc/cmdlet/SameFile/SelectSameFile.md) and [Resolve-ImageStoreSimilarFiles](doc/cmdlet/SimilarFile/ResolveSimilarFiles.md) open windows, which requires the host to run in a single-threaded apartment. ```pwsh``` does so by default, but the PowerShell Integrated Console in Visual Studio Code does not — run those two cmdlets from a real console.* ## Enable Information and Verbose Output By default, the information and verbose level output will be silenced. ImageStore will report key information as informational output and progress updates as verbose one. Thus, enabling information output is highly recommended. If ImageStore is dealing with large amount of files, turning on verbose output is advised.