Ejemplo n.º 1
0
        public SettingsViewModel()
        {
            var metaLocation      = AppDomain.CurrentDomain.BaseDirectory;
            var globalIniLocation = Path.Combine(metaLocation, Settings.Default.GlobalIniLocation);
            var globalIniFile     = File.ReadAllText(globalIniLocation);

            GlobalIniText = new TextDocument {
                Text = globalIniFile != "" ? globalIniFile : ""
            };

            GameLocation = GetSettings.Return(SettingTypes.GameLocation);

            if (GameLocation != "")
            {
                return;
            }

            var regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\Bethesda Softworks\Skyrim");

            if (regKey != null)
            {
                var value = (string)regKey.GetValue("Installed Path");

                GameLocation = value;
            }
            Model.SaveSettings.Save(SettingTypes.GameLocation, GameLocation);
        }
Ejemplo n.º 2
0
        private void ClosePresetDialog(object sender, DialogClosingEventArgs eventargs)
        {
            // Close the dialog unless more commands are needed.
            if ((bool)eventargs.Parameter == false)
            {
                return;
            }
            if (PresetName == null)
            {
                return;
            }
            if (GetSettings.Return(SettingTypes.GameLocation) == "")
            {
                return;
            }

            PresetManager.SavePreset(PresetName, PresetDescription, UsingGlobalIni);

            Presets = new ObservableCollection <PresetData>(PresetManager.GetPresets());

            PresetName        = null;
            PresetDescription = null;

            IsHintVisible = Presets.Count <= 0;
        }
Ejemplo n.º 3
0
        public void OpenGameDirectory(object o)
        {
            var gameDirectory = GetSettings.Return(SettingTypes.GameLocation);

            if (gameDirectory != "")
            {
                Process.Start(gameDirectory);
            }
        }
Ejemplo n.º 4
0
        private void InstallPreset(object o)
        {
            if ((string)o == GetSettings.Return(SettingTypes.InstalledPreset))
            {
                PresetManager.CleanGameDirectory();
                SaveSettings.Save(SettingTypes.InstalledPreset, "");
            }

            else
            {
                PresetManager.InstallPreset((string)o);
            }

            Presets = new ObservableCollection <PresetData>(PresetManager.GetPresets());
        }