示例#1
0
        public override void Dispose()
        {
            VObjectCollection ThisContent = this.Content as VObjectCollection;

            ThisContent.Clear();
            base.Dispose();
        }
示例#2
0
        public override void DeSerialize(Stream Input)
        {
            base.DeSerialize(Input);
            VObjectCollection ThisContent = new VObjectCollection();

            uint Count = this.Serialized.ReadUint();

            List <uint> ChildrenLengths = new List <uint>();

            for (int i = 0; i < Count; i++)
            {
                ChildrenLengths.Add(this.Serialized.ReadUint());
            }

            for (int i = 0; i < Count; i++)
            {
                uint   keylength = this.Serialized.ReadUint();
                string keyname   = this.Serialized.ReadUnicode((int)keylength);

                uint   l       = ChildrenLengths[i] - keylength - 4;
                Stream vobject = new MemoryStream();
                this.Serialized.CopyTo(vobject, (int)l);
                ThisContent.Objects.Add(keyname, new VObjectCollectionWrap(vobject));
            }
            this.Content = ThisContent;
        }
示例#3
0
        public override VObject DeepCopy()
        {
            VObjectCollection ThisContent = (VObjectCollection)this.Content;
            VObjectCollection NewObject   = new VObjectCollection();

            foreach (KeyValuePair <string, VObjectCollectionWrap> kvp in ThisContent.Objects)
            {
                VObjectCollectionWrap NewCollection = (VObjectCollectionWrap)kvp.Value.DeepCopy();
                NewObject.Objects.Add(kvp.Key, NewCollection);
            }
            VObjectDictionaryWrap NewWrap = new VObjectDictionaryWrap(NewObject);

            return((VObject)NewWrap);
        }
示例#4
0
        public void RemoveTagged()
        {
            this.RemoveList.Clear();
            foreach (KeyValuePair <string, VObjectCollectionWrap> kvp in this.Objects)
            {
                VObjectCollection Content = kvp.Value.Content as VObjectCollection;
                if (Content.Removing)
                {
                    this.RemoveList.Add(kvp.Key);
                }
            }

            foreach (string k in this.RemoveList)
            {
                this.Objects[k].Dispose();
                this.Objects.Remove(k);
            }
            this.RemoveList.Clear();
        }
示例#5
0
        public override void Serialize()
        {
            base.Serialize();
            VObjectCollection ThisContent = this.Content as VObjectCollection;
            Stream            dest        = this.Serialized;

            dest.WriteUint((uint)ThisContent.Objects.Count);                                  // 0 | 4

            foreach (KeyValuePair <string, VObjectCollectionWrap> kvp in ThisContent.Objects) // 4 | CC*4
            {
                kvp.Value.Serialize();
                uint l = (uint)kvp.Value.Serialized.Length; // serialized here
                l += kvp.Key.UnicodeLength() + 4;
                dest.WriteUint(l);
            }

            foreach (KeyValuePair <string, VObjectCollectionWrap> kvp in ThisContent.Objects) // 4 + CC*4
            {
                dest.WriteUint(kvp.Key.UnicodeLength());                                      // 0 | 4
                dest.WriteUnicode(kvp.Key);                                                   // 4 | KL

                kvp.Value.Serialized.CopyTo(dest);                                            // 4 + KL | CL // using the stream created above
            }
        }
示例#6
0
 public VObjectDictionaryWrap(VObjectCollection o) : base(o)
 {
 }
示例#7
0
        public void RemoveObject(string k)
        {
            VObjectCollection tbr = this.Objects[k].Content as VObjectCollection;

            tbr.Removing = true;
        }