Пример #1
0
        public void Compile()
        {
            if (this.Compiling != null)
            {
                this.Compiling();
            }

            // Backup file if needed
            if (this.enableBackup)
            {
                var backupFile = new FileInfo(this.fileInfo.FullName + ".backup");

                if (backupFile.Exists)
                {
                    if (this.overWriteBackup)
                    {
                        backupFile.Delete();
                        this.fileInfo.CopyTo(backupFile.FullName);
                    }
                }
                else
                {
                    this.fileInfo.CopyTo(backupFile.FullName);
                }
            }

            var compile = new BackgroundWorker();

            compile.DoWork += (sender, args) =>
            {
                var result = Apktool.Build(new DirectoryInfo(TempPath), this.fileInfo);
                Trace.TraceInformation(result.Error);
                Trace.TraceInformation(result.Output);
                if (this.enableSigning)
                {
                    Signapk.Sign(this.fileInfo, !this.createSeperateSigningFile);
                }
            };

            compile.RunWorkerCompleted += (sender, args) =>
            {
                if (this.Compiled != null)
                {
                    this.Compiled();
                }
            };
            compile.RunWorkerAsync();
        }
Пример #2
0
        public static void run(string apk)
        {
            var dfs = Apktool.Decode(apk);

            string[] smali = File.ReadAllLines(dfs.LogFile);

            for (int i = 0; i < smali.Length; i++)
            {
                string line = smali[i];

                if (line.Trim().Equals("const/4 v0, 0x0"))
                {
                    smali[i] = line.Replace("0x0", "0x1");
                    break;
                }
            }

            File.Delete(dfs.LogFile);
            File.WriteAllLines(dfs.LogFile, smali);

            //Debug_ap
            Apktool.Build("DEBUG_" + apk);
        }