Newer
Older
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace MasterDevs.ChromeDevTools.ProtocolGenerator
Frederik Carlier
committed
{
Frederik Carlier
committed
{
public ProtocolItem()
{
this.SupportedBy = new Collection<string>();
}
Frederik Carlier
committed
public virtual string Description
{
get;
set;
}
public virtual bool Hidden
{
get;
set;
}
public virtual string Name
{
get;
set;
}
public Collection<string> SupportedBy
{
get;
}
Frederik Carlier
committed
public override string ToString()
{
return this.Name;
}
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
public static bool Equals(ProtocolItem a, ProtocolItem b)
{
if (a == null && b == null)
{
return true;
}
if (a == null || b == null)
{
return false;
}
if (a.GetType() != b.GetType())
{
return false;
}
return a.Equals(b);
}
public override bool Equals(object obj)
{
// In the Equals method, we only include properties which would impact how
// messages are serialized over the wire. E.g.: because the description does not
// impact this, but the name does, the description is ignored but the name is included.
var other = obj as ProtocolItem;
if (other == null)
{
return false;
}
return string.Equals(other.Name, this.Name, StringComparison.OrdinalIgnoreCase);
}
public override int GetHashCode()
{
unchecked
{
int hash = 17;
if (this.Name != null)
{
hash = hash * 23 + StringComparer.OrdinalIgnoreCase.GetHashCode(this.Name);
}
return hash;
}
}