public override void change(string newValue) { try { IniManager _iniManager = new IniManager(_iniFilepath); _iniManager.setParameter(_iniKey, newValue, _iniSection); Logger.addLine(true, "Изменение настроек"); } catch (Exception) { Logger.addLine(false, "Изменение настроек"); throw new INIDataNotFoundException(_iniSection, _iniKey, _iniFilepath); } }
private void beforeRun() { Application.Current.Dispatcher.Invoke(new Action(() => { Application.Current.MainWindow.IsEnabled = false; })); if (File.Exists(INIT.GAME_ROOT + @"d3d9.bak")) { File.Move(INIT.GAME_ROOT + @"d3d9.bak", INIT.GAME_ROOT + @"d3d9.dll"); } if (File.Exists(INIT.GAME_ROOT + @"Data\OBSE\Plugins\Construction Set Extender.dll")) { File.Move(INIT.GAME_ROOT + @"Data\OBSE\Plugins\Construction Set Extender.dll", INIT.GAME_ROOT + @"Data\OBSE\Plugins\Const.bak"); } if (File.Exists(INIT.GAME_ROOT + @"ObivionPerfect.ini")) { IniManager im = new IniManager(INIT.GAME_ROOT + @"ObivionPerfect.ini"); if (Convert.ToBoolean(im.getValueByKey("bDisableExplorer", "[GBR]"))) { explorerisDisableNow = true; } } Directory.SetCurrentDirectory(Path.GetDirectoryName(apppath)); if (explorerisDisableNow) { foreach (Process process in Process.GetProcessesByName("explorer")) { process.KillExplorer(); } explorerisDisableNow = true; } if (MusicPlayer.isPlaying()) { MusicPlayer.Stop(); } }
public INI_Setting(string name, string text, string desc, int position, string defaultValue, string iniFilepath, string iniSection, string iniKey) : base(name, text, desc, defaultValue, position) { _iniFilepath = INIT.getpath(iniFilepath); _iniKey = iniKey; _iniSection = iniSection; if (!string.IsNullOrEmpty(_iniFilepath)) { IniManager _iniManager = new IniManager(_iniFilepath); if (!_iniSection.Equals("[NULL]")) { if (!_iniManager.isKeyExist(_iniKey) || !_iniManager.isSectionExist(_iniSection)) { if (!_iniKey.Contains(',')) { throw new INIDataNotFoundException(_iniSection, _iniKey, _iniFilepath); } else { List <string> substrings = iniKey.Split(',').ToList <string>(); foreach (string s in substrings) { if (!_iniManager.isKeyExist(s)) { throw new INIDataNotFoundException(_iniSection, _iniKey, _iniFilepath); } } } } } _currentValue = ""; _currentValue = _iniManager.getValueByKey(iniKey, iniSection); } }
public override void resetTodefault() { IniManager _iniManager = new IniManager(_iniFilepath); _iniManager.setParameter(_iniKey, _default_value, _iniSection); }