This commit is contained in:
nsnail 2022-11-30 11:23:59 +08:00
parent fdaf7518c6
commit 5e17e20aab
15 changed files with 79 additions and 104 deletions

3
.gitignore vendored
View File

@ -1,8 +1,9 @@
pkg
build build
bin bin
obj obj
bin\log
packages packages
Migrations
_gsdata_ _gsdata_
_ReSharper* _ReSharper*
TestResults TestResults

4
.tgitconfig Normal file
View File

@ -0,0 +1,4 @@
[hook "startcommit"]
cmdline = code-format.cmd
wait = true
show = true

7
Directory.Build.props Normal file
View File

@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<BaseOutputPath>../build/temp/bin</BaseOutputPath>
<BaseIntermediateOutputPath>../build/temp/obj</BaseIntermediateOutputPath>
<MSBuildProjectExtensionsPath>../build/temp/obj</MSBuildProjectExtensionsPath>
</PropertyGroup>
</Project>

3
code-format.cmd Normal file
View File

@ -0,0 +1,3 @@
do.exe trim-utf8-bom
do.exe remove-whitespace
do.exe convert-lf

View File

1
git-clean.ps1 Normal file
View File

@ -0,0 +1 @@
git reset --hard | git clean -d -fx .

View File

View File

@ -1,4 +1,3 @@
# 定义参数
Param( Param(
# Nuget APIKey # Nuget APIKey
[string] $apikey [string] $apikey
@ -6,18 +5,18 @@ Param(
if ($apikey -eq $null -or $apikey -eq "") if ($apikey -eq $null -or $apikey -eq "")
{ {
Write-Error "必须指定apiKey"; Write-Error "require apiKey";
return; return;
} }
rm -r ../build/nupkgs/ rm -r ./build/nupkgs
dotnet build -c Release ../src/NSExt.sln dotnet build -c Release ./src/NSExt.sln
$files = Get-ChildItem -Path ../build/nupkgs/ -Filter *.nupkg $files = Get-ChildItem -Path ./build/nupkgs/ -Filter *.nupkg
foreach($file in $files) foreach($file in $files)
{ {
dotnet nuget push $file.fullName --skip-duplicate --api-key $apikey --source https://api.nuget.org/v3/index.json dotnet nuget push $file.fullName --skip-duplicate --api-key $apikey --source https://api.nuget.org/v3/index.json
} }
$files = Get-ChildItem -Path ../build/nupkgs/ -Filter *.snupkg $files = Get-ChildItem -Path ./build/nupkgs/ -Filter *.snupkg
foreach($file in $files) foreach($file in $files)
{ {
dotnet nuget push $file.fullName --skip-duplicate --api-key $apikey --source https://api.nuget.org/v3/index.json dotnet nuget push $file.fullName --skip-duplicate --api-key $apikey --source https://api.nuget.org/v3/index.json

View File

View File

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,7 @@ public static class LoggerExtensions
int callerLineNumber) int callerLineNumber)
{ {
return return
$"{message} <s:{Thread.CurrentThread.ManagedThreadId}#{callerName}@{Path.GetFileName(callerFilePath)}:{callerLineNumber}>"; $"{message} <s:{Environment.CurrentManagedThreadId}#{callerName}@{Path.GetFileName(callerFilePath)}:{callerLineNumber}>";
} }
public static void Debug(this ILogger me, public static void Debug(this ILogger me,

View File

@ -8,7 +8,7 @@ namespace NSExt.Extensions;
public static class StringExtensions public static class StringExtensions
{ {
private static readonly JsonSerializerOptions _DEFAULT_JSON_SERIALIZER_OPTIONS = private static readonly JsonSerializerOptions _defaultJsonSerializerOptions =
default(JsonSerializerOptions).NewJsonSerializerOptions(); default(JsonSerializerOptions).NewJsonSerializerOptions();
/// <summary> /// <summary>
@ -300,6 +300,16 @@ public static class StringExtensions
.ToLower(CultureInfo.CurrentCulture); .ToLower(CultureInfo.CurrentCulture);
} }
/// <summary>
/// html编码
/// </summary>
/// <param name="me"></param>
/// <returns></returns>
public static string Html(this string me)
{
return HttpUtility.HtmlEncode(me);
}
/// <summary> /// <summary>
/// 解码html编码 /// 解码html编码
/// </summary> /// </summary>
@ -450,7 +460,7 @@ public static class StringExtensions
/// <returns>反序列化后生成的对象</returns> /// <returns>反序列化后生成的对象</returns>
public static T Object<T>(this string me, JsonSerializerOptions options = null) public static T Object<T>(this string me, JsonSerializerOptions options = null)
{ {
return JsonSerializer.Deserialize<T>(me, options ?? _DEFAULT_JSON_SERIALIZER_OPTIONS); return JsonSerializer.Deserialize<T>(me, options ?? _defaultJsonSerializerOptions);
} }
@ -463,7 +473,7 @@ public static class StringExtensions
/// <returns>反序列化后生成的对象</returns> /// <returns>反序列化后生成的对象</returns>
public static object Object(this string me, Type type, JsonSerializerOptions options = null) public static object Object(this string me, Type type, JsonSerializerOptions options = null)
{ {
return JsonSerializer.Deserialize(me, type, options ?? _DEFAULT_JSON_SERIALIZER_OPTIONS); return JsonSerializer.Deserialize(me, type, options ?? _defaultJsonSerializerOptions);
} }

View File

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks> <TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<VersionPrefix>1.0.3</VersionPrefix> <Version>1.0.4</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>