protected override void WriteTextNode(XmlDictionaryReader reader, bool attribute)
{
Type type = reader.ValueType;
if (type == typeof(string))
{
if (reader.CanReadValueChunk)
{
if (chars == null)
{
chars = new char[256];
}
int count;
while ((count = reader.ReadValueChunk(chars, 0, chars.Length)) > 0)
{
this.WriteChars(chars, 0, count);
}
}
else
{
WriteString(reader.Value);
}
if (!attribute)
{
reader.Read();
}
}
else if (type == typeof(byte[]))
{
if (reader.CanReadBinaryContent)
{
// Its best to read in buffers that are a multiple of 3 so we don't break base64 boundaries when converting text
if (bytes == null)
{
bytes = new byte[384];
}
int count;
while ((count = reader.ReadValueAsBase64(bytes, 0, bytes.Length)) > 0)
{
this.WriteBase64(bytes, 0, count);
}
}
else
{
WriteString(reader.Value);
}
if (!attribute)
{
reader.Read();
}
}
else
{
base.WriteTextNode(reader, attribute);
}
}