ybx_Gdn пре 1 година
родитељ
комит
f2a0cda453
2 измењених фајлова са 40 додато и 10 уклоњено
  1. 38 10
      Assets/Src/Core/Config/ConfigMgr.cs
  2. 2 0
      Assets/Src/Core/DownLoad/FileHelper.cs

+ 38 - 10
Assets/Src/Core/Config/ConfigMgr.cs

@@ -305,21 +305,49 @@ public class ConfigMgr : Singleton<ConfigMgr>
         return Table;
     }
 
+    private string[] GetLanguageString(string text)
+    {
+        string[] ret = null;
+        int i = text.IndexOf(',');
+
+        if (i >= 0)
+        {
+            ret = new string[2];
+            ret[0] = text.Substring(0,i);
+            ret[1] = FileHelper.RemoveHeadandTailChar(text.Substring(i + 1, text.Length - i - 1), '"');
+            Debug.Log($"1 = {ret[0]}   2 = {ret[1]}");
+        }
+
+        return ret;
+    }
+
     private Dictionary<string, Dictionary<string, string>> getData_New(string name, string content)
     {
-        string[][] csvdatas = FileHelper.GetCsvDatas(content);
-        
+        string[] lineArray;
         string[] charArray = null;
-        
-      
-        string[] indexname = csvdatas[1];
-        
 
-        Dictionary<string, Dictionary<string, string>> Table = new Dictionary<string, Dictionary<string, string>>(csvdatas.Length);
+        System.IO.StringReader reader = new System.IO.StringReader(content);
+        string str = reader.ReadLine();
+        List<string> tempList = new List<string>();
+        while (!string.IsNullOrEmpty(str))
+        {
+            tempList.Add(str);
+            str = reader.ReadLine();
+        }
+        lineArray = tempList.ToArray();
+     
+        string[] indexname = null;
+ 
+        indexname = GetLanguageString(lineArray[1]);
+    
+   
+
+        Dictionary<string, Dictionary<string, string>> Table = new Dictionary<string, Dictionary<string, string>>(lineArray.Length);
         int linelength = 0;
-        for (int i = linestart; i < csvdatas.Length; ++i)
+        for (int i = linestart; i < lineArray.Length; ++i)
         {
-            charArray = csvdatas[i];
+
+            charArray = GetLanguageString(lineArray[i]);     
 
             linelength = charArray.Length;
             if (linelength > 0 && charArray[0] == string.Empty)
@@ -359,7 +387,7 @@ public class ConfigMgr : Singleton<ConfigMgr>
         if (ConfigLongthDictionary != null && !ConfigLongthDictionary.ContainsKey(name))
         {
             //int length = lineArray.Length - (linestart + 1);
-            int length = csvdatas.Length - (linestart);
+            int length = lineArray.Length - (linestart);
             ConfigLongthDictionary.Add(name, length);
         }
         return Table;

+ 2 - 0
Assets/Src/Core/DownLoad/FileHelper.cs

@@ -442,5 +442,7 @@ public class FileHelper
             return datas.ToArray();
         }
     }
+
+
 }