OneFrameInputs.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System;
  2. using System.Collections.Generic;
  3. namespace ET
  4. {
  5. public partial class OneFrameInputs
  6. {
  7. protected bool Equals(OneFrameInputs other)
  8. {
  9. return Equals(this.Inputs, other.Inputs);
  10. }
  11. public void CopyTo(OneFrameInputs to)
  12. {
  13. to.Inputs.Clear();
  14. foreach (var kv in this.Inputs)
  15. {
  16. to.Inputs.Add(kv.Key, kv.Value);
  17. }
  18. }
  19. public override bool Equals(object obj)
  20. {
  21. if (ReferenceEquals(null, obj))
  22. {
  23. return false;
  24. }
  25. if (ReferenceEquals(this, obj))
  26. {
  27. return true;
  28. }
  29. if (obj.GetType() != this.GetType())
  30. {
  31. return false;
  32. }
  33. return Equals((OneFrameInputs) obj);
  34. }
  35. public override int GetHashCode()
  36. {
  37. return HashCode.Combine(this.Inputs);
  38. }
  39. public static bool operator==(OneFrameInputs a, OneFrameInputs b)
  40. {
  41. if (a is null || b is null)
  42. {
  43. if (a is null && b is null)
  44. {
  45. return true;
  46. }
  47. return false;
  48. }
  49. if (a.Inputs.Count != b.Inputs.Count)
  50. {
  51. return false;
  52. }
  53. foreach (var kv in a.Inputs)
  54. {
  55. if (!b.Inputs.TryGetValue(kv.Key, out LSInput inputInfo))
  56. {
  57. return false;
  58. }
  59. if (kv.Value != inputInfo)
  60. {
  61. return false;
  62. }
  63. }
  64. return true;
  65. }
  66. public static bool operator !=(OneFrameInputs a, OneFrameInputs b)
  67. {
  68. return !(a == b);
  69. }
  70. }
  71. }