// ********************************** // Output an error or warning message // ********************************** public static DialogResult Show(string messageTitle, string messageText, MessageBoxIcon messageBoxIcon, MessageBoxButtons messageButtons, bool neverShowTouchOptimized = false) { // If we are running in SebWindowsClient we need to activate it before showing the password dialog if (SEBClientInfo.SebWindowsClientForm != null) { SebWindowsClientMain.SEBToForeground(); } DialogResult messageBoxResult; if (!neverShowTouchOptimized && (Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyTouchOptimized)[SEBSettings.KeyTouchOptimized] == true) { messageBoxResult = MetroMessageBox.Show( new Form() { TopMost = true, Top = 0, Left = 0, Width = Screen.PrimaryScreen.Bounds.Width, Height = Screen.PrimaryScreen.Bounds.Height }, messageText, messageTitle, messageButtons, messageBoxIcon); } else { messageBoxResult = MessageBox.Show(new Form() { TopMost = true }, messageText, messageTitle, messageButtons, messageBoxIcon); } return(messageBoxResult); }
public static bool SetSebClientConfiguration() { SEBClientInfo.IsNewOS = false; SEBClientInfo.ExplorerShellWasKilled = false; SEBClientInfo.UserNameRegistryFlags = new char[100]; SEBClientInfo.RegistryFlags = new char[50]; SEBClientInfo.UserSid = new char[512]; SEBClientInfo.UserName = ""; SEBClientInfo.HostName = "localhost"; SEBClientInfo.HostIpAddress = "127.0.0.1"; SEBClientInfo.PortNumber = 57016; SEBClientInfo.SendInterval = 100; SEBClientInfo.RecvTimeout = 100; SEBClientInfo.NumMessages = 3; SEBClientInfo.SetSebPaths(); byte[] sebSettings = (byte[])null; StringBuilder stringBuilder = new StringBuilder(); try { sebSettings = File.ReadAllBytes(SEBClientInfo.SebClientSettingsProgramDataFile); } catch (Exception ex) { stringBuilder.Append("Could not load SebClientSettigs.seb from the Program Data directory").Append(ex == null ? (string)null : ex.GetType().ToString()).Append(ex.Message); } if (sebSettings == null) { try { sebSettings = File.ReadAllBytes(SEBClientInfo.SebClientSettingsAppDataFile); } catch (Exception ex) { stringBuilder.Append("Could not load SebClientSettigs.seb from the Roaming Application Data directory. ").Append(ex == null ? (string)null : ex.GetType().ToString()).Append(ex.Message); } } if (!SEBSettings.StoreDecryptedSebClientSettings(sebSettings)) { return(false); } SEBClientInfo.InitializeLogger(); Logger.AddError(stringBuilder.ToString(), (object)null, (Exception)null, (string)null); SEBClientInfo.UserName = Environment.UserName; int num = 1; Logger.AddInformation(new StringBuilder("User Name: ").Append(SEBClientInfo.UserName).Append(" Host Name: ").Append(SEBClientInfo.HostName).Append(" Port Number: ").Append(SEBClientInfo.PortNumber).Append(" Send Interval: ").Append(SEBClientInfo.SendInterval).Append(" Recv Timeout: ").Append(SEBClientInfo.RecvTimeout).Append(" Num Messages: ").Append(SEBClientInfo.NumMessages).Append(" SebClientConfigFileDirectory: ").Append(SEBClientInfo.SebClientSettingsAppDataDirectory).Append(" SebClientConfigFile: ").Append(SEBClientInfo.SebClientSettingsAppDataFile).ToString(), (object)null, (Exception)null, (string)null); return(num != 0); }
private static string GetStartupPathOrUrl() { if (!string.IsNullOrEmpty((string)SEBSettings.settingsCurrent[SEBSettings.KeyStartResource])) { var resource = GetAdditionalResourceById((string)SEBSettings.settingsCurrent[SEBSettings.KeyStartResource]); var filename = (string)resource[SEBSettings.KeyAdditionalResourcesResourceDataFilename]; var path = new FileCompressor().DecompressDecodeAndSaveFile( (string)resource[SEBSettings.KeyAdditionalResourcesResourceData], filename, resource[SEBSettings.KeyAdditionalResourcesIdentifier].ToString()); return(new Uri(path + filename).AbsoluteUri); } else { return(SEBClientInfo.getSebSetting(SEBSettings.KeyStartURL)[SEBSettings.KeyStartURL].ToString()); } }
public static void SetSebPaths() { SEBClientInfo.ApplicationExecutableDirectory = Path.GetDirectoryName(Application.ExecutablePath); SEBClientInfo.ProgramFilesX86Directory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86); string folderPath1 = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); string folderPath2 = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); SEBClientInfo.SebClientSettingsProgramDataDirectory = new StringBuilder(folderPath1).Append("\\").Append("SafeExamBrowser").Append("\\").ToString(); SEBClientInfo.SebClientSettingsAppDataDirectory = new StringBuilder(folderPath2).Append("\\").Append("SafeExamBrowser").Append("\\").ToString(); SEBClientInfo.SebClientDirectory = new StringBuilder(SEBClientInfo.ProgramFilesX86Directory).Append("\\").Append("SafeExamBrowser").Append("\\").ToString(); SEBClientInfo.XulRunnerDirectory = new StringBuilder("SebWindowsBrowser").Append("\\").Append("xulrunner").Append("\\").ToString(); SEBClientInfo.XulSebDirectory = new StringBuilder("SebWindowsBrowser").Append("\\").Append("xul_seb").Append("\\").ToString(); SEBClientInfo.XulRunnerExePath = new StringBuilder(SEBClientInfo.XulRunnerDirectory).Append("xulrunner.exe").ToString(); SEBClientInfo.XulRunnerSebIniPath = new StringBuilder(SEBClientInfo.XulSebDirectory).Append("seb.ini").ToString(); SEBClientInfo.SebClientSettingsProgramDataFile = new StringBuilder(SEBClientInfo.SebClientSettingsProgramDataDirectory).Append("SebClientSettings.seb").ToString(); SEBClientInfo.SebClientSettingsAppDataFile = new StringBuilder(SEBClientInfo.SebClientSettingsAppDataDirectory).Append("SebClientSettings.seb").ToString(); SEBClientInfo.SebResourceDirectory = new StringBuilder(SEBClientInfo.ApplicationExecutableDirectory).Append("\\").Append("SebWindowsResources").Append("\\").ToString(); SEBClientInfo.SetDefaultClientLogFile(); }
public static void InitializeLogger() { if (!(bool)SEBClientInfo.getSebSetting("enableLogging")["enableLogging"]) { return; } string name = (string)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, "logDirectoryWin"); if (!string.IsNullOrEmpty(name)) { SEBClientInfo.SebClientLogFileDirectory = Environment.ExpandEnvironmentVariables(name); SEBClientInfo.SebClientLogFile = string.Format("{0}\\{1}", (object)SEBClientInfo.SebClientLogFileDirectory, (object)"SebClient.log"); } else { SEBClientInfo.SetDefaultClientLogFile(); } Logger.InitLogger(SEBClientInfo.SebClientLogFileDirectory, (string)null); }
/// <summary> /// Initialise Logger if it's enabled. /// </summary> public static void InitializeLogger() { if ((Boolean)getSebSetting(SEBSettings.KeyEnableLogging)[SEBSettings.KeyEnableLogging]) { string logDirectory = (string)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, SEBSettings.KeyLogDirectoryWin); if (!String.IsNullOrEmpty(logDirectory)) { // Expand environment variables in log file path SebClientLogFileDirectory = Environment.ExpandEnvironmentVariables(logDirectory); SebClientLogFile = String.Format(@"{0}\{1}", SebClientLogFileDirectory, SEB_CLIENT_LOG); } else { SEBClientInfo.SetDefaultClientLogFile(); } Logger.InitLogger(SEBClientInfo.SebClientLogFileDirectory, null); } }
public static DialogResult Show(string messageTitle, string messageText, MessageBoxIcon messageBoxIcon, MessageBoxButtons messageButtons, bool neverShowTouchOptimized = false) { if (SEBClientInfo.SebWindowsClientForm != null) { SebWindowsClientMain.SEBToForeground(); } DialogResult dialogResult; if (!neverShowTouchOptimized && (bool)SEBClientInfo.getSebSetting("touchOptimized")["touchOptimized"]) { Form form = new Form(); form.TopMost = true; int num1 = 0; form.Top = num1; int num2 = 0; form.Left = num2; Rectangle bounds = Screen.PrimaryScreen.Bounds; int width = bounds.Width; form.Width = width; bounds = Screen.PrimaryScreen.Bounds; int height1 = bounds.Height; form.Height = height1; string message = messageText; string title = messageTitle; int num3 = (int)messageButtons; int num4 = (int)messageBoxIcon; int height2 = 211; dialogResult = MetroMessageBox.Show((IWin32Window)form, message, title, (MessageBoxButtons)num3, (MessageBoxIcon)num4, height2); } else { Form form = new Form(); form.TopMost = true; string text = messageText; string caption = messageTitle; int num1 = (int)messageButtons; int num2 = (int)messageBoxIcon; dialogResult = MessageBox.Show((IWin32Window)form, text, caption, (MessageBoxButtons)num1, (MessageBoxIcon)num2); } return(dialogResult); }
/// <summary> /// Sets properties in config.json XULRunner configuration file. /// </summary> /// <returns></returns> public static bool SetXulRunnerConfiguration() { bool setXulRunnerConfiguration = false; try { // Get the path of the "Program Data" directory. string localAppDataDirectory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); //string programDataDirectory = Environment.GetEnvironmentVariable("PROGRAMMDATA"); // Set the location of the XULRunnerConfigFileDirectory StringBuilder xulRunnerConfigFileDirectoryBuilder = new StringBuilder(localAppDataDirectory).Append("\\").Append(MANUFACTURER_LOCAL).Append("\\"); //.Append(PRODUCT_NAME).Append("\\"); XulRunnerConfigFileDirectory = xulRunnerConfigFileDirectoryBuilder.ToString(); // Set the location of the config.json file StringBuilder xulRunnerConfigFileBuilder = new StringBuilder(XulRunnerConfigFileDirectory).Append(XUL_RUNNER_CONFIG); XulRunnerConfigFile = xulRunnerConfigFileBuilder.ToString(); XULRunnerConfig xulRunnerConfig = SEBXulRunnerSettings.XULRunnerConfigDeserialize(XulRunnerConfigFile); xulRunnerConfig.seb_openwin_width = Int32.Parse(SEBClientInfo.getSebSetting(SEBSettings.KeyNewBrowserWindowByLinkWidth)[SEBSettings.KeyNewBrowserWindowByLinkWidth].ToString()); xulRunnerConfig.seb_openwin_height = Int32.Parse(SEBClientInfo.getSebSetting(SEBSettings.KeyNewBrowserWindowByLinkHeight)[SEBSettings.KeyNewBrowserWindowByLinkHeight].ToString()); if ((Int32)SEBClientInfo.getSebSetting(SEBSettings.KeyBrowserViewMode)[SEBSettings.KeyBrowserViewMode] == (int)browserViewModes.browserViewModeWindow) { xulRunnerConfig.seb_mainWindow_titlebar_enabled = true; } else { xulRunnerConfig.seb_mainWindow_titlebar_enabled = false; } xulRunnerConfig.seb_url = SEBClientInfo.getSebSetting(SEBSettings.KeyStartURL)[SEBSettings.KeyStartURL].ToString(); setXulRunnerConfiguration = true; SEBXulRunnerSettings.XULRunnerConfigSerialize(xulRunnerConfig, XulRunnerConfigFile); } catch (Exception ex) { Logger.AddError("Error ocurred by setting XulRunner configuration.", null, ex, ex.Message); } return(setXulRunnerConfiguration); }
public static bool SetXulRunnerConfiguration() { bool flag = false; try { SEBClientInfo.XulRunnerConfigFileDirectory = new StringBuilder(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)).Append("\\").Append("SafeExamBrowser").Append("\\").ToString(); SEBClientInfo.XulRunnerConfigFile = new StringBuilder(SEBClientInfo.XulRunnerConfigFileDirectory).Append("config.json").ToString(); XULRunnerConfig objXULRunnerConfig = SEBXulRunnerSettings.XULRunnerConfigDeserialize(SEBClientInfo.XulRunnerConfigFile); objXULRunnerConfig.seb_openwin_width = int.Parse(SEBClientInfo.getSebSetting("newBrowserWindowByLinkWidth")["newBrowserWindowByLinkWidth"].ToString()); objXULRunnerConfig.seb_openwin_height = int.Parse(SEBClientInfo.getSebSetting("newBrowserWindowByLinkHeight")["newBrowserWindowByLinkHeight"].ToString()); objXULRunnerConfig.seb_mainWindow_titlebar_enabled = (int)SEBClientInfo.getSebSetting("browserViewMode")["browserViewMode"] == 0; objXULRunnerConfig.seb_url = SEBClientInfo.getSebSetting("startURL")["startURL"].ToString(); flag = true; SEBXulRunnerSettings.XULRunnerConfigSerialize(objXULRunnerConfig, SEBClientInfo.XulRunnerConfigFile); } catch (Exception ex) { Logger.AddError("Error ocurred by setting XulRunner configuration.", (object)null, ex, ex.Message); } return(flag); }
/// ---------------------------------------------------------------------------------------- /// <summary> /// Decrypt, parse and use new SEB settings /// </summary> /// ---------------------------------------------------------------------------------------- public static bool StoreDecryptedSEBSettings(byte[] sebData) { DictObj sebPreferencesDict; string sebFilePassword = null; bool passwordIsHash = false; X509Certificate2 sebFileCertificateRef = null; sebPreferencesDict = DecryptSEBSettings(sebData, false, ref sebFilePassword, ref passwordIsHash, ref sebFileCertificateRef); if (sebPreferencesDict == null) { return(false); //Decryption didn't work, we abort } Logger.AddInformation("Reconfiguring"); // Reset SEB, close third party applications SEBClientInfo.SebWindowsClientForm.closeSebClient = false; Logger.AddInformation("Attempting to CloseSEBForm for reconfiguration"); SEBClientInfo.SebWindowsClientForm.CloseSEBForm(); Logger.AddInformation("Succesfully CloseSEBForm for reconfiguration"); SEBClientInfo.SebWindowsClientForm.closeSebClient = true; //SEBClientInfo.SebWindowsClientForm.Close(); //SEBClientInfo.SebWindowsClientForm.Dispose(); // We need to check if setting for createNewDesktop changed SEBClientInfo.CreateNewDesktopOldValue = (bool)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, SEBSettings.KeyCreateNewDesktop); if ((int)sebPreferencesDict[SEBSettings.KeySebConfigPurpose] == (int)SEBSettings.sebConfigPurposes.sebConfigPurposeStartingExam) { /// /// If these SEB settings are ment to start an exam /// Logger.AddInformation("Reconfiguring to start an exam"); /// If these SEB settings are ment to start an exam // Store decrypted settings Logger.AddInformation("Attempting to StoreSebClientSettings"); SEBSettings.StoreSebClientSettings(sebPreferencesDict); Logger.AddInformation("Successfully StoreSebClientSettings"); // Set the flag that SEB is running in exam mode now SEBClientInfo.examMode = true; //Re-initialize logger SEBClientInfo.InitializeLogger(); // Check if SEB is running on the standard desktop and the new settings demand to run in new desktop (createNewDesktop = true) // or the other way around! if (SEBClientInfo.CreateNewDesktopOldValue != (bool)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, SEBSettings.KeyCreateNewDesktop)) { // If it did, SEB needs to quit and be restarted manually for the new setting to take effekt if (SEBClientInfo.CreateNewDesktopOldValue == false) { SEBMessageBox.Show(SEBUIStrings.settingsRequireNewDesktop, SEBUIStrings.settingsRequireNewDesktopReason, MessageBoxIcon.Error, MessageBoxButtons.OK); } else { SEBMessageBox.Show(SEBUIStrings.settingsRequireNotNewDesktop, SEBUIStrings.settingsRequireNotNewDesktopReason, MessageBoxIcon.Error, MessageBoxButtons.OK); } //SEBClientInfo.SebWindowsClientForm.closeSebClient = true; SEBClientInfo.SebWindowsClientForm.ExitApplication(); } // Re-Initialize SEB according to the new settings Logger.AddInformation("Attemting to InitSEBDesktop for reconfiguration"); if (!SebWindowsClientMain.InitSEBDesktop()) { return(false); } Logger.AddInformation("Sucessfully InitSEBDesktop for reconfiguration"); // Re-open the main form //SEBClientInfo.SebWindowsClientForm = new SebWindowsClientForm(); //SebWindowsClientMain.singleInstanceController.SetMainForm(SEBClientInfo.SebWindowsClientForm); //return if initializing SEB with openend preferences was successful Logger.AddInformation("Attempting to OpenSEBForm for reconfiguration"); var ret = SEBClientInfo.SebWindowsClientForm.OpenSEBForm(); Logger.AddInformation("Successfully OpenSEBForm for reconfiguration"); return(ret); } else { /// /// If these SEB settings are ment to configure a client /// Logger.AddInformation("Reconfiguring to configure a client"); /// If these SEB settings are ment to configure a client // Check if we have embedded identities and import them into the Windows Certifcate Store ListObj embeddedCertificates = (ListObj)sebPreferencesDict[SEBSettings.KeyEmbeddedCertificates]; for (int i = embeddedCertificates.Count - 1; i >= 0; i--) { // Get the Embedded Certificate DictObj embeddedCertificate = (DictObj)embeddedCertificates[i]; // Is it an identity? if ((int)embeddedCertificate[SEBSettings.KeyType] == 1) { // Store the identity into the Windows Certificate Store SEBProtectionController.StoreCertificateIntoStore((byte[])embeddedCertificate[SEBSettings.KeyCertificateData]); } // Remove the identity from settings, as it should be only stored in the Certificate Store and not in the locally stored settings file embeddedCertificates.RemoveAt(i); } // Store decrypted settings SEBSettings.StoreSebClientSettings(sebPreferencesDict); //Re-initialize logger SEBClientInfo.InitializeLogger(); // Write new settings to the localapp directory SEBSettings.WriteSebConfigurationFile(SEBClientInfo.SebClientSettingsAppDataFile, "", false, null, SEBSettings.sebConfigPurposes.sebConfigPurposeConfiguringClient); // Re-Initialize SEB desktop according to the new settings if (!SebWindowsClientMain.InitSEBDesktop()) { return(false); } if (SEBClientInfo.SebWindowsClientForm.OpenSEBForm()) { // Activate SebWindowsClient so the message box gets focus //SEBClientInfo.SebWindowsClientForm.Activate(); // Check if setting for createNewDesktop changed if (SEBClientInfo.CreateNewDesktopOldValue != (bool)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, SEBSettings.KeyCreateNewDesktop)) { // If it did, SEB needs to quit and be restarted manually for the new setting to take effekt SEBMessageBox.Show(SEBUIStrings.sebReconfiguredRestartNeeded, SEBUIStrings.sebReconfiguredRestartNeededReason, MessageBoxIcon.Warning, MessageBoxButtons.OK); //SEBClientInfo.SebWindowsClientForm.closeSebClient = true; SEBClientInfo.SebWindowsClientForm.ExitApplication(); } if (SEBMessageBox.Show(SEBUIStrings.sebReconfigured, SEBUIStrings.sebReconfiguredQuestion, MessageBoxIcon.Question, MessageBoxButtons.YesNo) == DialogResult.No) { //SEBClientInfo.SebWindowsClientForm.closeSebClient = true; SEBClientInfo.SebWindowsClientForm.ExitApplication(); } return(true); //reading preferences was successful } else { return(false); } } }
public static bool StoreDecryptedSEBSettings(byte[] sebData) { string sebFilePassword = (string)null; bool passwordIsHash = false; X509Certificate2 sebFileCertificateRef = (X509Certificate2)null; Dictionary <string, object> settingsDict = SEBConfigFileManager.DecryptSEBSettings(sebData, false, ref sebFilePassword, ref passwordIsHash, ref sebFileCertificateRef); if (settingsDict == null) { return(false); } Logger.AddInformation("Reconfiguring", (object)null, (Exception)null, (string)null); SEBClientInfo.SebWindowsClientForm.closeSebClient = false; Logger.AddInformation("Attempting to CloseSEBForm for reconfiguration", (object)null, (Exception)null, (string)null); SEBClientInfo.SebWindowsClientForm.CloseSEBForm(); Logger.AddInformation("Succesfully CloseSEBForm for reconfiguration", (object)null, (Exception)null, (string)null); SEBClientInfo.SebWindowsClientForm.closeSebClient = true; SEBClientInfo.CreateNewDesktopOldValue = (bool)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, "createNewDesktop"); if ((int)settingsDict["sebConfigPurpose"] == 0) { Logger.AddInformation("Reconfiguring to start an exam", (object)null, (Exception)null, (string)null); Logger.AddInformation("Attempting to StoreSebClientSettings", (object)null, (Exception)null, (string)null); SEBSettings.StoreSebClientSettings(settingsDict); Logger.AddInformation("Successfully StoreSebClientSettings", (object)null, (Exception)null, (string)null); SEBClientInfo.examMode = true; SEBClientInfo.InitializeLogger(); if (SEBClientInfo.CreateNewDesktopOldValue != (bool)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, "createNewDesktop")) { if (!SEBClientInfo.CreateNewDesktopOldValue) { int num1 = (int)SEBMessageBox.Show(SEBUIStrings.settingsRequireNewDesktop, SEBUIStrings.settingsRequireNewDesktopReason, MessageBoxIcon.Hand, MessageBoxButtons.OK, false); } else { int num2 = (int)SEBMessageBox.Show(SEBUIStrings.settingsRequireNotNewDesktop, SEBUIStrings.settingsRequireNotNewDesktopReason, MessageBoxIcon.Hand, MessageBoxButtons.OK, false); } SEBClientInfo.SebWindowsClientForm.ExitApplication(true); } Logger.AddInformation("Attemting to InitSEBDesktop for reconfiguration", (object)null, (Exception)null, (string)null); if (!SebWindowsClientMain.InitSEBDesktop()) { return(false); } Logger.AddInformation("Sucessfully InitSEBDesktop for reconfiguration", (object)null, (Exception)null, (string)null); Logger.AddInformation("Attempting to OpenSEBForm for reconfiguration", (object)null, (Exception)null, (string)null); int num = SEBClientInfo.SebWindowsClientForm.OpenSEBForm() ? 1 : 0; Logger.AddInformation("Successfully OpenSEBForm for reconfiguration", (object)null, (Exception)null, (string)null); return(num != 0); } Logger.AddInformation("Reconfiguring to configure a client", (object)null, (Exception)null, (string)null); List <object> objectList = (List <object>)settingsDict["embeddedCertificates"]; for (int index = objectList.Count - 1; index >= 0; --index) { Dictionary <string, object> dictionary = (Dictionary <string, object>)objectList[index]; if ((int)dictionary["type"] == 1) { SEBProtectionController.StoreCertificateIntoStore((byte[])dictionary["certificateData"]); } objectList.RemoveAt(index); } SEBSettings.StoreSebClientSettings(settingsDict); SEBClientInfo.InitializeLogger(); SEBSettings.WriteSebConfigurationFile(SEBClientInfo.SebClientSettingsAppDataFile, "", false, (X509Certificate2)null, SEBSettings.sebConfigPurposes.sebConfigPurposeConfiguringClient, false); if (!SebWindowsClientMain.InitSEBDesktop() || !SEBClientInfo.SebWindowsClientForm.OpenSEBForm()) { return(false); } if (SEBClientInfo.CreateNewDesktopOldValue != (bool)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, "createNewDesktop")) { int num = (int)SEBMessageBox.Show(SEBUIStrings.sebReconfiguredRestartNeeded, SEBUIStrings.sebReconfiguredRestartNeededReason, MessageBoxIcon.Exclamation, MessageBoxButtons.OK, false); SEBClientInfo.SebWindowsClientForm.ExitApplication(true); } if (SEBMessageBox.Show(SEBUIStrings.sebReconfigured, SEBUIStrings.sebReconfiguredQuestion, MessageBoxIcon.Question, MessageBoxButtons.YesNo, false) == DialogResult.No) { SEBClientInfo.SebWindowsClientForm.ExitApplication(true); } return(true); }
public static bool SetSystemVersionInfo() { SEBClientInfo.OSVERSIONINFO o = new SEBClientInfo.OSVERSIONINFO(); o.dwOSVersionInfoSize = Marshal.SizeOf(typeof(SEBClientInfo.OSVERSIONINFO)); int num = 800; try { if ((int)SEBClientInfo.GetVersionEx(ref o) != 0) { switch (o.dwPlatformId) { case 1: switch (o.dwMinorVersion) { case 0: num = 950; break; case 10: num = 980; break; case 90: num = 999; break; default: num = 800; break; } break; case 2: switch (o.dwMajorVersion) { case 3: num = 1351; break; case 4: num = 1400; break; case 5: num = o.dwMinorVersion != 0 ? 2010 : 2000; break; case 6: num = o.dwMinorVersion != 0 ? (o.dwMinorVersion != 1 ? (o.dwMinorVersion != 2 ? 2050 : 2050) : 2050) : 2050; break; case 10: num = 2050; break; default: num = 800; break; } break; default: num = 800; break; } } } catch (Exception ex) { Logger.AddError("SetSystemVersionInfo.", (object)null, ex, (string)null); } Logger.AddInformation("OS Version: " + num.ToString(), (object)null, (Exception)null, (string)null); if (num <= 1351) { if (num <= 980) { if (num != 950 && num != 980) { goto label_27; } } else if (num != 999) { if (num == 1351) { goto label_25; } else { goto label_27; } } SEBClientInfo.IsNewOS = false; return(true); } if (num <= 2000) { if (num != 1400 && num != 2000) { goto label_27; } } else if (num != 2010 && num != 2050) { goto label_27; } label_25: SEBClientInfo.IsNewOS = true; return(true); label_27: return(false); }