コード例 #1
0
 void Moved()
 {
     if (this.ReadState == ReadState.Initial)
     {
         throw PropertyTreesFailure.ReaderNotMoved();
     }
 }
コード例 #2
0
 void Moved()
 {
     if (this.reader.ReadState == XReadState.Initial || this.data.Count == 0)
     {
         throw PropertyTreesFailure.ReaderNotMoved();
     }
 }
コード例 #3
0
 internal static void ExpectNode(
     IPropertyTreeNavigator reader, PropertyNodeType expect)
 {
     if (reader.NodeType != expect)
     {
         throw PropertyTreesFailure.ReaderWrongPosition(expect, reader.NodeType);
     }
 }
コード例 #4
0
        public override void WriteEndTree()
        {
            if (currentParent == null)
            {
                throw PropertyTreesFailure.WouldCreateMalformedDocument();
            }

            PopParent();
        }
コード例 #5
0
        public override void WritePropertyValue(object value)
        {
            if (this.property == null)
            {
                throw PropertyTreesFailure.WouldCreateMalformedDocument();
            }

            this.property.AppendValue(value);
        }
コード例 #6
0
        public PropertyTreeWriter Append()
        {
            if (IsPropertyTree)
            {
                return(new PropertyTreeNodeWriter((PropertyTree)this));
            }

            throw PropertyTreesFailure.CannotAppendChild();
        }
コード例 #7
0
        protected virtual void RemoveSelfCore()
        {
            if (Parent == null)
            {
                throw PropertyTreesFailure.CannotDeleteRoot();
            }

            Parent.RemoveChild(this);
        }
コード例 #8
0
        private void PushParent(PropertyNode newParent)
        {
            if (this.currentParent == null)
            {
                throw PropertyTreesFailure.WouldCreateMalformedDocument();
            }

            this.currentParent.Append(newParent);
            this.currentParent = newParent;
        }
コード例 #9
0
 PTXWriterState RequirePop(PTXWriterStateType requiredType)
 {
     if (this.states.Peek().State == requiredType)
     {
         return(PopState());
     }
     else
     {
         throw PropertyTreesFailure.WouldCreateMalformedDocument();
     }
 }
コード例 #10
0
 PTXWriterState RequirePeek(PTXWriterStateType requiredType)
 {
     if (this.states.Peek().State == requiredType)
     {
         return(this.states.Peek());
     }
     else
     {
         throw PropertyTreesFailure.WriterIncorrectState(this.WriteState);
     }
 }
コード例 #11
0
        public override void WriteEndProperty()
        {
            if (property == null || currentParent == null)
            {
                throw PropertyTreesFailure.WouldCreateMalformedDocument();
            }

            this.property.End();
            this.property = null;
            PopParent();
        }
コード例 #12
0
            public override PTXWriterState CreatePropertyChild(string ns, string name)
            {
                QualifiedName qn = QualifiedName.Create(ns, name);

                if (pendingMetadata.ContainsKey(qn))
                {
                    throw PropertyTreesFailure.WriterPropertyOrTreeExists(qn);
                }

                // TODO Support schema trees (may have to store them as PTrees)
                throw new NotImplementedException();
            }
コード例 #13
0
        public override void WriteStartProperty(string localName, string ns)
        {
            if (localName == null)
            {
                throw new ArgumentNullException("localName");
            }
            if (string.IsNullOrEmpty(localName))
            {
                throw Failure.EmptyString("localName");
            }
            if (currentParent == null)
            {
                throw PropertyTreesFailure.WouldCreateMalformedDocumentRootRequired();
            }

            this.property = new PropertyBuilder(ns, localName);
            CopyLineInfo(property.Property);
            PushParent(this.property.Property);
        }
コード例 #14
0
        public override void InsertChildAt(int index, PropertyNode propertyNode)
        {
            if (propertyNode == null)
            {
                throw new ArgumentNullException("propertyNode");
            }
            if (propertyNode.Parent == this)
            {
                return;
            }

            if (propertyNode.QualifiedName != null)
            {
                PropertyNode existing = this.Children[propertyNode.QualifiedName];
                if (existing != null && (propertyNode.IsProperty || existing.IsProperty))
                {
                    throw PropertyTreesFailure.DuplicateProperty("propertyNode", propertyNode.QualifiedName);
                }
            }

            this.children.InsertInternal(index, propertyNode);
        }
コード例 #15
0
 public virtual string ConvertToString(object value, IValueSerializerContext context)
 {
     throw PropertyTreesFailure.CannotConvertToString();
 }
コード例 #16
0
 public virtual object ConvertFromString(string text, Type destinationType, IValueSerializerContext context)
 {
     throw PropertyTreesFailure.CannotConvertFromString(destinationType);
 }
コード例 #17
0
 public override PTXWriterState CreatePropertyChild(string ns, string name)
 {
     throw PropertyTreesFailure.WouldCreateMalformedDocumentRootRequired();
 }
コード例 #18
0
 public virtual void InsertChildAt(int index, PropertyNode node)
 {
     throw PropertyTreesFailure.CannotAppendChild();
 }