Upgrade to NET 7

This commit is contained in:
Manu 2023-01-23 20:07:13 +01:00
parent fcb162e8d2
commit f7e4198433
17 changed files with 118 additions and 43 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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);
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>bin\Release\net7.0\win-x64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net7.0</TargetFramework>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2023-01-23T19:03:47.7790063Z;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Authors>Manu098vm</Authors>
@ -21,14 +21,20 @@
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='WSL|AnyCPU'">
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup>
<DebugType>embedded</DebugType>
<EmbedAllSources>true</EmbedAllSources>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>false</PublishTrimmed>
<SelfContained>false</SelfContained>
</PropertyGroup>
<ItemGroup>
<None Include="..\README.md">
<Pack>True</Pack>

View File

@ -5,5 +5,6 @@
</PropertyGroup>
<PropertyGroup>
<ActiveDebugProfile>SwitchGiftDataManager.CommandLine</ActiveDebugProfile>
<_LastSelectedProfileId>D:\Projects\SwitchGiftDataManager\SwitchGiftDataManager.CommandLine\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
</PropertyGroup>
</Project>

View File

@ -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;

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Authors>Manu098vm</Authors>
@ -43,6 +43,10 @@
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Octokit" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">

View File

@ -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<bool> IsUpdateAvailable()
public static async Task<bool> IsUpdateAvailable()
{
var currentVersion = ParseVersion(GetPluginVersion());
var latestVersion = ParseVersion(await GetLatestVersion());

View File

@ -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);
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>bin\Release\net7.0-windows\win-x64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net7.0-windows</TargetFramework>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>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;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net7.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
@ -26,15 +26,20 @@
<Optimize>True</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='WSL|AnyCPU'">
<DebugType>embedded</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup>
<DebugType>embedded</DebugType>
<EmbedAllSources>true</EmbedAllSources>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>false</PublishTrimmed>
<SelfContained>false</SelfContained>
</PropertyGroup>
<ItemGroup>
<None Include="..\README.md">
<Pack>True</Pack>
@ -49,10 +54,6 @@
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Octokit" Version="4.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SwitchGiftDataManager.Core\SwitchGiftDataManager.Core.csproj">
<Private>True</Private>
@ -95,6 +96,10 @@
<Move SourceFiles="$(OUTDIR)\SwitchGiftDataManager.WinForm.exe" DestinationFiles="$(OUTDIR)\Switch Gift Data Manager.exe" />
</Target>
<Target Name="PostPublish" AfterTargets="Publish" Condition="$(ConfigurationName) == Release and '$(OS)' == 'Windows_NT'">
<Move SourceFiles="$(OUTDIR)\publish\SwitchGiftDataManager.WinForm.exe" DestinationFiles="$(OUTDIR)\publish\Switch Gift Data Manager.exe" />
</Target>
<Target Name="PostClean" AfterTargets="Clean" Condition="$(ConfigurationName) == Release">
<RemoveDir Directories="$(TargetDir)" />
<RemoveDir Directories="$(ProjectDir)$(BaseIntermediateOutputPath)" />

View File

@ -1,11 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Compile Update="MainWindow.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="SaveWindow.cs">
<SubType>Form</SubType>
</Compile>
</ItemGroup>
<PropertyGroup>
<_LastSelectedProfileId>D:\Projects\SwitchGiftDataManager\SwitchGiftDataManager.WinForm\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
</PropertyGroup>
</Project>