Inheritance: XmlDictionaryWriter
Exemplo n.º 1
0
 public XmlBaseWriterNodeWriterAsyncHelper(XmlBaseWriter writer)
 {
     this.writer = writer;
 }
Exemplo n.º 2
0
            public WriteBase64AsyncResult(byte[] buffer, int offset, int count, XmlBaseWriter writer, AsyncCallback callback, object state)
                : base(callback, state)
            {
                this.writer = writer;
                this.buffer = buffer;
                this.offset = offset;
                this.count = count;

                bool completeSelf = true;

                if (this.count > 0)
                {
                    if (writer.trailByteCount > 0)
                    {
                        while (writer.trailByteCount < 3 && this.count > 0)
                        {
                            writer.trailBytes[writer.trailByteCount++] = buffer[this.offset++];
                            this.count--;
                        }
                    }

                    this.totalByteCount = writer.trailByteCount + this.count;
                    this.actualByteCount = totalByteCount - (totalByteCount % 3);

                    if (writer.trailBytes == null)
                    {
                        writer.trailBytes = new byte[3];
                    }

                    if (actualByteCount >= 3)
                    {
                        if (writer.attributeValue != null)
                        {
                            writer.WriteAttributeText(XmlConverter.Base64Encoding.GetString(writer.trailBytes, 0, writer.trailByteCount));
                            writer.WriteAttributeText(XmlConverter.Base64Encoding.GetString(buffer, this.offset, actualByteCount - writer.trailByteCount));
                        }

                        // StartContent/WriteBase64Text/EndContent will be called from HandleWriteBase64 as appropriate
                        completeSelf = HandleWriteBase64Text(null);
                    }
                    else
                    {
                        Buffer.BlockCopy(buffer, this.offset, writer.trailBytes, writer.trailByteCount, this.count);
                        writer.trailByteCount += this.count;
                    }
                }

                if (completeSelf)
                {
                    this.Complete(true);
                }
            }