Example #1
0
 public object DecodeRequiredStructure(IPinchableFactory factory, PinchFieldProperties properties)
 {
     return PinchDecoder.DecodeStructure(this, factory, false);
 }
Example #2
0
        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;
        }
Example #3
0
        public object DecodeOptionalStructure(IPinchableFactory factory, PinchFieldProperties properties)
        {
            if (IsOptionalFieldPresent())
            {
                return PinchDecoder.DecodeStructure(this, factory, false);
            }
            else
            {
                ReadNull();

                return null;
            }
        }