Пример #1
0
        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);
        }
Пример #2
0
 internal void Deserialize(MasterCategoryList mcl)
 {
     MasterCategoryListSerializer.CatchSerializationException(delegate
     {
         bool flag = false;
         this.xmlReader.Read();
         while (!this.xmlReader.EOF)
         {
             if (this.xmlReader.NodeType == XmlNodeType.Element && this.IsFromCategoriesNamespace())
             {
                 this.EnsureLocationIsExpectedForKnownElements(flag);
                 string localName;
                 if ((localName = this.xmlReader.LocalName) != null)
                 {
                     if (localName == "categories")
                     {
                         mcl.SetProperties(this.ReadAttributes(MasterCategoryListSchema.Instance));
                         flag = true;
                         this.xmlReader.Read();
                         continue;
                     }
                     if (localName == "category")
                     {
                         this.LoadCategory(mcl);
                         continue;
                     }
                 }
                 this.xmlReader.Skip();
             }
             else
             {
                 this.xmlReader.Skip();
             }
         }
         if (!flag)
         {
             this.ReportFault();
         }
     });
 }