Monitor.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Collections.Generic;
  3. public class Monitor
  4. {
  5. public static List<Monitor.InfoData> info_data_list
  6. {
  7. get
  8. {
  9. if (Monitor.data_ == null || Monitor.data_.Count == 0)
  10. {
  11. Monitor.<>c__AnonStorey0 <>c__AnonStorey = new Monitor.<>c__AnonStorey0();
  12. Monitor.data_ = new List<Monitor.InfoData>();
  13. <>c__AnonStorey.class_pointer = DLLMonitorData.CreateMonitorData();
  14. int monitorCount = DLLMonitorData.GetMonitorCount(<>c__AnonStorey.class_pointer);
  15. int i;
  16. for (i = 0; i < monitorCount; i++)
  17. {
  18. DllBase.NativeWriteStringFunction func = delegate(IntPtr p, int buff_size)
  19. {
  20. DLLMonitorData.GetMonitorName(<>c__AnonStorey.class_pointer, i, p, buff_size);
  21. };
  22. Monitor.InfoData item;
  23. item.name = DllBase.GetNativeStringToUtf8(func);
  24. item.width = DLLMonitorData.GetMonitorWidth(<>c__AnonStorey.class_pointer, i);
  25. item.height = DLLMonitorData.GetMonitorHeight(<>c__AnonStorey.class_pointer, i);
  26. item.is_primary = DLLMonitorData.IsMonitorPrimary(<>c__AnonStorey.class_pointer, i);
  27. Monitor.data_.Add(item);
  28. }
  29. DLLMonitorData.DeleteMonitorData(<>c__AnonStorey.class_pointer);
  30. }
  31. return Monitor.data_;
  32. }
  33. }
  34. private static List<Monitor.InfoData> data_;
  35. public struct InfoData
  36. {
  37. public string name;
  38. public int width;
  39. public int height;
  40. public bool is_primary;
  41. }
  42. }