Exemplo n.º 1
0
 private void FormExecution_Shown(object sender, EventArgs e)
 {
     if (!JavaSearch.TrySearchJava(ref javaExe))
     {
         MessageBox.Show(Language.ErrorJavaDetect, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
     ToLog(new ProcessRun.OutData(ProcessRun.StreamType.Info, DateTime.Now, "Java location: " + javaExe));
     InitializeAPKTool();
     InitializeSignApk();
     CommandDetection();
 }
Exemplo n.º 2
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);
        }