Ejemplo n.º 1
0
 private void AddModLoaderToApk(string apkFilename)
 {
     UpdateStatus("Adding the libmodloader.so file to the APK...");
     try
     {
         using (var apk = new ZipFileProvider(apkFilename, FileCacheMode.None, false, QuestomAssets.Utils.FileUtils.GetTempDirectory()))
         {
             using (var resStream = _context.Resources.OpenRawResource(Resource.Raw.libmodloader))
             {
                 using (var resStream64 = _context.Resources.OpenRawResource(Resource.Raw.libmodloader64))
                 {
                     if (apk.DirectoryExists(LIBMODLOADER_TARGET_FILE.GetDirectoryFwdSlash()))
                     {
                         apk.QueueWriteStream(LIBMODLOADER_TARGET_FILE, resStream, true, true);
                     }
                     if (apk.DirectoryExists(LIBMODLOADER64_TARGET_FILE.GetDirectoryFwdSlash()))
                     {
                         apk.QueueWriteStream(LIBMODLOADER64_TARGET_FILE, resStream64, true, true);
                     }
                     apk.Save();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Log.LogErr("Error adding libmodloader.so to APK", ex);
         UpdateStatus("Error adding modloader to the APK!");
         throw new ModException("Error adding libmodloader.so to APK", ex);
     }
 }
Ejemplo n.º 2
0
 private void SaveFileToApk(string apkFileName, string toFileName, string sourceFile)
 {
     using (var apk = new ZipFileProvider(apkFileName, FileCacheMode.None, false, QuestomAssets.Utils.FileUtils.GetTempDirectory()))
     {
         using (var fs = File.OpenRead(sourceFile))
         {
             apk.QueueWriteStream(toFileName, fs, true, true);
             apk.Save();
         }
     }
 }
Ejemplo n.º 3
0
 private void AddManifestModToApk(string apkFilename)
 {
     UpdateStatus("Modding the manifest in the APK...");
     try
     {
         using (var apk = new ZipFileProvider(apkFilename, FileCacheMode.None, false, QuestomAssets.Utils.FileUtils.GetTempDirectory()))
         {
             using (var resStream = _context.Resources.OpenRawResource(Resource.Raw.manifestmod))
             {
                 apk.QueueWriteStream("AndroidManifest.xml", resStream, true, true);
                 apk.Save();
             }
         }
     }
     catch (Exception ex)
     {
         Log.LogErr("Error modding the manifest in the APK", ex);
         UpdateStatus("Error modding the manifest in the APK!");
         throw new ModException("Error modding the manifest in the APK", ex);
     }
 }