diff --git a/.vs/ExcelTool/FileContentIndex/ca1cf71e-203e-499c-a1e1-d1b7d3bbd63a.vsidx b/.vs/ExcelTool/FileContentIndex/ca1cf71e-203e-499c-a1e1-d1b7d3bbd63a.vsidx new file mode 100644 index 0000000..5d1c5d8 Binary files /dev/null and b/.vs/ExcelTool/FileContentIndex/ca1cf71e-203e-499c-a1e1-d1b7d3bbd63a.vsidx differ diff --git a/.vs/ExcelTool/FileContentIndex/e68dd585-904a-468a-a084-9c18947c45bf.vsidx b/.vs/ExcelTool/FileContentIndex/e68dd585-904a-468a-a084-9c18947c45bf.vsidx new file mode 100644 index 0000000..73747f4 Binary files /dev/null and b/.vs/ExcelTool/FileContentIndex/e68dd585-904a-468a-a084-9c18947c45bf.vsidx differ diff --git a/.vs/ExcelTool/FileContentIndex/read.lock b/.vs/ExcelTool/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 diff --git a/.vs/ExcelTool/v17/.suo b/.vs/ExcelTool/v17/.suo new file mode 100644 index 0000000..9d811f5 Binary files /dev/null and b/.vs/ExcelTool/v17/.suo differ diff --git a/ExcelTool/Parser/GenModels.cs b/ExcelTool/Parser/GenModels.cs index 01134ee..b3be1f0 100644 --- a/ExcelTool/Parser/GenModels.cs +++ b/ExcelTool/Parser/GenModels.cs @@ -29,7 +29,7 @@ namespace ExcelTool var excelName = fileInfo.Name.Remove(fileInfo.Name.IndexOf(".xlsx")); StringBuilder sb = new StringBuilder(); sb.Append($"/*\n * auto generated by tools(注意:千万不要手动修改本文件)\n * {excelName}\n */\n"); - sb.Append("using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\n"); + sb.Append("using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Text;\n\n"); sb.Append("[Serializable]\n"); sb.Append($"public partial class {excelName} : IBinarySerializable\n"); sb.Append("{\n"); @@ -475,7 +475,8 @@ namespace ExcelTool sb.Append("[Serializable]\n"); sb.Append($"public partial class {excelName}Config : IBinarySerializable\n"); sb.Append("{\n"); - sb.Append($"\tpublic List<{excelName}> {excelName}Infos = new List<{excelName}>();\n"); + // sb.Append($"\tpublic List<{excelName}> {excelName}Infos = new List<{excelName}>();\n"); + sb.Append($"\tDictionary {excelName}Infos = new Dictionary();\n"); sb.Append($"\tpublic void DeSerialize(BinaryReader reader)\n"); sb.Append("\t{\n"); sb.Append($"\t\tint count = reader.ReadInt32();\n"); @@ -483,7 +484,8 @@ namespace ExcelTool sb.Append("\t\t{\n"); sb.Append($"\t\t\t{excelName} tempData = new {excelName}();\n"); sb.Append($"\t\t\ttempData.DeSerialize(reader);\n"); - sb.Append($"\t\t\t{excelName}Infos.Add(tempData);\n"); + // sb.Append($"\t\t\t{excelName}Infos.Add(tempData);\n"); + sb.Append($"\t\t\t{excelName}Infos.Add(tempData.Id, tempData);\n"); sb.Append("\t\t}\n"); sb.Append("\t}\n"); sb.Append("\n"); @@ -497,10 +499,14 @@ namespace ExcelTool sb.Append("\t}\n\n"); sb.Append($"\tpublic {excelName} QueryById(int id)\n"); sb.Append("\t{\n"); - sb.Append($"\t\tvar datas = from d in {excelName}Infos\n"); - sb.Append($"\t\t\t\t\twhere d.Id == id\n"); - sb.Append($"\t\t\t\t\tselect d;\n"); - sb.Append("\t\treturn datas.First();\n"); + // sb.Append($"\t\tvar datas = from d in {excelName}Infos\n"); + // sb.Append($"\t\t\t\t\twhere d.Id == id\n"); + // sb.Append($"\t\t\t\t\tselect d;\n"); + // sb.Append("\t\treturn datas.First();\n"); + sb.Append($"\t\tif ({excelName}Infos.ContainsKey(id))\n"); + sb.Append($"\t\t\treturn {excelName}Infos[id];\n"); + sb.Append($"\t\telse\n"); + sb.Append($"\t\t\treturn null;\n"); sb.Append("\t}\n"); sb.Append("}\n"); FileManager.WriteToFile(Path.Combine(outputDir, $"{excelName}.cs"), sb.ToString()); diff --git a/ExcelTool/bin/Debug/ExcelTool.exe b/ExcelTool/bin/Debug/ExcelTool.exe index b96ba3d..73d9626 100644 Binary files a/ExcelTool/bin/Debug/ExcelTool.exe and b/ExcelTool/bin/Debug/ExcelTool.exe differ diff --git a/ExcelTool/bin/Debug/ExcelTool.pdb b/ExcelTool/bin/Debug/ExcelTool.pdb index 98312f3..5af038c 100644 Binary files a/ExcelTool/bin/Debug/ExcelTool.pdb and b/ExcelTool/bin/Debug/ExcelTool.pdb differ diff --git a/ExcelTool/bin/Debug/Microsoft.mshtml.dll b/ExcelTool/bin/Debug/Microsoft.mshtml.dll index da0768b..ffe2141 100644 Binary files a/ExcelTool/bin/Debug/Microsoft.mshtml.dll and b/ExcelTool/bin/Debug/Microsoft.mshtml.dll differ diff --git a/ExcelTool/bin/Debug/avatarguideTest.cs b/ExcelTool/bin/Debug/avatarguideTest.cs index eed9b3a..dc9e6e3 100644 --- a/ExcelTool/bin/Debug/avatarguideTest.cs +++ b/ExcelTool/bin/Debug/avatarguideTest.cs @@ -6,7 +6,6 @@ using System; using System.IO; using System.Collections.Generic; using System.Text; -using System.Linq; [Serializable] public partial class avatarguideTest : IBinarySerializable @@ -116,7 +115,7 @@ public partial class avatarguideTest : IBinarySerializable [Serializable] public partial class avatarguideTestConfig : IBinarySerializable { - public List avatarguideTestInfos = new List(); + Dictionary avatarguideTestInfos = new Dictionary(); public void DeSerialize(BinaryReader reader) { int count = reader.ReadInt32(); @@ -124,7 +123,7 @@ public partial class avatarguideTestConfig : IBinarySerializable { avatarguideTest tempData = new avatarguideTest(); tempData.DeSerialize(reader); - avatarguideTestInfos.Add(tempData); + avatarguideTestInfos.Add(tempData.Id, tempData); } } @@ -139,9 +138,9 @@ public partial class avatarguideTestConfig : IBinarySerializable public avatarguideTest QueryById(int id) { - var datas = from d in avatarguideTestInfos - where d.Id == id - select d; - return datas.FirstOrDefault(); + if (avatarguideTestInfos.ContainsKey(id)) + return avatarguideTestInfos[id]; + else + return null; } } diff --git a/ExcelTool/bin/Debug/battleScene.cs b/ExcelTool/bin/Debug/battleScene.cs index c9cfaf3..57b68fc 100644 --- a/ExcelTool/bin/Debug/battleScene.cs +++ b/ExcelTool/bin/Debug/battleScene.cs @@ -6,7 +6,6 @@ using System; using System.IO; using System.Collections.Generic; using System.Text; -using System.Linq; [Serializable] public partial class battleScene : IBinarySerializable @@ -145,7 +144,7 @@ public partial class battleScene : IBinarySerializable [Serializable] public partial class battleSceneConfig : IBinarySerializable { - public List battleSceneInfos = new List(); + Dictionary battleSceneInfos = new Dictionary(); public void DeSerialize(BinaryReader reader) { int count = reader.ReadInt32(); @@ -153,7 +152,7 @@ public partial class battleSceneConfig : IBinarySerializable { battleScene tempData = new battleScene(); tempData.DeSerialize(reader); - battleSceneInfos.Add(tempData); + battleSceneInfos.Add(tempData.Id, tempData); } } @@ -168,9 +167,9 @@ public partial class battleSceneConfig : IBinarySerializable public battleScene QueryById(int id) { - var datas = from d in battleSceneInfos - where d.Id == id - select d; - return datas.FirstOrDefault(); + if (battleSceneInfos.ContainsKey(id)) + return battleSceneInfos[id]; + else + return null; } } diff --git a/ExcelTool/bin/Debug/official_room.cs b/ExcelTool/bin/Debug/official_room.cs index c8028e3..bac0683 100644 --- a/ExcelTool/bin/Debug/official_room.cs +++ b/ExcelTool/bin/Debug/official_room.cs @@ -6,7 +6,6 @@ using System; using System.IO; using System.Collections.Generic; using System.Text; -using System.Linq; [Serializable] public partial class official_room : IBinarySerializable @@ -218,7 +217,7 @@ public partial class official_room : IBinarySerializable [Serializable] public partial class official_roomConfig : IBinarySerializable { - public List official_roomInfos = new List(); + Dictionary official_roomInfos = new Dictionary(); public void DeSerialize(BinaryReader reader) { int count = reader.ReadInt32(); @@ -226,7 +225,7 @@ public partial class official_roomConfig : IBinarySerializable { official_room tempData = new official_room(); tempData.DeSerialize(reader); - official_roomInfos.Add(tempData); + official_roomInfos.Add(tempData.Id, tempData); } } @@ -241,9 +240,9 @@ public partial class official_roomConfig : IBinarySerializable public official_room QueryById(int id) { - var datas = from d in official_roomInfos - where d.Id == id - select d; - return datas.FirstOrDefault(); + if (official_roomInfos.ContainsKey(id)) + return official_roomInfos[id]; + else + return null; } } diff --git a/ExcelTool/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/ExcelTool/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 3f151ce..7a4eed7 100644 Binary files a/ExcelTool/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/ExcelTool/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/ExcelTool/obj/Debug/ExcelTool.csproj.AssemblyReference.cache b/ExcelTool/obj/Debug/ExcelTool.csproj.AssemblyReference.cache new file mode 100644 index 0000000..b1b9e11 Binary files /dev/null and b/ExcelTool/obj/Debug/ExcelTool.csproj.AssemblyReference.cache differ diff --git a/ExcelTool/obj/Debug/ExcelTool.csproj.FileListAbsolute.txt b/ExcelTool/obj/Debug/ExcelTool.csproj.FileListAbsolute.txt index 4ea49de..58a1d3d 100644 --- a/ExcelTool/obj/Debug/ExcelTool.csproj.FileListAbsolute.txt +++ b/ExcelTool/obj/Debug/ExcelTool.csproj.FileListAbsolute.txt @@ -34,20 +34,22 @@ D:\Work\CodeHubG\ExcelTool\ExcelTool\obj\Debug\ExcelTool.csproj.CoreCompileInput D:\Work\CodeHubG\ExcelTool\ExcelTool\obj\Debug\ExcelTool.csproj.CopyComplete D:\Work\CodeHubG\ExcelTool\ExcelTool\obj\Debug\ExcelTool.exe D:\Work\CodeHubG\ExcelTool\ExcelTool\obj\Debug\ExcelTool.pdb -D:\Study\github\ExcelTool\ExcelTool\bin\Debug\ExcelTool.exe.config -D:\Study\github\ExcelTool\ExcelTool\bin\Debug\ExcelTool.exe -D:\Study\github\ExcelTool\ExcelTool\bin\Debug\ExcelTool.pdb -D:\Study\github\ExcelTool\ExcelTool\bin\Debug\ICSharpCode.SharpZipLib.dll -D:\Study\github\ExcelTool\ExcelTool\bin\Debug\NPOI.dll -D:\Study\github\ExcelTool\ExcelTool\bin\Debug\NPOI.OOXML.dll -D:\Study\github\ExcelTool\ExcelTool\bin\Debug\NPOI.OpenXml4Net.dll -D:\Study\github\ExcelTool\ExcelTool\bin\Debug\NPOI.OpenXmlFormats.dll -D:\Study\github\ExcelTool\ExcelTool\bin\Debug\Spire.Pdf.dll -D:\Study\github\ExcelTool\ExcelTool\bin\Debug\Spire.XLS.dll -D:\Study\github\ExcelTool\ExcelTool\bin\Debug\Microsoft.mshtml.dll -D:\Study\github\ExcelTool\ExcelTool\bin\Debug\Spire.Pdf.xml -D:\Study\github\ExcelTool\ExcelTool\bin\Debug\Spire.XLS.xml -D:\Study\github\ExcelTool\ExcelTool\obj\Debug\ExcelTool.csproj.CopyComplete -D:\Study\github\ExcelTool\ExcelTool\obj\Debug\ExcelTool.exe -D:\Study\github\ExcelTool\ExcelTool\obj\Debug\ExcelTool.pdb -D:\Study\GitHub\ExcelTool\ExcelTool\obj\Debug\ExcelTool.csproj.CoreCompileInputs.cache +D:\study\github\ExcelTool\ExcelTool\bin\Debug\ExcelTool.exe.config +D:\study\github\ExcelTool\ExcelTool\bin\Debug\ExcelTool.exe +D:\study\github\ExcelTool\ExcelTool\bin\Debug\ExcelTool.pdb +D:\study\github\ExcelTool\ExcelTool\bin\Debug\ICSharpCode.SharpZipLib.dll +D:\study\github\ExcelTool\ExcelTool\bin\Debug\NPOI.dll +D:\study\github\ExcelTool\ExcelTool\bin\Debug\NPOI.OOXML.dll +D:\study\github\ExcelTool\ExcelTool\bin\Debug\NPOI.OpenXml4Net.dll +D:\study\github\ExcelTool\ExcelTool\bin\Debug\NPOI.OpenXmlFormats.dll +D:\study\github\ExcelTool\ExcelTool\bin\Debug\Spire.Pdf.dll +D:\study\github\ExcelTool\ExcelTool\bin\Debug\Spire.XLS.dll +D:\study\github\ExcelTool\ExcelTool\bin\Debug\Microsoft.mshtml.dll +D:\study\github\ExcelTool\ExcelTool\bin\Debug\Spire.Pdf.xml +D:\study\github\ExcelTool\ExcelTool\bin\Debug\Spire.XLS.xml +D:\study\github\ExcelTool\ExcelTool\obj\Debug\ExcelTool.csproj.AssemblyReference.cache +D:\study\github\ExcelTool\ExcelTool\obj\Debug\ExcelTool.csproj.SuggestedBindingRedirects.cache +D:\study\github\ExcelTool\ExcelTool\obj\Debug\ExcelTool.csproj.CoreCompileInputs.cache +D:\study\github\ExcelTool\ExcelTool\obj\Debug\ExcelTool.csproj.CopyComplete +D:\study\github\ExcelTool\ExcelTool\obj\Debug\ExcelTool.exe +D:\study\github\ExcelTool\ExcelTool\obj\Debug\ExcelTool.pdb diff --git a/ExcelTool/obj/Debug/ExcelTool.csproj.SuggestedBindingRedirects.cache b/ExcelTool/obj/Debug/ExcelTool.csproj.SuggestedBindingRedirects.cache new file mode 100644 index 0000000..e69de29 diff --git a/ExcelTool/obj/Debug/ExcelTool.exe b/ExcelTool/obj/Debug/ExcelTool.exe index b96ba3d..73d9626 100644 Binary files a/ExcelTool/obj/Debug/ExcelTool.exe and b/ExcelTool/obj/Debug/ExcelTool.exe differ diff --git a/ExcelTool/obj/Debug/ExcelTool.pdb b/ExcelTool/obj/Debug/ExcelTool.pdb index 98312f3..5af038c 100644 Binary files a/ExcelTool/obj/Debug/ExcelTool.pdb and b/ExcelTool/obj/Debug/ExcelTool.pdb differ