private void Initialize(XamlReader wrappedReader, int bufferSize)
        {
            _providerFullEvent = new EventWaitHandle(false, EventResetMode.AutoReset);
            _dataReceivedEvent = new EventWaitHandle(false, EventResetMode.AutoReset);

            _incoming = new XamlNode[bufferSize];
            _outgoing = new XamlNode[bufferSize];

            _wrappedReader            = wrappedReader;
            _wrappedReaderHasLineInfo = ((IXamlLineInfo)_wrappedReader).HasLineInfo;

            var xamlNodeAddDelegate = new XamlNodeAddDelegate(Add);
            XamlLineInfoAddDelegate lineInfoAddDelegate = null;

            if (_wrappedReaderHasLineInfo)
            {
                lineInfoAddDelegate = new XamlLineInfoAddDelegate(AddLineInfo);
            }
            _writer = new WriterDelegate(xamlNodeAddDelegate, lineInfoAddDelegate, _wrappedReader.SchemaContext);

            XamlNodeNextDelegate xamlNodeNextDelegate;

            if (_wrappedReaderHasLineInfo)
            {
                xamlNodeNextDelegate = new XamlNodeNextDelegate(Next_ProcessLineInfo);
            }
            else
            {
                xamlNodeNextDelegate = new XamlNodeNextDelegate(Next);
            }
            _internalReader = new ReaderDelegate(_wrappedReader.SchemaContext, xamlNodeNextDelegate, _wrappedReaderHasLineInfo);

            //Standin so it won't start null
            _currentNode = new XamlNode(XamlNode.InternalNodeType.StartOfStream);
        }
Exemplo n.º 2
0
        private void Initialize(XamlReader wrappedReader, int bufferSize)
        {
            XamlNodeNextDelegate delegate4;

            this._providerFullEvent        = new EventWaitHandle(false, EventResetMode.AutoReset);
            this._dataReceivedEvent        = new EventWaitHandle(false, EventResetMode.AutoReset);
            this._incoming                 = new XamlNode[bufferSize];
            this._outgoing                 = new XamlNode[bufferSize];
            this._wrappedReader            = wrappedReader;
            this._wrappedReaderHasLineInfo = ((IXamlLineInfo)this._wrappedReader).HasLineInfo;
            XamlNodeAddDelegate     add = new XamlNodeAddDelegate(this.Add);
            XamlLineInfoAddDelegate addlineInfoDelegate = null;

            if (this._wrappedReaderHasLineInfo)
            {
                addlineInfoDelegate = new XamlLineInfoAddDelegate(this.AddLineInfo);
            }
            this._writer = new WriterDelegate(add, addlineInfoDelegate, this._wrappedReader.SchemaContext);
            if (this._wrappedReaderHasLineInfo)
            {
                delegate4 = new XamlNodeNextDelegate(this.Next_ProcessLineInfo);
            }
            else
            {
                delegate4 = new XamlNodeNextDelegate(this.Next);
            }
            this._internalReader = new ReaderDelegate(this._wrappedReader.SchemaContext, delegate4, this._wrappedReaderHasLineInfo);
            this._currentNode    = new XamlNode(XamlNode.InternalNodeType.StartOfStream);
        }
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing && !base.IsDisposed)
         {
             this._addDelegate(XamlNodeType.None, XamlNode.InternalNodeType.EndOfStream);
             this._addDelegate = new XamlNodeAddDelegate(this.ThrowBecauseWriterIsClosed);
             this._addLineInfoDelegate = (this._addLineInfoDelegate != null) ? new XamlLineInfoAddDelegate(this.ThrowBecauseWriterIsClosed2) : null;
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing && !base.IsDisposed)
         {
             this._addDelegate(XamlNodeType.None, XamlNode.InternalNodeType.EndOfStream);
             this._addDelegate         = new XamlNodeAddDelegate(this.ThrowBecauseWriterIsClosed);
             this._addLineInfoDelegate = (this._addLineInfoDelegate != null) ? new XamlLineInfoAddDelegate(this.ThrowBecauseWriterIsClosed2) : null;
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
Exemplo n.º 5
0
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing && !IsDisposed)
         {
             _addDelegate(XamlNodeType.None, XamlNode.InternalNodeType.EndOfStream);
             _addDelegate = delegate { throw new XamlException(SR.Get(SRID.WriterIsClosed)); };
             if (_addLineInfoDelegate != null)
             {
                 _addLineInfoDelegate = delegate { throw new XamlException(SR.Get(SRID.WriterIsClosed)); };
             }
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
Exemplo n.º 6
0
 public WriterDelegate(XamlNodeAddDelegate add, XamlLineInfoAddDelegate addlineInfoDelegate, XamlSchemaContext xamlSchemaContext)
 {
     _addDelegate         = add;
     _addLineInfoDelegate = addlineInfoDelegate;
     _schemaContext       = xamlSchemaContext;
 }
 public WriterDelegate(XamlNodeAddDelegate add, XamlLineInfoAddDelegate addlineInfoDelegate, XamlSchemaContext xamlSchemaContext)
 {
     this._addDelegate = add;
     this._addLineInfoDelegate = addlineInfoDelegate;
     this._schemaContext = xamlSchemaContext;
 }
 private void Initialize(XamlReader wrappedReader, int bufferSize)
 {
     XamlNodeNextDelegate delegate4;
     this._providerFullEvent = new EventWaitHandle(false, EventResetMode.AutoReset);
     this._dataReceivedEvent = new EventWaitHandle(false, EventResetMode.AutoReset);
     this._incoming = new XamlNode[bufferSize];
     this._outgoing = new XamlNode[bufferSize];
     this._wrappedReader = wrappedReader;
     this._wrappedReaderHasLineInfo = ((IXamlLineInfo) this._wrappedReader).HasLineInfo;
     XamlNodeAddDelegate add = new XamlNodeAddDelegate(this.Add);
     XamlLineInfoAddDelegate addlineInfoDelegate = null;
     if (this._wrappedReaderHasLineInfo)
     {
         addlineInfoDelegate = new XamlLineInfoAddDelegate(this.AddLineInfo);
     }
     this._writer = new WriterDelegate(add, addlineInfoDelegate, this._wrappedReader.SchemaContext);
     if (this._wrappedReaderHasLineInfo)
     {
         delegate4 = new XamlNodeNextDelegate(this.Next_ProcessLineInfo);
     }
     else
     {
         delegate4 = new XamlNodeNextDelegate(this.Next);
     }
     this._internalReader = new ReaderDelegate(this._wrappedReader.SchemaContext, delegate4, this._wrappedReaderHasLineInfo);
     this._currentNode = new XamlNode(XamlNode.InternalNodeType.StartOfStream);
 }