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
diff --git a/Utils/Exts/StringExtension.cs b/Utils/Exts/StringExtension.cs
index 71e28541..d1b0d3d5 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;
@@ -142,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)
{
///