2
// <copyright see="prj:///doc/copyright.txt"/>
3
// <license see="prj:///doc/license.txt"/>
4
// <owner name="Oakland Software Incorporated" email="general@oaklandsoftware.com"/>
5
// <version>$Revision$</version>
12
// Note this class is used only internally in TypeLibrary
13
// Used to identify type libraries in the hash tables
14
internal class TypeLibKey : IComparable
18
// The Major.Minor version of a type library, matches
21
internal String _version;
22
internal int _majorVersion;
23
internal int _minorVersion;
25
// Version can be null, to match on the any version
26
internal TypeLibKey(Guid guid,
38
throw new Exception("Error creating TypeLib key for: " +
39
guid + " " + version, ex);
43
protected void GetVersionNumbers()
47
int dot = _version.IndexOf('.');
50
_majorVersion = Convert.
51
ToInt16(_version.Substring(0, dot));
52
_minorVersion = Convert.
53
ToInt16(_version.Substring(dot + 1));
58
Convert.ToInt16(_version);
65
Exception("Error converting version string for: "
70
public override bool Equals(Object other)
72
if (!(other is TypeLibKey))
74
TypeLibKey b = (TypeLibKey)other;
75
bool guidEquals = b._guid.Equals(_guid);
78
if (_version != null && b._version != null)
79
return _version.Equals(b._version);
80
// Our version specified and the other not, no match
81
if (_version != null && b._version == null)
83
// We don't care about version, match any version, or
84
// no version is specified for either one, that's a match
88
public override int GetHashCode()
90
return _guid.GetHashCode();
93
public int CompareTo(Object other)
95
if (!(other is TypeLibKey))
97
TypeLibKey b = (TypeLibKey)other;
100
int compVal = _guid.CompareTo(b._guid);
103
if (_version != null && b._version != null)
104
return _version.CompareTo(b._version);
105
if ((_version != null && b._version == null) ||
106
(_version == null && b._version != null))
113
public override String ToString()
115
return _guid + " " + _version;