CodeTemplateFactory.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 FunctionGroupTemplate { get; private set; }
  11. public static string FunctionGroupOnlyTemplate { get; private set; }
  12. public static string FunctionSingleTemplate { get; private set; }
  13. //public static string ConfigTemplateEditor { get => _configTemplateEditor; }
  14. //public static string ConfigArrayTemplateEditor { get => _configArrayTemplateEditor; }
  15. public static void Init()
  16. {
  17. ConfigTemplate = File.ReadAllText(ExcelConfig.templatePath + "Config.txt");
  18. //using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "Config.txt"))
  19. //{
  20. // ConfigTemplate = sr.ReadToEnd();
  21. //}
  22. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "ConfigArray.txt"))
  23. {
  24. ConfigArrayTemplate = sr.ReadToEnd();
  25. }
  26. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionGroup.txt"))
  27. {
  28. FunctionGroupTemplate = sr.ReadToEnd();
  29. }
  30. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionGroupOnly.txt"))
  31. {
  32. FunctionGroupOnlyTemplate = sr.ReadToEnd();
  33. }
  34. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionSingle.txt"))
  35. {
  36. FunctionSingleTemplate = sr.ReadToEnd();
  37. }
  38. }
  39. }
  40. }