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);
}