Ejemplo n.º 1
0
        public void AddPreset(PresetModel preset)
        {
            if (preset.HasErrors)
            {
                throw new InvalidOperationException("Cannot add a preset with errors.");
            }

            if (PresetExists(preset))
            {
                throw new InvalidOperationException("Cannot add an existing preset.");
            }

            var index = CollectionHelper.BinarySearch(_presets, preset);

            _presets.Insert(~index, preset);
        }