diff --git a/BD.Common.sln b/BD.Common.sln index 0f0134f19..6b428dd44 100644 --- a/BD.Common.sln +++ b/BD.Common.sln @@ -19,10 +19,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Root", "_Root", "{F221D7EA ProjectSection(SolutionItems) = preProject src\.editorconfig = src\.editorconfig .gitignore = .gitignore + .gitmodules = .gitmodules .github\workflows\CI.yml = .github\workflows\CI.yml src\Directory.Build.props = src\Directory.Build.props ref\DirectoryPackages\Directory.Packages.props = ref\DirectoryPackages\Directory.Packages.props src\GeneratePackage.props = src\GeneratePackage.props + nuget.config = nuget.config README.md = README.md EndProjectSection EndProject @@ -110,15 +112,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BD.Common.DynamicHttpWindow EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TFM", "TFM", "{149E7C8E-7B18-4363-A327-B80B65DB74A9}" ProjectSection(SolutionItems) = preProject - src\TFM_NET7.props = src\TFM_NET7.props - src\TFM_NET7_ANDROID.props = src\TFM_NET7_ANDROID.props - src\TFM_NET7_IOS.props = src\TFM_NET7_IOS.props - src\TFM_NET7_IOS_MACOS_MACCATALYST.props = src\TFM_NET7_IOS_MACOS_MACCATALYST.props - src\TFM_NET7_MAUI.props = src\TFM_NET7_MAUI.props - src\TFM_NET7_WINDOWS.props = src\TFM_NET7_WINDOWS.props - src\TFM_NET7_WITH_ALL.props = src\TFM_NET7_WITH_ALL.props - src\TFM_NET7_WITH_ANDROID.props = src\TFM_NET7_WITH_ANDROID.props - src\TFM_NET7_WITH_WINDOWS.props = src\TFM_NET7_WITH_WINDOWS.props + src\TFM_NETX.props = src\TFM_NETX.props + src\TFM_NETX_ANDROID.props = src\TFM_NETX_ANDROID.props + src\TFM_NETX_IOS.props = src\TFM_NETX_IOS.props + src\TFM_NETX_IOS_MACOS_MACCATALYST.props = src\TFM_NETX_IOS_MACOS_MACCATALYST.props + src\TFM_NETX_MAUI.props = src\TFM_NETX_MAUI.props + src\TFM_NETX_WINDOWS.props = src\TFM_NETX_WINDOWS.props + src\TFM_NETX_WITH_ALL.props = src\TFM_NETX_WITH_ALL.props + src\TFM_NETX_WITH_ANDROID.props = src\TFM_NETX_WITH_ANDROID.props + src\TFM_NETX_WITH_WINDOWS.props = src\TFM_NETX_WITH_WINDOWS.props EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ImplicitUsings", "ImplicitUsings", "{78E65096-FE22-4E82-AB15-EB4CB986194B}" @@ -178,7 +180,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BD.Common.Settings.V4.Sourc EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BD.Common.Settings.V4.SourceGenerator.Tools", "src\BD.Common.Settings.V4.SourceGenerator.Tools\BD.Common.Settings.V4.SourceGenerator.Tools.csproj", "{45B649C9-70DE-4D5A-B10A-2F1CA5F657BB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BD.Common.AspNetCore.SourceGenerator", "src\BD.Common.AspNetCore.SourceGenerator\BD.Common.AspNetCore.SourceGenerator.csproj", "{7923D9C3-B2AC-4435-9065-17A6B6CD1B34}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BD.Common.AspNetCore.SourceGenerator", "src\BD.Common.AspNetCore.SourceGenerator\BD.Common.AspNetCore.SourceGenerator.csproj", "{7923D9C3-B2AC-4435-9065-17A6B6CD1B34}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BD.Common.Repositories.SourceGenerator.Annotations", "src\BD.Common.Repositories.SourceGenerator.Annotations\BD.Common.Repositories.SourceGenerator.Annotations.csproj", "{28C1F178-7080-48B3-93F5-45C4D38A3748}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BD.Common.Repositories.SourceGenerator", "src\BD.Common.Repositories.SourceGenerator\BD.Common.Repositories.SourceGenerator.csproj", "{1B63CB93-87E7-4158-9849-2FA09A139FC1}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SourceGenerator", "SourceGenerator", "{38AD83FC-B2FD-4458-ACEE-84B2B768FA6D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{67F7A45D-E442-4F64-A2B1-776DFBC772BD}" + ProjectSection(SolutionItems) = preProject + src\Translate.cs = src\Translate.cs + src\Utils.cs = src\Utils.cs + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -354,6 +368,14 @@ Global {7923D9C3-B2AC-4435-9065-17A6B6CD1B34}.Debug|Any CPU.Build.0 = Debug|Any CPU {7923D9C3-B2AC-4435-9065-17A6B6CD1B34}.Release|Any CPU.ActiveCfg = Release|Any CPU {7923D9C3-B2AC-4435-9065-17A6B6CD1B34}.Release|Any CPU.Build.0 = Release|Any CPU + {28C1F178-7080-48B3-93F5-45C4D38A3748}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28C1F178-7080-48B3-93F5-45C4D38A3748}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28C1F178-7080-48B3-93F5-45C4D38A3748}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28C1F178-7080-48B3-93F5-45C4D38A3748}.Release|Any CPU.Build.0 = Release|Any CPU + {1B63CB93-87E7-4158-9849-2FA09A139FC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1B63CB93-87E7-4158-9849-2FA09A139FC1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1B63CB93-87E7-4158-9849-2FA09A139FC1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1B63CB93-87E7-4158-9849-2FA09A139FC1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -390,7 +412,7 @@ Global {41FCFFCC-CC2D-42E9-8289-D1FCE1864553} = {2396192B-A608-4B23-B05C-ED66885398A9} {34A24725-D4B5-45B2-950B-DA1414715705} = {72184E2D-34EE-4E81-9008-1B2E4FC03972} {149E7C8E-7B18-4363-A327-B80B65DB74A9} = {F221D7EA-7ADF-4F89-B2C9-6373E52D8731} - {78E65096-FE22-4E82-AB15-EB4CB986194B} = {F221D7EA-7ADF-4F89-B2C9-6373E52D8731} + {78E65096-FE22-4E82-AB15-EB4CB986194B} = {67F7A45D-E442-4F64-A2B1-776DFBC772BD} {B3A960DC-6E46-48D3-A3AE-A77E1989504B} = {72184E2D-34EE-4E81-9008-1B2E4FC03972} {6A660134-CEF5-4066-8A4E-B7543A2695C5} = {F221D7EA-7ADF-4F89-B2C9-6373E52D8731} {1DDE0DE2-D729-4DAA-B61E-E6A200B11C00} = {F221D7EA-7ADF-4F89-B2C9-6373E52D8731} @@ -399,6 +421,10 @@ Global {668C6475-1857-4CCB-AF7D-C3FD96C3C88B} = {D47E3B6A-2AE8-4AD4-ABA4-9BC9750FAE9A} {45B649C9-70DE-4D5A-B10A-2F1CA5F657BB} = {D47E3B6A-2AE8-4AD4-ABA4-9BC9750FAE9A} {7923D9C3-B2AC-4435-9065-17A6B6CD1B34} = {AEF20BA0-D8EC-49EB-8050-440DE5933957} + {28C1F178-7080-48B3-93F5-45C4D38A3748} = {38AD83FC-B2FD-4458-ACEE-84B2B768FA6D} + {1B63CB93-87E7-4158-9849-2FA09A139FC1} = {38AD83FC-B2FD-4458-ACEE-84B2B768FA6D} + {38AD83FC-B2FD-4458-ACEE-84B2B768FA6D} = {09F764B5-4DB4-40B3-84B0-B9DD15AB69AA} + {67F7A45D-E442-4F64-A2B1-776DFBC772BD} = {F221D7EA-7ADF-4F89-B2C9-6373E52D8731} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3ABA6CBD-C4DB-4300-B2A2-087D9B5C872A} diff --git a/nuget.config b/nuget.config new file mode 100644 index 000000000..acdb3d260 --- /dev/null +++ b/nuget.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/.editorconfig b/src/.editorconfig index 39e6eb591..eed987cce 100644 --- a/src/.editorconfig +++ b/src/.editorconfig @@ -122,7 +122,7 @@ csharp_prefer_static_local_function = true csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async # 代码块首选项 -csharp_style_namespace_declarations=file_scoped:error +csharp_style_namespace_declarations=file_scoped:suggestion csharp_prefer_braces = false csharp_prefer_simple_using_statement = true @@ -282,7 +282,7 @@ dotnet_diagnostic.SA1633.severity = silent dotnet_diagnostic.SA1128.severity = silent # SA1413: Use trailing comma in multi-line initializers -dotnet_diagnostic.SA1413.severity = error +dotnet_diagnostic.SA1413.severity = suggestion # SA1005: Single line comments should begin with single space dotnet_diagnostic.SA1005.severity = none @@ -482,39 +482,6 @@ dotnet_diagnostic.CS8604.severity = error # CA1829: 在可用时使用 Length/Count 属性而不是 Count() dotnet_diagnostic.CA1829.severity = error -# CS8601: 引用类型赋值可能为 null。 -dotnet_diagnostic.CS8601.severity = error - -# CS8603: 可能返回 null 引用。 -dotnet_diagnostic.CS8603.severity = error - -# IDE0005: Using 指令是不需要的。 -dotnet_diagnostic.IDE0005.severity = error - -# CS8602: 解引用可能出现空引用。 -dotnet_diagnostic.CS8602.severity = error - -# CS8766: 返回类型中引用类型的为 Null 性与隐式实现的成员不匹配(可能是由于为 Null 性特性)。 -dotnet_diagnostic.CS8766.severity = error - -# CS8600: 将 null 字面量或可能为 null 的值转换为非 null 类型。 -dotnet_diagnostic.CS8600.severity = error - -# CS8767: 参数类型中引用类型的为 Null 性与隐式实现的成员不匹配(可能是由于为 Null 性特性)。 -dotnet_diagnostic.CS8767.severity = error - -# CS8625: 无法将 null 字面量转换为非 null 的引用类型。 -dotnet_diagnostic.CS8625.severity = error - -# CS8765: 参数类型的为 Null 性与重写成员不匹配(可能是由于为 Null 性特性)。 -dotnet_diagnostic.CS8765.severity = error - -# CS8619: 值中的引用类型的为 Null 性与目标类型不匹配。 -dotnet_diagnostic.CS8619.severity = error - -# CS8622: Nullability of reference types in type of parameter doesn't match the target delegate (possibly because of nullability attributes). -dotnet_diagnostic.CS8622.severity = error - # CA1846: 首选 “AsSpan” 而不是 “Substring” dotnet_diagnostic.CA1846.severity = error diff --git a/src/BD.Common.Area.ConsoleTest/BD.Common.Area.ConsoleTest.csproj b/src/BD.Common.Area.ConsoleTest/BD.Common.Area.ConsoleTest.csproj index 68f9b384a..37b9c9712 100644 --- a/src/BD.Common.Area.ConsoleTest/BD.Common.Area.ConsoleTest.csproj +++ b/src/BD.Common.Area.ConsoleTest/BD.Common.Area.ConsoleTest.csproj @@ -28,6 +28,6 @@ - + diff --git a/src/BD.Common.Area/BD.Common.Area.csproj b/src/BD.Common.Area/BD.Common.Area.csproj index 85a7e372f..9f53b8931 100644 --- a/src/BD.Common.Area/BD.Common.Area.csproj +++ b/src/BD.Common.Area/BD.Common.Area.csproj @@ -45,7 +45,7 @@ - + diff --git a/src/BD.Common.AspNetCore.Blazor.BackManage/BD.Common.AspNetCore.Blazor.BackManage.csproj b/src/BD.Common.AspNetCore.Blazor.BackManage/BD.Common.AspNetCore.Blazor.BackManage.csproj index 2f1fc143d..d8307e4be 100644 --- a/src/BD.Common.AspNetCore.Blazor.BackManage/BD.Common.AspNetCore.Blazor.BackManage.csproj +++ b/src/BD.Common.AspNetCore.Blazor.BackManage/BD.Common.AspNetCore.Blazor.BackManage.csproj @@ -96,7 +96,7 @@ - + diff --git a/src/BD.Common.AspNetCore.Identity.BackManage/BD.Common.AspNetCore.Identity.BackManage.csproj b/src/BD.Common.AspNetCore.Identity.BackManage/BD.Common.AspNetCore.Identity.BackManage.csproj index fbe70a9e3..2ad6ad9b2 100644 --- a/src/BD.Common.AspNetCore.Identity.BackManage/BD.Common.AspNetCore.Identity.BackManage.csproj +++ b/src/BD.Common.AspNetCore.Identity.BackManage/BD.Common.AspNetCore.Identity.BackManage.csproj @@ -64,7 +64,7 @@ - + \ No newline at end of file diff --git a/src/BD.Common.AspNetCore.Identity/BD.Common.AspNetCore.Identity.csproj b/src/BD.Common.AspNetCore.Identity/BD.Common.AspNetCore.Identity.csproj index 73bfd518a..54c004235 100644 --- a/src/BD.Common.AspNetCore.Identity/BD.Common.AspNetCore.Identity.csproj +++ b/src/BD.Common.AspNetCore.Identity/BD.Common.AspNetCore.Identity.csproj @@ -63,7 +63,7 @@ - + \ No newline at end of file diff --git a/src/BD.Common.AspNetCore/BD.Common.AspNetCore.csproj b/src/BD.Common.AspNetCore/BD.Common.AspNetCore.csproj index 178743490..84861e690 100644 --- a/src/BD.Common.AspNetCore/BD.Common.AspNetCore.csproj +++ b/src/BD.Common.AspNetCore/BD.Common.AspNetCore.csproj @@ -53,7 +53,7 @@ - + \ No newline at end of file diff --git a/src/BD.Common.BirthDate/BD.Common.BirthDate.csproj b/src/BD.Common.BirthDate/BD.Common.BirthDate.csproj index 1215378d9..c8b9d2d7e 100644 --- a/src/BD.Common.BirthDate/BD.Common.BirthDate.csproj +++ b/src/BD.Common.BirthDate/BD.Common.BirthDate.csproj @@ -38,7 +38,7 @@ - + diff --git a/src/BD.Common.DynamicHttpWindowsProxy.ConsoleTest/BD.Common.DynamicHttpWindowsProxy.ConsoleTest.csproj b/src/BD.Common.DynamicHttpWindowsProxy.ConsoleTest/BD.Common.DynamicHttpWindowsProxy.ConsoleTest.csproj index 95e537ec9..98481741a 100644 --- a/src/BD.Common.DynamicHttpWindowsProxy.ConsoleTest/BD.Common.DynamicHttpWindowsProxy.ConsoleTest.csproj +++ b/src/BD.Common.DynamicHttpWindowsProxy.ConsoleTest/BD.Common.DynamicHttpWindowsProxy.ConsoleTest.csproj @@ -9,6 +9,6 @@ - + diff --git a/src/BD.Common.EFCore/BD.Common.EFCore.csproj b/src/BD.Common.EFCore/BD.Common.EFCore.csproj index 3f865c418..b8a0e1d1b 100644 --- a/src/BD.Common.EFCore/BD.Common.EFCore.csproj +++ b/src/BD.Common.EFCore/BD.Common.EFCore.csproj @@ -43,7 +43,7 @@ - + \ No newline at end of file diff --git a/src/BD.Common.EFCore/Extensions/QueryableExtensions.Paging.cs b/src/BD.Common.EFCore/Extensions/QueryableExtensions.Paging.cs index 887de32b9..deec61277 100644 --- a/src/BD.Common.EFCore/Extensions/QueryableExtensions.Paging.cs +++ b/src/BD.Common.EFCore/Extensions/QueryableExtensions.Paging.cs @@ -32,7 +32,7 @@ public static async Task> PagingAsync( var futureTotal = source.DeferredCount().FutureValue(); query = source.Skip(skipCount).Take(pageSize); #if DEBUG - var sqlString = query.ToQueryString(); + var sqlString = query.ToQueryString(); #endif var futureDataSource = query.Future(); total = await futureTotal.ValueAsync(cancellationToken); @@ -51,7 +51,7 @@ public static async Task> PagingAsync( total = await source.CountAsync(cancellationToken); query = source.Skip(skipCount).Take(pageSize); #if DEBUG - var sqlString = query.ToQueryString(); + var sqlString2 = query.ToQueryString(); #endif dataSource = await query.ToArrayAsync(cancellationToken); pagedModel = new PagedModel diff --git a/src/BD.Common.Essentials.Maui/BD.Common.Essentials.Maui.csproj b/src/BD.Common.Essentials.Maui/BD.Common.Essentials.Maui.csproj index 66f7b1750..398327346 100644 --- a/src/BD.Common.Essentials.Maui/BD.Common.Essentials.Maui.csproj +++ b/src/BD.Common.Essentials.Maui/BD.Common.Essentials.Maui.csproj @@ -42,7 +42,7 @@ - + diff --git a/src/BD.Common.Essentials.Preferences.DBreeze/BD.Common.Essentials.Preferences.DBreeze.csproj b/src/BD.Common.Essentials.Preferences.DBreeze/BD.Common.Essentials.Preferences.DBreeze.csproj index 2fb7c30a4..e4f868ac7 100644 --- a/src/BD.Common.Essentials.Preferences.DBreeze/BD.Common.Essentials.Preferences.DBreeze.csproj +++ b/src/BD.Common.Essentials.Preferences.DBreeze/BD.Common.Essentials.Preferences.DBreeze.csproj @@ -48,7 +48,7 @@ - + diff --git a/src/BD.Common.Essentials.Preferences.SQLite/BD.Common.Essentials.Preferences.SQLite.csproj b/src/BD.Common.Essentials.Preferences.SQLite/BD.Common.Essentials.Preferences.SQLite.csproj index 93790d368..bdabdf4df 100644 --- a/src/BD.Common.Essentials.Preferences.SQLite/BD.Common.Essentials.Preferences.SQLite.csproj +++ b/src/BD.Common.Essentials.Preferences.SQLite/BD.Common.Essentials.Preferences.SQLite.csproj @@ -34,7 +34,7 @@ - + diff --git a/src/BD.Common.Essentials.Primitives/BD.Common.Essentials.Primitives.csproj b/src/BD.Common.Essentials.Primitives/BD.Common.Essentials.Primitives.csproj index 3cd561b4c..ce68616a4 100644 --- a/src/BD.Common.Essentials.Primitives/BD.Common.Essentials.Primitives.csproj +++ b/src/BD.Common.Essentials.Primitives/BD.Common.Essentials.Primitives.csproj @@ -27,7 +27,7 @@ - + diff --git a/src/BD.Common.Essentials.Utils/BD.Common.Essentials.Utils.csproj b/src/BD.Common.Essentials.Utils/BD.Common.Essentials.Utils.csproj index 41416f3e2..c3db46f6e 100644 --- a/src/BD.Common.Essentials.Utils/BD.Common.Essentials.Utils.csproj +++ b/src/BD.Common.Essentials.Utils/BD.Common.Essentials.Utils.csproj @@ -30,7 +30,7 @@ - + diff --git a/src/BD.Common.Essentials.Xamarin/BD.Common.Essentials.Xamarin.csproj b/src/BD.Common.Essentials.Xamarin/BD.Common.Essentials.Xamarin.csproj index 1544d560b..07229cf2c 100644 --- a/src/BD.Common.Essentials.Xamarin/BD.Common.Essentials.Xamarin.csproj +++ b/src/BD.Common.Essentials.Xamarin/BD.Common.Essentials.Xamarin.csproj @@ -40,7 +40,7 @@ - + diff --git a/src/BD.Common.Essentials/BD.Common.Essentials.csproj b/src/BD.Common.Essentials/BD.Common.Essentials.csproj index c75218c55..f1bf7b193 100644 --- a/src/BD.Common.Essentials/BD.Common.Essentials.csproj +++ b/src/BD.Common.Essentials/BD.Common.Essentials.csproj @@ -28,7 +28,7 @@ - + diff --git a/src/BD.Common.ModelValidator/BD.Common.ModelValidator.csproj b/src/BD.Common.ModelValidator/BD.Common.ModelValidator.csproj index b6aed7afb..e9351073a 100644 --- a/src/BD.Common.ModelValidator/BD.Common.ModelValidator.csproj +++ b/src/BD.Common.ModelValidator/BD.Common.ModelValidator.csproj @@ -50,7 +50,7 @@ - + diff --git a/src/BD.Common.Mvvm.ReactiveUI/BD.Common.Mvvm.ReactiveUI.csproj b/src/BD.Common.Mvvm.ReactiveUI/BD.Common.Mvvm.ReactiveUI.csproj index 5376de552..4cc9d0ee9 100644 --- a/src/BD.Common.Mvvm.ReactiveUI/BD.Common.Mvvm.ReactiveUI.csproj +++ b/src/BD.Common.Mvvm.ReactiveUI/BD.Common.Mvvm.ReactiveUI.csproj @@ -24,7 +24,7 @@ - + diff --git a/src/BD.Common.Mvvm/BD.Common.Mvvm.csproj b/src/BD.Common.Mvvm/BD.Common.Mvvm.csproj index 3a9280d54..96b3446a8 100644 --- a/src/BD.Common.Mvvm/BD.Common.Mvvm.csproj +++ b/src/BD.Common.Mvvm/BD.Common.Mvvm.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/BD.Common.Navigation/BD.Common.Navigation.csproj b/src/BD.Common.Navigation/BD.Common.Navigation.csproj index 7c853ac45..674d24b32 100644 --- a/src/BD.Common.Navigation/BD.Common.Navigation.csproj +++ b/src/BD.Common.Navigation/BD.Common.Navigation.csproj @@ -17,7 +17,7 @@ - + diff --git a/src/BD.Common.PhoneNumber/BD.Common.PhoneNumber.csproj b/src/BD.Common.PhoneNumber/BD.Common.PhoneNumber.csproj index 98e83a612..8fba8733e 100644 --- a/src/BD.Common.PhoneNumber/BD.Common.PhoneNumber.csproj +++ b/src/BD.Common.PhoneNumber/BD.Common.PhoneNumber.csproj @@ -38,7 +38,7 @@ - + diff --git a/src/BD.Common.Pinyin.CFStringTransform/BD.Common.Pinyin.CFStringTransform.csproj b/src/BD.Common.Pinyin.CFStringTransform/BD.Common.Pinyin.CFStringTransform.csproj index 709f59bee..7cd13256b 100644 --- a/src/BD.Common.Pinyin.CFStringTransform/BD.Common.Pinyin.CFStringTransform.csproj +++ b/src/BD.Common.Pinyin.CFStringTransform/BD.Common.Pinyin.CFStringTransform.csproj @@ -25,7 +25,7 @@ - + diff --git a/src/BD.Common.Pinyin.ChnCharInfo/BD.Common.Pinyin.ChnCharInfo.csproj b/src/BD.Common.Pinyin.ChnCharInfo/BD.Common.Pinyin.ChnCharInfo.csproj index 26388e0cc..1b6c3c956 100644 --- a/src/BD.Common.Pinyin.ChnCharInfo/BD.Common.Pinyin.ChnCharInfo.csproj +++ b/src/BD.Common.Pinyin.ChnCharInfo/BD.Common.Pinyin.ChnCharInfo.csproj @@ -31,7 +31,7 @@ - + diff --git a/src/BD.Common.Pinyin.TinyPinyin/BD.Common.Pinyin.TinyPinyin.csproj b/src/BD.Common.Pinyin.TinyPinyin/BD.Common.Pinyin.TinyPinyin.csproj index 63d582f2a..34028823b 100644 --- a/src/BD.Common.Pinyin.TinyPinyin/BD.Common.Pinyin.TinyPinyin.csproj +++ b/src/BD.Common.Pinyin.TinyPinyin/BD.Common.Pinyin.TinyPinyin.csproj @@ -33,7 +33,7 @@ - + diff --git a/src/BD.Common.Pinyin/BD.Common.Pinyin.csproj b/src/BD.Common.Pinyin/BD.Common.Pinyin.csproj index 3f061a5ba..b5ccfd7a2 100644 --- a/src/BD.Common.Pinyin/BD.Common.Pinyin.csproj +++ b/src/BD.Common.Pinyin/BD.Common.Pinyin.csproj @@ -24,7 +24,7 @@ - + diff --git a/src/BD.Common.Primitives.ApiResponse/BD.Common.Primitives.ApiResponse.csproj b/src/BD.Common.Primitives.ApiResponse/BD.Common.Primitives.ApiResponse.csproj index 18784e53a..b925e6f46 100644 --- a/src/BD.Common.Primitives.ApiResponse/BD.Common.Primitives.ApiResponse.csproj +++ b/src/BD.Common.Primitives.ApiResponse/BD.Common.Primitives.ApiResponse.csproj @@ -8,7 +8,7 @@ __API_RSP__;$(DefineConstants) - + diff --git a/src/BD.Common.Primitives/BD.Common.Primitives.csproj b/src/BD.Common.Primitives/BD.Common.Primitives.csproj index bc785fcd8..9b99b6444 100644 --- a/src/BD.Common.Primitives/BD.Common.Primitives.csproj +++ b/src/BD.Common.Primitives/BD.Common.Primitives.csproj @@ -41,7 +41,7 @@ - + \ No newline at end of file diff --git a/src/BD.Common.Repositories.EFCore/BD.Common.Repositories.EFCore.csproj b/src/BD.Common.Repositories.EFCore/BD.Common.Repositories.EFCore.csproj index 5291bf2b4..84f1fa1a5 100644 --- a/src/BD.Common.Repositories.EFCore/BD.Common.Repositories.EFCore.csproj +++ b/src/BD.Common.Repositories.EFCore/BD.Common.Repositories.EFCore.csproj @@ -39,7 +39,7 @@ - + diff --git a/src/BD.Common.Repositories.SQLitePCL/BD.Common.Repositories.SQLitePCL.csproj b/src/BD.Common.Repositories.SQLitePCL/BD.Common.Repositories.SQLitePCL.csproj index 09fefd1b6..5aaf8ac66 100644 --- a/src/BD.Common.Repositories.SQLitePCL/BD.Common.Repositories.SQLitePCL.csproj +++ b/src/BD.Common.Repositories.SQLitePCL/BD.Common.Repositories.SQLitePCL.csproj @@ -48,7 +48,7 @@ - + diff --git a/src/BD.Common.Repositories.SourceGenerator.Annotations/BD.Common.Repositories.SourceGenerator.Annotations.csproj b/src/BD.Common.Repositories.SourceGenerator.Annotations/BD.Common.Repositories.SourceGenerator.Annotations.csproj new file mode 100644 index 000000000..d85a4de7e --- /dev/null +++ b/src/BD.Common.Repositories.SourceGenerator.Annotations/BD.Common.Repositories.SourceGenerator.Annotations.csproj @@ -0,0 +1,18 @@ + + + + netstandard2.0 + BeyondDimension Common CommonRepositories Repositories SourceGenerator Annotations + $(Product) + enable + + + + + + + + + + + diff --git a/src/BD.Common.Repositories.SourceGenerator/BD.Common.Repositories.SourceGenerator.csproj b/src/BD.Common.Repositories.SourceGenerator/BD.Common.Repositories.SourceGenerator.csproj new file mode 100644 index 000000000..9d61f075c --- /dev/null +++ b/src/BD.Common.Repositories.SourceGenerator/BD.Common.Repositories.SourceGenerator.csproj @@ -0,0 +1,48 @@ + + + + netstandard2.0 + BeyondDimension Common CommonRepositories Repositories SourceGenerator + $(Product) + true + true + enable + true + + + + + + + + + + Extensions + + + Extensions + + + Helpers + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + diff --git a/src/BD.Common.Repositories/BD.Common.Repositories.csproj b/src/BD.Common.Repositories/BD.Common.Repositories.csproj index 1b1fca63d..af9ba394f 100644 --- a/src/BD.Common.Repositories/BD.Common.Repositories.csproj +++ b/src/BD.Common.Repositories/BD.Common.Repositories.csproj @@ -24,7 +24,7 @@ - + diff --git a/src/BD.Common.Security/BD.Common.Security.csproj b/src/BD.Common.Security/BD.Common.Security.csproj index 319d19e5e..5a91fc4ce 100644 --- a/src/BD.Common.Security/BD.Common.Security.csproj +++ b/src/BD.Common.Security/BD.Common.Security.csproj @@ -20,7 +20,7 @@ - + diff --git a/src/BD.Common.Settings.V3/BD.Common.Settings.V3.csproj b/src/BD.Common.Settings.V3/BD.Common.Settings.V3.csproj index e34a78a9b..44fa5a8cc 100644 --- a/src/BD.Common.Settings.V3/BD.Common.Settings.V3.csproj +++ b/src/BD.Common.Settings.V3/BD.Common.Settings.V3.csproj @@ -20,7 +20,7 @@ - + diff --git a/src/BD.Common.Settings.V4.SourceGenerator.Tools/BD.Common.Settings.V4.SourceGenerator.Tools.csproj b/src/BD.Common.Settings.V4.SourceGenerator.Tools/BD.Common.Settings.V4.SourceGenerator.Tools.csproj index a95238c75..fc67c2ab3 100644 --- a/src/BD.Common.Settings.V4.SourceGenerator.Tools/BD.Common.Settings.V4.SourceGenerator.Tools.csproj +++ b/src/BD.Common.Settings.V4.SourceGenerator.Tools/BD.Common.Settings.V4.SourceGenerator.Tools.csproj @@ -25,6 +25,6 @@ - + diff --git a/src/BD.Common.Settings.V4.SourceGenerator/IndexRange.cs b/src/BD.Common.Settings.V4.SourceGenerator/IndexRange.cs index 4faf797be..7724c4c52 100644 --- a/src/BD.Common.Settings.V4.SourceGenerator/IndexRange.cs +++ b/src/BD.Common.Settings.V4.SourceGenerator/IndexRange.cs @@ -3,6 +3,7 @@ using System.Runtime.CompilerServices; +// ReSharper disable once CheckNamespace namespace System { /// Represent a type can be used to index a collection either from the start or the end. @@ -233,6 +234,7 @@ public override string ToString() } } +// ReSharper disable once CheckNamespace namespace System.Runtime.CompilerServices { internal static class RuntimeHelpers diff --git a/src/BD.Common.Settings.V4.SourceGenerator/IsExternalInit.cs b/src/BD.Common.Settings.V4.SourceGenerator/IsExternalInit.cs index b25ce1b68..2e6e90553 100644 --- a/src/BD.Common.Settings.V4.SourceGenerator/IsExternalInit.cs +++ b/src/BD.Common.Settings.V4.SourceGenerator/IsExternalInit.cs @@ -7,6 +7,7 @@ // https://docs.microsoft.com/zh-cn/dotnet/api/system.runtime.compilerservices.isexternalinit?view=net-6.0 using System.ComponentModel; +// ReSharper disable once CheckNamespace namespace System.Runtime.CompilerServices; [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/src/BD.Common.Settings.V4/BD.Common.Settings.V4.csproj b/src/BD.Common.Settings.V4/BD.Common.Settings.V4.csproj index 013eac69b..ae95ed969 100644 --- a/src/BD.Common.Settings.V4/BD.Common.Settings.V4.csproj +++ b/src/BD.Common.Settings.V4/BD.Common.Settings.V4.csproj @@ -18,7 +18,7 @@ - + diff --git a/src/BD.Common.Settings/BD.Common.Settings.csproj b/src/BD.Common.Settings/BD.Common.Settings.csproj index dfcbb0b34..782a46a82 100644 --- a/src/BD.Common.Settings/BD.Common.Settings.csproj +++ b/src/BD.Common.Settings/BD.Common.Settings.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/BD.Common.SmsSender/BD.Common.SmsSender.csproj b/src/BD.Common.SmsSender/BD.Common.SmsSender.csproj index feb0e44b8..9f02fd499 100644 --- a/src/BD.Common.SmsSender/BD.Common.SmsSender.csproj +++ b/src/BD.Common.SmsSender/BD.Common.SmsSender.csproj @@ -42,7 +42,7 @@ - + diff --git a/src/BD.Common.Toast/BD.Common.Toast.csproj b/src/BD.Common.Toast/BD.Common.Toast.csproj index 2b1929d52..dc6aed988 100644 --- a/src/BD.Common.Toast/BD.Common.Toast.csproj +++ b/src/BD.Common.Toast/BD.Common.Toast.csproj @@ -28,7 +28,7 @@ - + diff --git a/src/BD.Common.UnitTest/BD.Common.UnitTest.csproj b/src/BD.Common.UnitTest/BD.Common.UnitTest.csproj index 61f234785..a2d0c6a74 100644 --- a/src/BD.Common.UnitTest/BD.Common.UnitTest.csproj +++ b/src/BD.Common.UnitTest/BD.Common.UnitTest.csproj @@ -28,6 +28,6 @@ - + diff --git a/src/BD.Common/BD.Common.csproj b/src/BD.Common/BD.Common.csproj index b0fd486f1..4a502b0f7 100644 --- a/src/BD.Common/BD.Common.csproj +++ b/src/BD.Common/BD.Common.csproj @@ -74,7 +74,7 @@ - + \ No newline at end of file diff --git a/src/BD.Common/Extensions/StreamExtensions.Format.cs b/src/BD.Common/Extensions/StreamExtensions.Format.cs new file mode 100644 index 000000000..f83c8ba01 --- /dev/null +++ b/src/BD.Common/Extensions/StreamExtensions.Format.cs @@ -0,0 +1,34 @@ +// ReSharper disable once CheckNamespace +namespace System; + +public static partial class StreamExtensions +{ + const byte l_brace = 123; + const byte r_brace = 125; + + public static void WriteFormat(this Stream stream, + ReadOnlySpan utf8String, + params object?[] args) + { + var index_l_brace = utf8String.IndexOf(l_brace); + if (index_l_brace >= 0) + { + var index_l_brace_add_1 = index_l_brace + 1; + if (index_l_brace_add_1 < utf8String.Length) + { + if (utf8String[index_l_brace_add_1] == l_brace) + { + stream.Write(utf8String[..index_l_brace_add_1]); + stream.WriteFormat(utf8String[index_l_brace_add_1..], args); + return; + } + else + { + + } + } + } + + stream.Write(utf8String); + } +} \ No newline at end of file diff --git a/src/BD.Common/Extensions/StreamExtensions.cs b/src/BD.Common/Extensions/StreamExtensions.cs index 0e205220d..6acc3555d 100644 --- a/src/BD.Common/Extensions/StreamExtensions.cs +++ b/src/BD.Common/Extensions/StreamExtensions.cs @@ -1,7 +1,7 @@ // ReSharper disable once CheckNamespace namespace System; -public static class StreamExtensions +public static partial class StreamExtensions { [MethodImpl(MethodImplOptions.AggressiveInlining)] public static byte ReadValueU8(this Stream stream) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 0f2db41df..c76b41b46 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,5 +1,6 @@ + 7.0 $(NoWarn);NU1507;1591;SA1612;IL2026 latest enable diff --git a/src/TFM_NET7.props b/src/TFM_NETX.props similarity index 71% rename from src/TFM_NET7.props rename to src/TFM_NETX.props index 6ec52ad04..c8fe6f15b 100644 --- a/src/TFM_NET7.props +++ b/src/TFM_NETX.props @@ -1,6 +1,6 @@ - net7.0 + net$(DotNet_Version).0 diff --git a/src/TFM_NET7_ANDROID.props b/src/TFM_NETX_ANDROID.props similarity index 74% rename from src/TFM_NET7_ANDROID.props rename to src/TFM_NETX_ANDROID.props index 20baa30ac..745161615 100644 --- a/src/TFM_NET7_ANDROID.props +++ b/src/TFM_NETX_ANDROID.props @@ -1,6 +1,6 @@ - net7.0-android + net$(DotNet_Version).0-android 21.0 \ No newline at end of file diff --git a/src/TFM_NET7_IOS.props b/src/TFM_NETX_IOS.props similarity index 78% rename from src/TFM_NET7_IOS.props rename to src/TFM_NETX_IOS.props index 551e54dfe..07c6b27b2 100644 --- a/src/TFM_NET7_IOS.props +++ b/src/TFM_NETX_IOS.props @@ -1,6 +1,6 @@ - net7.0-ios;net7.0-maccatalyst + net$(DotNet_Version).0-ios;net$(DotNet_Version).0-maccatalyst 14.2 14.0 diff --git a/src/TFM_NET7_IOS_MACOS_MACCATALYST.props b/src/TFM_NETX_IOS_MACOS_MACCATALYST.props similarity index 79% rename from src/TFM_NET7_IOS_MACOS_MACCATALYST.props rename to src/TFM_NETX_IOS_MACOS_MACCATALYST.props index b7d82287a..f5398c304 100644 --- a/src/TFM_NET7_IOS_MACOS_MACCATALYST.props +++ b/src/TFM_NETX_IOS_MACOS_MACCATALYST.props @@ -1,6 +1,6 @@ - net7.0-ios;net7.0-macos;net7.0-maccatalyst + net$(DotNet_Version).0-ios;net$(DotNet_Version).0-macos;net$(DotNet_Version).0-maccatalyst 14.2 14.0 10.15 diff --git a/src/TFM_NET7_MAUI.props b/src/TFM_NETX_MAUI.props similarity index 84% rename from src/TFM_NET7_MAUI.props rename to src/TFM_NETX_MAUI.props index 84a7a8525..485d3663b 100644 --- a/src/TFM_NET7_MAUI.props +++ b/src/TFM_NETX_MAUI.props @@ -1,7 +1,7 @@ - net7.0;net7.0-android;net7.0-ios;net7.0-maccatalyst - $(TargetFrameworks);net7.0-windows10.0.19041.0 + net$(DotNet_Version).0;net$(DotNet_Version).0-android;net$(DotNet_Version).0-ios;net$(DotNet_Version).0-maccatalyst + $(TargetFrameworks);net$(DotNet_Version).0-windows10.0.19041.0 true true false diff --git a/src/TFM_NET7_WITH_WINDOWS.props b/src/TFM_NETX_WINDOWS.props similarity index 62% rename from src/TFM_NET7_WITH_WINDOWS.props rename to src/TFM_NETX_WINDOWS.props index a6c50d86e..7964c1d75 100644 --- a/src/TFM_NET7_WITH_WINDOWS.props +++ b/src/TFM_NETX_WINDOWS.props @@ -1,7 +1,7 @@ - net7.0 - $(TargetFrameworks);net7.0-windows10.0.19041.0 + net$(DotNet_Version).0 + net$(DotNet_Version).0-windows10.0.19041.0 diff --git a/src/TFM_NET7_WITH_ALL.props b/src/TFM_NETX_WITH_ALL.props similarity index 81% rename from src/TFM_NET7_WITH_ALL.props rename to src/TFM_NETX_WITH_ALL.props index 5c8c75d20..bcf88ae3c 100644 --- a/src/TFM_NET7_WITH_ALL.props +++ b/src/TFM_NETX_WITH_ALL.props @@ -1,8 +1,8 @@ - net7.0 - $(TargetFrameworks);net7.0-android;net7.0-ios;net7.0-macos;net7.0-maccatalyst;net7.0-windows10.0.19041.0 - $(TargetFrameworks);net7.0-android;net7.0-ios;net7.0-macos;net7.0-maccatalyst + net$(DotNet_Version).0 + $(TargetFrameworks);net$(DotNet_Version).0-android;net$(DotNet_Version).0-ios;net$(DotNet_Version).0-macos;net$(DotNet_Version).0-maccatalyst;net$(DotNet_Version).0-windows10.0.19041.0 + $(TargetFrameworks);net$(DotNet_Version).0-android;net$(DotNet_Version).0-ios;net$(DotNet_Version).0-macos;net$(DotNet_Version).0-maccatalyst $(TargetFrameworks) 14.2 14.0 diff --git a/src/TFM_NET7_WITH_ANDROID.props b/src/TFM_NETX_WITH_ANDROID.props similarity index 69% rename from src/TFM_NET7_WITH_ANDROID.props rename to src/TFM_NETX_WITH_ANDROID.props index a3b792271..de1bbcd28 100644 --- a/src/TFM_NET7_WITH_ANDROID.props +++ b/src/TFM_NETX_WITH_ANDROID.props @@ -1,6 +1,6 @@ - net7.0;net7.0-android + net$(DotNet_Version).0;net$(DotNet_Version).0-android 21.0 \ No newline at end of file diff --git a/src/TFM_NET7_WINDOWS.props b/src/TFM_NETX_WITH_WINDOWS.props similarity index 59% rename from src/TFM_NET7_WINDOWS.props rename to src/TFM_NETX_WITH_WINDOWS.props index 00cc805ab..65302f8cd 100644 --- a/src/TFM_NET7_WINDOWS.props +++ b/src/TFM_NETX_WITH_WINDOWS.props @@ -1,7 +1,7 @@ - net7.0 - net7.0-windows10.0.19041.0 + net$(DotNet_Version).0 + $(TargetFrameworks);net$(DotNet_Version).0-windows10.0.19041.0 diff --git a/src/Translate.cs b/src/Translate.cs new file mode 100644 index 000000000..95fd494c2 --- /dev/null +++ b/src/Translate.cs @@ -0,0 +1,165 @@ +// https://github.com/MicrosoftTranslator/Text-Translation-API-V3-C-Sharp/blob/master/Translate.cs +using System.Text.Json; + +#nullable disable +namespace System; + +/// +/// The C# classes that represents the JSON returned by the Translator Text API. +/// +public sealed class TranslationResult +{ + public DetectedLanguage DetectedLanguage { get; set; } + + public TextResult SourceText { get; set; } + + public Translation[] Translations { get; set; } +} + +public sealed class DetectedLanguage +{ + public string Language { get; set; } + + public float Score { get; set; } +} + +public sealed class TextResult +{ + public string Text { get; set; } + + public string Script { get; set; } +} + +public sealed class Translation +{ + public string Text { get; set; } + + public TextResult Transliteration { get; set; } + + public string To { get; set; } + + public Alignment Alignment { get; set; } + + public SentenceLength SentLen { get; set; } +} + +public sealed class Alignment +{ + public string Proj { get; set; } +} + +public sealed class SentenceLength +{ + public int[] SrcSentLen { get; set; } + + public int[] TransSentLen { get; set; } +} + +public sealed class TranslatecsSettings +{ + public string Key { get; set; } + + public string Endpoint { get; set; } + + public string Region { get; set; } +} + +public sealed class Translatecs +{ + public static TranslatecsSettings Settings { internal get; set; } + + //const string region_var = "TRANSLATOR_SERVICE_REGION"; + static /*readonly*/ string Region => Settings.Region; + //= Environment.GetEnvironmentVariable(region_var); + + //const string key_var = "TRANSLATOR_TEXT_SUBSCRIPTION_KEY"; + static /*readonly*/ string SubscriptionKey => Settings.Key; + //= Environment.GetEnvironmentVariable(key_var); + + //const string endpoint_var = "TRANSLATOR_TEXT_ENDPOINT"; + static /*readonly*/ string Endpoint => Settings.Endpoint; + + //= Environment.GetEnvironmentVariable(endpoint_var); + + //static Translatecs() + //{ + // if (null == region) + // { + // throw new Exception("Please set/export the environment variable: " + region_var); + // } + // if (null == subscriptionKey) + // { + // throw new Exception("Please set/export the environment variable: " + key_var); + // } + // if (null == endpoint) + // { + // throw new Exception("Please set/export the environment variable: " + endpoint_var); + // } + //} + + static readonly JsonSerializerOptions options = new(JsonSerializerDefaults.Web); + static readonly HttpClient client = new(); + + // Async call to the Translator Text API + public static async Task TranslateTextAsync(/*string subscriptionKey, string endpoint,*/ string route, string inputText) + { + var body = new object[] { new { Text = inputText } }; + using var requestStream = new MemoryStream(); + var requestBody = JsonSerializer.SerializeAsync(requestStream, body, options); + + var request = new HttpRequestMessage + { + // Build the request. + Method = HttpMethod.Post, + RequestUri = new Uri(/*endpoint +*/ route), + Content = new StreamContent(requestStream), + }; + request.Content.Headers.ContentType.MediaType = "application/json"; + request.Content.Headers.ContentType.CharSet = "utf-8"; + request.Headers.Add("Ocp-Apim-Subscription-Key", SubscriptionKey); + request.Headers.Add("Ocp-Apim-Subscription-Region", Region); + + // Send the request and get response. + var response = await client.SendAsync(request).ConfigureAwait(false); + // Read response as a string. + + //using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + //using var reader = new StreamReader(stream, Encoding.UTF8); + //using var json = new JsonTextReader(reader); + //var deserializedOutput = jsonSerializer.Deserialize(json); + + using var result = await response.Content.ReadAsStreamAsync(); + var deserializedOutput = await JsonSerializer.DeserializeAsync(result, options); + + return deserializedOutput; + + // Iterate over the deserialized results. + //foreach (TranslationResult o in deserializedOutput) + //{ + // // Print the detected input languge and confidence score. + // Console.WriteLine("Detected input language: {0}\nConfidence score: {1}\n", o.DetectedLanguage.Language, o.DetectedLanguage.Score); + // // Iterate over the results and print each translation. + // foreach (Translation t in o.Translations) + // { + // Console.WriteLine("Translated to {0}: {1}", t.To, t.Text); + // } + //} + } + + //static async Task Main(string[] args) + //{ + // // This is our main function. + // // Output languages are defined in the route. + // // For a complete list of options, see API reference. + // // https://docs.microsoft.com/azure/cognitive-services/translator/reference/v3-0-translate + // string route = "/translate?api-version=3.0&to=de&to=it&to=ja&to=th"; + // // Prompts you for text to translate. If you'd prefer, you can + // // provide a string as textToTranslate. + // Console.Write("Type the phrase you'd like to translate? "); + // string textToTranslate = Console.ReadLine(); + // await TranslateTextRequest(subscriptionKey, endpoint, route, textToTranslate); + // Console.WriteLine("Press any key to continue."); + // Console.ReadKey(); + //} +} +#nullable enable \ No newline at end of file