コード例 #1
0
        /// <summary>
        /// Mimics the same method in SettingsUtils, but it registers every action in URS
        /// </summary>
        /// <param name="urs"></param>
        /// <param name="current"></param>
        /// <param name="new"></param>
        public static void OverrideValues(UndoRedoStack urs, BaseSettings current, BaseSettings @new)
        {
            var currentDict = current.GetUnsortedSettingPropertyGroups().ToDictionary(x => x.GroupName, x => x);

            foreach (var nspg in @new.GetAllSettingPropertyGroupDefinitions())
            {
                if (currentDict.TryGetValue(nspg.GroupName, out var spg))
                {
                    OverrideValues(urs, spg, nspg);
                }
                else
                {
                    MCMUISubModule.Logger.LogWarning("{NewId}::{GroupName} was not found on, {CurrentId}", @new.Id, nspg.GroupName, current.Id);
                }
            }
        }
コード例 #2
0
 public static List <SettingsPropertyGroupDefinition> GetSettingPropertyGroups(this BaseSettings settings) => settings
 .GetUnsortedSettingPropertyGroups()
 .SortDefault()
 .ToList();