diff --git a/AM2RPortHelperCLI/Program.cs b/AM2RPortHelperCLI/Program.cs index a27c8fc..3f48416 100644 --- a/AM2RPortHelperCLI/Program.cs +++ b/AM2RPortHelperCLI/Program.cs @@ -22,7 +22,7 @@ internal static class Program var linuxOption = new Option(new[] { "-l", "--linux" }, "The output file path for the Linux mod. None given equals to no Linux port."); var androidOption = new Option(new[] { "-a", "--android" }, "The output file path for the Android mod. None given equals to no Android port."); var macOption = new Option(new[] { "-m", "--mac" }, "The output file path for the Mac mod. None given equals to no Mac port."); - var nameOption = new Option(new[] { "-n", "--name" }, "The name used for the Mac or Android mod. Required for the Mac option, and optional for the Android version. Has no effect on anything else."); + var nameOption = new Option(new[] { "-s", "--customsave" }, "Whether the Android Port should use a custom save location. Has no effect on anything else."); var internetOption = new Option(new[] { "-w", "--internet" }, "Add internet usage permissions to the Android mod. Has no effect to other OS."); var verboseOption = new Option(new[] { "-v", "--verbose" }, "Whether to show verbose output."); @@ -44,7 +44,7 @@ internal static class Program } #pragma warning disable CS1998 private static async Task RootMethod(bool interactive, FileInfo inputModPath, FileInfo linuxPath, FileInfo androidPath, FileInfo macPath, - string modName, bool usesInternet, bool beVerbose) + bool useCustomSave, bool usesInternet, bool beVerbose) #pragma warning restore CS1998 { if (interactive || beVerbose) @@ -69,16 +69,11 @@ internal static class Program if (androidPath is not null) { RawMods.PortToAndroid(inputModPath.FullName, androidPath.FullName, - String.IsNullOrWhiteSpace(modName) ? null : modName, usesInternet, beVerbose ? OutputHandlerDelegate : null); + useCustomSave, usesInternet, beVerbose ? OutputHandlerDelegate : null); } if (macPath is not null) { - if (modName is null) - { - Console.Error.WriteLine("Mac option was chosen but mod name was not given!"); - return 1; - } - RawMods.PortToMac(inputModPath.FullName, macPath.FullName, modName, beVerbose ? OutputHandlerDelegate : null); + RawMods.PortToMac(inputModPath.FullName, macPath.FullName, beVerbose ? OutputHandlerDelegate : null); } if (beVerbose) Console.WriteLine("Done."); @@ -170,8 +165,23 @@ internal static class Program Console.WriteLine(); } while (internetSelected == null); + + bool? customSaveSelected = null; + do + { + Console.WriteLine("Do you want to use a custom save location for Android (y/n)?"); + var input = Console.ReadKey().Key; + switch (input) + { + case ConsoleKey.Y: customSaveSelected = true; break; + case ConsoleKey.N: customSaveSelected = false; break; + default: Console.WriteLine("Invalid input!"); break; + } + Console.WriteLine(); + } + while (customSaveSelected == null); - RawMods.PortToAndroid(modZipPath, androidPath, null, internetSelected.Value, OutputHandlerDelegate); + RawMods.PortToAndroid(modZipPath, androidPath, customSaveSelected.Value, customSaveSelected.Value, OutputHandlerDelegate); } if (macSelected) { @@ -180,7 +190,7 @@ internal static class Program Console.WriteLine("Mac requires a name! Please enter one (no special characters!):"); string modName = Console.ReadLine(); - RawMods.PortToMac(modZipPath, macPath, modName, OutputHandlerDelegate); + RawMods.PortToMac(modZipPath, macPath, OutputHandlerDelegate); } Console.WriteLine("Successfully finished!"); diff --git a/AM2RPortHelperGUI/AM2RPortHelperGUI/AM2RPortHelperGUI.csproj b/AM2RPortHelperGUI/AM2RPortHelperGUI/AM2RPortHelperGUI.csproj index 3841b18..d12bb63 100644 --- a/AM2RPortHelperGUI/AM2RPortHelperGUI/AM2RPortHelperGUI.csproj +++ b/AM2RPortHelperGUI/AM2RPortHelperGUI/AM2RPortHelperGUI.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + .net6.0 10 diff --git a/AM2RPortHelperGUI/AM2RPortHelperGUI/MainForm.cs b/AM2RPortHelperGUI/AM2RPortHelperGUI/MainForm.cs index a29d800..745962e 100644 --- a/AM2RPortHelperGUI/AM2RPortHelperGUI/MainForm.cs +++ b/AM2RPortHelperGUI/AM2RPortHelperGUI/MainForm.cs @@ -42,7 +42,7 @@ public partial class MainForm : Form mainLayout.EndCentered(); mainLayout.AddRow(new Label() { Height = 5 }); mainLayout.BeginCentered(); - mainLayout.AddRow(labelModName, new Label { Width = 15 }, textboxModName); + mainLayout.AddRow(checkboxUseCustomSave); mainLayout.EndCentered(); mainLayout.AddSpace(); mainLayout.BeginVertical(); @@ -79,7 +79,7 @@ public partial class MainForm : Form checkboxAndroidRequiresInternet.CheckedChanged += ShouldButtonPortBeEnabled; checkboxLinux.CheckedChanged += ShouldButtonPortBeEnabled; checkboxMac.CheckedChanged += ShouldButtonPortBeEnabled; - textboxModName.TextChanged += ShouldButtonPortBeEnabled; + checkboxUseCustomSave.TextChanged += ShouldButtonPortBeEnabled; filePicker.FilePathChanged += ShouldButtonPortBeEnabled; buttonPort.Click += ButtonPortOnClick; } @@ -107,19 +107,18 @@ public partial class MainForm : Form { if (File.Exists(androidPath)) File.Delete(androidPath); - - string modName = null; - if (!String.IsNullOrWhiteSpace(textboxModName.Text)) modName = textboxModName.Text; + + bool useCustomSave = checkboxUseCustomSave.Checked.Value; bool useInternet = checkboxAndroidRequiresInternet.Checked.Value; - await Task.Run(() => RawMods.PortToAndroid(modZipPath, androidPath, modName, useInternet, OutputHandlerDelegate)); + await Task.Run(() => RawMods.PortToAndroid(modZipPath, androidPath, useCustomSave, useInternet, OutputHandlerDelegate)); } if (checkboxMac.Checked.Value) { if (File.Exists(macPath)) File.Delete(macPath); - string modName = textboxModName.Text; - await Task.Run(() => RawMods.PortToMac(modZipPath, macPath, modName, OutputHandlerDelegate)); + string modName = checkboxUseCustomSave.Text; + await Task.Run(() => RawMods.PortToMac(modZipPath, macPath, OutputHandlerDelegate)); } labelProgress.Text = "Done!"; @@ -144,7 +143,7 @@ public partial class MainForm : Form if ((!String.IsNullOrWhiteSpace(filePicker.FilePath) && ((checkboxAndroid.Checked.Value && !checkboxMac.Checked.Value)) || (checkboxLinux.Checked.Value && !checkboxMac.Checked.Value) - || (checkboxMac.Checked.Value && !String.IsNullOrWhiteSpace(textboxModName.Text)))) + || (checkboxMac.Checked.Value && !String.IsNullOrWhiteSpace(checkboxUseCustomSave.Text)))) buttonPort.Enabled = true; else @@ -159,7 +158,7 @@ public partial class MainForm : Form checkboxMac.Enabled = !disabled; filePicker.Enabled = !disabled; buttonPort.Enabled = !disabled; - textboxModName.Enabled = !disabled; + checkboxUseCustomSave.Enabled = !disabled; } // Attributes @@ -203,16 +202,15 @@ public partial class MainForm : Form private readonly CheckBox checkboxAndroidRequiresInternet = new CheckBox { Text = "Requires internet (See tooltip for info)", - ToolTip = "Only affects Android. If your mod interacts with the internet in any way (such as multiplayer), you should check this," + + ToolTip = "Only affects Android. If your mod interacts with the internet in any way (such as multiplayer), you should check this, " + "as otherwise internet functions won't work." }; - private readonly Label labelModName = new Label + private readonly CheckBox checkboxUseCustomSave = new CheckBox { - Text = "Enter mod name:\n(See tooltip for info)", - ToolTip = "The mod name is required for Mac, and optional for Android. It does not have any affect on other OS.\n" + - "For Mac, it is used as the display name when the application is started. For Android, the name is used for the save location." + Text = "Use custom save location (See tooltip for info)", + ToolTip = "Only affects Android. Determines whether Android will use a custom save location based on its display name. If you don't " + + "want your mod overwriting normal AM2R on Android, you should check this." }; - private readonly TextBox textboxModName = new TextBox(); private readonly Button buttonPort = new Button { diff --git a/AM2RPortHelperLib/AM2RPortHelperLib.csproj b/AM2RPortHelperLib/AM2RPortHelperLib.csproj index c2e52ac..caba697 100644 --- a/AM2RPortHelperLib/AM2RPortHelperLib.csproj +++ b/AM2RPortHelperLib/AM2RPortHelperLib.csproj @@ -1,7 +1,8 @@ - netstandard2.1 + + .net6.0 enable 10 1.8.0 diff --git a/UndertaleModTool b/UndertaleModTool index 7970426..ad5a84b 160000 --- a/UndertaleModTool +++ b/UndertaleModTool @@ -1 +1 @@ -Subproject commit 79704260e15ab8c7ffdbc7effb3cbe366f480a00 +Subproject commit ad5a84bdfbf3a58079c3e2a60ce487b3438a0bce