Ejemplo n.º 1
0
		internal AXmlReader(ObjectIterator objectIterator, XmlReaderSettings settings = null, Func<int, TextLocation> offsetToTextLocation = null)
		{
			this.objectIterator = objectIterator;
			this.settings = settings ?? new XmlReaderSettings();
			this.offsetToTextLocation = offsetToTextLocation;
			this.nameTable = this.settings.NameTable ?? new NameTable();
			this.nsManager = new XmlNamespaceManager(this.nameTable);
			objectIterator.StopAtElementEnd = true;
		}
Ejemplo n.º 2
0
 internal AXmlReader(ObjectIterator objectIterator, XmlReaderSettings settings = null, Func <int, TextLocation> offsetToTextLocation = null)
 {
     this.objectIterator             = objectIterator;
     this.settings                   = settings ?? new XmlReaderSettings();
     this.offsetToTextLocation       = offsetToTextLocation;
     this.nameTable                  = this.settings.NameTable ?? new NameTable();
     this.nsManager                  = new XmlNamespaceManager(this.nameTable);
     objectIterator.StopAtElementEnd = true;
 }
Ejemplo n.º 3
0
        public List <InternalObject> ReadAllObjectsIncremental(InternalObject[] oldObjects, List <UnchangedSegment> reuseMap, CancellationToken cancellationToken)
        {
            ObjectIterator oldObjectIterator = new ObjectIterator(oldObjects);
            int            reuseMapIndex     = 0;

            while (reuseMapIndex < reuseMap.Count)
            {
                var reuseEntry = reuseMap[reuseMapIndex];
                while (this.CurrentLocation < reuseEntry.NewOffset)
                {
                    cancellationToken.ThrowIfCancellationRequested();
                    ReadObject();
                }
                if (this.CurrentLocation >= reuseEntry.NewOffset + reuseEntry.Length)
                {
                    reuseMapIndex++;
                    continue;
                }
                Debug.Assert(reuseEntry.NewOffset <= this.CurrentLocation && this.CurrentLocation < reuseEntry.NewOffset + reuseEntry.Length);
                // reuse the nodes within this reuseEntry starting at oldOffset:
                int oldOffset = this.CurrentLocation - reuseEntry.NewOffset + reuseEntry.OldOffset;
                // seek to oldOffset in the oldObjects array:
                oldObjectIterator.SkipTo(oldOffset);
                if (oldObjectIterator.CurrentPosition == oldOffset)
                {
                    // reuse old objects within this reuse entry:
                    int reuseEnd = reuseEntry.OldOffset + reuseEntry.Length;
                    while (oldObjectIterator.CurrentObject != null && oldObjectIterator.CurrentPosition + oldObjectIterator.CurrentObject.LengthTouched < reuseEnd)
                    {
                        StoreObject(oldObjectIterator.CurrentObject);
                        Skip(oldObjectIterator.CurrentObject.Length);
                        oldObjectIterator.MoveNext();
                    }
                    reuseMapIndex++;                     // go to next re-use map
                }
                else
                {
                    // We are in a region where old objects are available, but aren't aligned correctly.
                    // Don't skip this reuse entry, and read a single object so that we can re-align
                    ReadObject();
                }
            }
            while (HasMoreData())
            {
                cancellationToken.ThrowIfCancellationRequested();
                ReadObject();
            }
            return(objects);
        }
Ejemplo n.º 4
0
		public List<InternalObject> ReadAllObjectsIncremental(InternalObject[] oldObjects, List<UnchangedSegment> reuseMap, CancellationToken cancellationToken)
		{
			ObjectIterator oldObjectIterator = new ObjectIterator(oldObjects);
			int reuseMapIndex = 0;
			while (reuseMapIndex < reuseMap.Count) {
				var reuseEntry = reuseMap[reuseMapIndex];
				while (this.CurrentLocation < reuseEntry.NewOffset) {
					cancellationToken.ThrowIfCancellationRequested();
					ReadObject();
				}
				if (this.CurrentLocation >= reuseEntry.NewOffset + reuseEntry.Length) {
					reuseMapIndex++;
					continue;
				}
				Debug.Assert(reuseEntry.NewOffset <= this.CurrentLocation && this.CurrentLocation < reuseEntry.NewOffset + reuseEntry.Length);
				// reuse the nodes within this reuseEntry starting at oldOffset:
				int oldOffset = this.CurrentLocation - reuseEntry.NewOffset + reuseEntry.OldOffset;
				// seek to oldOffset in the oldObjects array:
				oldObjectIterator.SkipTo(oldOffset);
				if (oldObjectIterator.CurrentPosition == oldOffset) {
					// reuse old objects within this reuse entry:
					int reuseEnd = reuseEntry.OldOffset + reuseEntry.Length;
					while (oldObjectIterator.CurrentObject != null && oldObjectIterator.CurrentPosition + oldObjectIterator.CurrentObject.LengthTouched < reuseEnd) {
						StoreObject(oldObjectIterator.CurrentObject);
						Skip(oldObjectIterator.CurrentObject.Length);
						oldObjectIterator.MoveNext();
					}
					reuseMapIndex++; // go to next re-use map
				} else {
					// We are in a region where old objects are available, but aren't aligned correctly.
					// Don't skip this reuse entry, and read a single object so that we can re-align
					ReadObject();
				}
			}
			while (HasMoreData()) {
				cancellationToken.ThrowIfCancellationRequested();
				ReadObject();
			}
			return objects;
		}
Ejemplo n.º 5
0
 internal AXmlReader(InternalObject[] objects, int startPosition = 0, Func<int, TextLocation> offsetToTextLocation = null)
 {
     this.offsetToTextLocation = offsetToTextLocation;
     objectIterator = new ObjectIterator(objects, startPosition);
     objectIterator.StopAtElementEnd = true;
 }
Ejemplo n.º 6
0
 internal AXmlReader(InternalObject[] objects, int startPosition = 0, Func <int, TextLocation> offsetToTextLocation = null)
 {
     this.offsetToTextLocation       = offsetToTextLocation;
     objectIterator                  = new ObjectIterator(objects, startPosition);
     objectIterator.StopAtElementEnd = true;
 }