GenerateDataCache.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using FlutterCodeGenerator.Map.Interface;
  2. using FlutterCodeGenerator.ModelTypes;
  3. using System.Collections.Generic;
  4. namespace FlutterCodeGenerator.Model
  5. {
  6. internal class GenerateDataCache
  7. {
  8. private static GenerateDataCache _instance;
  9. private IServiceMap _currentServiceMap;
  10. public static GenerateDataCache Instance => _instance ?? (_instance = new GenerateDataCache());
  11. public Dictionary<ComplexModelType, string> AlreadyGeneratedList { get; }
  12. public Dictionary<string, Dictionary<ModelType, int>> ConflictModelTypeList { get; }
  13. public string CurrentService { get; set; }
  14. public string CurrentMethod { get; set; }
  15. public string CurrentParameter { get; set; }
  16. public bool IsLoadFinished { get; set; }
  17. public bool IsGenerateFinished { get; set; }
  18. public string CurrentGenerator { get; set; }
  19. public GenerateDataCache()
  20. {
  21. AlreadyGeneratedList = new Dictionary<ComplexModelType, string>();
  22. ConflictModelTypeList = new Dictionary<string, Dictionary<ModelType, int>>();
  23. }
  24. public void SetCurrentServiceMap(IServiceMap serviceMap)
  25. {
  26. CurrentService = serviceMap.ServiceName;
  27. _currentServiceMap = serviceMap;
  28. }
  29. public IServiceMap GetCurrentServiceMap()
  30. {
  31. return _currentServiceMap;
  32. }
  33. }
  34. }