private static void OnClientMessageBinary(byte[] obj)
        {
            // Check if we're running in exam mode already, if yes, then refuse to load a .seb file
            if (SEBClientInfo.examMode)
            {
                Logger.AddInformation("Reconfiguring SEB using the downloaded Config File data is not allowed because it is already running in exam mode, sending command ReconfigureAborted to browser");
                SEBXULRunnerWebSocketServer.SendMessage(new SEBXULMessage(SEBXULMessage.SEBXULHandler.ReconfigureAborted));

                SebWindowsClientMain.LoadingSebFile(false);
                SebWindowsClientForm.ShowReconfigureNotAllowed();
                return;
            }

            HasBeenReconfiguredByMessage = true;
            Logger.AddInformation("Received downloaded Config File data, " + obj.Length + " bytes. Sending command SebFileTransfer to browser");
            SEBXULRunnerWebSocketServer.SendMessage(new SEBXULMessage(SEBXULMessage.SEBXULHandler.SebFileTransfer, true));
            if (SEBClientInfo.SebWindowsClientForm.ReconfigureWithSettings(obj))
            {
                Logger.AddInformation("SEB was successfully reconfigured using the downloaded Config File data");

                // Convert new URL Filter rules to XUL seb2 rules
                // and add Start URL to allowed rules
                SEBURLFilter urlFilter = new SEBURLFilter();
                urlFilter.UpdateFilterRules();

                // Create JSON object with XULRunner parameters to pass to firefox.exe as base64 string
                var    xulRunnerSettings   = DeepClone(SEBSettings.settingsCurrent);
                string XULRunnerParameters = SEBXulRunnerSettings.XULRunnerConfigDictionarySerialize(xulRunnerSettings);

                SEBXULRunnerWebSocketServer.SendMessage(new SEBXULMessage(SEBXULMessage.SEBXULHandler.Reconfigure, new { configBase64 = XULRunnerParameters }));
            }
            else
            {
                Logger.AddInformation("Reconfiguring SEB using the downloaded Config File data failed, sending command ReconfigureAborted to browser");
                SEBXULRunnerWebSocketServer.SendMessage(new SEBXULMessage(SEBXULMessage.SEBXULHandler.ReconfigureAborted));
            }
            HasBeenReconfiguredByMessage = false;
        }
        public static void CheckDistributionIntegrity()
        {
            string path1 = SEBXulRunnerSettings.ResolveResourcePath((string)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, "startURL"));
            string path2 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "SafeExamBrowser", "SebClientSettings.seb");

            if (!File.Exists(path1))
            {
                throw new Exception(string.Format("Distribution is corrupted, file \"{0}\" isn't exists, it's insecure to run app now.", (object)path1));
            }
            if (!File.Exists(path2))
            {
                throw new Exception(string.Format("Distribution is corrupted, file \"{0}\" isn't exists, it's insecure to run app now.", (object)path2));
            }
            byte[] array = ((IEnumerable <byte>)File.ReadAllBytes(path1)).Concat <byte>((IEnumerable <byte>)File.ReadAllBytes(path2)).ToArray <byte>();
            string base64String;

            using (MD5 md5 = MD5.Create())
                base64String = Convert.ToBase64String(md5.ComputeHash(array));
            if (base64String != IntegrityConstants.IndexCRC)
            {
                throw new Exception("Distribution was changed externally, it's insecure to run app now.");
            }
        }