private void btnOK_Click(object sender, EventArgs e) { if (ValidateFields() && CheckFeasibility()) { // create a new communication line CommLine commLineEntity = new CommLine { CommLineNum = Convert.ToInt32(numCommLineNum.Value), Name = txtName.Text, Descr = txtDescr.Text }; // insert the line in the configuration database project.ConfigBase.CommLineTable.AddItem(commLineEntity); project.ConfigBase.CommLineTable.Modified = true; // insert the line in the Communicator settings if (chkAddToComm.Checked && cbInstance.SelectedItem is Instance instance) { if (instance.CommApp.Enabled) { CommLineSettings = SettingsConverter.CreateCommLine(commLineEntity); CommLineSettings.Parent = instance.CommApp.Settings; instance.CommApp.Settings.CommLines.Add(CommLineSettings); } InstanceName = recentSelection.InstanceName = instance.Name; } recentSelection.CommLineNum = commLineEntity.CommLineNum; DialogResult = DialogResult.OK; } }
public static void WriteDataToFile() { if (!DataHasChanged || ComponentSolverFactory.SilentMode) { return; } string path = Path.Combine(Application.persistentDataPath, usersSavePath); DebugHelper.Log($"ModuleData: Writing file {path}"); try { List <ModuleInformation> infoList = ComponentSolverFactory.GetModuleInformation().ToList(); infoList = infoList.OrderBy(info => info.moduleDisplayName).ThenBy(info => info.moduleID).ToList(); File.WriteAllText(path, SettingsConverter.Serialize(infoList)); //JsonConvert.SerializeObject(infoList, Formatting.Indented)); } catch (FileNotFoundException) { DebugHelper.LogWarning($"ModuleData: File {path} was not found."); return; } catch (Exception ex) { DebugHelper.LogException(ex); return; } DataHasChanged = false; DebugHelper.Log($"ModuleData: Writing of file {path} completed successfully."); }
public static void WriteDataToFile() { if (!DataHasChanged || ComponentSolverFactory.SilentMode) { return; } string path = Path.Combine(Application.persistentDataPath, usersSavePath); DebugHelper.Log($"ModuleData: Writing file {path}"); try { var infoList = ComponentSolverFactory .GetModuleInformation() .OrderBy(info => info.moduleDisplayName) .ThenBy(info => info.moduleID) .Select(info => { var fileInfo = lastRead.FirstOrDefault(file => file.moduleID == info.moduleID); var dictionary = new Dictionary <string, object>(); foreach (var field in infoFields) { if (!(info.CallMethod <bool?>($"ShouldSerialize{field.Name}") ?? true)) { continue; } var value = field.GetValue(info); if (field.Name == "moduleScore") { value = fileInfo?.moduleScore; } else if (field.Name == "moduleScoreIsDynamic") { value = fileInfo?.moduleScoreIsDynamic; } dictionary[field.Name] = value; } return(dictionary); }) .ToList(); File.WriteAllText(path, SettingsConverter.Serialize(infoList)); } catch (FileNotFoundException) { DebugHelper.LogWarning($"ModuleData: File {path} was not found."); return; } catch (Exception ex) { DebugHelper.LogException(ex); return; } DataHasChanged = false; DebugHelper.Log($"ModuleData: Writing of file {path} completed successfully."); }
private void OnEnable() { Instance = this; BombActive = true; EnableDisableInput(); Leaderboard.Instance.ClearSolo(); LogUploader.Instance.Clear(); callsNeeded = 1; CallingPlayers.Clear(); _bombStarted = false; ParentService.GetComponent <KMGameInfo>().OnLightsChange += OnLightsChange; StartCoroutine(CheckForBomb()); try { string path = Path.Combine(Application.persistentDataPath, "TwitchPlaysLastClaimed.json"); LastClaimedModule = SettingsConverter.Deserialize <Dictionary <string, Dictionary <string, double> > >(File.ReadAllText(path)); } catch (Exception ex) { DebugHelper.LogException(ex, "Couldn't read TwitchPlaysLastClaimed.json:"); LastClaimedModule = new Dictionary <string, Dictionary <string, double> >(); } }
public static bool LoadDataFromFile() { string path = Path.Combine(Application.persistentDataPath, usersSavePath); try { DebugHelper.Log("TwitchPlayStrings: Loading Custom strings data from file: {0}", path); data = SettingsConverter.Deserialize <TwitchPlaySettingsData>(File.ReadAllText(path)); //JsonConvert.DeserializeObject<TwitchPlaySettingsData>(File.ReadAllText(path)); data.ValidateStrings(); WriteDataToFile(); } catch (FileNotFoundException) { DebugHelper.LogWarning("TwitchPlayStrings: File {0} was not found.", path); data = new TwitchPlaySettingsData(); WriteDataToFile(); return(false); } catch (Exception ex) { data = new TwitchPlaySettingsData(); DebugHelper.LogException(ex); return(false); } return(true); }
static decimal GetAxisMapPoints(string axis, string up = null, string down = null) { var points = 0m; MapType type; int index; if (SettingsConverter.TryParseIniValue(axis, out type, out index)) { // If proper axis mapped then give full point. points += 1m; } else { // For every map 0.25 points. if (SettingsConverter.TryParseIniValue(up, out type, out index)) { points += 0.25m; } if (SettingsConverter.TryParseIniValue(down, out type, out index)) { points += 0.25m; } } return(points); }
public static bool LoadDataFromFile() { ModuleInformation[] modInfo; string path = Path.Combine(Application.persistentDataPath, usersSavePath); try { DebugHelper.Log($"ModuleData: Loading Module information data from file: {path}"); modInfo = SettingsConverter.Deserialize <ModuleInformation[]>(File.ReadAllText(path)); //JsonConvert.DeserializeObject<ModuleInformation[]>(File.ReadAllText(path)); } catch (FileNotFoundException) { DebugHelper.LogWarning($"ModuleData: File {path} was not found."); return(false); } catch (Exception ex) { DebugHelper.LogException(ex); return(false); } foreach (ModuleInformation info in modInfo) { ComponentSolverFactory.AddModuleInformation(info); } return(true); }
private void DisableReadonly(object value) { if (value == null) { return; } Type type = value.GetType(); PropertyInfo[] propertyInfos = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo pi in propertyInfos) { Type pType = pi.PropertyType; ParameterInfo[] parInfo = pi.GetIndexParameters(); //if represents a array if (parInfo != null && parInfo.Length > 0) { continue; } //Set Read Only ReadOnlyAttribute[] attribute2 = pi.GetCustomAttributes(typeof(ReadOnlyAttribute), false) as ReadOnlyAttribute[]; if (attribute2 != null && attribute2.Length > 0) { FieldInfo ftoChange = attribute2[0].GetType().GetField("isReadOnly", BindingFlags.NonPublic | BindingFlags.Instance); if (ftoChange != null) { ftoChange.SetValue(attribute2[0], false); } } if (pType.IsPrimitive || pType.IsValueType || pType == typeof(string)) //enums are value types too { return; } else { //go deeper object pValue = pi.GetValue(value, null); if (SettingsConverter.IsListType(pType)) { IList pList = (IList)pValue; foreach (object pListValue in pList) { DisableReadonly(pList); } } else { DisableReadonly(pValue); } } } }
public void GetPageSettings_PaperSizeSetNull_ExpectDefault() { var convertOptions = new ConverterOptions(); var actual = SettingsConverter.GetPageSettings(convertOptions); Assert.Equal(794, actual.Width); Assert.Equal(1123, actual.Height); }
public void LoadUsers() { _usersPath = this.UsersSettingsFilePath; _settingsDoc = new SettingsDocument(); _settingsDoc.Load(_usersPath, SettingsFileOption.Encrypted); SettingsConverter.UpdateObjectFromNode(this.getUserAccessSettings(), _settingsDoc); }
public static bool LoadDataFromFile() { FileModuleInformation[] modInfo; string path = Path.Combine(Application.persistentDataPath, usersSavePath); try { DebugHelper.Log($"Loading Module information data from file: {path}"); modInfo = SettingsConverter.Deserialize<FileModuleInformation[]>(File.ReadAllText(path)); lastRead = modInfo; } catch (FileNotFoundException) { DebugHelper.LogWarning($"File {path} was not found."); return false; } catch (Exception ex) { DebugHelper.LogException(ex); return false; } foreach (var fileInfo in modInfo) { ModuleInformation defaultInfo = null; if (fileInfo.moduleID != null) { defaultInfo = ComponentSolverFactory.GetDefaultInformation(fileInfo.moduleID); } var info = new ModuleInformation(); foreach (FieldInfo fileFieldInfo in fileInfoFields) { if (fileFieldInfo.DeclaringType == typeof(ModuleInformation)) { if (fileInfoFields.Any(field => field.DeclaringType == typeof(FileModuleInformation) && field.Name == fileFieldInfo.Name)) continue; fileFieldInfo.SetValue(info, fileFieldInfo.GetValue(fileInfo)); } else { var baseFieldInfo = Array.Find(infoFields, field => field.Name == fileFieldInfo.Name); if (baseFieldInfo == null) throw new NotSupportedException("Superclass isn't overriding only base fields."); var value = fileFieldInfo.GetValue(fileInfo); if (value == null && defaultInfo != null) { value = baseFieldInfo.GetValue(defaultInfo); } baseFieldInfo.SetValue(info, value); } } ComponentSolverFactory.AddModuleInformation(info); } return true; }
public RadioButtonBinding(string propName) { Bindings.Add(new Binding(propName)); Bindings.Add(new Binding("Content") { RelativeSource = new RelativeSource(RelativeSourceMode.Self) }); Converter = new SettingsConverter(); }
private void buttonSave_Click(object sender, EventArgs e) { if (_filePathUsers != null) { SettingsDocument doc = SettingsConverter.ConvertObjectToDocument(_settingsObject, _filePathUsers); doc.Save(_filePathUsers, SettingsFileOption.Encrypted); UpdateUsersSettings.SafeInvoke(this._settingsObject, e); } }
public void GetPageSettings_MarginsSetNull_ExpectDefault() { var convertOptions = new ConverterOptions(); var actual = SettingsConverter.GetPageSettings(convertOptions); Assert.Equal(38, actual.Left); Assert.Equal(38, actual.Top); Assert.Equal(38, actual.Right); Assert.Equal(38, actual.Bottom); }
/// <summary> /// Called when accept is clicked. /// </summary> protected override void OnAccept() { UpdateSettingsNodes(treeView.Nodes); UpdateInfo(); SettingsConverter.UpdateObjectFromNode(_settingsObject, SettingsDocument); IsDirty = false; }
private void buttonSave_Click(object sender, EventArgs e) { if (_filePathUsers != null) { SettingsDocument doc = SettingsConverter.ConvertObjectToDocument(_settingsObject, _filePathUsers); doc.Save(_filePathUsers, SettingsFileOption.Encrypted); UpdateUsersSettings.SafeInvoke(this._settingsObject, e); Notify.PopUp("Configuration File Saved", "Updated settings have been saved to disk", "", "OK"); } }
public void GetPageSettings_PaperSizeSetA5Portrait_ExpectA5Portrait() { var convertOptions = new ConverterOptions { Paper = new Paper { Size = "A5" } }; var actual = SettingsConverter.GetPageSettings(convertOptions); Assert.Equal(794, actual.Height); Assert.Equal(562, actual.Width); }
public SettingsDTO GetSettings(string username) { var acc = accountService.GetAccountForUser(username); if (acc == null) { throw new Exception("Such account doesn't exist!"); } var settings = settingsRepository.GetById(acc.SettingsId); return(SettingsConverter.ToDTO(settings)); }
public void GetPageSettings_PaperSizeSetA4Landscape_ExpectA4Landscape() { var convertOptions = new ConverterOptions { Paper = new Paper { Size = "A4", Orientation = "Landscape" } }; var actual = SettingsConverter.GetPageSettings(convertOptions); Assert.Equal(794, actual.Height); Assert.Equal(1123, actual.Width); }
private void OnDisable() { GameRoom.ShowCamera(); BombActive = false; EnableDisableInput(); bool claimsEnabled = TwitchModule.ClaimsEnabled; TwitchModule.ClearUnsupportedModules(); if (!claimsEnabled) { TwitchModule.ClaimsEnabled = true; } StopAllCoroutines(); Leaderboard.Instance.BombsAttempted++; // ReSharper disable once DelegateSubtraction ParentService.GetComponent <KMGameInfo>().OnLightsChange -= OnLightsChange; TwitchPlaysService.Instance.SetHeaderVisbility(false); LogUploader.Instance.GetBombUrl(); ParentService.StartCoroutine(SendDelayedMessage(1.0f, GetBombResult(), SendAnalysisLink)); if (!claimsEnabled) { ParentService.StartCoroutine(SendDelayedMessage(1.1f, "Claims have been enabled.")); } if (ModuleCameras != null) { ModuleCameras.gameObject.SetActive(false); } foreach (var bomb in Bombs.Where(x => x != null)) { Destroy(bomb.gameObject, 2.0f); } Bombs.Clear(); DestroyComponentHandles(); MusicPlayer.StopAllMusic(); GameRoom.Instance?.OnDisable(); try { string path = Path.Combine(Application.persistentDataPath, "TwitchPlaysLastClaimed.json"); File.WriteAllText(path, SettingsConverter.Serialize(LastClaimedModule)); } catch (Exception ex) { DebugHelper.LogException(ex, "Couldn't write TwitchPlaysLastClaimed.json:"); } }
void LoadUserSetting(UserSetting userSetting) { _UserSetting = userSetting; if (_UserSetting == null) { Data = null; return; } MapTypeComboBox.ItemsSource = new List <MapType>() { MapType.Button, MapType.Axis, MapType.Slider, MapType.POV } .Select(x => x.ToString()).ToList(); MapTypeComboBox.SelectedItem = MapType.Button.ToString(); MapEventTypeComboBox.ItemsSource = Enum.GetValues(typeof(MapEventType)).Cast <MapEventType>() .Select(x => x.ToString()).ToList(); MapEventTypeComboBox.SelectedItem = MapEventType.EnterUpLeaveDown.ToString(); MapRpmTypeComboBox.ItemsSource = Enum.GetValues(typeof(MapRpmType)).Cast <MapRpmType>() .Select(x => x.ToString()).ToList(); MapRpmTypeComboBox.SelectedItem = MapRpmType.DownIncrease.ToString(); UserMacrosTabPage.Header = string.Format("User Macros for {0}", userSetting.InstanceName); RefreshList(); // https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.keys?view=netcore-3.1 AllKeys = ((Key[])Enum.GetValues(typeof(Key))).ToList(); AddKeys(Control1KeysComboBox, "Mod", new Key[] { Key.Shift, Key.ShiftKey, Key.LShiftKey, Key.RShiftKey, Key.Control, Key.ControlKey, Key.LControlKey, Key.RControlKey, Key.Alt, Key.Menu, Key.RMenu, Key.LMenu, Key.LWin, Key.RWin, }); AddKeys(CharKeysComboBox, "Key", AllKeys.Where(x => x >= Key.A && x <= Key.Z || x == Key.Space)); AddKeys(NumPadKeysComboBox, "NumPad", AllKeys.Where(x => x >= Key.NumPad0 && x <= Key.NumPad9)); AddKeys(FKeysComboBox, "F-Key", AllKeys.Where(x => x >= Key.F1 && x <= Key.F24)); AddKeys(Control2KeysComboBox, "Control", new Key[] { Key.Escape, Key.Tab, Key.CapsLock, Key.Back, Key.Enter, Key.Insert, Key.Delete, Key.Home, Key.End, Key.PageUp, Key.PageDown, Key.NumLock }); // Add remaining keys AddKeys(OtherKeysComboBox, "Other", AllKeys); AddKeys(MouseKeysComboBox, "Mouse", new Key[] { Key.LButton, Key.MButton, Key.RButton, Key.XButton1, Key.XButton2 }); // Add X360CE buttons. var xKeys = Enum.GetValues(typeof(MapCode)).Cast <MapCode>() .Where(x => SettingsConverter.IsButtonOrDirection(x)); var sKeys = xKeys.Select(x => x.ToString()).Distinct().ToList(); sKeys.Insert(0, "XInput"); XButtonsComboBox.ItemsSource = sKeys; XButtonsComboBox.SelectedIndex = alwaysSelectedIndex; XButtonsComboBox.SelectionChanged += KeysComboBox_SelectionChanged; }
/// <summary> /// Imports communication lines and devices. /// </summary> private void Import(out bool noData) { noData = true; ImportedCommLines = new List <Settings.CommLine>(); ImportedDevices = new List <Settings.KP>(); Settings settings = instance.CommApp.Settings; foreach (TreeNode commLineNode in treeView.Nodes) { if (commLineNode.Checked) { CommLine commLineEntity = (CommLine)commLineNode.Tag; Settings.CommLine commLineSettings = CommLineSettings; if (commLineSettings == null) { // import communication line noData = false; commLineSettings = SettingsConverter.CreateCommLine(commLineEntity); commLineSettings.Parent = settings; settings.CommLines.Add(commLineSettings); ImportedCommLines.Add(commLineSettings); } foreach (TreeNode kpNode in commLineNode.Nodes) { if (kpNode.Checked) { // import device noData = false; KP kpEntity = (KP)kpNode.Tag; Settings.KP kpSettings = SettingsConverter.CreateKP(kpEntity, project.ConfigBase.KPTypeTable); kpSettings.Parent = commLineSettings; if (commEnvironment.TryGetKPView(kpSettings, true, null, out KPView kpView, out string errMsg)) { kpSettings.SetReqParams(kpView.DefaultReqParams); } commLineSettings.ReqSequence.Add(kpSettings); ImportedDevices.Add(kpSettings); } } } } }
public SettingsDTO UpdateSettings(string username, SettingsDTO dto) { var acc = accountService.GetAccountForUser(username); if (acc == null) { throw new Exception("Such account doesn't exist!"); } var settings = settingsRepository.GetById(acc.SettingsId); var newSettings = SettingsConverter.ToEntity(dto); newSettings.Id = settings.Id; settingsRepository.Save(newSettings); return(dto); }
public override ValidationResult Validate(object value, CultureInfo cultureInfo) { var v = (string)value; if (string.IsNullOrEmpty(v)) { return(ValidationResult.ValidResult); } var iniValue = SettingsConverter.ToIniValue(v); if (string.IsNullOrEmpty(iniValue)) { return(new ValidationResult(false, $"Please enter correct value.")); } return(ValidationResult.ValidResult); }
/// <summary> /// Synchronizes the communication line. /// </summary> private void SyncCommLine(Settings.CommLine commLineSettings) { if (project.ConfigBase.CommLineTable.Items.TryGetValue(commLineSettings.Number, out CommLine commLineEntity)) { commLineSettings.Name = commLineEntity.Name; } BaseTable <KP> kpTable = project.ConfigBase.KPTable; BaseTable <KPType> kpTypeTable = project.ConfigBase.KPTypeTable; foreach (Settings.KP kpSettings in commLineSettings.ReqSequence) { if (kpTable.Items.TryGetValue(kpSettings.Number, out KP kpEntity)) { SettingsConverter.Copy(kpEntity, kpSettings, kpTypeTable); } } }
private void OnDisable() { _hideBombs = false; BombActive = false; EnableDisableInput(); TwitchComponentHandle.ClaimedList.Clear(); TwitchComponentHandle.ClearUnsupportedModules(); StopAllCoroutines(); Leaderboard.Instance.BombsAttempted++; parentService.GetComponent <KMGameInfo>().OnLightsChange -= OnLightsChange; LogUploader.Instance.Post(); parentService.StartCoroutine(SendDelayedMessage(1.0f, GetBombResult(), SendAnalysisLink)); moduleCameras?.gameObject.SetActive(false); foreach (TwitchBombHandle handle in BombHandles) { if (handle != null) { Destroy(handle.gameObject, 2.0f); } } BombHandles.Clear(); BombCommanders.Clear(); DestroyComponentHandles(); MusicPlayer.StopAllMusic(); GameRoom.Instance?.OnDisable(); OtherModes.RefreshModes(); try { string path = Path.Combine(Application.persistentDataPath, "TwitchPlaysLastClaimed.json"); File.WriteAllText(path, SettingsConverter.Serialize(LastClaimedModule)); } catch (Exception ex) { DebugHelper.LogException(ex, "Couldn't Write TwitchPlaysLastClaimed.json:"); } }
private void OnEnable() { Instance = this; BombActive = true; EnableDisableInput(); Leaderboard.Instance.ClearSolo(); LogUploader.Instance.Clear(); callsNeeded = 1; CallingPlayers.Clear(); callWaiting = false; VoteDetonateAttempted = false; ProcessingClaimQueue = false; VoteSolveCount = 0; FindClaimPlayers.Clear(); MysteryModuleShim.CoveredModules.Clear(); RetryAllowed = true; _bombStarted = false; ParentService.GetComponent <KMGameInfo>().OnLightsChange += OnLightsChange; StartCoroutine(CheckForBomb()); StartCoroutine(new WaitForSeconds(TwitchPlaySettings.data.InstantModuleClaimCooldown).Yield(() => ClaimCooldown = false)); FindClaimUse = TwitchPlaySettings.data.FindClaimLimit; alertSound = gameObject.Traverse <AudioSource>("AlertSound"); StartCoroutine(AdjustFindClaimLimit()); if (OtherModes.TrainingModeOn) { StartCoroutine(EndTrainingModeBomb()); } try { string path = Path.Combine(Application.persistentDataPath, "TwitchPlaysLastClaimed.json"); LastClaimedModule = SettingsConverter.Deserialize <Dictionary <string, Dictionary <string, double> > >(File.ReadAllText(path)); } catch (Exception ex) { DebugHelper.LogException(ex, "Couldn't read TwitchPlaysLastClaimed.json:"); LastClaimedModule = new Dictionary <string, Dictionary <string, double> >(); } }
private Stream GetFileInFormat(Book book, SettingsConverter converter) { var file = FileUtils.GetBookFile(book); // TODO: zip fb2 book? if (converter == null) { logger.Debug("File {0}.{1} served directly from archive.", book.File, book.Ext); return(file); } else { logger.Debug("Trying to convert file {0} from {1} to {2}", book.File, book.Ext, converter.To); var tempDir = Path.Combine(Path.GetTempPath(), "DotOPDS_Temp"); Directory.CreateDirectory(tempDir); var from = Path.Combine(tempDir, Path.GetRandomFileName() + book.File + "." + book.Ext); var to = Path.Combine(tempDir, Path.GetRandomFileName()) + "." + converter.To; using (var output = File.Create(from)) { file.CopyTo(output); } var args = string.Format(converter.Arguments, from, to); logger.Debug("Starting converter process: {0} {1}", converter.Command, args); var process = new Process { StartInfo = new ProcessStartInfo { FileName = converter.Command, Arguments = args, WindowStyle = ProcessWindowStyle.Hidden } }; process.Start(); process.WaitForExit(); logger.Debug("Converter process exited with code {0}", process.ExitCode); return(File.OpenRead(to)); } }
private void btnOK_Click(object sender, EventArgs e) { if (ValidateFields() && CheckFeasibility(out Comm.Settings.CommLine commLineSettings)) { // create a new device int commLineNum = (int)cbCommLine.SelectedValue; KP kpEntity = new KP { KPNum = Convert.ToInt32(numKPNum.Value), Name = txtName.Text, KPTypeID = (int)cbKPType.SelectedValue, Address = txtAddress.Text == "" ? null : (int?)int.Parse(txtAddress.Text), CallNum = txtCallNum.Text, CommLineNum = commLineNum > 0 ? (int?)commLineNum : null, Descr = txtDescr.Text }; // insert the device in the configuration database project.ConfigBase.KPTable.AddItem(kpEntity); project.ConfigBase.KPTable.Modified = true; // insert the line in the Communicator settings if (chkAddToComm.Checked && cbInstance.SelectedItem is Instance instance) { if (instance.CommApp.Enabled) { KPSettings = SettingsConverter.CreateKP(kpEntity, project.ConfigBase.KPTypeTable); KPSettings.Parent = commLineSettings; commLineSettings.ReqSequence.Add(KPSettings); CommLineSettings = commLineSettings; } InstanceName = recentSelection.InstanceName = instance.Name; } recentSelection.CommLineNum = commLineNum; recentSelection.KPNum = kpEntity.KPNum; recentSelection.KPTypeID = kpEntity.KPTypeID; DialogResult = DialogResult.OK; } }
/// <summary> /// Loads settings from settings document. /// </summary> protected override void OnLoad() { if (SettingsDocument != null) { SettingsDocument.NodeChanged -= SettingsNodeChanged; SettingsDocument.NodeInserted -= SettingsNodeInserted; SettingsDocument.NodeRemoved -= SettingsNodeRemoved; } base.OnLoad(); UpdateTreeView(); SettingsDocument.NodeChanged += new SettingsNodeChangeEventHandler(SettingsNodeChanged); SettingsDocument.NodeInserted += new SettingsNodeChangeEventHandler(SettingsNodeInserted); SettingsDocument.NodeRemoved += new SettingsNodeChangeEventHandler(SettingsNodeRemoved); if (_settingsObject != null) { SettingsConverter.UpdateObjectFromNode(_settingsObject, SettingsDocument); } }