private ProtectedBinary ReadProtectedBinary(XmlReader xr)
{
if(xr.MoveToAttribute(AttrRef))
{
string strRef = xr.Value;
if(strRef != null)
{
ProtectedBinary pb = BinPoolGet(strRef);
if(pb != null) return pb;
else { Debug.Assert(false); }
}
else { Debug.Assert(false); }
}
bool bCompressed = false;
if(xr.MoveToAttribute(AttrCompressed))
bCompressed = (xr.Value == ValTrue);
XorredBuffer xb = ProcessNode(xr);
if(xb != null)
{
Debug.Assert(!bCompressed); // See SubWriteValue(ProtectedBinary value)
return new ProtectedBinary(true, xb);
}
string strValue = ReadString(xr);
if(strValue.Length == 0) return new ProtectedBinary(false);
byte[] pbData = Convert.FromBase64String(strValue);
if(bCompressed) pbData = MemUtil.Decompress(pbData);
return new ProtectedBinary(false, pbData);
}