public override int GetHashCode() { int hash = 1; if (ServableName.Length != 0) { hash ^= ServableName.GetHashCode(); } if (VersionNum != 0L) { hash ^= VersionNum.GetHashCode(); } if (VersionPath.Length != 0) { hash ^= VersionPath.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/*----< adds version number for package to chains List >-------*/ /* * - will throw exception if version is not higher than all versions in list * - You can turn that off by setting mustBeOrdered to false. * That allows you to build version chain by reading directories and then sorting. */ public void addVersion(Package package, VersionNum ver, bool mustBeOrdered = true) { if (chain_.Keys.Contains(package)) { int latestVer = getLatestVersion(package); if (ver <= latestVer && mustBeOrdered) { string msg = String.Format("attempt to add version {0} in package {1} failed, version out of order", ver, package); Exception ex = new Exception(msg); throw ex; } if (!chain_[package].Contains(ver)) { chain_[package].Add(ver); } } else { List <VersionNum> versions = new List <VersionNum>(); versions.Add(ver); chain_[package] = versions; } }