From a6ad9770dacec3b2ea6354194863340be9bff9cd Mon Sep 17 00:00:00 2001 From: Blake Burkhart Date: Sat, 1 Jun 2024 02:10:09 -0500 Subject: [PATCH] Update for ITAD redesign and rewrite extension in C# --- .github/workflows/build.yaml | 53 ++++ .github/workflows/pext.yaml | 28 -- .gitignore | 39 +++ App.xaml | 12 + IsThereAnyDeal.psm1 | 72 ----- IsthereanydealClient.cs | 258 ++++++++++++++++++ IsthereanydealCollectionSync.cs | 87 ++++++ IsthereanydealCollectionSync.csproj | 85 ++++++ IsthereanydealCollectionSync.sln | 25 ++ IsthereanydealCollectionSyncSettings.cs | 99 +++++++ IsthereanydealCollectionSyncSettingsView.xaml | 60 ++++ ...eanydealCollectionSyncSettingsView.xaml.cs | 25 ++ LICENSE | 24 ++ Localization/en_US.xaml | 4 + Properties/AssemblyInfo.cs | 36 +++ README.md | 18 +- RadioButtonBinding.cs | 39 +++ extension.yaml | 15 +- icon.svg | 21 ++ packages.config | 4 + 20 files changed, 887 insertions(+), 117 deletions(-) create mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/pext.yaml create mode 100644 .gitignore create mode 100644 App.xaml delete mode 100644 IsThereAnyDeal.psm1 create mode 100644 IsthereanydealClient.cs create mode 100644 IsthereanydealCollectionSync.cs create mode 100644 IsthereanydealCollectionSync.csproj create mode 100644 IsthereanydealCollectionSync.sln create mode 100644 IsthereanydealCollectionSyncSettings.cs create mode 100644 IsthereanydealCollectionSyncSettingsView.xaml create mode 100644 IsthereanydealCollectionSyncSettingsView.xaml.cs create mode 100644 LICENSE create mode 100644 Localization/en_US.xaml create mode 100644 Properties/AssemblyInfo.cs create mode 100644 RadioButtonBinding.cs create mode 100644 icon.svg create mode 100644 packages.config diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..d6a760e --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,53 @@ +on: + release: + types: [published] + +name: Build and Upload Release Asset + +jobs: + build: + name: Build and Upload Release Asset + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.0.3 + + - name: Setup NuGet.exe + uses: nuget/setup-nuget@v1 + + - name: Restore NuGet Packages + run: nuget restore IsthereanydealCollectionSync.sln + + - name: Build and Publish + run: | + msbuild IsthereanydealCollectionSync.sln /p:Configuration=Release + $version = ($env:GITHUB_REF -Split "/")[-1] + echo "VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append + + - name: Setup Playnite + run: | + mkdir playnite + Invoke-WebRequest -Uri "https://github.com/JosefNemec/Playnite/releases/download/10.33/Playnite1033.zip" -OutFile "playnite\Playnite1033.zip" + Expand-Archive "playnite\Playnite1033.zip" -DestinationPath "playnite" + + - name: Package release + run: | + Copy-Item LICENSE bin\release + mkdir release + playnite\toolbox.exe pack "bin\release" "release" + $contents = Get-ChildItem -Path "release" -Force -Recurse -File | Select-Object -First 1 + echo "PEXTFILE=$contents" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ env.PEXTFILE }} + asset_name: IsthereanydealCollectionSync-${{ env.VERSION }}.pext + asset_content_type: application/zip \ No newline at end of file diff --git a/.github/workflows/pext.yaml b/.github/workflows/pext.yaml deleted file mode 100644 index c15e39e..0000000 --- a/.github/workflows/pext.yaml +++ /dev/null @@ -1,28 +0,0 @@ -on: - release: - types: [published] - -name: Upload Release Asset - -jobs: - build: - name: Upload Release Asset - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Create pext zip - run: | - RELEASE_VERSION=${GITHUB_REF#refs/*/} - echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - git archive --format=zip -o "bburky-IsThereAnyDeal-${RELEASE_VERSION}.pext" "${{ github.ref }}" - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ./bburky-IsThereAnyDeal-${{ env.RELEASE_VERSION }}.pext - asset_name: bburky-IsThereAnyDeal-${{ env.RELEASE_VERSION }}.pext - asset_content_type: application/zip diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8fe47c6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +*.swp +*.*~ +project.lock.json +.DS_Store +*.pyc +nupkg/ + +# Visual Studio Code +.vscode + +# Rider +.idea + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ +[Oo]ut/ +msbuild.log +msbuild.err +msbuild.wrn + +# Visual Studio 2015 +.vs/ + +packages \ No newline at end of file diff --git a/App.xaml b/App.xaml new file mode 100644 index 0000000..5b208c5 --- /dev/null +++ b/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/IsthereanydealCollectionSyncSettingsView.xaml.cs b/IsthereanydealCollectionSyncSettingsView.xaml.cs new file mode 100644 index 0000000..fd0ed63 --- /dev/null +++ b/IsthereanydealCollectionSyncSettingsView.xaml.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace IsthereanydealCollectionSync +{ + public partial class IsthereanydealCollectionSyncSettingsView : UserControl + { + public IsthereanydealCollectionSyncSettingsView() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0360f1e --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +BSD 2-Clause License + +Copyright (c) 2024, Blake Burkhart + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/Localization/en_US.xaml b/Localization/en_US.xaml new file mode 100644 index 0000000..bdc1782 --- /dev/null +++ b/Localization/en_US.xaml @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..12bf10b --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("IsthereanydealCollectionSync")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("IsthereanydealCollectionSync")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 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 +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("1f1c327f-8896-47de-950c-c92dc9fab556")] + +// 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")] \ No newline at end of file diff --git a/README.md b/README.md index ba59944..0d1a9b5 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@ -# Is There Any Deal Collection Sync Playnite Extension +# IsThereAnyDeal Collection Sync Playnite Extension -## Installation -[Download extension .pext from the forum post](https://playnite.link/forum/thread-270-post-753.html) +* [Install](playnite://playnite/installaddon/bburky-IsThereAnyDeal) (requires Playnite to be installed) +* [Playnite addon details](https://playnite.link/addons.html#bburky-IsThereAnyDeal) +* [Download extension from GitHub Releases](https://github.com/bburky/playnite-playlist/releases) ## Usage -1. Select games to add to your Is There Any Deal collection. -2. Right-click the games and select "Add Games to Is There Any Deal Collection" in the menu. -3. Log into Is There Any Deal if it prompts you to. Close the window and rerun the extension after logging in. -4. Review the list of games and scroll to the bottom. Check "Remove from Waitlist" if desired. Click "Import (safe option)". -5. Close the window after importing. +1. Log into IsThereAnyDeal in the "Add-ons..." settings and configure options. +2. Select games to add to your Is There Any Deal collection. +3. Right-click the games and select "Add to IsThereAnyDeal Collection" in the menu. +4. View your collection at https://isthereanydeal.com/collection/import/ or use with https://augmentedsteam.com/ (games on Steam will show if they are already in your collection if owned on another store) Games are only imported to Is There Any Deal by name, it is possible it could guess the wrong game. -Note, while playtime and completion status can be imported to Is There Any Deal, it does not always seem to update. You can try using "Replace" while importing or deleting games from your collection to force it to update. +Currently does not handle duplicate copies very well. IsThereAnyDeal offers the choice of ignoring duplicate imports or replacing the all of the old copies with the newly imported copies, you can configure this choice in the extension settings. You cannot merge the new import with the existing IsThereAnyDeal data. If you use the [DuplicateHider extension](https://playnite.link/addons.html#felixkmh_DuplicateHider_Plugin), you can filter your Playnite library to only show the preferred copy and then replace the old copy in IsThereAnyDeal. This extension does not support importing your list of games from Is There Any Deal *into* Playnite. \ No newline at end of file diff --git a/RadioButtonBinding.cs b/RadioButtonBinding.cs new file mode 100644 index 0000000..a930753 --- /dev/null +++ b/RadioButtonBinding.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Markup; + +namespace IsthereanydealCollectionSync +{ + // https://stackoverflow.com/a/3361553 + public class BoolInverterConverter : IValueConverter + { + #region IValueConverter Members + + public object Convert(object value, Type targetType, object parameter, + System.Globalization.CultureInfo culture) + { + if (value is bool) + { + return !(bool)value; + } + return value; + } + + public object ConvertBack(object value, Type targetType, object parameter, + System.Globalization.CultureInfo culture) + { + if (value is bool) + { + return !(bool)value; + } + return value; + } + + #endregion + } +} diff --git a/extension.yaml b/extension.yaml index 56de237..3ab710d 100644 --- a/extension.yaml +++ b/extension.yaml @@ -1,11 +1,10 @@ -Id: bburky-IsThereAnyDeal -Name: Is There Any Deal +Id: bburky-IsThereAnyDeal +Name: IsThereAnyDeal Collection Sync Author: Blake Burkhart -Version: 1.4.1 -Module: IsThereAnyDeal.psm1 -Type: Script +Version: 2.0 +Module: IsthereanydealCollectionSync.dll +Type: GenericPlugin +Icon: icon.svg Links: - - Name: Forum - Url: https://playnite.link/forum/thread-270.html - - Name: GitHub + - Name: Source Url: https://github.com/bburky/isthereanydeal-playnite/ diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..f359f1a --- /dev/null +++ b/icon.svg @@ -0,0 +1,21 @@ + + + + + + ITAD-rocket-color-bgBlack-RGB + + + + + + + + \ No newline at end of file diff --git a/packages.config b/packages.config new file mode 100644 index 0000000..5b23211 --- /dev/null +++ b/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file