diff --git a/ProjectStormtrooper/ProjectStormtrooper/PlanesGenericStorage.cs b/ProjectStormtrooper/ProjectStormtrooper/PlanesGenericStorage.cs new file mode 100644 index 0000000..078087f --- /dev/null +++ b/ProjectStormtrooper/ProjectStormtrooper/PlanesGenericStorage.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectStormtrooper +{ + internal class PlanesGenericStorage + { + /// + /// Словарь (хранилище) + /// + readonly Dictionary> _planeStorages; + /// + /// Возвращение списка названий наборов + /// + public List Keys => _planeStorages.Keys.ToList(); + /// + /// Ширина окна отрисовки + /// + private readonly int _pictureWidth; + /// + /// Высота окна отрисовки + /// + private readonly int _pictureHeight; + /// + /// Конструктор + /// + /// + /// + public PlanesGenericStorage(int pictureWidth, int pictureHeight) + { + _planeStorages = new Dictionary>(); + _pictureWidth = pictureWidth; + _pictureHeight = pictureHeight; + } + /// + /// Добавление набора + /// + /// Название набора + public void AddSet(string name) + { + _planeStorages.Add(name, new PlanesGenericCollection(_pictureWidth, _pictureHeight)); + } + /// + /// Удаление набора + /// + /// Название набора + public void DelSet(string name) + { + if (_planeStorages.ContainsKey(name)) + _planeStorages.Remove(name); + } + /// + /// Доступ к набору + /// + /// + /// + public PlanesGenericCollection? this[string ind] + { + get + { + if (_planeStorages.ContainsKey(ind)) + return _planeStorages[ind]; + return null; + } + } + } +}