diff --git a/Directory.Build.props b/Directory.Build.props
index b2ad2a4..5d1b5a8 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -26,7 +26,7 @@
$(AssemblyName)
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/NSExt.sln.DotSettings b/NSExt.sln.DotSettings
index ea9fc25..0913323 100644
--- a/NSExt.sln.DotSettings
+++ b/NSExt.sln.DotSettings
@@ -1,58 +1,38 @@
-
- Inherit
- True
- True
- DO_NOT_SHOW
- HINT
- DO_NOT_SHOW
- DO_NOT_SHOW
- NEVER
- NEVER
- NEVER
- NEVER
- ID
- IOS
- IP
- UI
- <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" />
-
- True
- True
- True
- True
- True
- 1
- 1
+
+
+ True
+ Inherit
+
+
+ True
OFF
- HINT
+ DO_NOT_SHOW
+ DO_NOT_SHOW
+ DO_NOT_SHOW
+ DO_NOT_SHOW
+ DO_NOT_SHOW
+ DO_NOT_SHOW
+ HINT
+ DO_NOT_SHOW
+ DO_NOT_SHOW
+
+
+ 1
+ 1
Required
- Required
- Required
+ Required
+ Required
Required
- <Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" />
- <Policy Inspect="True" Prefix="_" Suffix="" Style="AA_BB" />
- <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" />
- <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ NEVER
+ NEVER
+ NEVER
+ NEVER
+ <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static readonly fields (private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /></Policy>
+ <Policy><Descriptor Staticness="Any" AccessRightKinds="Private" Description="Constant fields (private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="_" Suffix="" Style="AA_BB" /></Policy>
+ <Policy><Descriptor Staticness="Any" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Constant fields (not private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></Policy>
+ <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Types and namespaces"><ElementKinds><Kind Name="NAMESPACE" /><Kind Name="CLASS" /><Kind Name="STRUCT" /><Kind Name="ENUM" /><Kind Name="DELEGATE" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" /></Policy>
+ <Policy><Descriptor Staticness="Static" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Static readonly fields (not private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy>
+
<?xml version="1.0" encoding="utf-16"?>
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
<TypePattern>
@@ -93,36 +73,21 @@
</Entry>
</TypePattern>
</Patterns>
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
+
+
+ True
+ True
+ True
+ True
+ True
+
+
+ True
+
+
+ True
+ True
+ True
+ True
\ No newline at end of file
diff --git a/build/code.quality.props b/build/code.quality.props
index c9025f2..5e41197 100644
--- a/build/code.quality.props
+++ b/build/code.quality.props
@@ -15,15 +15,15 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/backend/NSExt.Tests/AllTests.cs b/src/backend/NSExt.Tests/AllTests.cs
new file mode 100644
index 0000000..eeddbeb
--- /dev/null
+++ b/src/backend/NSExt.Tests/AllTests.cs
@@ -0,0 +1,19 @@
+using NSExt.Extensions;
+using Xunit;
+
+namespace NSExt;
+
+///
+/// 所有测试用例
+///
+public class AllTests
+{
+ ///
+ /// IsJsonString
+ ///
+ [Fact]
+ public void IsJsonString()
+ {
+ Assert.True("{\"a\":\"b\"}".IsJsonString());
+ }
+}
\ No newline at end of file
diff --git a/src/backend/NSExt.Tests/NSExt.Tests.csproj b/src/backend/NSExt.Tests/NSExt.Tests.csproj
index 571955e..b14ac29 100644
--- a/src/backend/NSExt.Tests/NSExt.Tests.csproj
+++ b/src/backend/NSExt.Tests/NSExt.Tests.csproj
@@ -1,11 +1,12 @@
-
-
+
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/src/backend/NSExt/Extensions/StringExtensions.cs b/src/backend/NSExt/Extensions/StringExtensions.cs
index 80c49fe..1b3a3c9 100644
--- a/src/backend/NSExt/Extensions/StringExtensions.cs
+++ b/src/backend/NSExt/Extensions/StringExtensions.cs
@@ -358,6 +358,26 @@ public static class StringExtensions
return lastEqualSignPos == me.Length - 1 && me[firstEqualSignPos..lastEqualSignPos].All(x => x == '=');
}
+ ///
+ /// 是否json字符串
+ ///
+ /// me
+ public static bool IsJsonString(this string me)
+ {
+ if (me.NullOrEmpty()) {
+ return false;
+ }
+
+ try {
+ _ = JsonDocument.Parse(me);
+ }
+ catch {
+ return false;
+ }
+
+ return true;
+ }
+
///
/// 中文姓名打马赛克
///