public override void AddVObject(VObjectDictionaryWrap Parent, VObject Source)
        {
            VObjectDictionary Content = Parent.Content as VObjectDictionary;

            if (Source is VObjectCollectionWrap)
            {
                VObjectCollection Child = Source.Content as VObjectCollection;
                if (!Content.Objects.ContainsKey(Child.Name))
                {
                    if (FNotExistObjMan[this.CurrParent] == ManageNotExisting.Create)
                    {
                        Content.Objects.Add(Child.Name, (VObjectCollectionWrap)Source);
                    }
                }
                else
                {
                    if (FExistObjMan[this.CurrParent] == ManageExistingObject.Overwrite)
                    {
                        Content.Objects[Child.Name].Dispose();
                        Content.Objects[Child.Name] = (VObjectCollectionWrap)Source;
                    }
                    if (FExistObjMan[this.CurrParent] == ManageExistingObject.Extend)
                    {
                        VObjectCollection ColSource  = Content.Objects[Child.Name].Content as VObjectCollection;
                        VObjectCollection CurrSource = Source.Content as VObjectCollection;

                        foreach (KeyValuePair <string, VObject> kvp in CurrSource.Children)
                        {
                            if (ColSource.Children.ContainsKey(kvp.Key))
                            {
                                if (FExistKeyMan[this.CurrParent][this.CurrSource] == ManageExistingKey.Overwrite)
                                {
                                    ColSource[kvp.Key].Dispose();
                                    ColSource[kvp.Key] = kvp.Value;
                                }
                            }
                            else
                            {
                                if (FNotExistKeyMan[this.CurrParent][this.CurrSource] == ManageNotExisting.Create)
                                {
                                    ColSource.Add(kvp.Key, kvp.Value);
                                }
                            }
                        }
                    }
                }
                if (FResetAge[this.CurrParent])
                {
                    VObjectCollection CurrSource = Source.Content as VObjectCollection;
                    CurrSource.Age.Restart();
                }
            }
        }
示例#2
0
        public CompositeVObject(IVObject[] children)
            : this()
        {
            if (children == null)
            {
                throw new System.ArgumentNullException("children");
            }
            if (children.Length < 1)
            {
                throw new System.ArgumentException(StringResources.GetString("ExStrArrayZeroLengthError"), "children");
            }

            for (int i = 0; i < children.Length; i++)
            {
                _children.Add(children[i]);
            }
        }
示例#3
0
 public override void AddObject(object Parent, object Source)
 {
     if (Parent is VObjectCollection)
     {
         VObjectCollection Content = Parent as VObjectCollection;
         if (!Content.Children.ContainsKey(FName[this.CurrParent][this.CurrSource]))
         {
             if (FNotExistObjMan[this.CurrParent] == ManageNotExisting.Create)
             {
                 Content.Add(FName[this.CurrParent][this.CurrSource], Source);
             }
         }
         else
         {
             if (FExistObjMan[this.CurrParent] == ManageExistingObject.Overwrite)
             {
                 Content[FName[this.CurrParent][this.CurrSource]] = Source;
             }
         }
     }
 }
示例#4
0
        public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
        {
            if (info == null)
            {
                throw new System.ArgumentNullException("info");
            }

            info.AddValue(SerializationNames.Name, _name);
            info.AddValue(SerializationNames.Locked, _locked);
            info.AddValue(SerializationNames.LayerVisible, _visible);

            VObjectCollection serializableObjects = new VObjectCollection();

            foreach (IVObject obj in _objects)
            {
                if (obj.GetType().IsSerializable)
                {
                    serializableObjects.Add(obj);
                }
            }

            info.AddValue(SerializationNames.LayerObjects, serializableObjects);
        }