ConfigConverter.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. using ConfigOperator;
  2. using RealtimeData;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace Test;
  9. internal class ConfigConverter
  10. {
  11. public void Convert(string basePath)
  12. {
  13. if (string.IsNullOrEmpty(basePath))
  14. return;
  15. string localBase =Path.Combine( System.Environment.CurrentDirectory,"Settings");
  16. Hardwares hardwares = new();
  17. HardwareFileLoader hardwareFileLoader = new(hardwares);
  18. hardwareFileLoader.Load(Path.Combine(basePath, "Hardwares"));
  19. hardwareFileLoader.Save(Path.Combine(localBase, "Hardwares"));
  20. HardwareAddress hardwareAddress = new HardwareAddress();
  21. AddressFileLoader addressFileLoader = new(hardwareAddress);
  22. addressFileLoader.LoadPLC(Path.Combine(basePath, "PLCIOList"), Path.Combine(basePath, "PLCIOList", "PLCChannel"));
  23. addressFileLoader.SavePLC(Path.Combine(localBase, "PLCIOList"), Path.Combine(localBase, "PLCIOList", "PLCChannel"));
  24. addressFileLoader.Load(Path.Combine(basePath, "IOList"));
  25. addressFileLoader.Save(Path.Combine(localBase, "IOList"));
  26. }
  27. }