diff --git a/SortingPlugin/PluginMain.cs b/SortingPlugin/PluginMain.cs index 9015c1f..69c62f4 100644 --- a/SortingPlugin/PluginMain.cs +++ b/SortingPlugin/PluginMain.cs @@ -144,10 +144,7 @@ public static void LoadMenuStrip() { if(gen != 1) { ToolStripMenuItem nationalDexSortButton = new ToolStripMenuItem("National Pokédex"); - nationalDexSortButton.Click += (s, e) => { - saveFileEditor.SAV.SortBoxes(); - saveFileEditor.ReloadSlots(); - }; + nationalDexSortButton.Click += (s, e) => SortByFunctions(); sortItems.Add(nationalDexSortButton); if(gen >= 7 && !isBDSP) { @@ -163,9 +160,15 @@ public static void LoadMenuStrip() { sortItems.Add(settingsButton); } - private static void SortByFunctions(Func[] sortFunctions) { - IEnumerable sortMethod(IEnumerable pkms, int start) => pkms.OrderByCustom(sortFunctions); - saveFileEditor.SAV.SortBoxes(0, -1, sortMethod); + private static void SortByFunctions(Func[] sortFunctions = null) { + int beginIndex = PluginSettings.Default.SortBeginBox - 1; + int endIndex = PluginSettings.Default.SortEndBox < 0 ? -1 : PluginSettings.Default.SortEndBox - 1; + if (sortFunctions != null) { + IEnumerable sortMethod(IEnumerable pkms, int start) => pkms.OrderByCustom(sortFunctions); + saveFileEditor.SAV.SortBoxes(beginIndex, endIndex, sortMethod); + } else { + saveFileEditor.SAV.SortBoxes(beginIndex, endIndex); + } saveFileEditor.ReloadSlots(); } diff --git a/SortingPlugin/PluginSettings.Designer.cs b/SortingPlugin/PluginSettings.Designer.cs index 9534042..87eec3b 100644 --- a/SortingPlugin/PluginSettings.Designer.cs +++ b/SortingPlugin/PluginSettings.Designer.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 @@ -9,21 +9,25 @@ //------------------------------------------------------------------------------ namespace SortingPlugin { - - + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] internal sealed partial class PluginSettings : global::System.Configuration.ApplicationSettingsBase { - + private static PluginSettings defaultInstance = ((PluginSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new PluginSettings()))); - + public static PluginSettings Default { get { return defaultInstance; } } - + + /// + /// Show the individual area Pokedéxes for those that have it. + /// [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Configuration.SettingsDescriptionAttribute("Show the individual area Pokedéxes for those that have it.")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] public bool ShowIndividualPokedéxes { @@ -34,5 +38,37 @@ public bool ShowIndividualPokedéxes { this["ShowIndividualPokedéxes"] = value; } } + + /// + /// The box to begin sorting from. + /// + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Configuration.SettingsDescriptionAttribute("The box to begin sorting from.")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("1")] + public int SortBeginBox { + get { + return ((int)(this["SortBeginBox"])); + } + set { + this["SortBeginBox"] = value; + } + } + + /// + /// The box to ending sorting in. -1 can be used to specify the last box. + /// + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Configuration.SettingsDescriptionAttribute("The box to ending sorting in. -1 can be used to specify the last box.")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("-1")] + public int SortEndBox { + get { + return ((int)(this["SortEndBox"])); + } + set { + this["SortEndBox"] = value; + } + } } } diff --git a/SortingPlugin/PluginSettings.settings b/SortingPlugin/PluginSettings.settings index 27918e5..c9362ee 100644 --- a/SortingPlugin/PluginSettings.settings +++ b/SortingPlugin/PluginSettings.settings @@ -1,9 +1,15 @@ - + - + False + + 1 + + + -1 + - + \ No newline at end of file diff --git a/SortingPlugin/app.config b/SortingPlugin/app.config index a544c03..3484249 100644 --- a/SortingPlugin/app.config +++ b/SortingPlugin/app.config @@ -1,7 +1,7 @@  - +
@@ -27,6 +27,12 @@ False + + 1 + + + -1 + \ No newline at end of file