/// <summary> /// Returns true if the given two unit references are to be considered equivalent. /// </summary> public static bool UnitsAreEquivalent(IUnitReference unit1, IUnitReference unit2) { if (unit1 == null || unit2 == null) { return(false); } if (unit1 == unit2) { return(true); } if (UnitHelper.AssembliesAreEquivalent(unit1 as IAssemblyReference, unit2 as IAssemblyReference)) { return(true); } if (UnitHelper.ModulesAreEquivalent(unit1 as IModuleReference, unit2 as IModuleReference)) { return(true); } return(false); }
/// <summary> /// Returns true if the given two unit references are to be considered equivalent as containers. /// </summary> public static bool UnitsAreContainmentEquivalent(IUnitReference unit1, IUnitReference unit2) { if (unit1 == null || unit2 == null) { return(false); } if (unit1 == unit2) { return(true); } IModuleReference /*?*/ moduleRef1 = unit1 as IModuleReference; IModuleReference /*?*/ moduleRef2 = unit2 as IModuleReference; if (moduleRef1 != null && moduleRef2 != null) { if (UnitHelper.AssembliesAreEquivalent(moduleRef1.ContainingAssembly, moduleRef2.ContainingAssembly)) { return(true); } } return(false); }
/// <summary> /// Returns true if the given two module references are to be considered equivalent. /// </summary> public static bool ModulesAreEquivalent(IModuleReference /*?*/ module1, IModuleReference /*?*/ module2) { if (module1 == null || module2 == null) { return(false); } if (module1 == module2) { return(true); } if (module1.ContainingAssembly != null) { if (module2.ContainingAssembly == null) { return(false); } if (!UnitHelper.AssembliesAreEquivalent(module1.ContainingAssembly, module2.ContainingAssembly)) { return(false); } } return(module1.Name.UniqueKeyIgnoringCase == module2.Name.UniqueKeyIgnoringCase); }