mirror of
https://github.com/nsnail/ns-ext.git
synced 2025-07-02 15:08:16 +08:00
refactor: ♻️ 2.0 (#3)
This commit is contained in:
@ -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>
|
@ -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);
|
||||
// }
|
||||
}
|
@ -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;
|
@ -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>
|
6
src/backend/GlobalUsings.cs
Normal file
6
src/backend/GlobalUsings.cs
Normal 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;
|
14
src/backend/NSExt.Tests/NSExt.Tests.csproj
Normal file
14
src/backend/NSExt.Tests/NSExt.Tests.csproj
Normal 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>
|
@ -1,3 +1,6 @@
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
|
||||
namespace NSExt.Extensions;
|
||||
|
||||
/// <summary>
|
@ -1,5 +1,8 @@
|
||||
// ReSharper disable TemplateIsNotCompileTimeConstantProblem
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace NSExt.Extensions;
|
||||
|
||||
/// <summary>
|
@ -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>
|
32
src/backend/NSExt/NSExt.csproj
Normal file
32
src/backend/NSExt/NSExt.csproj
Normal 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>
|
Reference in New Issue
Block a user