refactor: ♻️ 2.0 (#3)

This commit is contained in:
2023-12-14 15:03:07 +08:00
committed by GitHub
parent 8c0dbcf1f4
commit cf2988b389
73 changed files with 1157 additions and 371 deletions

View File

@ -1,9 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0-preview-23424-02"/>
<PackageReference Include="xunit" Version="2.5.2-pre.2"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NSExt\NSExt.csproj"/>
</ItemGroup>
</Project>

View File

@ -1,36 +0,0 @@
namespace NSExt.Tests;
/// <summary>
/// 测试用例
/// </summary>
public class TestCase
{
// private readonly ITestOutputHelper _testOutputHelper;
//
// public TestCase(ITestOutputHelper testOutputHelper)
// {
// _testOutputHelper = testOutputHelper;
// }
//
// public enum MyEnum1
// {
// [ResourceDescription<TestCase>(nameof(Description))]
// Online = 1
//
// , Offline = 2
// }
//
// public static string Description { get; set; } = "123";
//
// /// <summary>
// /// Case1
// /// </summary>
// [Fact]
// public void Case1()
// {
// var test = MyEnum1.Online.ResDesc<TestCase>();
//
// _testOutputHelper.WriteLine(test);
// Assert.True(test is not null);
// }
}

View File

@ -1,8 +0,0 @@
global using System.Data;
global using System.Data.Common;
global using System.Globalization;
global using System.Runtime.CompilerServices;
global using System.Text;
global using System.Text.RegularExpressions;
global using System.Web;
global using Microsoft.Extensions.Logging;

View File

@ -1,10 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../code.quality.props"/>
<Import Project="../../packable.props"/>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0"/>
</ItemGroup>
<ItemGroup>
<None Include="../../logo.png" Pack="true" PackagePath=""/>
</ItemGroup>
</Project>

View File

View File

@ -0,0 +1,6 @@
global using System;
global using System.ComponentModel;
global using System.Globalization;
global using System.Text;
global using System.Text.RegularExpressions;
global using NSExt.Languages;

View File

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="xunit" Version="2.6.3"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<ProjectReference Include="../NSExt/NSExt.csproj"/>
</ItemGroup>
</Project>

View File

@ -1,3 +1,6 @@
using System.Data;
using System.Data.Common;
namespace NSExt.Extensions;
/// <summary>

View File

@ -1,5 +1,8 @@
// ReSharper disable TemplateIsNotCompileTimeConstantProblem
using System.Runtime.CompilerServices;
using Microsoft.Extensions.Logging;
namespace NSExt.Extensions;
/// <summary>

View File

@ -4,6 +4,7 @@
#pragma warning disable CA1720
using System.Security.Cryptography;
using System.Text.Json;
using System.Web;
using NSExt.Constant;
namespace NSExt.Extensions;
@ -141,7 +142,9 @@ public static class StringExtensions
/// <returns>转换后的日期对象</returns>
public static DateTime DateTimeTry(this string me, DateTime def)
{
return !System.DateTime.TryParse(me, CultureInfo.InvariantCulture, out var ret) ? def : ret;
return !System.DateTime.TryParse(me, CultureInfo.InvariantCulture, DateTimeStyles.None, out var ret)
? def
: ret;
}
/// <summary>

View File

@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyOriginatorKeyFile>../../../key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<EmbedAllSources>true</EmbedAllSources>
<EmbedUntrackedSource>true</EmbedUntrackedSource>
<IncludeSymbols>true</IncludeSymbols>
<IsPackable>true</IsPackable>
<PackageIcon>logo.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/nsnail/NSExt.git</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>extensions</PackageTags>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RootNamespace>NSExt</RootNamespace>
<SignAssembly>true</SignAssembly>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<Import Project="$(SolutionDir)/build/code.quality.props"/>
<Import Project="$(SolutionDir)/build/copy.pkg.xml.comment.files.targets"/>
<Import Project="$(SolutionDir)/build/prebuild.targets"/>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0"/>
</ItemGroup>
<ItemGroup>
<None Include="../../../assets/logo.png" Pack="true" PackagePath="/"/>
<None Include="../../../README.md" Pack="true" PackagePath="/"/>
<None Update="*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>