예제 #1
0
        /// <summary>
        /// Returns the next child.
        /// </summary>
        private IReference NextChild()
        {
            // check if a specific browse name is requested.
            if (QualifiedName.IsNull(base.BrowseName))
            {
                return(NextChild(m_stage));
            }

            // keep fetching references until a matching browse name if found.
            NodeStateReference reference = null;

            do
            {
                reference = NextChild(m_stage);

                if (reference != null)
                {
                    // need to let the caller look up the browse name.
                    if (reference.Target == null)
                    {
                        return(reference);
                    }

                    // check for browse name match.
                    if (reference.Target.BrowseName == base.BrowseName)
                    {
                        return(reference);
                    }
                }
            }while (reference != null);

            // no match - need to go onto the next stage.
            return(null);
        }
예제 #2
0
        /// <summary>
        /// Returns the next child.
        /// </summary>
        private IReference NextChild()
        {
            ComDaClientManager system = (ComDaClientManager)this.SystemContext.SystemHandle;
            ComDaClient        client = system.SelectClient((ServerSystemContext)SystemContext);

            // check if a specific browse name is requested.
            if (QualifiedName.IsNull(base.BrowseName))
            {
                return(NextChild(m_stage));
            }

            // keep fetching references until a matching browse name if found.
            NodeStateReference reference = null;

            do
            {
                reference = NextChild(m_stage);

                if (reference != null)
                {
                    // need to let the caller look up the browse name.
                    if (reference.Target == null)
                    {
                        return(reference);
                    }

                    // check for browse name match.
                    if (reference.Target.BrowseName == base.BrowseName)
                    {
                        return(reference);
                    }
                }
            }while (reference != null);

            // no match - need to go onto the next stage.
            return(null);
        }
예제 #3
0
        /// <summary>
        /// Returns the next reference.
        /// </summary>
        /// <returns></returns>
        public override IReference Next()
        {
            lock (DataLock)
            {
                IReference reference = null;

                // enumerate pre-defined references.
                // always call first to ensure any pushed-back references are returned first.
                reference = base.Next();

                if (reference != null)
                {
                    return(reference);
                }

                // check that the root exists.
                if (m_area == null || !m_area.Exists)
                {
                    return(null);
                }

                // don't start browsing huge number of references when only internal references are requested.
                if (InternalOnly)
                {
                    return(null);
                }

                // start with directories.
                if (m_stage == Stage.Begin)
                {
                    m_stage       = Stage.Directories;
                    m_directories = m_area.GetDirectories();
                    m_position    = 0;
                }

                // enumerate directories.
                if (m_stage == Stage.Directories)
                {
                    if (IsRequired(ReferenceTypeIds.Organizes, false))
                    {
                        reference = NextChild();

                        if (reference != null)
                        {
                            return(reference);
                        }
                    }

                    m_stage    = Stage.Files;
                    m_files    = m_area.GetFiles("*.csv");
                    m_position = 0;
                }

                // enumerate files.
                if (m_stage == Stage.Files)
                {
                    if (IsRequired(ReferenceTypeIds.Organizes, false))
                    {
                        reference = NextChild();

                        if (reference != null)
                        {
                            return(reference);
                        }
                    }

                    m_stage    = Stage.Parents;
                    m_position = 0;
                }

                // enumerate parents.
                if (m_stage == Stage.Parents)
                {
                    if (IsRequired(ReferenceTypeIds.Organizes, true))
                    {
                        if (m_isRoot)
                        {
                            reference = new NodeStateReference(ReferenceTypeIds.Organizes, true, ObjectIds.ObjectsFolder);
                        }
                        else
                        {
                            // create the parent area.
                            AreaState parent = new AreaState(SystemContext, m_area.Parent);

                            // construct the reference.
                            reference = new NodeStateReference(ReferenceTypeIds.Organizes, true, parent);
                        }

                        m_stage    = Stage.Done;
                        m_position = 0;

                        return(reference);
                    }
                }

                // all done.
                return(null);
            }
        }
예제 #4
0
 public void AddToReferences(NodeStateReference nodeRef)
 {
     m_references.Add(nodeRef);
 }