From 0318b2b2f33a62850a491d893fc1c32968a42ffd Mon Sep 17 00:00:00 2001 From: zyro670 Date: Wed, 16 Oct 2024 20:51:49 -0400 Subject: [PATCH] v3.2 - Fix version check for Switch 19.0.0 Support --- PokeViewer.NET/MainViewer.cs | 10 +++++++--- PokeViewer.NET/SubForms/BoxViewerMode.cs | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/PokeViewer.NET/MainViewer.cs b/PokeViewer.NET/MainViewer.cs index 4fc7854..a3c8275 100644 --- a/PokeViewer.NET/MainViewer.cs +++ b/PokeViewer.NET/MainViewer.cs @@ -14,6 +14,7 @@ using System.IO.Compression; using System.Net.Sockets; using System.Reflection; +using System.Text.RegularExpressions; using static PokeViewer.NET.CommandsUtil.CommandsUtil; using static PokeViewer.NET.RoutineExecutor; using static PokeViewer.NET.ViewerUtil; @@ -26,7 +27,7 @@ namespace PokeViewer.NET public partial class MainViewer : Form { public ViewerExecutor Executor = null!; - private const string ViewerVersion = "3.1.1"; + private const string ViewerVersion = "3.2"; private readonly bool[] FormLoaded = new bool[8]; private int GameType; private SimpleTrainerInfo TrainerInfo = new(); @@ -72,7 +73,10 @@ private async Task CheckBotBaseReq(CancellationToken token) GitHubClient client = new(new ProductHeaderValue("usb-botbase")); Release releases = await client.Repository.Release.GetLatest("zyro670", "usb-botbase"); var sbb = await Executor.SwitchConnection.GetBotbaseVersion(token).ConfigureAwait(false); - if (!sbb.Equals("2.353\n")) + string replacement = Regex.Replace(sbb, @"\t|\n|\r", ""); + string vIn = replacement.Replace('"', ' ').Trim(); + var vOut = Convert.ToDouble(vIn); + if (vOut < 2.4) { DialogResult dialogResult = MessageBox.Show($"Current version of sysbot-base v{sbb.ToString().TrimEnd('\r', '\n')} does not match minimum required version. Download latest?", "An update is available", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) @@ -344,7 +348,7 @@ private async void FillPokeData(PKM pk, ulong offset, uint offset2, int size) case 1: gender = " (F)"; break; case 2: break; } - string output = $"{(pk.ShinyXor == 0 ? "■ - " : pk.ShinyXor <= 16 ? "★ - " : "")}{isAlpha}{(Species)pk.Species}{form}{gender}{ec}{pid}{Environment.NewLine}Nature: {(Nature)pk.Nature}{Environment.NewLine}Ability: {GameInfo.GetStrings(1).Ability[pk.Ability]}{Environment.NewLine}IVs: {pk.IV_HP}/{pk.IV_ATK}/{pk.IV_DEF}/{pk.IV_SPA}/{pk.IV_SPD}/{pk.IV_SPE}{Environment.NewLine}{scale}{msg}"; + string output = $"{(pk.ShinyXor == 0 ? "■ - " : pk.ShinyXor <= 16 ? "★ - " : "")}{isAlpha}{(Species)pk.Species}{form}{gender}{ec}{pid}{Environment.NewLine}Nature: {pk.Nature}{Environment.NewLine}Ability: {GameInfo.GetStrings(1).Ability[pk.Ability]}{Environment.NewLine}IVs: {pk.IV_HP}/{pk.IV_ATK}/{pk.IV_DEF}/{pk.IV_SPA}/{pk.IV_SPD}/{pk.IV_SPE}{Environment.NewLine}{scale}{msg}"; LiveStats.Text = $"{GameInfo.GetStrings(1).Move[pk.Move1]} - {pk.Move1_PP}PP{Environment.NewLine}{GameInfo.GetStrings(1).Move[pk.Move2]} - {pk.Move2_PP}PP{Environment.NewLine}{GameInfo.GetStrings(1).Move[pk.Move3]} - {pk.Move3_PP}PP{Environment.NewLine}{GameInfo.GetStrings(1).Move[pk.Move4]} - {pk.Move4_PP}PP"; ViewBox.Text = output; sprite = PokeImg(pk, isGmax); diff --git a/PokeViewer.NET/SubForms/BoxViewerMode.cs b/PokeViewer.NET/SubForms/BoxViewerMode.cs index f0b798b..c4b7681 100644 --- a/PokeViewer.NET/SubForms/BoxViewerMode.cs +++ b/PokeViewer.NET/SubForms/BoxViewerMode.cs @@ -441,7 +441,7 @@ private async Task Sanitize(PKM pk, CancellationToken token) if (!string.IsNullOrEmpty(pid) && !string.IsNullOrEmpty(ec)) sens = pid + ec; CurrentSlotSpecies.Add($"{(pk.ShinyXor == 0 ? "■ - " : pk.ShinyXor <= 16 ? "★ - " : "")}{gMax}{alpha}{(Species)pk.Species}{form}{gender}{Environment.NewLine}{sens}"); - CurrentSlotNature.Add($"Nature: {(Nature)pk.Nature}"); + CurrentSlotNature.Add($"Nature: {pk.Nature}"); CurrentSlotAbility.Add($"Ability: {(Ability)pk.Ability}"); CurrentSlotIVs.Add($"IVs: {pk.IV_HP}/{pk.IV_ATK}/{pk.IV_DEF}/{pk.IV_SPA}/{pk.IV_SPD}/{pk.IV_SPE}"); CurrentSlotScale.Add(scale);