diff --git a/AM2RPortHelperCLI/AM2RPortHelperCLI.csproj b/AM2RPortHelperCLI/AM2RPortHelperCLI.csproj
index 51499ea..e709579 100644
--- a/AM2RPortHelperCLI/AM2RPortHelperCLI.csproj
+++ b/AM2RPortHelperCLI/AM2RPortHelperCLI.csproj
@@ -6,10 +6,11 @@
LatestMajor
10
AM2RPortHelper
+ 1.0.0
-
+
diff --git a/AM2RPortHelperCLI/Program.cs b/AM2RPortHelperCLI/Program.cs
index 3541584..6f77188 100644
--- a/AM2RPortHelperCLI/Program.cs
+++ b/AM2RPortHelperCLI/Program.cs
@@ -1,4 +1,7 @@
using System;
+using System.CommandLine;
+using System.CommandLine.Builder;
+using System.CommandLine.Parsing;
using System.IO;
using System.Threading;
using AM2RPortHelperLib;
@@ -11,41 +14,106 @@ internal static class Program
//TODO: add "-l" flag. transfer launcher mods to each other.
- private static void Main(string[] args)
+ private static int Main(string[] args)
{
Console.WriteLine("AM2RPortHelperCLI v" + version);
- if (args == null || args.Length == 0)
- {
- Console.WriteLine("Please drag-n-drop a Zip of your mod or provide it as an argument.");
- return;
- }
+ //TODO!
+ var interactiveOption = new Option(new[] {"-i", "--interactive"}, "Use an interactive mode");
- FileInfo modZipPath = new FileInfo(args[0]);
- if (!modZipPath.Exists && modZipPath.Extension.ToLower() != "zip")
- {
- Console.WriteLine("Path does not point to a mod zip");
- return;
- }
+ RootCommand rootCommand = new RootCommand();
+ rootCommand.AddOption(interactiveOption);
+ rootCommand.SetHandler(RootMethod, interactiveOption);
+ return rootCommand.Invoke(args);
+
+ /*
Console.WriteLine("\n**Make sure to replace the icon.png and splash.png with custom ones if you don't want to have placeholders**\n");
Console.WriteLine("THIS ONLY WORKS FOR MODS BASED ON THE COMMUNITY UPDATES! MODS BASED ON 1.1 WILL NOT WORK!");
Console.WriteLine("To which platform do you want to port to?\n1 - Linux\n2 - Android\n3 - MacOS");
+ */
- var input = Console.ReadKey().Key.ToString();
- Console.WriteLine();
- switch (input)
+ }
+ private static void RootMethod(bool interactive)
+ {
+ if (interactive)
{
- case "D1": PortHelper.PortWindowsToLinux(modZipPath); break;
+ RunInteractive();
+ return;
+ }
+ var x = 0;
+ }
+ private static void RunInteractive()
+ {
+ // Path to zip
+ bool invalidZip = true;
+ string modZipPath;
+ do
+ {
+ Console.WriteLine("Please provide the full path to the raw mod zip!");
+ modZipPath = Console.ReadLine();
- case "D2": PortHelper.PortWindowsToAndroid(modZipPath); break;
+ if (modZipPath == null || (!File.Exists(modZipPath) && Path.GetExtension(modZipPath).ToLower() != ".zip"))
+ Console.WriteLine("Path does not exist, or does not point to a zip file!");
+ else
+ invalidZip = false;
+ } while (invalidZip);
+
+ // OS choice
+ bool linuxSelected = false;
+ bool androidSelected = false;
+ bool macSelected = false;
+ bool invalidOS = true;
+ do
+ {
+ Console.WriteLine("Select the platforms you want to port to:");
+ Console.WriteLine($"1 - Linux (currently {(linuxSelected ? "on" : "off")})");
+ Console.WriteLine($"2 - Android (currently {(androidSelected ? "on" : "off")})");
+ Console.WriteLine($"3 - Mac (currently {(macSelected ? "on" : "off")})");
+ Console.WriteLine("4 - Port!");
+ var input = Console.ReadKey().Key.ToString();
+ Console.WriteLine();
+
+ switch (input)
+ {
+ case "D1": linuxSelected = !linuxSelected; break;
- case "D3": PortHelper.PortWindowsToMac(modZipPath); break;
+ case "D2": androidSelected = !androidSelected; break;
- default: Console.WriteLine("Unacceptable input. Aborting..."); return;
+ case "D3": macSelected = !macSelected; break;
+
+ case "D4":
+ if (linuxSelected || androidSelected || macSelected)
+ invalidOS = false;
+ else
+ Console.WriteLine("You have to at least select one OS!");
+ break;
+ }
+ } while (invalidOS);
+
+ string currentDir = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
+ string linuxPath = $"{currentDir}/{Path.GetFileNameWithoutExtension(modZipPath)}_LINUX.zip";
+ string androidPath = $"{currentDir}/{Path.GetFileNameWithoutExtension(modZipPath)}_ANDROID.apk";
+ string macPath = $"{currentDir}/{Path.GetFileNameWithoutExtension(modZipPath)}_MACOS.zip";
+
+ if (File.Exists(linuxPath))
+ File.Delete(linuxPath);
+ if (File.Exists(androidPath))
+ File.Delete(androidPath);
+ if (File.Exists(macPath))
+ File.Delete(macPath);
+
+ if (linuxSelected)
+ PortHelper.PortWindowsToLinux(modZipPath,linuxPath);
+ if (androidSelected)
+ PortHelper.PortWindowsToAndroid(modZipPath, androidPath);
+ if (macSelected)
+ {
+ Console.WriteLine("Mac requires a name! Please enter one (no special characters!):");
+ string modName = Console.ReadLine();
+ PortHelper.PortWindowsToMac(modZipPath, macPath, modName);
}
+
Console.WriteLine("Successfully finished!");
- Console.WriteLine("Exiting in 3 seconds...");
- Thread.Sleep(3000);
}
}
\ No newline at end of file
diff --git a/AM2RPortHelperCLI/Properties/launchSettings.json b/AM2RPortHelperCLI/Properties/launchSettings.json
deleted file mode 100644
index 084c28e..0000000
--- a/AM2RPortHelperCLI/Properties/launchSettings.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "profiles": {
- "AM2RPortHelper": {
- "commandName": "Project"
- }
- }
-}
\ No newline at end of file
diff --git a/AM2RPortHelperGUI/AM2RPortHelperGUI/MainForm.cs b/AM2RPortHelperGUI/AM2RPortHelperGUI/MainForm.cs
index 60f8d8d..fdb0053 100644
--- a/AM2RPortHelperGUI/AM2RPortHelperGUI/MainForm.cs
+++ b/AM2RPortHelperGUI/AM2RPortHelperGUI/MainForm.cs
@@ -83,7 +83,7 @@ namespace AM2RPortHelperGUI
if (checkboxLinux.Checked.Value)
await Task.Run(() => PortHelper.PortWindowsToLinux(modZipPath,linuxPath, handler));
- if (checkboxAndroid.Checked.Value) //
+ if (checkboxAndroid.Checked.Value)
await Task.Run(() =>PortHelper.PortWindowsToAndroid(modZipPath, androidPath, handler));
if (checkboxMac.Checked.Value)
{
diff --git a/AM2RPortHelperLib/AM2RPortHelperLib.csproj b/AM2RPortHelperLib/AM2RPortHelperLib.csproj
index 3394079..4d9dddb 100644
--- a/AM2RPortHelperLib/AM2RPortHelperLib.csproj
+++ b/AM2RPortHelperLib/AM2RPortHelperLib.csproj
@@ -7,7 +7,7 @@
-
+