HardwareConfigManager.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.IO;
  5. using BaseLibRWFile;
  6. namespace HardwareConfig
  7. {
  8. [TypeConverter(typeof(ExpandableObjectConverter))]
  9. public class HardConfigManager :XMLRW<HardConfigManager>
  10. {
  11. public string HardConfigFilePath { get; }= $"{GlobalPara.BaseFilePath}\\Config\\HardConfig.xml";
  12. public List<BaseHardware> HardwareList { get; set; } = new List<BaseHardware>();
  13. public static HardConfigManager Ins { get; set; } = new HardConfigManager();
  14. public static HardConfigManager LoadHardConfigFile(string filepath)
  15. {
  16. LoadSysSettingConfig();
  17. return Load(filepath, typeof(HardConfigManager));
  18. }
  19. public static void LoadSysSettingConfig()
  20. {
  21. string strPath = SysSettingPara.Instance.StrSysSettingFilePath;
  22. if (File.Exists(strPath))
  23. {
  24. SysSettingPara.Instance = ClsXml.XmlConfigReader(strPath, typeof(SysSettingPara)) as SysSettingPara;
  25. }
  26. }
  27. public void Save()
  28. {
  29. Save(HardConfigFilePath);
  30. }
  31. public override bool CheckIfNormal()
  32. {
  33. throw new NotImplementedException();
  34. }
  35. }
  36. }