internal SystemCheckResult DoExecute(bool promptSetup) { SystemCheckResult res = SystemCheckResult.Error; RegistryKey regKey; try { bool found = false; int pos; Version minVersion = new Version(InstallConfiguration.Java); if ((regKey = Registry.LocalMachine.OpenSubKey(@"Software\JavaSoft\Java Runtime Environment", false)) != null) { using (regKey) foreach (string s in regKey.GetSubKeyNames()) { try { found = (new Version((((pos = s.IndexOf('-')) > 0) ? s.Substring(0, pos) : s).Replace('_', '.')) >= minVersion); } catch { } if (found) { break; } } } if (found) { res = SystemCheckResult.Success; } } catch { } if (res != SystemCheckResult.Success) { if (promptSetup && MessageBox.Show(InstallerForm.ActiveForm, Properties.Resources.JavaNope, "Java", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { using (JavaForm javaForm = new JavaForm(Path.Combine(Application.StartupPath, "files\\zupjava" + ((IntPtr.Size == 8) ? 64 : 32) + ".exe"), "/quiet /qn /norestart")) { javaForm.ShowDialog(InstallerForm.ActiveForm); return(DoExecute(false)); } } else { MessageBox.Show(InstallerForm.ActiveForm, string.Format(Properties.Resources.JavaNoInstall, (IntPtr.Size == 8) ? 64 : 32), "Java", MessageBoxButtons.OK, MessageBoxIcon.Information); } } return(res); }
private bool ExecuteCheck(int index) { SystemCheck check = checks[index]; string imageLabelName = "imageLabel" + index; string textLabelName = "textLabel" + index; Label imageLabel = (Label)tableLayoutPanel.Controls[imageLabelName]; Label textLabel = (Label)tableLayoutPanel.Controls[textLabelName]; try { SystemCheckResult result = check.Execute(); if (result == SystemCheckResult.Success) { imageLabel.Image = global::CodePlex.SharePointInstaller.Properties.Resources.CheckOk; textLabel.Text = check.OkText; } else if (result == SystemCheckResult.Error) { errors++; imageLabel.Image = global::CodePlex.SharePointInstaller.Properties.Resources.CheckFail; textLabel.Text = check.ErrorText; } // // Show play icon on next check that will run. // int nextIndex = index + 1; string nextImageLabelName = "imageLabel" + nextIndex; Label nextImageLabel = (Label)tableLayoutPanel.Controls[nextImageLabelName]; if (nextImageLabel != null) { nextImageLabel.Image = global::CodePlex.SharePointInstaller.Properties.Resources.CheckPlay; } return(true); } catch (InstallException ex) { errors++; imageLabel.Image = global::CodePlex.SharePointInstaller.Properties.Resources.CheckFail; textLabel.Text = ex.Message; } return(false); }
public void SetUp() { testSystemSystemChecker = new TestSystemSystemChecker(); result = testSystemSystemChecker.CheckSystem(); }