Beispiel #1
0
        /// <summary>
        /// Reads an verifies all of the nodes.
        /// </summary>
        private bool DoReadDataEncodingTest()
        {
            // follow tree from each starting node.
            bool success = true;

            double increment = MaxProgress / AvailableNodes.Count;
            double position  = 0;

            Log("Starting ReadDataEncodingTest for {0} Nodes", AvailableNodes.Values.Count);

            ReadValueIdCollection nodesToRead = new ReadValueIdCollection();

            int nodes      = 0;
            int operations = 0;

            uint[] attributeIds = Attributes.GetIdentifiers();

            foreach (Node node in AvailableNodes.Values)
            {
                nodes++;

                AddDataEncodings(node, nodesToRead, attributeIds);

                // process batch.
                if (nodesToRead.Count > BlockSize)
                {
                    operations += nodesToRead.Count;

                    if (!Read(nodesToRead))
                    {
                        success = false;
                        break;
                    }

                    if (nodes > AvailableNodes.Count / 5)
                    {
                        Log("Read {0} attribute values for {1} nodes.", operations, nodes);
                        nodes      = 0;
                        operations = 0;
                    }

                    nodesToRead.Clear();
                }

                position += increment;
                ReportProgress(position);
            }

            // process final batch.
            if (success)
            {
                if (nodesToRead.Count > 0)
                {
                    operations += nodesToRead.Count;

                    if (!Read(nodesToRead))
                    {
                        success = false;
                    }
                    else
                    {
                        Log("Read {0} attribute values for {1} nodes.", operations, nodes);
                    }
                }
            }

            return(success);
        }
Beispiel #2
0
        /// <summary>
        /// Reads an verifies all of the nodes.
        /// </summary>
        private bool DoReadDataEncodingTest()
        {
            // follow tree from each starting node.
            bool success = true;
                     
            double increment = MaxProgress/AvailableNodes.Count;
            double position  = 0;
            
            Log("Starting ReadDataEncodingTest for {0} Nodes", AvailableNodes.Values.Count);
            
            ReadValueIdCollection nodesToRead = new ReadValueIdCollection();
            
            int nodes = 0;
            int operations = 0;
            
            uint[] attributeIds = Attributes.GetIdentifiers();

            foreach (Node node in AvailableNodes.Values)
            {               
                nodes++;

                AddDataEncodings(node, nodesToRead, attributeIds);

                // process batch.
                if (nodesToRead.Count > BlockSize)
                {
                    operations += nodesToRead.Count;

                    if (!Read(nodesToRead))
                    {
                        success = false;
                        break;
                    }

                    if (nodes > AvailableNodes.Count/5)
                    {
                        Log("Read {0} attribute values for {1} nodes.", operations, nodes);
                        nodes = 0;
                        operations = 0;
                    }

                    nodesToRead.Clear();
                }

                position += increment;
                ReportProgress(position);
            }   
         
            // process final batch.
            if (success)
            {
                if (nodesToRead.Count > 0)
                {
                    operations += nodesToRead.Count;

                    if (!Read(nodesToRead))
                    {
                        success = false;
                    }
                    else
                    {
                        Log("Read {0} attribute values for {1} nodes.", operations, nodes);
                    }
                }
            }

            return success;
        }