From ed98029a88cd89702980ac7c40b711afddc5aeb2 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 20 十一月 2025 14:44:59 +0800
Subject: [PATCH] Merge branch 'master' of http://mobile.secondworld.net.cn:10010/r/Project_SG_scripts
---
Main/Config/ConfigParse.cs | 45 +++++++++++++++++++++++++++------------------
1 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/Main/Config/ConfigParse.cs b/Main/Config/ConfigParse.cs
index 8e2f2f8..da09db2 100644
--- a/Main/Config/ConfigParse.cs
+++ b/Main/Config/ConfigParse.cs
@@ -62,6 +62,7 @@
return string.Empty;
}
+ //涓�缁存暟缁勶細鏉ユ簮鏍煎紡濡� 1|2|3|4
public static T[] GetMultipleStr<T>(string msg) where T : struct
{
string[] segs = GetMultipleStr(msg);
@@ -206,7 +207,6 @@
}
//{'17':['63','6','27'],'65':['800'],'55':['139'],'19':['1000','2600','130']}
- public static Regex userDataRegex = new Regex(@"'([0-9]+)':\[(.*?)\]", RegexOptions.Singleline);
public static Dictionary<int, List<int>> Analysis(string val)//姝e垯琛ㄨ揪寮忕殑瀛楃涓插垎鍓�
{
string s = ServerStringTrim(val);
@@ -265,23 +265,8 @@
//}
}
- public static Dictionary<int, List<int>> ParseJsonDict(string jsonStr)
- {
- if (jsonStr == "{}" || string.IsNullOrEmpty(jsonStr))
- {
- return new Dictionary<int, List<int>>();
- }
- var dict = JsonMapper.ToObject<Dictionary<string, List<int>>>(jsonStr);
- Dictionary<int, List<int>> result = new Dictionary<int, List<int>>();
- foreach (var item in dict)
- {
- result[int.Parse(item.Key)] = item.Value;
- }
-
- return result;
- }
-
+ //json鏍煎紡锛� {"1":1}
public static Dictionary<int, int> ParseIntDict(string jsonStr)
{
if (jsonStr == "{}" || string.IsNullOrEmpty(jsonStr))
@@ -299,6 +284,7 @@
return result;
}
+ //json鏍煎紡锛� {"1":[1,2],"2":[3,4]}
public static Dictionary<int, int[]> ParseIntArrayDict(string jsonStr)
{
if (jsonStr == "{}" || string.IsNullOrEmpty(jsonStr))
@@ -316,6 +302,7 @@
return result;
}
+ //json鏍煎紡锛� {"1":[[1,2],[3,4]]}
public static Dictionary<int, int[][]> ParseIntArray2Dict(string jsonStr)
{
if (jsonStr == "{}" || string.IsNullOrEmpty(jsonStr))
@@ -333,13 +320,35 @@
return result;
}
+ //json鏍煎紡锛� {"1":{"1":1,"2":2},"2":{"3":3,"4":4}}
+ public static Dictionary<int, Dictionary<int, int>> ParseDictInDict(string jsonStr)
+ {
+ if (jsonStr == "{}" || string.IsNullOrEmpty(jsonStr))
+ {
+ return new Dictionary<int, Dictionary<int, int>>();
+ }
+ var dict = JsonMapper.ToObject<Dictionary<string, Dictionary<string, int>>>(jsonStr);
+ Dictionary<int, Dictionary<int, int>> result = new Dictionary<int, Dictionary<int, int>>();
+
+ foreach (var item in dict)
+ {
+ Dictionary<int, int> subDict = new Dictionary<int, int>();
+ foreach (var subItem in item.Value)
+ {
+ subDict[int.Parse(subItem.Key)] = subItem.Value;
+ }
+ result[int.Parse(item.Key)] = subDict;
+ }
+
+ return result;
+ }
//涓囧垎鐜囪浆涓烘瘡涓猧d瀵瑰簲鐨勬鐜� [[涓囧垎姒傜巼锛宨d1],[涓囧垎姒傜巼锛宨d2]]
public static Dictionary<int, int> GetRateDict(int[][] rateArray)
{
Dictionary<int, int> dic = new Dictionary<int, int>();
//姒傜巼涓� 鍑忓幓涓婁竴涓鐜囩殑鍊煎嵆涓哄綋鍓岻D姒傜巼
- for (int i = 0;i< rateArray.Length; i++)
+ for (int i = 0; i < rateArray.Length; i++)
{
if (i > 0)
{
--
Gitblit v1.8.0