diff --git a/AM2RPortHelper.sln b/AM2RPortHelper.sln index a11a3be..5d0dd7e 100644 --- a/AM2RPortHelper.sln +++ b/AM2RPortHelper.sln @@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31613.86 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AM2RPortHelper", "AM2RPortHelper\AM2RPortHelper.csproj", "{A630476D-8D81-4178-A742-529ADC1B3E97}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AM2RPortHelperCLI", "AM2RPortHelperCLI\AM2RPortHelperCLI.csproj", "{A630476D-8D81-4178-A742-529ADC1B3E97}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AM2RPortHelperLib", "AM2RPortHelperLib\AM2RPortHelperLib.csproj", "{FB200270-51C9-45FC-BF9C-E9006576D00A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +17,10 @@ Global {A630476D-8D81-4178-A742-529ADC1B3E97}.Debug|Any CPU.Build.0 = Debug|Any CPU {A630476D-8D81-4178-A742-529ADC1B3E97}.Release|Any CPU.ActiveCfg = Release|Any CPU {A630476D-8D81-4178-A742-529ADC1B3E97}.Release|Any CPU.Build.0 = Release|Any CPU + {FB200270-51C9-45FC-BF9C-E9006576D00A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FB200270-51C9-45FC-BF9C-E9006576D00A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FB200270-51C9-45FC-BF9C-E9006576D00A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FB200270-51C9-45FC-BF9C-E9006576D00A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/AM2RPortHelper/AM2RPortHelper.csproj b/AM2RPortHelperCLI/AM2RPortHelperCLI.csproj similarity index 78% rename from AM2RPortHelper/AM2RPortHelper.csproj rename to AM2RPortHelperCLI/AM2RPortHelperCLI.csproj index b40dffd..029503d 100644 --- a/AM2RPortHelper/AM2RPortHelper.csproj +++ b/AM2RPortHelperCLI/AM2RPortHelperCLI.csproj @@ -5,6 +5,7 @@ net6.0 LatestMajor 10 + AM2RPortHelper @@ -20,4 +21,8 @@ + + + + diff --git a/AM2RPortHelper/LICENSE b/AM2RPortHelperCLI/LICENSE similarity index 100% rename from AM2RPortHelper/LICENSE rename to AM2RPortHelperCLI/LICENSE diff --git a/AM2RPortHelperCLI/Program.cs b/AM2RPortHelperCLI/Program.cs new file mode 100644 index 0000000..3541584 --- /dev/null +++ b/AM2RPortHelperCLI/Program.cs @@ -0,0 +1,51 @@ +using System; +using System.IO; +using System.Threading; +using AM2RPortHelperLib; + +namespace AM2RPortHelper; + +internal static class Program +{ + private const string version = "1.3"; + + //TODO: add "-l" flag. transfer launcher mods to each other. + + private static void 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; + } + + FileInfo modZipPath = new FileInfo(args[0]); + if (!modZipPath.Exists && modZipPath.Extension.ToLower() != "zip") + { + Console.WriteLine("Path does not point to a mod zip"); + return; + } + + 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) + { + case "D1": PortHelper.PortWindowsToLinux(modZipPath); break; + + case "D2": PortHelper.PortWindowsToAndroid(modZipPath); break; + + case "D3": PortHelper.PortWindowsToMac(modZipPath); break; + + default: Console.WriteLine("Unacceptable input. Aborting..."); return; + } + Console.WriteLine("Successfully finished!"); + Console.WriteLine("Exiting in 3 seconds..."); + Thread.Sleep(3000); + } +} \ No newline at end of file diff --git a/AM2RPortHelper/Properties/launchSettings.json b/AM2RPortHelperCLI/Properties/launchSettings.json similarity index 100% rename from AM2RPortHelper/Properties/launchSettings.json rename to AM2RPortHelperCLI/Properties/launchSettings.json diff --git a/AM2RPortHelperLib/AM2RPortHelperLib.csproj b/AM2RPortHelperLib/AM2RPortHelperLib.csproj new file mode 100644 index 0000000..073e294 --- /dev/null +++ b/AM2RPortHelperLib/AM2RPortHelperLib.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/AM2RPortHelper/Program.cs b/AM2RPortHelperLib/PortHelper.cs similarity index 88% rename from AM2RPortHelper/Program.cs rename to AM2RPortHelperLib/PortHelper.cs index 3f12be9..a8091c8 100644 --- a/AM2RPortHelper/Program.cs +++ b/AM2RPortHelperLib/PortHelper.cs @@ -1,62 +1,19 @@ -using SixLabors.ImageSharp; -using SixLabors.ImageSharp.Processing; -using System; -using System.Diagnostics; -using System.IO; +using System.Diagnostics; using System.IO.Compression; using System.Runtime.InteropServices; -using System.Threading; +using SixLabors.ImageSharp; +using SixLabors.ImageSharp.Processing; -namespace AM2RPortHelper; +namespace AM2RPortHelperLib; -internal static class Program +public class PortHelper { - private const string version = "1.3"; + private static readonly string tmp = Path.GetTempPath(); private static readonly string currentDir = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); private static readonly string utilDir = currentDir + "/utils"; - - //TODO: add "-l" flag. transfer launcher mods to each other. - private static void Main(string[] args) - { - Console.WriteLine("AM2RPortHelper 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; - } - - FileInfo modZipPath = new FileInfo(args[0]); - if (!modZipPath.Exists && modZipPath.Extension.ToLower() != "zip") - { - Console.WriteLine("Path does not point to a mod zip"); - return; - } - - 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) - { - case "D1": PortForLinux(modZipPath); break; - - case "D2": PortForAndroid(modZipPath); break; - - case "D3": PortForMac(modZipPath); break; - - default: Console.WriteLine("Unacceptable input. Aborting..."); return; - } - Console.WriteLine("Successfully finished!"); - Console.WriteLine("Exiting in 3 seconds..."); - Thread.Sleep(3000); - } - - private static void PortForLinux(FileInfo modZipPath) + public static void PortWindowsToLinux(FileInfo modZipPath) { string extractDirectory = tmp + "/" + modZipPath.Name; string assetsDir = extractDirectory + "/assets"; @@ -108,7 +65,7 @@ internal static class Program Directory.Delete(assetsDir, true); } - private static void PortForAndroid(FileInfo modZipPath) + public static void PortWindowsToAndroid(FileInfo modZipPath) { string extractDirectory = tmp + "/" + modZipPath.Name; string unzipDir = extractDirectory + "/zip"; @@ -210,7 +167,8 @@ internal static class Program // Clean up Directory.Delete(extractDirectory, true); } - private static void PortForMac(FileInfo modZipPath) + + public static void PortWindowsToMac(FileInfo modZipPath) { string baseTempDirectory = tmp + "/" + modZipPath.Name; string extractDirectory = baseTempDirectory + "/extract"; @@ -336,7 +294,7 @@ internal static class Program LowercaseFolder(subDir.FullName); } } - + private static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs) { // Get the subdirectories for the specified directory. @@ -368,7 +326,7 @@ internal static class Program DirectoryCopy(subDir.FullName, tempPath, true); } } - + private static void SaveAndroidIcon(Image icon, int dimensions, string filePath) { Image picture = icon; diff --git a/AM2RPortHelper/utils/AM2RWrapper.apk b/AM2RPortHelperLib/utils/AM2RWrapper.apk similarity index 100% rename from AM2RPortHelper/utils/AM2RWrapper.apk rename to AM2RPortHelperLib/utils/AM2RWrapper.apk diff --git a/AM2RPortHelper/utils/Contents/Frameworks/libYoYoGamepad.dylib b/AM2RPortHelperLib/utils/Contents/Frameworks/libYoYoGamepad.dylib similarity index 100% rename from AM2RPortHelper/utils/Contents/Frameworks/libYoYoGamepad.dylib rename to AM2RPortHelperLib/utils/Contents/Frameworks/libYoYoGamepad.dylib diff --git a/AM2RPortHelper/utils/Contents/Frameworks/libYoYoIAP.dylib b/AM2RPortHelperLib/utils/Contents/Frameworks/libYoYoIAP.dylib similarity index 100% rename from AM2RPortHelper/utils/Contents/Frameworks/libYoYoIAP.dylib rename to AM2RPortHelperLib/utils/Contents/Frameworks/libYoYoIAP.dylib diff --git a/AM2RPortHelper/utils/Contents/Info.plist b/AM2RPortHelperLib/utils/Contents/Info.plist similarity index 100% rename from AM2RPortHelper/utils/Contents/Info.plist rename to AM2RPortHelperLib/utils/Contents/Info.plist diff --git a/AM2RPortHelper/utils/Contents/MacOS/Mac_Runner b/AM2RPortHelperLib/utils/Contents/MacOS/Mac_Runner similarity index 100% rename from AM2RPortHelper/utils/Contents/MacOS/Mac_Runner rename to AM2RPortHelperLib/utils/Contents/MacOS/Mac_Runner diff --git a/AM2RPortHelper/utils/Contents/PkgInfo b/AM2RPortHelperLib/utils/Contents/PkgInfo similarity index 100% rename from AM2RPortHelper/utils/Contents/PkgInfo rename to AM2RPortHelperLib/utils/Contents/PkgInfo diff --git a/AM2RPortHelper/utils/Contents/Resources/English.lproj/MainMenu.nib b/AM2RPortHelperLib/utils/Contents/Resources/English.lproj/MainMenu.nib similarity index 100% rename from AM2RPortHelper/utils/Contents/Resources/English.lproj/MainMenu.nib rename to AM2RPortHelperLib/utils/Contents/Resources/English.lproj/MainMenu.nib diff --git a/AM2RPortHelper/utils/Contents/Resources/gamecontrollerdb.txt b/AM2RPortHelperLib/utils/Contents/Resources/gamecontrollerdb.txt similarity index 100% rename from AM2RPortHelper/utils/Contents/Resources/gamecontrollerdb.txt rename to AM2RPortHelperLib/utils/Contents/Resources/gamecontrollerdb.txt diff --git a/AM2RPortHelper/utils/Contents/Resources/yoyorunner.config b/AM2RPortHelperLib/utils/Contents/Resources/yoyorunner.config similarity index 100% rename from AM2RPortHelper/utils/Contents/Resources/yoyorunner.config rename to AM2RPortHelperLib/utils/Contents/Resources/yoyorunner.config diff --git a/AM2RPortHelper/utils/UTMTCli/ICSharpCode.SharpZipLib.dll b/AM2RPortHelperLib/utils/UTMTCli/ICSharpCode.SharpZipLib.dll similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/ICSharpCode.SharpZipLib.dll rename to AM2RPortHelperLib/utils/UTMTCli/ICSharpCode.SharpZipLib.dll diff --git a/AM2RPortHelper/utils/UTMTCli/Microsoft.CodeAnalysis.CSharp.Scripting.dll b/AM2RPortHelperLib/utils/UTMTCli/Microsoft.CodeAnalysis.CSharp.Scripting.dll similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/Microsoft.CodeAnalysis.CSharp.Scripting.dll rename to AM2RPortHelperLib/utils/UTMTCli/Microsoft.CodeAnalysis.CSharp.Scripting.dll diff --git a/AM2RPortHelper/utils/UTMTCli/Microsoft.CodeAnalysis.CSharp.dll b/AM2RPortHelperLib/utils/UTMTCli/Microsoft.CodeAnalysis.CSharp.dll similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/Microsoft.CodeAnalysis.CSharp.dll rename to AM2RPortHelperLib/utils/UTMTCli/Microsoft.CodeAnalysis.CSharp.dll diff --git a/AM2RPortHelper/utils/UTMTCli/Microsoft.CodeAnalysis.Scripting.dll b/AM2RPortHelperLib/utils/UTMTCli/Microsoft.CodeAnalysis.Scripting.dll similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/Microsoft.CodeAnalysis.Scripting.dll rename to AM2RPortHelperLib/utils/UTMTCli/Microsoft.CodeAnalysis.Scripting.dll diff --git a/AM2RPortHelper/utils/UTMTCli/Microsoft.CodeAnalysis.dll b/AM2RPortHelperLib/utils/UTMTCli/Microsoft.CodeAnalysis.dll similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/Microsoft.CodeAnalysis.dll rename to AM2RPortHelperLib/utils/UTMTCli/Microsoft.CodeAnalysis.dll diff --git a/AM2RPortHelper/utils/UTMTCli/Microsoft.Win32.SystemEvents.dll b/AM2RPortHelperLib/utils/UTMTCli/Microsoft.Win32.SystemEvents.dll similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/Microsoft.Win32.SystemEvents.dll rename to AM2RPortHelperLib/utils/UTMTCli/Microsoft.Win32.SystemEvents.dll diff --git a/AM2RPortHelper/utils/UTMTCli/Newtonsoft.Json.dll b/AM2RPortHelperLib/utils/UTMTCli/Newtonsoft.Json.dll similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/Newtonsoft.Json.dll rename to AM2RPortHelperLib/utils/UTMTCli/Newtonsoft.Json.dll diff --git a/AM2RPortHelper/utils/UTMTCli/PropertyChanged.dll b/AM2RPortHelperLib/utils/UTMTCli/PropertyChanged.dll similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/PropertyChanged.dll rename to AM2RPortHelperLib/utils/UTMTCli/PropertyChanged.dll diff --git a/AM2RPortHelper/utils/UTMTCli/System.CommandLine.dll b/AM2RPortHelperLib/utils/UTMTCli/System.CommandLine.dll similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/System.CommandLine.dll rename to AM2RPortHelperLib/utils/UTMTCli/System.CommandLine.dll diff --git a/AM2RPortHelper/utils/UTMTCli/System.Drawing.Common.dll b/AM2RPortHelperLib/utils/UTMTCli/System.Drawing.Common.dll similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/System.Drawing.Common.dll rename to AM2RPortHelperLib/utils/UTMTCli/System.Drawing.Common.dll diff --git a/AM2RPortHelper/utils/UTMTCli/UTMTInfo.txt b/AM2RPortHelperLib/utils/UTMTCli/UTMTInfo.txt similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/UTMTInfo.txt rename to AM2RPortHelperLib/utils/UTMTCli/UTMTInfo.txt diff --git a/AM2RPortHelper/utils/UTMTCli/UndertaleModCli.deps.json b/AM2RPortHelperLib/utils/UTMTCli/UndertaleModCli.deps.json similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/UndertaleModCli.deps.json rename to AM2RPortHelperLib/utils/UTMTCli/UndertaleModCli.deps.json diff --git a/AM2RPortHelper/utils/UTMTCli/UndertaleModCli.dll b/AM2RPortHelperLib/utils/UTMTCli/UndertaleModCli.dll similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/UndertaleModCli.dll rename to AM2RPortHelperLib/utils/UTMTCli/UndertaleModCli.dll diff --git a/AM2RPortHelper/utils/UTMTCli/UndertaleModCli.exe b/AM2RPortHelperLib/utils/UTMTCli/UndertaleModCli.exe similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/UndertaleModCli.exe rename to AM2RPortHelperLib/utils/UTMTCli/UndertaleModCli.exe diff --git a/AM2RPortHelper/utils/UTMTCli/UndertaleModCli.runtimeconfig.json b/AM2RPortHelperLib/utils/UTMTCli/UndertaleModCli.runtimeconfig.json similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/UndertaleModCli.runtimeconfig.json rename to AM2RPortHelperLib/utils/UTMTCli/UndertaleModCli.runtimeconfig.json diff --git a/AM2RPortHelper/utils/UTMTCli/UndertaleModLib.dll b/AM2RPortHelperLib/utils/UTMTCli/UndertaleModLib.dll similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/UndertaleModLib.dll rename to AM2RPortHelperLib/utils/UTMTCli/UndertaleModLib.dll diff --git a/AM2RPortHelper/utils/UTMTCli/runtimes/unix/lib/netcoreapp3.0/System.Drawing.Common.dll b/AM2RPortHelperLib/utils/UTMTCli/runtimes/unix/lib/netcoreapp3.0/System.Drawing.Common.dll similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/runtimes/unix/lib/netcoreapp3.0/System.Drawing.Common.dll rename to AM2RPortHelperLib/utils/UTMTCli/runtimes/unix/lib/netcoreapp3.0/System.Drawing.Common.dll diff --git a/AM2RPortHelper/utils/UTMTCli/runtimes/win/lib/netcoreapp3.0/Microsoft.Win32.SystemEvents.dll b/AM2RPortHelperLib/utils/UTMTCli/runtimes/win/lib/netcoreapp3.0/Microsoft.Win32.SystemEvents.dll similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/runtimes/win/lib/netcoreapp3.0/Microsoft.Win32.SystemEvents.dll rename to AM2RPortHelperLib/utils/UTMTCli/runtimes/win/lib/netcoreapp3.0/Microsoft.Win32.SystemEvents.dll diff --git a/AM2RPortHelper/utils/UTMTCli/runtimes/win/lib/netcoreapp3.0/System.Drawing.Common.dll b/AM2RPortHelperLib/utils/UTMTCli/runtimes/win/lib/netcoreapp3.0/System.Drawing.Common.dll similarity index 100% rename from AM2RPortHelper/utils/UTMTCli/runtimes/win/lib/netcoreapp3.0/System.Drawing.Common.dll rename to AM2RPortHelperLib/utils/UTMTCli/runtimes/win/lib/netcoreapp3.0/System.Drawing.Common.dll diff --git a/AM2RPortHelper/utils/apktool-LICENSE b/AM2RPortHelperLib/utils/apktool-LICENSE similarity index 100% rename from AM2RPortHelper/utils/apktool-LICENSE rename to AM2RPortHelperLib/utils/apktool-LICENSE diff --git a/AM2RPortHelper/utils/apktool.jar b/AM2RPortHelperLib/utils/apktool.jar similarity index 100% rename from AM2RPortHelper/utils/apktool.jar rename to AM2RPortHelperLib/utils/apktool.jar diff --git a/AM2RPortHelper/utils/bc16AndRemoveFunctions.csx b/AM2RPortHelperLib/utils/bc16AndRemoveFunctions.csx similarity index 100% rename from AM2RPortHelper/utils/bc16AndRemoveFunctions.csx rename to AM2RPortHelperLib/utils/bc16AndRemoveFunctions.csx diff --git a/AM2RPortHelper/utils/icon.png b/AM2RPortHelperLib/utils/icon.png similarity index 100% rename from AM2RPortHelper/utils/icon.png rename to AM2RPortHelperLib/utils/icon.png diff --git a/AM2RPortHelper/utils/runner b/AM2RPortHelperLib/utils/runner similarity index 100% rename from AM2RPortHelper/utils/runner rename to AM2RPortHelperLib/utils/runner diff --git a/AM2RPortHelper/utils/splash.png b/AM2RPortHelperLib/utils/splash.png similarity index 100% rename from AM2RPortHelper/utils/splash.png rename to AM2RPortHelperLib/utils/splash.png diff --git a/AM2RPortHelper/utils/splashAndroid.png b/AM2RPortHelperLib/utils/splashAndroid.png similarity index 100% rename from AM2RPortHelper/utils/splashAndroid.png rename to AM2RPortHelperLib/utils/splashAndroid.png diff --git a/AM2RPortHelper/utils/uber-apk-signer-LICENSE b/AM2RPortHelperLib/utils/uber-apk-signer-LICENSE similarity index 100% rename from AM2RPortHelper/utils/uber-apk-signer-LICENSE rename to AM2RPortHelperLib/utils/uber-apk-signer-LICENSE diff --git a/AM2RPortHelper/utils/uber-apk-signer.jar b/AM2RPortHelperLib/utils/uber-apk-signer.jar similarity index 100% rename from AM2RPortHelper/utils/uber-apk-signer.jar rename to AM2RPortHelperLib/utils/uber-apk-signer.jar