From 042a2257bf908280028889bb25cbb645cc79c10a Mon Sep 17 00:00:00 2001 From: Alexander <GoodBoyAlex@users.noreply.github.com> Date: Fri, 2 Jun 2023 10:42:15 +0300 Subject: [PATCH] 20230602 --- anbs_cp/Classes/FileExtensions.cs | 4 +- anbs_cp/Structs/KeyValue.cs | 51 ++++++++++++++++++++++++++ anbs_cp/Structs/TwoDimSize.cs | 61 +++++++++++++++++++++++++++++++ anbs_cp/anbs_cp.csproj | 10 ++--- 4 files changed, 118 insertions(+), 8 deletions(-) create mode 100644 anbs_cp/Structs/KeyValue.cs create mode 100644 anbs_cp/Structs/TwoDimSize.cs 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; /// <summary> /// Класс -- расширение для класса 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; + +/// <summary> +/// Пара ключ-значение +/// </summary> +/// <typeparam name="TK">Тип ключа</typeparam> +/// <typeparam name="TV">Тип значения</typeparam> +public struct KeyValue<TK, TV> +{ + #region Конструкторы + /// <summary> + /// Конструктор по умолчанию + /// </summary> + public KeyValue () + { + Key = default; + Value = default; + } + + /// <summary> + /// Конструктор со значениями + /// </summary> + /// <param name="key">Ключ</param> + /// <param name="value">Значение</param> + public KeyValue (TK key, TV value) + { + Key = key; + Value = value; + } + #endregion + + #region Свойства + /// <summary> + /// Ключ + /// </summary> + public TK? Key { get; set; } + + /// <summary> + /// Значение + /// </summary> + public TV? Value { get; set; } + #endregion + + #region Методы + /// <summary> + /// Получает ключ-значение по умолчанию + /// </summary> + /// <returns>Ключ-значение по умолчанию</returns> + public static KeyValue<TK, TV> 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; + +/// <summary> +/// Двумерный размер +/// </summary> +public struct TwoDimSize +{ + #region Приватные поля + /// <summary> + /// Длина (приватное) + /// </summary> + private int _pWidth; + + /// <summary> + /// Высота (приватное) + /// </summary> + private int _pHeight; + #endregion + + #region Конструкторы + /// <summary> + /// Конструктор по умолчанию + /// </summary> + public TwoDimSize () + { + Width = 0; + Height = 0; + } + + /// <summary> + /// Конструктор + /// </summary> + /// <param name="width">Длина</param> + /// <param name="height">Высота</param> + public TwoDimSize (int width, int height) + { + Width = width; + Height = height; + } + #endregion + + #region Свойства + /// <summary> + /// Длина + /// </summary> + public int Width + { + readonly get => _pWidth; + set => _pWidth = value < 0 ? 0 : value; + } + + /// <summary> + /// Высота + /// </summary> + 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 @@ <PropertyGroup> <TargetFramework>net7.0</TargetFramework> - <Version>2023.0514.2</Version> + <Version>2023.0602</Version> <Authors>Александр Бабаев</Authors> <Product>Набор компонентов ANB Software</Product> <Description>Библиотека полезных методов языка C#</Description> @@ -38,13 +38,9 @@ <ItemGroup> <PackageReference Include="gfoidl.Base64" Version="2.0.0" /> - <PackageReference Include="Microsoft.VisualStudio.Shell.Interop" Version="17.5.33428.366" /> + <PackageReference Include="Microsoft.VisualStudio.Shell.Interop" Version="17.6.36389" /> <PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.1" /> - <PackageReference Include="MimeTypes" Version="2.4.1"> - <PrivateAssets>all</PrivateAssets> - <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> - </PackageReference> - <PackageReference Include="System.Text.Encodings.Web" Version="7.0.0" /> + <PackageReference Include="MimeKit" Version="4.0.0" /> </ItemGroup> <ItemGroup>