From f7e4198433d9184a06f0eaa8674a2668eb419d08 Mon Sep 17 00:00:00 2001 From: Manu <52102823+Manu098vm@users.noreply.github.com> Date: Mon, 23 Jan 2023 20:07:13 +0100 Subject: [PATCH] Upgrade to NET 7 --- .github/workflows/Linux.yml | 2 +- .github/workflows/Mac.yml | 2 +- .github/workflows/Windows.yml | 2 +- README.md | 2 +- SwitchGiftDataManager.CommandLine/Program.cs | 13 ++++++++++ .../PublishProfiles/FolderProfile.pubxml | 15 +++++++++++ .../PublishProfiles/FolderProfile.pubxml.user | 10 ++++++++ .../SwitchGiftDataManager.CommandLine.csproj | 16 ++++++++---- ...tchGiftDataManager.CommandLine.csproj.user | 1 + .../Classes/BCATManager/BCATManager.cs | 2 +- .../SwitchGiftDataManager.Core.csproj | 6 ++++- .../Util/GitHubUtil.cs | 14 ++--------- SwitchGiftDataManager.WinForm/MainWindow.cs | 15 +++++++++-- .../PublishProfiles/FolderProfile.pubxml | 15 +++++++++++ .../PublishProfiles/FolderProfile.pubxml.user | 10 ++++++++ .../SwitchGiftDataManager.WinForm.csproj | 25 +++++++++++-------- .../SwitchGiftDataManager.WinForm.csproj.user | 11 +++----- 17 files changed, 118 insertions(+), 43 deletions(-) create mode 100644 SwitchGiftDataManager.CommandLine/Properties/PublishProfiles/FolderProfile.pubxml create mode 100644 SwitchGiftDataManager.CommandLine/Properties/PublishProfiles/FolderProfile.pubxml.user rename {SwitchGiftDataManager.WinForm => SwitchGiftDataManager.Core}/Util/GitHubUtil.cs (73%) create mode 100644 SwitchGiftDataManager.WinForm/Properties/PublishProfiles/FolderProfile.pubxml create mode 100644 SwitchGiftDataManager.WinForm/Properties/PublishProfiles/FolderProfile.pubxml.user diff --git a/.github/workflows/Linux.yml b/.github/workflows/Linux.yml index c32dcf1..e2396c1 100644 --- a/.github/workflows/Linux.yml +++ b/.github/workflows/Linux.yml @@ -68,7 +68,7 @@ jobs: - name: Install .NET Core uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.x + dotnet-version: 7.0.x # Create the app package by building and packaging - name: Install dependencies diff --git a/.github/workflows/Mac.yml b/.github/workflows/Mac.yml index 316f75a..e235392 100644 --- a/.github/workflows/Mac.yml +++ b/.github/workflows/Mac.yml @@ -68,7 +68,7 @@ jobs: - name: Install .NET Core uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.x + dotnet-version: 7.0.x # Create the app package by building and packaging - name: Install dependencies diff --git a/.github/workflows/Windows.yml b/.github/workflows/Windows.yml index ea9fb2d..23e3af5 100644 --- a/.github/workflows/Windows.yml +++ b/.github/workflows/Windows.yml @@ -68,7 +68,7 @@ jobs: - name: Install .NET Core uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.x + dotnet-version: 7.0.x # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild - name: Setup MSBuild.exe diff --git a/README.md b/README.md index cb9fd95..1526f74 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Neither I nor the Project Pokémon staff takes any responsibility for possible a ## Usage This paragraph refers to the Windows Form app. The Command Line app usage is similar and should be fairly intuitive. -* Ensure you have the required [.NET 6.0 runtimes](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) correctly installed +* Ensure you have the required [.NET 7.0 Desktop Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) correctly installed * Dump your game's BCAT with [JKSV](https://github.com/J-D-K/JKSV/releases) and keep some copies somewhere safe * Open the tool and select your game of choice * Import wondercard files of your choice (by drag & drop or by clicking the `Open Files` button) diff --git a/SwitchGiftDataManager.CommandLine/Program.cs b/SwitchGiftDataManager.CommandLine/Program.cs index 67c7016..4e25952 100644 --- a/SwitchGiftDataManager.CommandLine/Program.cs +++ b/SwitchGiftDataManager.CommandLine/Program.cs @@ -11,6 +11,8 @@ namespace SwitchGiftDataManager.CommandLine var msg = $"Switch Gift Data Manager v{BCATManager.Version}"; Log(msg); + Task.Run(TryUpdate).Wait(); + msg = $"{Environment.NewLine}Select your game:{Environment.NewLine}{Environment.NewLine}" + $"1 - LGPE{Environment.NewLine}" + $"2 - SWSH{Environment.NewLine}" + @@ -216,6 +218,17 @@ namespace SwitchGiftDataManager.CommandLine Directory.Delete(targetDir, false); } + private static async Task TryUpdate() + { + if (await GitHubUtil.IsUpdateAvailable()) + { + Log("A program update is available. Do you want to download the latest release?\n[Y\\n]:"); + var str = Console.ReadLine(); + if (!string.IsNullOrWhiteSpace(str) && (str.ToLower().Equals("y") || str.ToLower().Equals("yes"))) + System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo { FileName = @"https://github.com/Manu098vm/Switch-Gift-Data-Manager/releases", UseShellExecute = true }); + } + } + private static void Log(string msg) => Console.WriteLine(msg); } } \ No newline at end of file diff --git a/SwitchGiftDataManager.CommandLine/Properties/PublishProfiles/FolderProfile.pubxml b/SwitchGiftDataManager.CommandLine/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..fcb9c0e --- /dev/null +++ b/SwitchGiftDataManager.CommandLine/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,15 @@ + + + + + Release + Any CPU + bin\Release\net7.0\win-x64\publish\ + FileSystem + <_TargetId>Folder + net7.0 + false + + \ No newline at end of file diff --git a/SwitchGiftDataManager.CommandLine/Properties/PublishProfiles/FolderProfile.pubxml.user b/SwitchGiftDataManager.CommandLine/Properties/PublishProfiles/FolderProfile.pubxml.user new file mode 100644 index 0000000..94564fb --- /dev/null +++ b/SwitchGiftDataManager.CommandLine/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -0,0 +1,10 @@ + + + + + True|2023-01-23T19:03:47.7790063Z; + + + \ No newline at end of file diff --git a/SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj b/SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj index 246637b..d21c12f 100644 --- a/SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj +++ b/SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj @@ -2,7 +2,7 @@ Exe - net6.0-windows + net7.0 enable enable Manu098vm @@ -21,14 +21,20 @@ embedded - - embedded - - embedded + + embedded + true + true + true + true + false + false + + True diff --git a/SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj.user b/SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj.user index 4db7283..e5144d3 100644 --- a/SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj.user +++ b/SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj.user @@ -5,5 +5,6 @@ SwitchGiftDataManager.CommandLine + <_LastSelectedProfileId>D:\Projects\SwitchGiftDataManager\SwitchGiftDataManager.CommandLine\Properties\PublishProfiles\FolderProfile.pubxml \ No newline at end of file diff --git a/SwitchGiftDataManager.Core/Classes/BCATManager/BCATManager.cs b/SwitchGiftDataManager.Core/Classes/BCATManager/BCATManager.cs index 8c8d502..fa3034c 100644 --- a/SwitchGiftDataManager.Core/Classes/BCATManager/BCATManager.cs +++ b/SwitchGiftDataManager.Core/Classes/BCATManager/BCATManager.cs @@ -9,7 +9,7 @@ namespace SwitchGiftDataManager.Core { public class BCATManager { - public const string Version = "1.2.0"; + public const string Version = "1.3.0"; private const int FileNameOffset = 0x00; private const int UnkOffset = 0x20; diff --git a/SwitchGiftDataManager.Core/SwitchGiftDataManager.Core.csproj b/SwitchGiftDataManager.Core/SwitchGiftDataManager.Core.csproj index 2fbdb09..64bd880 100644 --- a/SwitchGiftDataManager.Core/SwitchGiftDataManager.Core.csproj +++ b/SwitchGiftDataManager.Core/SwitchGiftDataManager.Core.csproj @@ -2,7 +2,7 @@ Library - net6.0 + net7.0 enable enable Manu098vm @@ -43,6 +43,10 @@ \ + + + + diff --git a/SwitchGiftDataManager.WinForm/Util/GitHubUtil.cs b/SwitchGiftDataManager.Core/Util/GitHubUtil.cs similarity index 73% rename from SwitchGiftDataManager.WinForm/Util/GitHubUtil.cs rename to SwitchGiftDataManager.Core/Util/GitHubUtil.cs index 1167f44..1a85acb 100644 --- a/SwitchGiftDataManager.WinForm/Util/GitHubUtil.cs +++ b/SwitchGiftDataManager.Core/Util/GitHubUtil.cs @@ -2,21 +2,11 @@ using SwitchGiftDataManager.Core; using Octokit; -namespace SwitchGiftDataManager.WinForm +namespace SwitchGiftDataManager.Core { public static class GitHubUtil { - public static async Task TryUpdate() - { - if (await IsUpdateAvailable()) - { - var result = MessageBox.Show("A program update is available. Do you want to download the latest release?", "Update available", MessageBoxButtons.YesNo); - if (result == DialogResult.Yes) - Process.Start(new ProcessStartInfo { FileName = @"https://github.com/Manu098vm/Switch-Gift-Data-Manager/releases", UseShellExecute = true } ); - } - } - - private static async Task IsUpdateAvailable() + public static async Task IsUpdateAvailable() { var currentVersion = ParseVersion(GetPluginVersion()); var latestVersion = ParseVersion(await GetLatestVersion()); diff --git a/SwitchGiftDataManager.WinForm/MainWindow.cs b/SwitchGiftDataManager.WinForm/MainWindow.cs index c39edc6..126237c 100644 --- a/SwitchGiftDataManager.WinForm/MainWindow.cs +++ b/SwitchGiftDataManager.WinForm/MainWindow.cs @@ -1,6 +1,7 @@ using System.Text.RegularExpressions; using SwitchGiftDataManager.Core; using Enums; +using System.Diagnostics; namespace SwitchGiftDataManager.WinForm { @@ -16,11 +17,21 @@ namespace SwitchGiftDataManager.WinForm public MainWindow() { - Task.Run(async () => { await GitHubUtil.TryUpdate(); }); + Task.Run(TryUpdate).Wait(); InitializeComponent(); Text += BCATManager.Version; } + private static async Task TryUpdate() + { + if (await GitHubUtil.IsUpdateAvailable()) + { + var result = MessageBox.Show("A program update is available. Do you want to download the latest release?", "Update available", MessageBoxButtons.YesNo); + if (result == DialogResult.Yes) + Process.Start(new ProcessStartInfo { FileName = @"https://github.com/Manu098vm/Switch-Gift-Data-Manager/releases", UseShellExecute = true }); + } + } + private void ChangeGame(Games game) { GrpBCAT.Enabled = true; @@ -259,7 +270,7 @@ namespace SwitchGiftDataManager.WinForm { if (e.Data is not null && CurrentGame is not Games.None) { - string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); + string[] files = (string[])e.Data.GetData(DataFormats.FileDrop)!; LoadLocalFiles(files); } } diff --git a/SwitchGiftDataManager.WinForm/Properties/PublishProfiles/FolderProfile.pubxml b/SwitchGiftDataManager.WinForm/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..f02811b --- /dev/null +++ b/SwitchGiftDataManager.WinForm/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,15 @@ + + + + + Release + Any CPU + bin\Release\net7.0-windows\win-x64\publish\ + FileSystem + <_TargetId>Folder + net7.0-windows + false + + \ No newline at end of file diff --git a/SwitchGiftDataManager.WinForm/Properties/PublishProfiles/FolderProfile.pubxml.user b/SwitchGiftDataManager.WinForm/Properties/PublishProfiles/FolderProfile.pubxml.user new file mode 100644 index 0000000..7ae32c6 --- /dev/null +++ b/SwitchGiftDataManager.WinForm/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -0,0 +1,10 @@ + + + + + True|2023-01-23T19:01:57.3824432Z;False|2023-01-23T20:00:42.5423966+01:00;True|2023-01-23T19:57:25.6949583+01:00; + + + \ No newline at end of file diff --git a/SwitchGiftDataManager.WinForm/SwitchGiftDataManager.WinForm.csproj b/SwitchGiftDataManager.WinForm/SwitchGiftDataManager.WinForm.csproj index 09dc936..6508a3e 100644 --- a/SwitchGiftDataManager.WinForm/SwitchGiftDataManager.WinForm.csproj +++ b/SwitchGiftDataManager.WinForm/SwitchGiftDataManager.WinForm.csproj @@ -2,7 +2,7 @@ WinExe - net6.0-windows + net7.0-windows enable true enable @@ -26,15 +26,20 @@ True - - embedded - True - - embedded + + embedded + true + true + true + true + false + false + + True @@ -49,10 +54,6 @@ - - - - True @@ -95,6 +96,10 @@ + + + + diff --git a/SwitchGiftDataManager.WinForm/SwitchGiftDataManager.WinForm.csproj.user b/SwitchGiftDataManager.WinForm/SwitchGiftDataManager.WinForm.csproj.user index 9366252..48fecc7 100644 --- a/SwitchGiftDataManager.WinForm/SwitchGiftDataManager.WinForm.csproj.user +++ b/SwitchGiftDataManager.WinForm/SwitchGiftDataManager.WinForm.csproj.user @@ -1,11 +1,6 @@  - - - Form - - - Form - - + + <_LastSelectedProfileId>D:\Projects\SwitchGiftDataManager\SwitchGiftDataManager.WinForm\Properties\PublishProfiles\FolderProfile.pubxml + \ No newline at end of file