Ejemplo n.º 1
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            BuildOptions options = new BuildOptions(projectDir);
            options.ForceAll = checkBoxForceAll.Checked;
            options.CopyOriginal = checkBoxCopyOriginal.Checked;
            if (checkBoxCustomAapt.Checked)
            {
                if (System.IO.File.Exists(textBoxAaptPath.Text))
                    options.AaptPath = textBoxAaptPath.Text;
                else
                {
                    MessageBox.Show("Указанного файла aapt не существует.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            if (checkBoxUseFramework.Checked)
                options.FrameworkPath = textBoxFrameworkPath.Text;
            options.AppPath = textBoxOutputApkPath.Text;

            bool started = false;
            #if !DEBUG
            try
                {
            #endif
            started = apktool.Build(options);
            #if !DEBUG
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            #endif
            if (started)
            {
                progressBarStyle = ProgressBarStyle.Marquee;
                StartButtonEnabled = false;
            }
        }
Ejemplo n.º 2
0
        public bool Build(BuildOptions options)
        {
            lastActionType = ApktoolActionType.Build;
            lastFilePath = options.AppPath;
            lastProjectDir = options.ProjectDirectory;

            string keyForceAll = null, keyAapt = null, keyCopyOriginal = null, keyFramePath = null, keyOutputAppPath = null;
            if (options.ForceAll)
                keyForceAll = BuildKeys.ForceAll;
            if (options.CopyOriginal)
                keyCopyOriginal = BuildKeys.CopyOriginal;
            if (!String.IsNullOrEmpty(options.AaptPath))
                keyAapt = String.Format("{0} \"{1}\"", BuildKeys.Aapt, options.AaptPath);
            if (!String.IsNullOrEmpty(options.FrameworkPath))
                keyFramePath = String.Format("{0} \"{1}\"", BuildKeys.FrameworkPath, options.FrameworkPath);
            if (!String.IsNullOrWhiteSpace(options.AppPath))
                keyOutputAppPath = String.Format("{0} \"{1}\"", BuildKeys.OutputAppPath, options.AppPath);

            string args = String.Format("b{0}{1}{2}{3}{4} \"{5}\"", keyForceAll, keyAapt, keyCopyOriginal, keyFramePath, keyOutputAppPath, options.ProjectDirectory);

            bool started = this.Start(args);
            this.BeginOutputReadLine();
            this.BeginErrorReadLine();
            return started;
        }
Ejemplo n.º 3
0
        private bool Build()
        {
            //String outputAPK = textBox_BUILD_InputProjectDir.Text + DateTime.Now.ToString("_yyyyMMdd_HH-mm-ss") + ".apk";

            BuildOptions options = new BuildOptions(textBox_BUILD_InputProjectDir.Text);
            options.ForceAll = checkBox_BUILD_ForceAll.Checked;
            options.CopyOriginal = checkBox_BUILD_CopyOriginal.Checked;
            if (checkBox_BUILD_UseAapt.Checked)
                options.AaptPath = textBox_BUILD_AaptPath.Text;
            if (checkBox_BUILD_UseFramework.Checked)
                options.FrameworkPath = textBox_BUILD_FrameDir.Text;
            if (checkBox_BUILD_OutputAppPath.Checked)
                options.AppPath = textBox_BUILD_OutputAppPath.Text;

            return apktool.Build(options);
        }