private static MasterCategoryList Resolve(MasterCategoryList client, MasterCategoryList server, MasterCategoryList original) { MasterCategoryList masterCategoryList = new MasterCategoryList(); masterCategoryList.SetProperties(MasterCategoryList.ResolveProperties(client.propertyBag, server.propertyBag, original.propertyBag, AcrProfile.MasterCategoryListProfile)); HashSet <Category> hashSet = new HashSet <Category>(server.Count); Util.AddRange <Category, Category>(hashSet, server); foreach (Category category in client) { Category category2 = server.FindMatch(category); Category original2 = original.FindMatch(category); Category category3 = Category.Resolve(category, category2, original2); if (category3 != null && masterCategoryList.FindMatch(category3) == null) { masterCategoryList.Add(category3); } if (category2 != null) { hashSet.Remove(category2); } } foreach (Category category4 in hashSet) { Category original3 = original.FindMatch(category4); Category category5 = Category.Resolve(null, category4, original3); if (category5 != null && masterCategoryList.FindMatch(category5) == null) { masterCategoryList.Add(category5); } } return(masterCategoryList); }
private void AddResolvingDuplicates(MasterCategoryList mcl, Category categoryToLoad) { Category category = mcl.FindMatch(categoryToLoad); if (category == null) { mcl.Add(categoryToLoad); return; } this.ReportFault(); ExTraceGlobals.StorageTracer.TraceDebug((long)this.GetHashCode(), "Duplicate Category found while deserializing a MasterCategoriesList: Name = \"{0}\" ({1}), Guid = \"{2}\" ({3})", new object[] { categoryToLoad.Name, (categoryToLoad.Name == category.Name) ? "same" : "different", categoryToLoad.Guid, (categoryToLoad.Guid == category.Guid) ? "same" : "different" }); Category item = Category.Resolve(categoryToLoad, category, null); mcl.Remove(category.Name); mcl.Add(item); }