BeckhoffItemManager.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using FestoDebugger.Service;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace FestoDebugger.Beckoff
  8. {
  9. public class BeckhoffItemManager : Singleton<BeckhoffItemManager>
  10. {
  11. private Dictionary<string, BeckhoffItem> _ioItemMap = new Dictionary<string, BeckhoffItem>();
  12. private Dictionary<string, BeckhoffItem> _writeItemMap = new Dictionary<string, BeckhoffItem>();
  13. public BeckhoffItem GetIOBeckhoffItem(string name)
  14. {
  15. return _ioItemMap.ContainsKey(name) ? _ioItemMap[name] : null;
  16. }
  17. public BeckhoffItem GetWriteBeckhoffItem(string name)
  18. {
  19. return _writeItemMap.ContainsKey(name) ? _writeItemMap[name] : null;
  20. }
  21. public void InitBeckhoffItem(string name, string address, string dataType, string ioType, int size, bool bitOperated, int bit, bool invert)
  22. {
  23. _ioItemMap[name] = new BeckhoffItem(name, address, dataType, ioType, size, bitOperated, bit, invert);
  24. }
  25. public void InitWriteBeckoffItem(string name, string address, string dataType, string ioType, int size, bool bitOperated, int bit, bool invert)
  26. {
  27. _writeItemMap[name] = new BeckhoffItem(name, address, dataType, ioType, size, bitOperated, bit, invert);
  28. }
  29. public List<BeckhoffItem> GetIOItems()
  30. {
  31. return _ioItemMap.Values.ToList();
  32. }
  33. public List<BeckhoffItem> GetWriteItems()
  34. {
  35. return _writeItemMap.Values.ToList();
  36. }
  37. }
  38. }