GetSbyte() public method

public GetSbyte ( int index ) : sbyte
index int
return sbyte
コード例 #1
0
 public bool MoveNext()
 {
     if (_pos >= _end)
     {
         return(false);
     }
     Current = _buffer.GetSbyte(_pos);
     _pos   += Size;
     return(true);
 }
コード例 #2
0
        private object DeserializePropertyValue(int structBase, FieldTypeDefinition field)
        {
            var typeModel = field.TypeModel;
            var offset    = GetFieldOffset(structBase, field.Offset);

            if (offset == 0)
            {
                // Nothing in buffer, use default value
                return(field.DefaultValueProvider.GetDefaultValue(field.TypeModel.Type));
            }

            switch (typeModel.BaseType)
            {
            case BaseType.Bool:
            {
                return(_buffer.Get(offset + structBase) == 1);
            }

            case BaseType.Char:
            {
                return(_buffer.GetSbyte(offset + structBase));
            }

            case BaseType.UType:
            case BaseType.UChar:
            {
                return(_buffer.Get(offset + structBase));
            }

            case BaseType.Short:
            {
                return(_buffer.GetShort(offset + structBase));
            }

            case BaseType.UShort:
            {
                return(_buffer.GetUshort(offset + structBase));
            }

            case BaseType.Int:
            {
                return(_buffer.GetInt(offset + structBase));
            }

            case BaseType.UInt:
            {
                return(_buffer.GetUint(offset + structBase));
            }

            case BaseType.Long:
            {
                return(_buffer.GetLong(offset + structBase));
            }

            case BaseType.ULong:
            {
                return(_buffer.GetUlong(offset + structBase));
            }

            case BaseType.Float:
            {
                return(_buffer.GetFloat(offset + structBase));
            }

            case BaseType.Double:
            {
                return(_buffer.GetDouble(offset + structBase));
            }

            case BaseType.String:
            case BaseType.Struct:
            case BaseType.Vector:
            case BaseType.Union:
            {
                return(DeserializeReferenceType(structBase, offset, field));
            }

            default:
            {
                throw new InvalidOperationException();
            }
            }
        }