Example #1
0
        private PropNodeCollectionIntInterface ClonePropNodes(PropNodeCollectionIntInterface sourcePNC, BagNode targetParent)
        {
            PropNodeCollectionIntInterface result;

            List <PropNode> newPropNodeColl = new List <PropNode>();

            foreach (PropNode propNode in sourcePNC.GetPropNodes())
            {
                PropNode newPropNode = propNode.CloneForNewParent(targetParent, useExistingValues: true);
                newPropNodeColl.Add(newPropNode);
            }

            if (sourcePNC.IsFixed)
            {
                System.Diagnostics.Debug.Assert(!sourcePNC.PropItemSetKey.IsEmpty, "We found a fixed PropSetCollection that has an empty PropItemSetKey.");
                // Create a Fixed PropNodeCollection.
                result = new PropNodeCollectionFixed(newPropNodeColl, sourcePNC.PropItemSetKey, sourcePNC.MaxPropsPerObject);
            }
            else
            {
                // Create an open PropNodeCollection.
                result = new PropNodeCollection(newPropNodeColl, sourcePNC.PropItemSetKey, sourcePNC.MaxPropsPerObject);
            }

            return(result);
        }
Example #2
0
        public bool TryGetPropNodeCollection(ObjectIdType objectId, out PropNodeCollectionIntInterface propNodeCollection)
        {
            IEnumerable <PropNode> family = _children.Where(kvp => kvp.Key.Level1Key == objectId).Select(x => x.Value);

            if (family.FirstOrDefault() != null)
            {
                propNodeCollection = new PropNodeCollectionFixed(family, _propItemSetKey, MaxPropsPerObject);
                return(true);
            }
            else
            {
                propNodeCollection = null;
                return(false);
            }
        }
Example #3
0
        public bool TryFixPropItemSet(BagNode propBagNode, PropItemSetKeyType propItemSetKey)
        {
            PropNodeCollectionInternalInterface pnc_int = propBagNode.PropNodeCollection;

            if (pnc_int.IsFixed)
            {
                System.Diagnostics.Debug.WriteLine("Warning: PropStoreAccessServiceProvider is being asked to fix an already fixed PropItemSet.");
                return(true);
            }
            else
            {
                PropNodeCollectionFixed newFixedCollection = new PropNodeCollectionFixed(pnc_int, propItemSetKey);
                propBagNode.PropNodeCollection = newFixedCollection;

                AddFixedPropCollection(newFixedCollection);
                return(true);
            }
        }