Exemplo n.º 1
0
 private void HandleInitialSettings()
 {
     if (HLVRSettingsManager.LauncherSettings.GeneralSettings[LauncherSettings.CategoryLauncher][LauncherSettings.StartMinimized].IsTrue())
     {
         WindowState = WindowState.Minimized;
         OnWindowStateChanged();
     }
     if (HLVRSettingsManager.LauncherSettings.GeneralSettings[LauncherSettings.CategoryLauncher][LauncherSettings.AutoRunMod].IsTrue() &&
         HLVRPaths.CheckHLDirectory() &&
         HLVRPaths.CheckModDirectory())
     {
         hlvrModLauncher.LaunchMod(false);
     }
 }
Exemplo n.º 2
0
        private static void InitModSettings()
        {
            if (AreModSettingsInitialized)
            {
                return;
            }

            ModSettings = new ModSettings();

            if (!HLVRPaths.CheckHLDirectory() || !HLVRPaths.CheckModDirectory())
            {
                AreModSettingsInitialized = false;
                return;
            }

            if (File.Exists(HLVRPaths.VRModSettingsFile))
            {
                if (!TryLoadSettings(HLVRPaths.VRModSettingsFile))
                {
                    var errorMsg   = new I18N.I18NString("ErrorMsgCouldNotLoadModSettings", "Couldn't load mod settings file. If you chose OK, HLVRConfig will replace settings with default values. If you chose Cancel, config tabs will not be available.");
                    var errorTitle = new I18N.I18NString("Error", "Error");
                    var result     = MessageBox.Show(I18N.Get(errorMsg), I18N.Get(errorTitle), MessageBoxButton.OKCancel, MessageBoxImage.Warning);
                    if (result != MessageBoxResult.OK)
                    {
                        AreModSettingsInitialized = false;
                        return;
                    }
                }
            }

            if (!TryStoreSettings(ModSettings, HLVRPaths.VRModSettingsFile))
            {
                var errorMsg   = new I18N.I18NString("ErrorMsgCouldNotSynchronizeModSettings", "Couldn't synchronize mod settings. Config tabs are not available.");
                var errorTitle = new I18N.I18NString("Error", "Error");
                MessageBox.Show(I18N.Get(errorMsg), I18N.Get(errorTitle), MessageBoxButton.OK, MessageBoxImage.Warning);
                AreModSettingsInitialized = false;
                return;
            }

            AreModSettingsInitialized = true;
        }
Exemplo n.º 3
0
 public void UpdateState()
 {
     UpdateSettingsAndLanguage();
     if (!HLVRPaths.CheckHLDirectory() || !HLVRPaths.CheckModDirectory())
     {
         ModNotFoundPanel.Visibility     = Visibility.Visible;
         NotRunningGamePanel.Visibility  = Visibility.Collapsed;
         RunningGamePannel.Visibility    = Visibility.Collapsed;
         CreateMiniDumpButton.Visibility = Visibility.Collapsed;
     }
     else
     {
         ModNotFoundPanel.Visibility     = Visibility.Collapsed;
         NotRunningGamePanel.Visibility  = hlvrModLauncher.IsGameRunning() ? Visibility.Collapsed : Visibility.Visible;
         RunningGamePannel.Visibility    = hlvrModLauncher.IsGameRunning() ? Visibility.Visible : Visibility.Collapsed;
         CreateMiniDumpButton.Visibility =
             (HLVRSettingsManager.LauncherSettings.GeneralSettings[LauncherSettings.CategoryDebug][LauncherSettings.EnableMiniDumpButton].IsTrue() &&
              hlvrModLauncher.IsGameRunning()
             ) ? Visibility.Visible : Visibility.Collapsed;
     }
 }
Exemplo n.º 4
0
        private static void InitFileSystemWatcherEtc()
        {
            if (storeLoadTaskWaitHandle == null)
            {
                storeLoadTaskWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);
            }

            if (storeLoadThread == null)
            {
                storeLoadThread = new Thread(StoreLoadWorkerLoop)
                {
                    IsBackground = true
                };
                storeLoadThread.Start();
            }

            if (!IsFileSystemWatcherInitialized)
            {
                if (fileSystemWatcher != null)
                {
                    fileSystemWatcher.Dispose();
                    fileSystemWatcher = null;
                }

                if (HLVRPaths.CheckHLDirectory() && HLVRPaths.CheckModDirectory())
                {
                    fileSystemWatcher = new FileSystemWatcher
                    {
                        Path = HLVRPaths.VRDirectory,
                        EnableRaisingEvents   = true,
                        IncludeSubdirectories = false,
                        NotifyFilter          = NotifyFilters.LastWrite
                    };
                    fileSystemWatcher.Changed += FileSystemWatcher_Changed;

                    IsFileSystemWatcherInitialized = true;
                }
            }
        }