public object DecodeRequiredStructure(IPinchableFactory factory, PinchFieldProperties properties) { return PinchDecoder.DecodeStructure(this, factory, false); }
internal static object DecodeStructure(PinchDecoder pinchDecoder, IPinchableFactory factory, bool expectHeader) { object value = factory.Create(null); if (value is IPinchable) { IPinchable pinchable = value as IPinchable; /* if (expectHeader) { int protocolVersion; pinchDecoder.DecodeHeader(out protocolVersion); if (protocolVersion == 0) { throw new NotImplementedException("Protocol identifier tagging is not yet implemented in this reader."); } if (protocolVersion != pinchable.ProtocolVersion) { throw new NotImplementedException(string.Format( "Versioning is not yet implemented; version {0} is supported by this " + "reader, but the encoded data was version {1}.", pinchable.ProtocolVersion, protocolVersion)); } } */ pinchable.Decode(pinchDecoder); } else { throw new InvalidOperationException(); } return value; }
public object DecodeOptionalStructure(IPinchableFactory factory, PinchFieldProperties properties) { if (IsOptionalFieldPresent()) { return PinchDecoder.DecodeStructure(this, factory, false); } else { ReadNull(); return null; } }