Example #1
0
        public virtual void CopyLauncherToProjectPath(BuildTarget TargetTestPlatform, string TempPath, string LocalPath)
        {
            if (TargetTestPlatform == BuildTarget.StandaloneOSXIntel64)
            {
                string        ZipPath     = Path.Combine(TempPath, "MonsterLauncherOSX.zip");
                List <string> ZipFileList = new List <string>();

                foreach (string FilePath in IgorRuntimeUtils.GetListOfFilesAndDirectoriesInDirectory(Path.Combine(TempPath, "MonsterLauncher.app"), true, false, true))
                {
                    ZipFileList.Add("MonsterLauncher.app/" + FilePath);
                }

                IgorZip.ZipFilesCrossPlatform(this, ZipFileList, ZipPath, false, TempPath);

                string ZipLocalPath = Path.Combine(LocalPath, "MonsterLauncherOSX.zip");

                if (File.Exists(ZipLocalPath))
                {
                    IgorRuntimeUtils.DeleteFile(ZipLocalPath);
                }

                IgorRuntimeUtils.CopyFile(ZipPath, ZipLocalPath);
            }
            else if (TargetTestPlatform == BuildTarget.StandaloneWindows64)
            {
                string        ZipPath     = Path.Combine(TempPath, "MonsterLauncherWindows.zip");
                List <string> ZipFileList = new List <string>();

                foreach (string FilePath in IgorRuntimeUtils.GetListOfFilesAndDirectoriesInDirectory(Path.Combine(TempPath, "MonsterLauncher_Data"), true, false, true))
                {
                    ZipFileList.Add("MonsterLauncher_Data/" + FilePath);
                }

                ZipFileList.Add("MonsterLauncher.exe");

                IgorZip.ZipFilesCrossPlatform(this, ZipFileList, ZipPath, false, TempPath);

                string ZipLocalPath = Path.Combine(LocalPath, "MonsterLauncherWindows.zip");

                if (File.Exists(ZipLocalPath))
                {
                    IgorRuntimeUtils.DeleteFile(ZipLocalPath);
                }

                IgorRuntimeUtils.CopyFile(ZipPath, ZipLocalPath);
            }
        }
Example #2
0
        public static bool ResignAPK(IIgorModule ModuleInst, string SourceAPK, string RepackagingDirectory, ref string FinalFilename, string KeystoreFilename,
                                     string KeystorePassword, string KeyAlias, string KeyAliasPassword)
        {
            if (Directory.Exists(RepackagingDirectory))
            {
                IgorRuntimeUtils.DeleteDirectory(RepackagingDirectory);
            }

            Directory.CreateDirectory(RepackagingDirectory);

            IgorZip.UnzipArchiveCrossPlatform(ModuleInst, SourceAPK, RepackagingDirectory);

            IgorRuntimeUtils.DeleteDirectory(Path.Combine(RepackagingDirectory, "META-INF"));

            string UnsignedAPK = Path.Combine(RepackagingDirectory, "Repackaged.unsigned.apk");

            List <string> APKContents = IgorRuntimeUtils.GetListOfFilesAndDirectoriesInDirectory(RepackagingDirectory);

            IgorZip.ZipFilesCrossPlatform(ModuleInst, APKContents, UnsignedAPK, false, RepackagingDirectory);

            string SignedAPK = Path.Combine(RepackagingDirectory, "Repackaged.signed.apk");

//			IgorCore.LogError(ModuleInst, "jarsigner command running from " + Path.GetFullPath(".") + " is\n" + "-verbose -keystore \"" + KeystoreFilename + "\" -storepass " + KeystorePassword +
//				" -keypass " + KeyAliasPassword + " -signedjar \"" + SignedAPK + "\" \"" + UnsignedAPK + "\" " + KeyAlias);

            if (IgorRuntimeUtils.RunProcessCrossPlatform(ModuleInst, "jarsigner", "jarsigner", "-verbose -sigalg SHA1withDSA -digestalg SHA1 -keystore \"" + KeystoreFilename + "\" -storepass " + KeystorePassword + " -keypass " +
                                                         KeyAliasPassword + " -signedjar \"" + SignedAPK + "\" \"" + UnsignedAPK + "\" " + KeyAlias, Path.GetFullPath("."), "Running jarsigner", true) != 0)
            {
                return(false);
            }

            string ZipAlignPath = GetZipAlignPath(ModuleInst);
            string AlignedAPK   = Path.Combine(RepackagingDirectory, "Repackaged.aligned.apk");

            if (IgorRuntimeUtils.RunProcessCrossPlatform(ModuleInst, ZipAlignPath, ZipAlignPath, "-v 4 \"" + SignedAPK + "\" \"" + AlignedAPK + "\"", Path.GetFullPath("."), "Running zipalign") != 0)
            {
                return(false);
            }

            FinalFilename = AlignedAPK;

            return(true);
        }