public MultiValue ReadValueMultiValue(object state)
        {
            object arg;

            var name = this._Input.ReadString(4, true, Encoding.ASCII);
            MultiValueOpcode op;

            if (MultiValue.TryParseOpcode(name, out op) == false)
            {
                throw new FormatException("invalid or unknown multivalue opcode");
            }

            // ReSharper disable BitwiseOperatorOnEnumWithoutFlags
            switch (op & MultiValueOpcode.TypeMask) // ReSharper restore BitwiseOperatorOnEnumWithoutFlags
            {
            case MultiValueOpcode.NON:
            {
                arg = null;
                break;
            }

            case MultiValueOpcode.StaticVariable:
            {
                StaticVariableType sv;
                if (MultiValue.TryParseStaticVariable(this._Input.ReadValueU32(), out sv) == false)
                {
                    throw new InvalidOperationException(
                              string.Format(
                                  "multival {0} had an unexpected static variable index",
                                  op));
                }
                arg = sv;
                break;
            }

            case MultiValueOpcode.INT:
            {
                arg = this._Input.ReadValueS64();
                break;
            }

            case MultiValueOpcode.FLT:
            {
                arg = this._Input.ReadValueF64();
                break;
            }

            case MultiValueOpcode.STR:
            {
                arg = this._Input.ReadStringPascalUncapped();
                break;
            }

            default:
                throw new InvalidOperationException(
                          string.Format(
                              "multival {0} had an unsupported argument data type",
                              op));
            }

            return(new MultiValue()
            {
                Op = op,
                Arg = arg,
            });
        }
        public MultiValue ReadValueMultiValue(object state)
        {
            MultiValueOpcode op;
            var _ = this._Input.ReadValueU32();

            if (MultiValue.TryParseOpcode(_, out op) == false)
            {
                throw new FormatException();
            }

            object arg;

            // ReSharper disable BitwiseOperatorOnEnumWithoutFlags
            switch (op & MultiValueOpcode.TypeMask) // ReSharper restore BitwiseOperatorOnEnumWithoutFlags
            {
            case MultiValueOpcode.NON:
            {
                arg = null;
                break;
            }

            case MultiValueOpcode.StaticVariable:
            {
                StaticVariableType sv;
                if (MultiValue.TryParseStaticVariable(this.ReadNativeUInt32Packed(), out sv) == false)
                {
                    throw new InvalidOperationException(
                              string.Format(
                                  "multival {0} had an unexpected static variable index",
                                  op));
                }
                arg = sv;
                break;
            }

            case MultiValueOpcode.INT:
            {
                var lo = this.ReadNativeUInt32Packed();
                var hi = this.ReadNativeUInt32Packed();
                arg = (long)(((ulong)hi << 32) | lo);
                break;
            }

            case MultiValueOpcode.FLT:
            {
                var lo = this.ReadNativeUInt32Packed();
                var hi = this.ReadNativeUInt32Packed();
                arg = BitConverter.Int64BitsToDouble(((long)hi << 32) | lo);
                break;
            }

            case MultiValueOpcode.STR:
            {
                arg = this._Input.ReadStringZ(Encoding.UTF8);
                break;
            }

            default:
            {
                throw new NotSupportedException("unhandled opcode in multival");
            }
            }

            return(new MultiValue()
            {
                Op = op,
                Arg = arg,
            });
        }