HMProtocol.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System.Xml;
  2. namespace System.Net.HomeMatic {
  3. public class HMProtocol : HMElement {
  4. //start="0" show="0" count="0"
  5. private int _start;
  6. private int _show;
  7. private int _count;
  8. public HMProtocol(HMApi Api) : base(Api) {
  9. }
  10. public HMProtocol(HMApi Api, XmlNode Data) : base(Api) {
  11. this.Init(Data);
  12. }
  13. private void Init(XmlNode Data) {
  14. this._start = this.Attr_Int32(Data, "start");
  15. this._show = this.Attr_Int32(Data, "show");
  16. this._count = this.Attr_Int32(Data, "count");
  17. }
  18. public int Start {
  19. get { return this._start; }
  20. }
  21. public int Show {
  22. get { return this._show; }
  23. }
  24. public int Count {
  25. get { return this._count; }
  26. }
  27. /*public override bool Equals(object o) {
  28. if (o == null) return false;
  29. if (((HMProtocol)o).Start == this._start &&
  30. ((HMProtocol)o).Show == this._show &&
  31. ((HMProtocol)o).Count == this._count)
  32. return true;
  33. else
  34. return false;
  35. }
  36. public static bool operator ==(HMProtocol c1, HMProtocol c2) {
  37. if (c1 == null || c2 == null) return c1 == null && c2 == null;
  38. return c1.Equals(c2);
  39. }
  40. public static bool operator !=(HMProtocol c1, HMProtocol c2) {
  41. if (c1 == null || c2 == null) return (c1 != null || c2 != null);
  42. return !c1.Equals(c2);
  43. }*/
  44. public override string ToString() {
  45. return "[System.Net.HomeMatic.HMProtocol[" + this.ValuesToString() + "]]";
  46. }
  47. private string ValuesToString() {
  48. return this._start.ToString() + ";" +
  49. this._show.ToString() + ";" +
  50. this._count.ToString() + ";";
  51. }
  52. public override int GetHashCode() {
  53. return this.ToString().GetHashCode();
  54. }
  55. }
  56. }