public void ApplyFrom(IPresetMetadata presetMetadata)
        {
            if (!UserOverwrittenProperties.Contains(nameof(Author)))
            {
                Author = presetMetadata.Author;
            }

            if (!UserOverwrittenProperties.Contains(nameof(Comment)))
            {
                Comment = presetMetadata.Comment;
            }

            if (!UserOverwrittenProperties.Contains(nameof(PresetName)))
            {
                PresetName = presetMetadata.PresetName;
            }

            if (!UserOverwrittenProperties.Contains(nameof(BankPath)))
            {
                BankPath = presetMetadata.BankPath;
            }

            if (!UserOverwrittenProperties.Contains(nameof(Types)))
            {
                using (Types.SuspendChangeNotifications(SuspensionMode.None))
                {
                    Types.Clear();

                    foreach (var type in presetMetadata.Types)
                    {
                        if (!type.IsIgnored)
                        {
                            Types.Add(new Type {
                                TypeName = type.TypeName, SubTypeName = type.SubTypeName
                            });
                        }
                    }
                }
            }

            if (!UserOverwrittenProperties.Contains(nameof(Characteristics)))
            {
                using (Characteristics.SuspendChangeNotifications(SuspensionMode.None))
                {
                    Characteristics.Clear();

                    foreach (var characteristic in presetMetadata.Characteristics)
                    {
                        if (!characteristic.IsIgnored)
                        {
                            Characteristics.Add(new Characteristic
                            {
                                CharacteristicName = characteristic.CharacteristicName
                            });
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void OnAfterCerasDeserialize()
        {
            using (Types.SuspendChangeNotifications())
            {
                Types.Clear();
                Types.AddItems(SerializedTypes);
            }

            using (Characteristics.SuspendChangeNotifications())
            {
                Characteristics.Clear();
                Characteristics.AddItems(SerializedCharacteristics);
            }
        }