Example #1
0
            public InventoryCollection ReadObject_InventoryCollection(bool isNullable, bool checkType)
            {
                InventoryCollection ob = null;

                if (isNullable && ReadNull())
                {
                    return(null);
                }

                if (checkType)
                {
                    System.Xml.XmlQualifiedName t = GetXsiType();
                    if (t == null)
                    {
                    }
                    else if (t.Name != "InventoryCollection" || t.Namespace != "")
                    {
                        throw CreateUnknownTypeException(t);
                    }
                }

                ob = (InventoryCollection)Activator.CreateInstance(typeof(InventoryCollection), true);

                Reader.MoveToElement();

                while (Reader.MoveToNextAttribute())
                {
                    if (IsXmlnsAttribute(Reader.Name))
                    {
                    }
                    else
                    {
                        UnknownNode(ob);
                    }
                }

                Reader.MoveToElement();
                Reader.MoveToElement();
                if (Reader.IsEmptyElement)
                {
                    Reader.Skip();
                    if (ob.@Folders == null)
                    {
                        ob.@Folders = new System.Collections.Generic.Dictionary <UUID, InventoryFolderWithChildren>();
                    }
                    if (ob.@Items == null)
                    {
                        ob.@Items = new System.Collections.Generic.Dictionary <UUID, InventoryItemBase>();
                    }
                    return(ob);
                }

                Reader.ReadStartElement();
                Reader.MoveToContent();

                bool b43 = false, b44 = false, b45 = false;

                while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
                {
                    if (Reader.NodeType == System.Xml.XmlNodeType.Element)
                    {
                        if (Reader.LocalName == "UserID" && Reader.NamespaceURI == "" && !b45)
                        {
                            b45        = true;
                            ob.@UserID = ReadObject_UUID(false, true);
                        }
                        else if (Reader.LocalName == "Items" && Reader.NamespaceURI == "" && !b44)
                        {
                            System.Collections.Generic.Dictionary <UUID, InventoryItemBase> o46 = ob.@Items;
                            if (((object)o46) == null)
                            {
                                o46       = new System.Collections.Generic.Dictionary <UUID, InventoryItemBase>();
                                ob.@Items = o46;
                            }
                            if (Reader.IsEmptyElement)
                            {
                                Reader.Skip();
                            }
                            else
                            {
                                int n47 = 0;
                                Reader.ReadStartElement();
                                Reader.MoveToContent();

                                while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
                                {
                                    if (Reader.NodeType == System.Xml.XmlNodeType.Element)
                                    {
                                        if (Reader.LocalName == "InventoryItemBase" && Reader.NamespaceURI == "")
                                        {
                                            if (((object)o46) == null)
                                            {
                                                throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryItemBase>");
                                            }
                                            InventoryItemBase item = ReadObject_InventoryItem(true, true);
                                            o46.Add(item.ID, item);
                                            n47++;
                                        }
                                        else
                                        {
                                            UnknownNode(null);
                                        }
                                    }
                                    else
                                    {
                                        UnknownNode(null);
                                    }

                                    Reader.MoveToContent();
                                }
                                ReadEndElement();
                            }
                            b44 = true;
                        }
                        else if (Reader.LocalName == "Folders" && Reader.NamespaceURI == "" && !b43)
                        {
                            System.Collections.Generic.Dictionary <UUID, InventoryFolderWithChildren> o48 = ob.@Folders;
                            if (((object)o48) == null)
                            {
                                o48         = new System.Collections.Generic.Dictionary <UUID, InventoryFolderWithChildren>();
                                ob.@Folders = o48;
                            }
                            if (Reader.IsEmptyElement)
                            {
                                Reader.Skip();
                            }
                            else
                            {
                                int n49 = 0;
                                Reader.ReadStartElement();
                                Reader.MoveToContent();

                                while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
                                {
                                    if (Reader.NodeType == System.Xml.XmlNodeType.Element)
                                    {
                                        if (Reader.LocalName == "InventoryFolderBase" && Reader.NamespaceURI == "")
                                        {
                                            if (((object)o48) == null)
                                            {
                                                throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryFolderBase>");
                                            }
                                            InventoryFolderWithChildren folder = ReadObject_InventoryFolder(true, true);
                                            o48.Add(folder.ID, folder);
                                            n49++;
                                        }
                                        else
                                        {
                                            UnknownNode(null);
                                        }
                                    }
                                    else
                                    {
                                        UnknownNode(null);
                                    }

                                    Reader.MoveToContent();
                                }
                                ReadEndElement();
                            }
                            b43 = true;
                        }
                        else
                        {
                            UnknownNode(ob);
                        }
                    }
                    else
                    {
                        UnknownNode(ob);
                    }

                    Reader.MoveToContent();
                }
                if (ob.@Folders == null)
                {
                    ob.@Folders = new System.Collections.Generic.Dictionary <UUID, InventoryFolderWithChildren>();
                }
                if (ob.@Items == null)
                {
                    ob.@Items = new System.Collections.Generic.Dictionary <UUID, InventoryItemBase>();
                }

                ReadEndElement();

                return(ob);
            }