@ -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.Reflection ;
using System.Runtime.InteropServices ;
using System.Runtime.InteropServices ;
using System.Threading ;
using System.Threading ;
@ -9,9 +10,9 @@ namespace AM2RPortHelper
{
{
class Program
class Program
{
{
static string version = "1. 0 ";
static string version = "1. 1 ";
static string tmp = Path . GetTempPath ( ) ;
static string tmp = Path . GetTempPath ( ) ;
static string currentDir = Directory. GetCurrentDirectory ( ) ;
static string currentDir = Path. GetDirectoryName ( Assembly . GetEntryAssembly ( ) . Location ) ;
static string utilDir = currentDir + "/utils" ;
static string utilDir = currentDir + "/utils" ;
static void Main ( string [ ] args )
static void Main ( string [ ] args )
@ -46,8 +47,6 @@ namespace AM2RPortHelper
default : Console . WriteLine ( "Unacceptable input. Aborting..." ) ; return ;
default : Console . WriteLine ( "Unacceptable input. Aborting..." ) ; return ;
}
}
Console . WriteLine ( "Successfully finished!" ) ;
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 ) ;
}
}
@ -79,7 +78,9 @@ namespace AM2RPortHelper
File . Delete ( assetsDir + "/D3DX9_43.dll" ) ;
File . Delete ( assetsDir + "/D3DX9_43.dll" ) ;
File . Move ( assetsDir + "/data.win" , assetsDir + "/game.unx" ) ;
File . Move ( assetsDir + "/data.win" , assetsDir + "/game.unx" ) ;
File . Copy ( utilDir + "/runner" , extractDirectory + "/runner" ) ;
File . Copy ( utilDir + "/runner" , extractDirectory + "/runner" ) ;
if ( ! File . Exists ( assetsDir + "/icon.png" ) )
File . Copy ( utilDir + "/icon.png" , assetsDir + "/icon.png" ) ;
File . Copy ( utilDir + "/icon.png" , assetsDir + "/icon.png" ) ;
if ( ! File . Exists ( assetsDir + "/splash.png" ) )
File . Copy ( utilDir + "/splash.png" , assetsDir + "/splash.png" ) ;
File . Copy ( utilDir + "/splash.png" , assetsDir + "/splash.png" ) ;
//recursively lowercase everything in the assets folder
//recursively lowercase everything in the assets folder
@ -95,6 +96,8 @@ namespace AM2RPortHelper
// Clean up
// Clean up
Directory . Delete ( assetsDir , true ) ;
Directory . Delete ( assetsDir , true ) ;
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" ) ;
}
}
static void PortForAndroid ( FileInfo modZipPath )
static void PortForAndroid ( FileInfo modZipPath )
@ -103,7 +106,6 @@ namespace AM2RPortHelper
string unzipDir = extractDirectory + "/zip" ;
string unzipDir = extractDirectory + "/zip" ;
string apkDir = extractDirectory + "/apk" ;
string apkDir = extractDirectory + "/apk" ;
string apkAssetsDir = apkDir + "/assets" ;
string apkAssetsDir = apkDir + "/assets" ;
string currentDir = Directory . GetCurrentDirectory ( ) ;
string bin = RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ? "cmd.exe" : "java" ;
string bin = RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ? "cmd.exe" : "java" ;
string args = RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ? "/C java -jar " : "-jar " ;
string args = RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ? "/C java -jar " : "-jar " ;
string apktool = currentDir + "/utils/apktool.jar" ;
string apktool = currentDir + "/utils/apktool.jar" ;
@ -118,8 +120,6 @@ namespace AM2RPortHelper
Directory . CreateDirectory ( extractDirectory ) ;
Directory . CreateDirectory ( extractDirectory ) ;
ZipFile . ExtractToDirectory ( modZipPath . FullName , unzipDir ) ;
ZipFile . ExtractToDirectory ( modZipPath . FullName , unzipDir ) ;
//TODO: MAKE CROSS PLATFORM
// Run APKTOOL and decompress the file
// Run APKTOOL and decompress the file
ProcessStartInfo pStartInfo = new ProcessStartInfo
ProcessStartInfo pStartInfo = new ProcessStartInfo
{
{
@ -153,7 +153,6 @@ namespace AM2RPortHelper
File . WriteAllText ( apkDir + "/apktool.yml" , yamlFile ) ;
File . WriteAllText ( apkDir + "/apktool.yml" , yamlFile ) ;
// Run APKTOOL and build the apk
// Run APKTOOL and build the apk
//TODO: MAKE CROSS PLATFORM
pStartInfo = new ProcessStartInfo
pStartInfo = new ProcessStartInfo
{
{
FileName = bin ,
FileName = bin ,
@ -164,7 +163,6 @@ namespace AM2RPortHelper
p . Start ( ) ;
p . Start ( ) ;
p . WaitForExit ( ) ;
p . WaitForExit ( ) ;
//TODO: MAKE CROSS PLATFORM
// Sign the apk
// Sign the apk
pStartInfo = new ProcessStartInfo
pStartInfo = new ProcessStartInfo
{
{
@ -186,6 +184,9 @@ namespace AM2RPortHelper
// Clean up
// Clean up
Directory . Delete ( extractDirectory , true ) ;
Directory . Delete ( extractDirectory , true ) ;
Console . WriteLine ( "Successfully finished!" ) ;
Console . WriteLine ( "\n**This will currently use default splashes and icons, if you don't like them don't forget to replace them in the apk**\n" ) ;
}
}
static void LowercaseFolder ( string directory )
static void LowercaseFolder ( string directory )