AcManager.Tools.GameProperties.RhmService.RunRhm C# (CSharp) Method

RunRhm() private method

private RunRhm ( bool keepVisible = false ) : bool
keepVisible bool
return bool
        private bool RunRhm(bool keepVisible = false) {
            if (SettingsHolder.Drive.RhmLocation == null) return false;

            try {
                _process = Process.Start(new ProcessStartInfo {
                    FileName = SettingsHolder.Drive.RhmLocation,
                    WorkingDirectory = Path.GetDirectoryName(SettingsHolder.Drive.RhmLocation) ?? ""
                });
                if (_process == null) throw new Exception(@"Process=NULL");
            } catch (Exception e) {
                NonfatalError.Notify("Can’t start RHM", e);
                return false;
            }

            ChildProcessTracker.AddProcess(_process);
            if (keepVisible) return true;

            for (var i = 0; i < 1000; i++) {
                if (SetVisibility(false)) return true;
                Thread.Sleep(1);
            }

            NonfatalError.Notify("Can’t find app’s window");
            EnsureStopped();
            return false;
        }