1.1 --- a/Hardware/Identifier.cs Tue Sep 07 22:15:02 2010 +0000
1.2 +++ b/Hardware/Identifier.cs Wed Sep 08 19:29:58 2010 +0000
1.3 @@ -36,7 +36,6 @@
1.4 */
1.5
1.6 using System;
1.7 -using System.Collections.Generic;
1.8 using System.Text;
1.9
1.10 namespace OpenHardwareMonitor.Hardware {
1.11 @@ -45,7 +44,7 @@
1.12
1.13 private static char SEPARATOR = '/';
1.14
1.15 - private static void CheckIdentifiers(string[] identifiers) {
1.16 + private static void CheckIdentifiers(string[] identifiers) {
1.17 foreach (string s in identifiers)
1.18 if (s.Contains(" ") || s.Contains(SEPARATOR.ToString()))
1.19 throw new ArgumentException("Invalid identifier");
1.20 @@ -97,7 +96,34 @@
1.21 if (other == null)
1.22 return 1;
1.23 else
1.24 - return this.identifier.CompareTo(other.identifier);
1.25 + return string.Compare(this.identifier, other.identifier,
1.26 + StringComparison.Ordinal);
1.27 }
1.28 +
1.29 + public static bool operator ==(Identifier id1, Identifier id2) {
1.30 + if (id1 == null)
1.31 + return id2 == null;
1.32 + else
1.33 + return id1.Equals(id2);
1.34 + }
1.35 +
1.36 + public static bool operator !=(Identifier id1, Identifier id2) {
1.37 + return !(id1 == id2);
1.38 + }
1.39 +
1.40 + public static bool operator <(Identifier id1, Identifier id2) {
1.41 + if (id1 == null)
1.42 + return id2 != null;
1.43 + else
1.44 + return (id1.CompareTo(id2) < 0);
1.45 + }
1.46 +
1.47 + public static bool operator >(Identifier id1, Identifier id2) {
1.48 + if (id1 == null)
1.49 + return false;
1.50 + else
1.51 + return (id1.CompareTo(id2) > 0);
1.52 + }
1.53 +
1.54 }
1.55 }