Exemple #1
0
 private void InitializeAPKTool()
 {
     apkTool                     = new APKTool(javaExe);
     apkTool.Exited             += new EventHandler(processRun_Exited);
     apkTool.OutputDataReceived += new MyDataReceivedEventHandler(processRun_OutputDataReceived);
     apkTool.ErrorDataReceived  += new MyDataReceivedEventHandler(processRun_ErrorDataReceived);
     apkTool.Exception          += new ExceptionEventHandler(processRun_Exception);
 }
Exemple #2
0
        private void ToLog(ProcessRun.OutData outData)
        {
            ProcessRun.OutData result = APKTool.ParseLog(outData);
            switch (result.Stream)
            {
            case ProcessRun.StreamType.Info:
                ToLog(result.Time.ToString("[dd.MM.yyyy HH:mm:ss]"), result.Message, Properties.Resources.info, Color.FromKnownColor(KnownColor.Window));
                ToStatus(result.Message, Properties.Resources.info);
                break;

            case ProcessRun.StreamType.Error:
                ToLog(result.Time.ToString("[dd.MM.yyyy HH:mm:ss]"), result.Message, Properties.Resources.error, Color.FromKnownColor(KnownColor.LightPink));
                ToStatus(result.Message, Properties.Resources.error);
                break;

            case ProcessRun.StreamType.Warning:
                ToLog(result.Time.ToString("[dd.MM.yyyy HH:mm:ss]"), result.Message, Properties.Resources.warning, Color.FromKnownColor(KnownColor.LightYellow));
                ToStatus(result.Message, Properties.Resources.warning);
                break;

            default:
                break;
            }
        }
Exemple #3
0
        private void FormMain_Shown(object sender, EventArgs e)
        {
            if (!JavaSearch.TrySearchJava(ref javaExe))
            {
                if (MessageBox.Show(Language.DoYouWantToSelectJavaLocation, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    OpenFileDialog openJavaExe = new OpenFileDialog()
                    {
                        Multiselect = false,
                        Filter      = "java.exe|java.exe"
                    };
                    if (openJavaExe.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        Properties.Settings.Default.JavaExe = openJavaExe.FileName;
                        Properties.Settings.Default.Save();
                        Application.Restart();
                    }
                    else
                    {
                        Application.Exit();
                    }
                }
                else
                {
                    Application.Exit();
                }
            }
            ToLog(new ProcessRun.OutData(ProcessRun.StreamType.Info, DateTime.Now, "Java location: " + javaExe));

            InitializeUpdateChecker();
            InitializeAPKTool();
            InitializeSignApk();
            InitializeProcessRun();

            String javaVersion = GetJavaVersion();

            if (javaVersion != null)
            {
                ToLog(new ProcessRun.OutData(ProcessRun.StreamType.Info, DateTime.Now, "Java version: " + javaVersion));

                string apktoolVersion = new APKTool(javaExe).GetVersion();

                if (apktoolVersion != null)
                {
                    ToLog(new ProcessRun.OutData(ProcessRun.StreamType.Info, DateTime.Now, "APKTool version: " + apktoolVersion));
                }
            }
            else
            {
                MessageBox.Show(Language.ErrorJavaDetect, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //if (Properties.Settings.Default.LastUpdateCheck != null)
            //{
            TimeSpan updateInterval = DateTime.Now - Properties.Settings.Default.LastUpdateCheck;

            if (updateInterval.Days > 0 && Properties.Settings.Default.CheckForUpdateAtStartup)
            {
                updateCheker.CheckAsync(true);
            }
            //}
            //else
            //    updateCheker.CheckAsync(true);
            ToStatus(Language.Done, Properties.Resources.done);
        }