Ejemplo n.º 1
0
        public void WriteNode(PropertyTreeReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader"); // $NON-NLS-1
            }
            int initialDepth = reader.Depth;

            do
            {
                switch (reader.NodeType)
                {
                case PropertyNodeType.EndPropertyTree:
                    this.WriteEndTree();
                    break;

                case PropertyNodeType.Property:
                    this.WriteProperty(reader.Name, reader.Namespace, Convert.ToString(reader.Value));

                    break;

                case PropertyNodeType.PropertyTree:
                    this.WriteStartTree(reader.Name, reader.Namespace);
                    break;
                }
            } while (reader.Read() &&
                     ((initialDepth < reader.Depth) ||
                      (initialDepth == reader.Depth && reader.NodeType == PropertyNodeType.EndPropertyTree)));
        }
Ejemplo n.º 2
0
        void _ReadSubtree(PropertyTreeReader reader, int depth)
        {
            while (reader.Read())
            {
                CopyCurrent(reader); // TODO Exceptions generated by the write here (invalid local name) should be detected earlier and have line numbers

                if (reader.NodeType == PropertyNodeType.EndPropertyTree ||
                    reader.NodeType == PropertyNodeType.Property)
                {
                    if (reader.Depth == depth)
                    {
                        break;
                    }
                }
            }
        }
        void _ReadSubtree(PropertyTreeReader reader, int depth)
        {
            while (reader.Read()) {
                CopyCurrent(reader); // TODO Exceptions generated by the write here (invalid local name) should be detected earlier and have line numbers

                if (reader.NodeType == PropertyNodeType.EndPropertyTree
                    || reader.NodeType == PropertyNodeType.Property) {

                    if (reader.Depth == depth)
                        break;
                }
            }
        }
        public void WriteNode(PropertyTreeReader reader)
        {
            if (reader == null)
                throw new ArgumentNullException("reader"); // $NON-NLS-1

            int initialDepth = reader.Depth;
            do {
                switch (reader.NodeType) {
                    case PropertyNodeType.EndPropertyTree:
                        this.WriteEndTree();
                        break;

                    case PropertyNodeType.Property:
                        this.WriteProperty(reader.Name, reader.Namespace, Convert.ToString(reader.Value));

                        break;

                    case PropertyNodeType.PropertyTree:
                        this.WriteStartTree(reader.Name, reader.Namespace);
                        break;
                }

            } while (reader.Read()
                     && ((initialDepth < reader.Depth)
                         || (initialDepth == reader.Depth && reader.NodeType == PropertyNodeType.EndPropertyTree)));
        }