// Token: 0x0600107D RID: 4221 RVA: 0x000419E0 File Offset: 0x0003FBE0 private void Initialize(Stream baseStream, long offset, long length) { if (!baseStream.CanSeek) { throw new ArgumentException("can’t seek on baseStream"); } if (offset < 0L) { throw new ArgumentOutOfRangeException("offset"); } if (length < 0L) { throw new ArgumentOutOfRangeException("length"); } SharedStream sharedStream = baseStream as SharedStream; if (sharedStream != null) { this._baseStream = sharedStream.BaseStream; this._offset = offset + sharedStream._offset; this._length = length; this._refCount = sharedStream._refCount; this._refCount.Value++; return; } this._baseStream = baseStream; this._offset = offset; this._length = length; this._refCount = new SharedStream.RefCount(); this._refCount.Value++; }
private void Initialize(Stream baseStream, long offset, long length) { if (baseStream.CanSeek == false) { throw new ArgumentException("can’t seek on baseStream"); } if (offset < 0) { throw new ArgumentOutOfRangeException("offset"); } if (length < 0) { throw new ArgumentOutOfRangeException("length"); } SharedStream subStream = baseStream as SharedStream; if (subStream != null) { _baseStream = subStream.BaseStream; _offset = offset + subStream._offset; _length = length; _refCount = subStream._refCount; _refCount.Value++; } else { _baseStream = baseStream; _offset = offset; _length = length; _refCount = new RefCount(); _refCount.Value++; } }
private void Process_DeferableContentStart() { Int32 contentSize = _binaryReader.ReadInt32(); if (_isBinaryProvider && contentSize > 0) { object binaryData = null; if (_settings.OwnsStream) { // Creates a SharedStream that will be used be shared long position = _binaryReader.BaseStream.Position; binaryData = new SharedStream(_binaryReader.BaseStream, position, contentSize); _binaryReader.BaseStream.Seek(position + contentSize, SeekOrigin.Begin); } else { // The stream may be closed after the end of the baml read // Copy the defered content so that it is available after the read has completed binaryData = new MemoryStream(_binaryReader.ReadBytes(contentSize)); } Common_Process_Property(); _xamlNodesWriter.WriteStartMember(BamlSchemaContext.ResourceDictionaryDeferredContentProperty); _xamlNodesWriter.WriteValue(binaryData); _xamlNodesWriter.WriteEndMember(); } else { _context.KeyList = new List<KeyRecord>(); _context.CurrentKey = 0; _context.CurrentFrame.IsDeferredContent = true; } }
private void Initialize(Stream stream, Baml2006SchemaContext schemaContext, Baml2006ReaderSettings settings) { schemaContext.Settings = settings; _settings = settings; _context = new Baml2006ReaderContext(schemaContext); _xamlMainNodeQueue = new XamlNodeQueue(schemaContext); _xamlNodesReader = _xamlMainNodeQueue.Reader; _xamlNodesWriter = _xamlMainNodeQueue.Writer; _lookingForAKeyOnAMarkupExtensionInADictionaryDepth = -1; _isBinaryProvider = !settings.ValuesMustBeString; // Since the reader owns the stream and is responsible for its lifetime // it can safely hand out shared streams. if (_settings.OwnsStream) { stream = new SharedStream(stream); } _binaryReader = new BamlBinaryReader(stream); _context.TemplateStartDepth = -1; if (!_settings.IsBamlFragment) { Process_Header(); } }