public static void OverrideValues(UndoRedoStack urs, SettingsPropertyGroupDefinition current, SettingsPropertyGroupDefinition @new) { foreach (var newSettingPropertyGroup in @new.SubGroups) { var settingPropertyGroup = current.SubGroups .FirstOrDefault(x => x.GroupName == newSettingPropertyGroup.GroupName); if (settingPropertyGroup is not null) { OverrideValues(urs, settingPropertyGroup, newSettingPropertyGroup); } else { MCMUISubModule.Logger.LogWarning("{NewId}::{GroupName} was not found on, {CurrentId}", @new.DisplayGroupName, newSettingPropertyGroup.GroupName, current.DisplayGroupName); } } foreach (var newSettingProperty in @new.SettingProperties) { var settingProperty = current.SettingProperties .FirstOrDefault(x => x.DisplayName == newSettingProperty.DisplayName); if (settingProperty is not null) { OverrideValues(urs, settingProperty, newSettingProperty); } else { MCMUISubModule.Logger.LogWarning("{NewId}::{GroupName} was not found on, {CurrentId}", @new.DisplayGroupName, newSettingProperty.DisplayName, current.DisplayGroupName); } } }
public static void OverrideValues(UndoRedoStack urs, SettingsPropertyGroupDefinition current, SettingsPropertyGroupDefinition @new) { var currentSubGroups = current.SubGroups.ToDictionary(x => x.GroupName, x => x); var currentSettingProperties = current.SettingProperties.ToDictionary(x => x.DisplayName, x => x); foreach (var nspg in @new.SubGroups) { if (currentSubGroups.TryGetValue(nspg.GroupName, out var spg)) { OverrideValues(urs, spg, nspg); } else { MCMUISubModule.Logger.LogWarning("{NewId}::{GroupName} was not found on, {CurrentId}", @new.DisplayGroupName, nspg.GroupName, current.DisplayGroupName); } } foreach (var nsp in @new.SettingProperties) { if (currentSettingProperties.TryGetValue(nsp.DisplayName, out var sp)) { OverrideValues(urs, sp, nsp); } else { MCMUISubModule.Logger.LogWarning("{NewId}::{GroupName} was not found on, {CurrentId}", @new.DisplayGroupName, nsp.DisplayName, current.DisplayGroupName); } } }
public static void OverrideValues(UndoRedoStack urs, SettingsPropertyGroupDefinition current, SettingsPropertyGroupDefinition @new) { foreach (var newSettingPropertyGroup in @new.SubGroups) { var settingPropertyGroup = current.SubGroups .FirstOrDefault(x => x.DisplayGroupName.ToString() == newSettingPropertyGroup.DisplayGroupName.ToString()); OverrideValues(urs, settingPropertyGroup, newSettingPropertyGroup); } foreach (var newSettingProperty in @new.SettingProperties) { var settingProperty = current.SettingProperties .FirstOrDefault(x => x.DisplayName == newSettingProperty.DisplayName); OverrideValues(urs, settingProperty, newSettingProperty); } }