|
@@ -49,7 +49,7 @@ namespace ET
|
|
|
public int Index;
|
|
|
public Dictionary<string, HeadInfo> HeadInfos = new Dictionary<string, HeadInfo>();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public static class ExcelExporter
|
|
|
{
|
|
|
private static string template;
|
|
@@ -100,7 +100,7 @@ namespace ET
|
|
|
{
|
|
|
//防止编译时裁剪掉protobuf
|
|
|
ProtoBuf.WireType.Fixed64.ToString();
|
|
|
-
|
|
|
+
|
|
|
template = File.ReadAllText("Template.txt");
|
|
|
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
|
|
|
|
@@ -178,7 +178,7 @@ namespace ET
|
|
|
configAssemblies[(int) ConfigType.s] = DynamicBuild(ConfigType.s);
|
|
|
|
|
|
List<string> excels = FileHelper.GetAllFiles(excelDir, "*.xlsx");
|
|
|
-
|
|
|
+
|
|
|
List<Task> tasks = new List<Task>();
|
|
|
foreach (string path in excels)
|
|
|
{
|
|
@@ -186,7 +186,7 @@ namespace ET
|
|
|
tasks.Add(task);
|
|
|
}
|
|
|
Task.WaitAll(tasks.ToArray());
|
|
|
-
|
|
|
+
|
|
|
if (Directory.Exists(clientProtoDir))
|
|
|
{
|
|
|
Directory.Delete(clientProtoDir, true);
|
|
@@ -229,7 +229,7 @@ namespace ET
|
|
|
fileNameWithoutCS = ss[0];
|
|
|
cs = ss[1];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (cs == "")
|
|
|
{
|
|
|
cs = "cs";
|
|
@@ -277,7 +277,7 @@ namespace ET
|
|
|
_ => CSClassDir
|
|
|
};
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 动态编译生成的cs代码
|
|
|
private static Assembly DynamicBuild(ConfigType configType)
|
|
|
{
|
|
@@ -379,7 +379,7 @@ namespace ET
|
|
|
table.HeadInfos[fieldName] = null;
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (fieldCS == "")
|
|
|
{
|
|
|
fieldCS = "cs";
|
|
@@ -471,7 +471,7 @@ namespace ET
|
|
|
sw.Write(sb.ToString());
|
|
|
}
|
|
|
|
|
|
- static void ExportSheetJson(ExcelWorksheet worksheet, string name,
|
|
|
+ static void ExportSheetJson(ExcelWorksheet worksheet, string name,
|
|
|
Dictionary<string, HeadInfo> classField, ConfigType configType, StringBuilder sb)
|
|
|
{
|
|
|
string configTypeStr = configType.ToString();
|
|
@@ -487,7 +487,7 @@ namespace ET
|
|
|
{
|
|
|
prefix = "cs";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (configType != ConfigType.cs && !prefix.Contains(configTypeStr))
|
|
|
{
|
|
|
continue;
|
|
@@ -598,8 +598,33 @@ namespace ET
|
|
|
foreach (string jsonPath in jsonPaths)
|
|
|
{
|
|
|
string json = File.ReadAllText(jsonPath);
|
|
|
- object deserialize = BsonSerializer.Deserialize(json, type);
|
|
|
- final.Merge(deserialize);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ object deserialize = BsonSerializer.Deserialize(json, type);
|
|
|
+ final.Merge(deserialize);
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ #region 为了定位该文件中具体那一行出现了异常
|
|
|
+ List<string> list = new List<string>(json.Split('\n'));
|
|
|
+ if (list.Count > 0)
|
|
|
+ list.RemoveAt(0);
|
|
|
+ if (list.Count > 0)
|
|
|
+ list.RemoveAt(list.Count-1);
|
|
|
+ foreach (string s in list)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ BsonSerializer.Deserialize(s.Substring(0, s.Length-1), subType);
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ Log.Console($"json : {s}");
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
string path = Path.Combine(dir, $"{protoName}Category.bytes");
|