diff --git a/anbs_cp/Classes/FileExtensions.cs b/anbs_cp/Classes/FileExtensions.cs index 2988845..6dee83e 100644 --- a/anbs_cp/Classes/FileExtensions.cs +++ b/anbs_cp/Classes/FileExtensions.cs @@ -1,4 +1,6 @@ -namespace anbs_cp.Classes; +using MimeKit; + +namespace anbs_cp.Classes; /// /// Класс -- расширение для класса File diff --git a/anbs_cp/Structs/KeyValue.cs b/anbs_cp/Structs/KeyValue.cs new file mode 100644 index 0000000..ab42d49 --- /dev/null +++ b/anbs_cp/Structs/KeyValue.cs @@ -0,0 +1,51 @@ +namespace anbs_cp.Structs; + +/// +/// Пара ключ-значение +/// +/// Тип ключа +/// Тип значения +public struct KeyValue +{ + #region Конструкторы + /// + /// Конструктор по умолчанию + /// + public KeyValue () + { + Key = default; + Value = default; + } + + /// + /// Конструктор со значениями + /// + /// Ключ + /// Значение + public KeyValue (TK key, TV value) + { + Key = key; + Value = value; + } + #endregion + + #region Свойства + /// + /// Ключ + /// + public TK? Key { get; set; } + + /// + /// Значение + /// + public TV? Value { get; set; } + #endregion + + #region Методы + /// + /// Получает ключ-значение по умолчанию + /// + /// Ключ-значение по умолчанию + public static KeyValue GetDefault() => new(); + #endregion +} \ No newline at end of file diff --git a/anbs_cp/Structs/TwoDimSize.cs b/anbs_cp/Structs/TwoDimSize.cs new file mode 100644 index 0000000..1e8db7d --- /dev/null +++ b/anbs_cp/Structs/TwoDimSize.cs @@ -0,0 +1,61 @@ +namespace anbs_cp.Structs; + +/// +/// Двумерный размер +/// +public struct TwoDimSize +{ + #region Приватные поля + /// + /// Длина (приватное) + /// + private int _pWidth; + + /// + /// Высота (приватное) + /// + private int _pHeight; + #endregion + + #region Конструкторы + /// + /// Конструктор по умолчанию + /// + public TwoDimSize () + { + Width = 0; + Height = 0; + } + + /// + /// Конструктор + /// + /// Длина + /// Высота + public TwoDimSize (int width, int height) + { + Width = width; + Height = height; + } + #endregion + + #region Свойства + /// + /// Длина + /// + public int Width + { + readonly get => _pWidth; + set => _pWidth = value < 0 ? 0 : value; + } + + /// + /// Высота + /// + public int Height + { + readonly get => _pHeight; + set => _pHeight = value < 0 ? 0 : value; + } + #endregion +} \ No newline at end of file diff --git a/anbs_cp/anbs_cp.csproj b/anbs_cp/anbs_cp.csproj index 21ced65..9037109 100644 --- a/anbs_cp/anbs_cp.csproj +++ b/anbs_cp/anbs_cp.csproj @@ -2,7 +2,7 @@ net7.0 - 2023.0514.2 + 2023.0602 Александр Бабаев Набор компонентов ANB Software Библиотека полезных методов языка C# @@ -38,13 +38,9 @@ - + - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - +