This commit is contained in:
Alexander 2022-10-28 10:02:17 +03:00
parent 1a45750f27
commit 5872049cc7
3 changed files with 36 additions and 7 deletions

View File

@ -1,4 +1,7 @@
namespace anbs_cp;
using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Html;
namespace anbs_cp;
/// <summary>
/// Конвертер типов на манер Delphi
@ -107,4 +110,28 @@ public static class TypeConverter
}
#endregion
#region Конвернтация IHtmlContent
/// <summary>
/// Преобразует тип <see cref="IHtmlContent"/> в строку <see cref="string"/>.
/// </summary>
/// <param name="content">Значение, которое нужно преобразовать.</param>
/// <returns><see cref="string"/></returns>
public static string HtmlContentToString (IHtmlContent content)
{
//Создаём writer
using StringWriter writer = new();
//Конвертируем IHtmlContent в string
content.WriteTo(writer, HtmlEncoder.Default);
//Возвращаем результат
return writer.ToString();
}
/// <summary>
/// Преобразует строку <see cref="string"/> в тип <see cref="IHtmlContent"/>.
/// </summary>
/// <param name="content">Значение, которое нужно преобразовать.</param>
/// <returns><see cref="IHtmlContent"/></returns>
public static IHtmlContent StringToHtmlContent(string content) => new HtmlContentBuilder().AppendHtml(content);
#endregion
}

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>1.2022.723</Version>
<Version>1.2022.1028</Version>
<Authors>Alexander Babaev</Authors>
<Product>ANB Software Components Pack</Product>
<Description>Library of some useful functions in C# language.</Description>
@ -13,10 +13,10 @@
<ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<SignAssembly>False</SignAssembly>
<PackageProjectUrl>https://github.com/GoodBoyAlex/anbsoftware_componentspack</PackageProjectUrl>
<RepositoryUrl>https://github.com/GoodBoyAlex/anbsoftware_componentspack</RepositoryUrl>
<AssemblyVersion>1.2022.723</AssemblyVersion>
<FileVersion>1.2022.723</FileVersion>
<PackageProjectUrl>https://git.babaev-an.ru/babaev-an/anbsoftware_componentspack</PackageProjectUrl>
<RepositoryUrl>https://git.babaev-an.ru/babaev-an/anbsoftware_componentspack</RepositoryUrl>
<AssemblyVersion>1.2022.1028</AssemblyVersion>
<FileVersion>1.2022.1028</FileVersion>
<PackageId>ANBSoftware.ComponentsPack</PackageId>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<AnalysisLevel>6.0</AnalysisLevel>
@ -33,6 +33,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop" Version="17.1.32210.191" />
</ItemGroup>

View File

@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=anbs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=_0412_0435_0440_043D_0451_043C/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=_041F_0430_0440_0441_0435_0440/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=_041F_0430_0440_0441_0435_0440/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=_0421_043E_0437_0434_0430_0451_043C/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>