From 25d05293bf63a49f0150e0f4acb8c56b1820062d Mon Sep 17 00:00:00 2001 From: Pigeon0v0 <60414767+Pigeon0v0@users.noreply.github.com> Date: Sat, 18 Oct 2025 23:13:45 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat(custom-page):=20=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E4=B8=8A=E6=B8=B8=E8=87=AA=E5=AE=9A=E4=B9=89=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Utils/Exts/StringExtension.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Utils/Exts/StringExtension.cs b/Utils/Exts/StringExtension.cs index f971117f..df705034 100644 --- a/Utils/Exts/StringExtension.cs +++ b/Utils/Exts/StringExtension.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Numerics; using System.Reflection; +using System.Runtime.CompilerServices; using System.Text.RegularExpressions; namespace PCL.Core.Utils.Exts; @@ -200,8 +201,22 @@ public static List RegexSearch(this string str, Regex regex) /// // ReSharper disable once InconsistentNaming public static bool IsASCII(this string str) + => str.All(c => c < 128); + + public static T ParseToEnum(this string str) where T : struct, Enum { - return str.All(c => c < 128); + if (String.IsNullOrWhiteSpace(str)) + { + return (T)(object)0; + } + else if (int.TryParse(str, out int numericValue)) + { + return (T)(object)numericValue; + } + else + { + return Enum.Parse(str, true); + } } public static bool StartsWithF(this string str, string prefix, bool ignoreCase = false) From fcc693addd83ff916214ae344cdacf9d4e269078 Mon Sep 17 00:00:00 2001 From: Pigeon0v0 <60414767+Pigeon0v0@users.noreply.github.com> Date: Sun, 19 Oct 2025 10:51:57 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat(wip):=20=E5=A4=A7=E6=A6=82=E6=90=AD?= =?UTF-8?q?=E4=B8=AA=E8=87=AA=E5=AE=9A=E4=B9=89=E5=8F=98=E9=87=8F=E7=9A=84?= =?UTF-8?q?=E6=A1=86=E6=9E=B6=EF=BC=8C=E5=85=B7=E4=BD=93=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E6=9C=89=E5=BE=85=E5=95=86=E6=A6=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/CustomVarible.cs | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 App/CustomVarible.cs diff --git a/App/CustomVarible.cs b/App/CustomVarible.cs new file mode 100644 index 00000000..cbd05d10 --- /dev/null +++ b/App/CustomVarible.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.Json.Nodes; +using PCL.Core.IO; + +namespace PCL.Core.App; + +public class CustomVarible +{ + /// + /// 自定义主页变量保存路径。 + /// + public static string VaribleJsonPath { get; } = Path.Combine(FileService.SharedDataPath, "varibles.json"); + + /// + /// 存放所有自定义主页变量的 JSON 对象。 + /// + public static JsonNode? VaribleJson; + + public static Dictionary VaribleDict = new(); + + public static void Set(string key, string value) + { + + } + + public static void Get(string key, string value) + { + + } + + public static void Init() + { + if (!File.Exists(VaribleJsonPath)) + { + File.Create(VaribleJsonPath).Close(); + } + else + { + try + { + VaribleJson = JsonNode.Parse(File.ReadAllText(VaribleJsonPath)); + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + } + } +} \ No newline at end of file From 354b326ef15cea672a9956ecb508a5d38e5f70e5 Mon Sep 17 00:00:00 2001 From: Pigeon0v0 <60414767+Pigeon0v0@users.noreply.github.com> Date: Sat, 17 Jan 2026 10:45:20 +0800 Subject: [PATCH 3/3] fix: ci --- Utils/Exts/StringExtension.cs | 36 +++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/Utils/Exts/StringExtension.cs b/Utils/Exts/StringExtension.cs index 6e3cf5f6..d1b0d3d5 100644 --- a/Utils/Exts/StringExtension.cs +++ b/Utils/Exts/StringExtension.cs @@ -143,6 +143,26 @@ public string FromB32ToB10() } } + extension(string input) + { + + public T ParseToEnum() where T : struct, Enum + { + if (String.IsNullOrWhiteSpace(input)) + { + return (T)(object)0; + } + else if (int.TryParse(input, out int numericValue)) + { + return (T)(object)numericValue; + } + else + { + return Enum.Parse(input, true); + } + } + } + extension([NotNullWhen(false)] string? value) { /// @@ -215,22 +235,6 @@ public bool IsASCII() { return str.All(c => c < 128); } - - public static T ParseToEnum(this string str) where T : struct, Enum - { - if (String.IsNullOrWhiteSpace(str)) - { - return (T)(object)0; - } - else if (int.TryParse(str, out int numericValue)) - { - return (T)(object)numericValue; - } - else - { - return Enum.Parse(str, true); - } - } public bool StartsWithF(string prefix, bool ignoreCase = false) => str.StartsWith(prefix, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);