From 95b4d0820db17de4efdcdb775d242bf2074fa0a0 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 18 May 2018 19:33:11 -0700 Subject: [PATCH] Minor reorganization amount of pkm obj classes is pretty high, move the static utility classes to another folder breaks usage of pkm.ShowdownText; removes a dependency from PKM. --- PKHeX.Core/{PKM => Editing}/ShowdownSet.cs | 0 PKHeX.Core/Legality/Core.cs | 2 +- PKHeX.Core/PKM/PKM.cs | 1 - PKHeX.Core/PKM/{ => Shared}/IShadowPKM.cs | 0 PKHeX.Core/PKM/{ => Util}/FormConverter.cs | 0 PKHeX.Core/PKM/{ => Util}/ItemConverter.cs | 0 PKHeX.Core/PKM/{ => Util}/PKMConverter.cs | 0 PKHeX.Core/PKM/{ => Util}/PKMSorting.cs | 0 PKHeX.Core/PKM/{ => Util}/PKX.cs | 0 PKHeX.Core/PKM/{ => Util}/SpeciesConverter.cs | 0 PKHeX.Core/PKM/{ => Util}/StringConverter.cs | 0 .../Controls/SAV Editor/SAVEditor.cs | 4 +-- .../Controls/SAV Editor/SlotChangeManager.cs | 2 +- PKHeX.WinForms/MainWindow/Main.cs | 31 +++---------------- 14 files changed, 8 insertions(+), 32 deletions(-) rename PKHeX.Core/{PKM => Editing}/ShowdownSet.cs (100%) rename PKHeX.Core/PKM/{ => Shared}/IShadowPKM.cs (100%) rename PKHeX.Core/PKM/{ => Util}/FormConverter.cs (100%) rename PKHeX.Core/PKM/{ => Util}/ItemConverter.cs (100%) rename PKHeX.Core/PKM/{ => Util}/PKMConverter.cs (100%) rename PKHeX.Core/PKM/{ => Util}/PKMSorting.cs (100%) rename PKHeX.Core/PKM/{ => Util}/PKX.cs (100%) rename PKHeX.Core/PKM/{ => Util}/SpeciesConverter.cs (100%) rename PKHeX.Core/PKM/{ => Util}/StringConverter.cs (100%) diff --git a/PKHeX.Core/PKM/ShowdownSet.cs b/PKHeX.Core/Editing/ShowdownSet.cs similarity index 100% rename from PKHeX.Core/PKM/ShowdownSet.cs rename to PKHeX.Core/Editing/ShowdownSet.cs diff --git a/PKHeX.Core/Legality/Core.cs b/PKHeX.Core/Legality/Core.cs index dca2c8431..183f43c0e 100644 --- a/PKHeX.Core/Legality/Core.cs +++ b/PKHeX.Core/Legality/Core.cs @@ -2173,7 +2173,7 @@ internal static bool IsTradedKadabraG1(PKM pkm) } if (IsYellow) return false; - // Yellow only moves in Red/Blue game, must be Allakazham + // Yellow only moves in Red/Blue game, must be Alakazam if (pk1.Moves.Contains(134)) // Kinesis, yellow only move return true; if (pk1.CurrentLevel < 20 && pkm.Moves.Contains(50)) // Obtaining Disable below level 20 implies a yellow only move diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs index 0e93465f8..e294ee260 100644 --- a/PKHeX.Core/PKM/PKM.cs +++ b/PKHeX.Core/PKM/PKM.cs @@ -352,7 +352,6 @@ protected static int SwapBits(int value, int p1, int p2) x = (x << p1) | (x << p2); return value ^ x; } - public string ShowdownText => ShowdownSet.GetShowdownText(this); public string[] QRText => this.GetQRLines(); public virtual string FileName diff --git a/PKHeX.Core/PKM/IShadowPKM.cs b/PKHeX.Core/PKM/Shared/IShadowPKM.cs similarity index 100% rename from PKHeX.Core/PKM/IShadowPKM.cs rename to PKHeX.Core/PKM/Shared/IShadowPKM.cs diff --git a/PKHeX.Core/PKM/FormConverter.cs b/PKHeX.Core/PKM/Util/FormConverter.cs similarity index 100% rename from PKHeX.Core/PKM/FormConverter.cs rename to PKHeX.Core/PKM/Util/FormConverter.cs diff --git a/PKHeX.Core/PKM/ItemConverter.cs b/PKHeX.Core/PKM/Util/ItemConverter.cs similarity index 100% rename from PKHeX.Core/PKM/ItemConverter.cs rename to PKHeX.Core/PKM/Util/ItemConverter.cs diff --git a/PKHeX.Core/PKM/PKMConverter.cs b/PKHeX.Core/PKM/Util/PKMConverter.cs similarity index 100% rename from PKHeX.Core/PKM/PKMConverter.cs rename to PKHeX.Core/PKM/Util/PKMConverter.cs diff --git a/PKHeX.Core/PKM/PKMSorting.cs b/PKHeX.Core/PKM/Util/PKMSorting.cs similarity index 100% rename from PKHeX.Core/PKM/PKMSorting.cs rename to PKHeX.Core/PKM/Util/PKMSorting.cs diff --git a/PKHeX.Core/PKM/PKX.cs b/PKHeX.Core/PKM/Util/PKX.cs similarity index 100% rename from PKHeX.Core/PKM/PKX.cs rename to PKHeX.Core/PKM/Util/PKX.cs diff --git a/PKHeX.Core/PKM/SpeciesConverter.cs b/PKHeX.Core/PKM/Util/SpeciesConverter.cs similarity index 100% rename from PKHeX.Core/PKM/SpeciesConverter.cs rename to PKHeX.Core/PKM/Util/SpeciesConverter.cs diff --git a/PKHeX.Core/PKM/StringConverter.cs b/PKHeX.Core/PKM/Util/StringConverter.cs similarity index 100% rename from PKHeX.Core/PKM/StringConverter.cs rename to PKHeX.Core/PKM/Util/StringConverter.cs diff --git a/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs b/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs index fa5999be5..2f554f0fd 100644 --- a/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs +++ b/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs @@ -1133,7 +1133,7 @@ private void ClickShowdownExportParty(object sender, EventArgs e) { try { - var str = string.Join(Environment.NewLine + Environment.NewLine, SAV.PartyData.Select(pk => pk.ShowdownText)); + var str = string.Join(Environment.NewLine + Environment.NewLine, SAV.PartyData.Select(ShowdownSet.GetShowdownText)); if (string.IsNullOrWhiteSpace(str)) return; Clipboard.SetText(str); } @@ -1144,7 +1144,7 @@ private void ClickShowdownExportBattleBox(object sender, EventArgs e) { try { - var str = string.Join(Environment.NewLine + Environment.NewLine, SAV.BattleBoxData.Select(pk => pk.ShowdownText)); + var str = string.Join(Environment.NewLine + Environment.NewLine, SAV.BattleBoxData.Select(ShowdownSet.GetShowdownText)); if (string.IsNullOrWhiteSpace(str)) return; Clipboard.SetText(str); } diff --git a/PKHeX.WinForms/Controls/SAV Editor/SlotChangeManager.cs b/PKHeX.WinForms/Controls/SAV Editor/SlotChangeManager.cs index c16c886e2..30292bdf1 100644 --- a/PKHeX.WinForms/Controls/SAV Editor/SlotChangeManager.cs +++ b/PKHeX.WinForms/Controls/SAV Editor/SlotChangeManager.cs @@ -170,7 +170,7 @@ private void ShowSimulatorSetTooltip(Control pb, PKM pk) if (pk.Species == 0) ShowSet.RemoveAll(); else - ShowSet.SetToolTip(pb, pk.ShowdownText); + ShowSet.SetToolTip(pb, ShowdownSet.GetShowdownText(pk)); } private void PlayCry(PKM pk) { diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index 268c65867..b3ceaa0d1 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -413,7 +413,8 @@ private void ClickShowdownExportPKM(object sender, EventArgs e) return; } - var text = PreparePKM().ShowdownText; + var pk = PreparePKM(); + var text = ShowdownSet.GetShowdownText(pk); Clipboard.SetText(text); var clip = Clipboard.GetText(); if (clip != text) @@ -421,32 +422,8 @@ private void ClickShowdownExportPKM(object sender, EventArgs e) else WinFormsUtil.Alert(MsgSimulatorExportSuccess, text); } - private void ClickShowdownExportParty(object sender, EventArgs e) - { - var data = C_SAV.SAV.PartyData; - if (data.Count <= 0) return; - try - { - var split = Environment.NewLine + Environment.NewLine; - var sets = data.Select(z => z.ShowdownText); - Clipboard.SetText(string.Join(split, sets)); - WinFormsUtil.Alert(MsgSimulatorExportParty); - } - catch { } - } - private void ClickShowdownExportBattleBox(object sender, EventArgs e) - { - var data = C_SAV.SAV.BattleBoxData; - if (data.Count <= 0) return; - try - { - var split = Environment.NewLine + Environment.NewLine; - var sets = data.Select(z => z.ShowdownText); - Clipboard.SetText(string.Join(split, sets)); - WinFormsUtil.Alert(MsgSimulatorExportBattleBox); - } - catch { } - } + private void ClickShowdownExportParty(object sender, EventArgs e) => C_SAV.ClickShowdownExportParty(sender, e); + private void ClickShowdownExportBattleBox(object sender, EventArgs e) => C_SAV.ClickShowdownExportBattleBox(sender, e); // Main Menu Subfunctions private void OpenQuick(string path, bool force = false)