Make cross platform + fill readme

actions 1.0
Miepee 5 years ago
parent d90ada3c1b
commit 71de0a0f50

@ -2,6 +2,7 @@
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
namespace AM2RPortHelper namespace AM2RPortHelper
@ -46,7 +47,7 @@ namespace AM2RPortHelper
} }
Console.WriteLine("Successfully finished!"); Console.WriteLine("Successfully finished!");
Console.WriteLine("**Make sure to replace the icon.png and splash.png with custom ones if you don't want to have placeholders**"); 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("Exiting in 5 seconds..."); Console.WriteLine("Exiting in 5 seconds...");
Thread.Sleep(5000); Thread.Sleep(5000);
} }
@ -103,9 +104,14 @@ namespace AM2RPortHelper
string apkDir = extractDirectory + "/apk"; string apkDir = extractDirectory + "/apk";
string apkAssetsDir = apkDir + "/assets"; string apkAssetsDir = apkDir + "/assets";
string currentDir = Directory.GetCurrentDirectory(); string currentDir = Directory.GetCurrentDirectory();
string bin = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "cmd.exe" : "java";
string args = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "/C java -jar " : "-jar ";
string apktool = currentDir + "/utils/apktool.jar";
string signer = currentDir + "/utils/uber-apk-signer.jar";
string finalApkBuild = extractDirectory + "/build-aligned-debugSigned.apk"; string finalApkBuild = extractDirectory + "/build-aligned-debugSigned.apk";
string apkModPath = currentDir + "/" + Path.GetFileNameWithoutExtension(modZipPath.FullName) + "_ANDROID.apk"; string apkModPath = currentDir + "/" + Path.GetFileNameWithoutExtension(modZipPath.FullName) + "_ANDROID.apk";
// Check if temp folder exists, delete if yes, extract zip to there // Check if temp folder exists, delete if yes, extract zip to there
if (Directory.Exists(extractDirectory)) if (Directory.Exists(extractDirectory))
Directory.Delete(extractDirectory, true); Directory.Delete(extractDirectory, true);
@ -117,8 +123,8 @@ namespace AM2RPortHelper
// Run APKTOOL and decompress the file // Run APKTOOL and decompress the file
ProcessStartInfo pStartInfo = new ProcessStartInfo ProcessStartInfo pStartInfo = new ProcessStartInfo
{ {
FileName = "cmd.exe", FileName = bin,
Arguments = "/C java -jar \"" + currentDir + "/utils/apktool.jar\" d -f -o \"" + apkDir + "\" \"" + currentDir + "/utils/AM2RWrapper.apk" + "\"", Arguments = args + "\"" + apktool + "\" d -f -o \"" + apkDir + "\" \"" + currentDir + "/utils/AM2RWrapper.apk" + "\"",
CreateNoWindow = true CreateNoWindow = true
}; };
Process p = new Process() { StartInfo = pStartInfo }; Process p = new Process() { StartInfo = pStartInfo };
@ -150,8 +156,8 @@ namespace AM2RPortHelper
//TODO: MAKE CROSS PLATFORM //TODO: MAKE CROSS PLATFORM
pStartInfo = new ProcessStartInfo pStartInfo = new ProcessStartInfo
{ {
FileName = "cmd.exe", FileName = bin,
Arguments = "/C java -jar \"" + currentDir + "/utils/apktool.jar\" b \"" + apkDir + "\" -o \"" + extractDirectory + "/build.apk" + "\"", Arguments = args + "\"" + apktool + "\" b \"" + apkDir + "\" -o \"" + extractDirectory + "/build.apk" + "\"",
CreateNoWindow = true CreateNoWindow = true
}; };
p = new Process() { StartInfo = pStartInfo }; p = new Process() { StartInfo = pStartInfo };
@ -162,8 +168,8 @@ namespace AM2RPortHelper
// Sign the apk // Sign the apk
pStartInfo = new ProcessStartInfo pStartInfo = new ProcessStartInfo
{ {
FileName = "cmd.exe", FileName = bin,
Arguments = "/C java -jar \"" + currentDir + "/utils/uber-apk-signer.jar\" -a \"" + extractDirectory + "/build.apk" + "\"", Arguments = args + "\"" + signer + "\" -a \"" + extractDirectory + "/build.apk" + "\"",
CreateNoWindow = true CreateNoWindow = true
}; };
p = new Process() { StartInfo = pStartInfo }; p = new Process() { StartInfo = pStartInfo };

@ -1,8 +1,7 @@
{ {
"profiles": { "profiles": {
"AM2RPortHelper": { "AM2RPortHelper": {
"commandName": "Project", "commandName": "Project"
"commandLineArgs": "\"C:\\Users\\Narr\\Desktop\\AM2R History Archive\\Official Releases\\(16-08-15) AM2R v1.1.zip\""
} }
} }
} }

@ -1,2 +1,6 @@
# AM2RPortHelper # AM2RPortHelper
A simple tool to make porting AM2R Windows builds to other platforms easier. A simple tool to make porting Windows builds of AM2R-Mods to other platforms easier. This will *only* work with VM-mods of the Community Updates, not of the original 1.1.
You need to have at least .NET Core 5 installed.
## How do I use this?
Simply compress your mod as a zip, and then drag-n-drop it into this tool. After that, select if you want to have a port made for Linux or Android. A zip/apk that can be used for the [AM2RModPacker]() will then be created into the directory next to the program.

Loading…
Cancel
Save