CodeTemplateFactory.cs 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using System.Collections;
  2. using System.IO;
  3. using UnityEngine;
  4. namespace GFGEditor
  5. {
  6. public class CodeTemplateFactory
  7. {
  8. public static string ConfigTemplate { get; private set; }
  9. public static string ConfigArrayTemplate { get; private set; }
  10. public static string InitTemplate { get; private set; }
  11. public static string DisposeTemplate { get; private set; }
  12. public static string FunctionSingleTemplate { get; private set; }
  13. public static string FunctionGroupTemplate { get; private set; }
  14. public static string FunctionAllTemplate { get; private set; }
  15. public static string FunctionAllSingleBlockTemplate { get; private set; }
  16. public static string FunctionAllGroupBlockTemplate { get; private set; }
  17. public static string DisposeAllCfgsCacheTemplate { get; private set; }
  18. public static string FunctionDisposeTemplate { get; private set; }
  19. public static string StrCfgArrayDisposeTemplate { get; private set; }
  20. public static string InitAllCfgsCacheTemplate { get; private set; }
  21. public static string FunctionInitTemplate { get; private set; }
  22. public static string StrCfgArrayInitTemplate { get; private set; }
  23. //public static string ConfigTemplateEditor { get => _configTemplateEditor; }
  24. //public static string ConfigArrayTemplateEditor { get => _configArrayTemplateEditor; }
  25. public static void Init()
  26. {
  27. ConfigTemplate = File.ReadAllText(ExcelConfig.templatePath + "Config.txt");
  28. //using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "Config.txt"))
  29. //{
  30. // ConfigTemplate = sr.ReadToEnd();
  31. //}
  32. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "ConfigArray.txt"))
  33. {
  34. ConfigArrayTemplate = sr.ReadToEnd();
  35. }
  36. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "Init.txt"))
  37. {
  38. InitTemplate = sr.ReadToEnd();
  39. }
  40. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "Dispose.txt"))
  41. {
  42. DisposeTemplate = sr.ReadToEnd();
  43. }
  44. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionSingle.txt"))
  45. {
  46. FunctionSingleTemplate = sr.ReadToEnd();
  47. }
  48. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionGroup.txt"))
  49. {
  50. FunctionGroupTemplate = sr.ReadToEnd();
  51. }
  52. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionAll.txt"))
  53. {
  54. FunctionAllTemplate = sr.ReadToEnd();
  55. }
  56. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionAllSingleBlock.txt"))
  57. {
  58. FunctionAllSingleBlockTemplate = sr.ReadToEnd();
  59. }
  60. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionAllGroupBlock.txt"))
  61. {
  62. FunctionAllGroupBlockTemplate = sr.ReadToEnd();
  63. }
  64. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "DisposeAllCfgsCache.txt"))
  65. {
  66. DisposeAllCfgsCacheTemplate = sr.ReadToEnd();
  67. }
  68. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionDispose.txt"))
  69. {
  70. FunctionDisposeTemplate = sr.ReadToEnd();
  71. }
  72. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "StrCfgArrayDisposeBlock.txt"))
  73. {
  74. StrCfgArrayDisposeTemplate = sr.ReadToEnd();
  75. }
  76. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "InitAllCfgsCache.txt"))
  77. {
  78. InitAllCfgsCacheTemplate = sr.ReadToEnd();
  79. }
  80. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionInit.txt"))
  81. {
  82. FunctionInitTemplate = sr.ReadToEnd();
  83. }
  84. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "StrCfgArrayInitBlock.txt"))
  85. {
  86. StrCfgArrayInitTemplate = sr.ReadToEnd();
  87. }
  88. }
  89. }
  90. }