internal bool PartialNameCompare(AssemblyNameExtension that, PartialComparisonFlags comparisonFlags) { if (!object.ReferenceEquals(this, that)) { if (object.ReferenceEquals(that, null)) { return(false); } if (((this.asAssemblyName != null) && (that.asAssemblyName != null)) && object.ReferenceEquals(this.asAssemblyName, that.asAssemblyName)) { return(true); } if ((((comparisonFlags & PartialComparisonFlags.SimpleName) != 0) && (this.Name != null)) && !string.Equals(this.Name, that.Name, StringComparison.OrdinalIgnoreCase)) { return(false); } if ((((comparisonFlags & PartialComparisonFlags.Version) != 0) && (this.Version != null)) && (this.Version != that.Version)) { return(false); } if ((((comparisonFlags & PartialComparisonFlags.Culture) != 0) && (this.CultureInfo != null)) && ((that.CultureInfo == null) || !this.CompareCulture(that))) { return(false); } if ((((comparisonFlags & PartialComparisonFlags.PublicKeyToken) != 0) && (this.GetPublicKeyToken() != null)) && !this.ComparePublicKeyToken(that)) { return(false); } } return(true); }
/// <summary> /// Do a partial comparison between two assembly name extensions. /// Compare the fields of A and B on the following conditions: /// 1) A.Field has a non null value /// 2) The field has been selected in the comparison flags or the default comparison flags are passed in. /// /// If A.Field is null then we will not compare A.Field and B.Field even when the comparison flag is set for that field unless skipNullFields is false. /// </summary> internal bool PartialNameCompare(AssemblyNameExtension that, PartialComparisonFlags comparisonFlags, bool considerRetargetableFlag) { // Pointer compare. if (Object.ReferenceEquals(this, that)) { return(true); } // If that is null then this and that are not equal. Also, this would cause a crash on the next line. if (Object.ReferenceEquals(that, null)) { return(false); } // Do both have assembly names? if (_asAssemblyName != null && that._asAssemblyName != null) { // Pointer compare. if (Object.ReferenceEquals(_asAssemblyName, that._asAssemblyName)) { return(true); } } // Do the names match? if ((comparisonFlags & PartialComparisonFlags.SimpleName) != 0 && Name != null && !String.Equals(Name, that.Name, StringComparison.OrdinalIgnoreCase)) { return(false); } if ((comparisonFlags & PartialComparisonFlags.Version) != 0 && Version != null && this.Version != that.Version) { return(false); } if ((comparisonFlags & PartialComparisonFlags.Culture) != 0 && CultureInfo != null && (that.CultureInfo == null || !CompareCulture(that))) { return(false); } if ((comparisonFlags & PartialComparisonFlags.PublicKeyToken) != 0 && GetPublicKeyToken() != null && !ComparePublicKeyToken(that)) { return(false); } if (considerRetargetableFlag && (Retargetable != that.Retargetable)) { return(false); } return(true); }
/// <summary> /// Do a partial comparison between two assembly name extensions. /// Compare the fields of A and B on the following conditions: /// 1) A.Field has a non null value /// 2) The field has been selected in the comparison flags or the default comparison flags are passed in. /// /// If A.Field is null then we will not compare A.Field and B.Field even when the comparison flag is set for that field unless skipNullFields is false. /// </summary> internal bool PartialNameCompare(AssemblyNameExtension that, PartialComparisonFlags comparisonFlags) { return(PartialNameCompare(that, comparisonFlags, false /* do not consider retargetable flag*/)); }
internal bool PartialNameCompare(AssemblyNameExtension that, PartialComparisonFlags comparisonFlags) { if (!object.ReferenceEquals(this, that)) { if (object.ReferenceEquals(that, null)) { return false; } if (((this.asAssemblyName != null) && (that.asAssemblyName != null)) && object.ReferenceEquals(this.asAssemblyName, that.asAssemblyName)) { return true; } if ((((comparisonFlags & PartialComparisonFlags.SimpleName) != 0) && (this.Name != null)) && !string.Equals(this.Name, that.Name, StringComparison.OrdinalIgnoreCase)) { return false; } if ((((comparisonFlags & PartialComparisonFlags.Version) != 0) && (this.Version != null)) && (this.Version != that.Version)) { return false; } if ((((comparisonFlags & PartialComparisonFlags.Culture) != 0) && (this.CultureInfo != null)) && ((that.CultureInfo == null) || !this.CompareCulture(that))) { return false; } if ((((comparisonFlags & PartialComparisonFlags.PublicKeyToken) != 0) && (this.GetPublicKeyToken() != null)) && !this.ComparePublicKeyToken(that)) { return false; } } return true; }
/// <summary> /// Do a partial comparison between two assembly name extensions. /// Compare the fields of A and B on the following conditions: /// 1) A.Field has a non null value /// 2) The field has been selected in the comparison flags or the default comparison flags are passed in. /// /// If A.Field is null then we will not compare A.Field and B.Field even when the comparison flag is set for that field unless skipNullFields is false. /// </summary> internal bool PartialNameCompare(AssemblyNameExtension that, PartialComparisonFlags comparisonFlags, bool considerRetargetableFlag) { // Pointer compare. if (Object.ReferenceEquals(this, that)) { return true; } // If that is null then this and that are not equal. Also, this would cause a crash on the next line. if (Object.ReferenceEquals(that, null)) { return false; } // Do both have assembly names? if (asAssemblyName != null && that.asAssemblyName != null) { // Pointer compare. if (Object.ReferenceEquals(asAssemblyName, that.asAssemblyName)) { return true; } } // Do the names match? if ((comparisonFlags & PartialComparisonFlags.SimpleName) != 0 && Name != null && !String.Equals(Name, that.Name, StringComparison.OrdinalIgnoreCase)) { return false; } if ((comparisonFlags & PartialComparisonFlags.Version) != 0 && Version != null && this.Version != that.Version) { return false; } if ((comparisonFlags & PartialComparisonFlags.Culture) != 0 && CultureInfo != null && (that.CultureInfo == null || !CompareCulture(that))) { return false; } if ((comparisonFlags & PartialComparisonFlags.PublicKeyToken) != 0 && GetPublicKeyToken() != null && !ComparePublicKeyToken(that)) { return false; } if (considerRetargetableFlag && (Retargetable != that.Retargetable)) { return false; } return true; }
/// <summary> /// Do a partial comparison between two assembly name extensions. /// Compare the fields of A and B on the following conditions: /// 1) A.Field has a non null value /// 2) The field has been selected in the comparison flags or the default comparison flags are passed in. /// /// If A.Field is null then we will not compare A.Field and B.Field even when the comparison flag is set for that field unless skipNullFields is false. /// </summary> internal bool PartialNameCompare(AssemblyNameExtension that, PartialComparisonFlags comparisonFlags) { return PartialNameCompare(that, comparisonFlags, false /* do not consider retargetable flag*/); }