internal ReaderImplSub( ReaderImpl rootReader, ReaderBase parent ) : base(rootReader) { Parent = parent; _jail = Root.CreateJail(); Root.Current = this; }
public IStructuredReader Restore(IServiceProvider baseServiceProvider) { XmlReader r = new XmlTextReader(_skippedFragment, XmlNodeType.Element, _xmlContext); ReaderImpl reader = new ReaderImpl(r, baseServiceProvider, _storageVersion, true); return(reader); }
internal ReaderImplSub(ReaderImpl rootReader, ReaderBase parent) : base(rootReader) { Parent = parent; _jail = Root.CreateJail(); Root.Current = this; }
public SubReaderJail(ReaderImpl holder) { _previous = holder._xmlReader; holder._xmlReader = _previous.ReadSubtree(); // Moves the reader on the current node. holder._xmlReader.Read(); _holder = holder; }
public void Dispose() { if (_root != null) { if (_deserializationActions != null) { _deserializationActions.RunOnce(); } OnDispose(); _root = null; } }
/// <summary> /// Creates a simple (full xml based) <see cref="IStructuredReader"/> instance. /// The inner stream will be closed whenever the reader will be disposed. /// </summary> /// <param name="stream">The stream.</param> /// <param name="serviceProvider">The <see cref="IServiceProvider"/> to use.</param> /// <param name="throwErrorOnMissingFile">True to throw an exception when the <paramref name="stream"/> parameter is null.</param> /// <returns>A reader bound to the <paramref name="stream"/> or null.</returns> static public IStructuredReader CreateReader(Stream stream, IServiceProvider serviceProvider, bool throwErrorOnMissingFile) { if (stream == null) { if (throwErrorOnMissingFile) { throw new CKException(R.FileNotFound); } else { return(null); } } XmlReader r = null; try { r = XmlReader.Create(stream, new XmlReaderSettings() { CloseInput = true, IgnoreComments = true, IgnoreProcessingInstructions = true, IgnoreWhitespace = true, DtdProcessing = DtdProcessing.Prohibit, ValidationType = ValidationType.None }); } catch (Exception ex) { if (r != null) { r.Close(); } throw new CKException(R.InvalidFileManifest, ex); } ReaderImpl rw = new ReaderImpl(r, serviceProvider, true); if (rw.StorageVersion == null) { rw.Dispose(); throw new CKException(R.InvalidFileManifestVersion); } return(rw); }
protected ReaderBase( ReaderImpl root ) { _root = root ?? (ReaderImpl)this; }
public void Dispose() { if( _root != null ) { if( _deserializationActions != null ) _deserializationActions.RunOnce(); OnDispose(); _root = null; } }
public IStructuredReader Restore( IServiceProvider baseServiceProvider ) { XmlReader r = new XmlTextReader( _skippedFragment, XmlNodeType.Element, _xmlContext ); ReaderImpl reader = new ReaderImpl( r, baseServiceProvider, _storageVersion, true ); return reader; }
protected ReaderBase(ReaderImpl root) { _root = root ?? (ReaderImpl)this; }
public SubReaderJail( ReaderImpl holder ) { _previous = holder._xmlReader; holder._xmlReader = _previous.ReadSubtree(); // Moves the reader on the current node. holder._xmlReader.Read(); _holder = holder; }
/// <summary> /// Creates a simple (full xml based) <see cref="IStructuredReader"/> instance. /// The inner stream will be closed whenever the reader will be disposed. /// </summary> /// <param name="stream">The stream.</param> /// <param name="serviceProvider">The <see cref="IServiceProvider"/> to use.</param> /// <param name="throwErrorOnMissingFile">True to throw an exception when the <paramref name="stream"/> parameter is null.</param> /// <returns>A reader bound to the <paramref name="stream"/> or null.</returns> public static IStructuredReader CreateReader( Stream stream, IServiceProvider serviceProvider, bool throwErrorOnMissingFile ) { if( stream == null ) { if( throwErrorOnMissingFile ) throw new CKException( R.FileNotFound ); else return null; } XmlReader r = null; try { r = XmlReader.Create( stream, new XmlReaderSettings() { CloseInput = true, IgnoreComments = true, IgnoreProcessingInstructions = true, IgnoreWhitespace = true, DtdProcessing = DtdProcessing.Prohibit, ValidationType = ValidationType.None } ); } catch( Exception ex ) { if( r != null ) r.Close(); throw new CKException( R.InvalidFileManifest, ex ); } ReaderImpl rw = new ReaderImpl( r, serviceProvider, true ); if( rw.StorageVersion == null ) { rw.Dispose(); throw new CKException( R.InvalidFileManifestVersion ); } return rw; }