public UInt64BytesISegment GetMap2KeySegment(Char key)
 {
     byte[] bs = new byte[BssomBinaryPrimitives.CharSize];
     BssomBinaryPrimitives.WriteCharLittleEndian(ref bs[0], key);
     return(new UInt64BytesISegment(bs));
 }
 public UInt64BytesISegment GetMap2KeySegment(Decimal key)
 {
     byte[] bs = new byte[BssomBinaryPrimitives.DecimalSize];
     BssomBinaryPrimitives.WriteDecimal(ref bs[0], key);
     return(new UInt64BytesISegment(bs));
 }
 public UInt64BytesISegment GetMap2KeySegment(Double key)
 {
     byte[] bs = new byte[BssomBinaryPrimitives.Float64Size];
     BssomBinaryPrimitives.WriteFloat64LittleEndian(ref bs[0], key);
     return(new UInt64BytesISegment(bs));
 }
 public UInt64BytesISegment GetMap2KeySegment(Boolean key)
 {
     byte[] bs = new byte[BssomBinaryPrimitives.BooleanSize];
     BssomBinaryPrimitives.WriteBoolean(ref bs[0], key);
     return(new UInt64BytesISegment(bs));
 }
 public UInt64BytesISegment GetMap2KeySegment(SByte key)
 {
     byte[] bs = new byte[BssomBinaryPrimitives.Int8Size];
     BssomBinaryPrimitives.WriteInt8(ref bs[0], key);
     return(new UInt64BytesISegment(bs));
 }
Beispiel #6
0
 internal DateTime ReadStandDateTimeWithOutTypeHead()
 {
     return(BssomBinaryPrimitives.ReadDateTime(BssomBuffer));
 }
 public UInt64BytesISegment GetMap2KeySegment(DateTime key)
 {
     byte[] bs = new byte[BssomBinaryPrimitives.NativeDateTimeSize];
     BssomBinaryPrimitives.WriteNativeDateTime(ref bs[0], key);
     return(new UInt64BytesISegment(bs));
 }
Beispiel #8
0
        private int GetSizeOfOneObjectToBuffer()
        {
            int  size;
            byte objType = GetBssomTypeFromStreamPack.Get(stream, buffer);

            buffer[0] = objType;
            position++;

            if (BssomBinaryPrimitives.TryGetPrimitiveTypeSizeFromStaticTypeSizes(objType,
                                                                                 out size))
            {
                size -= BssomBinaryPrimitives.BuildInTypeCodeSize;
            }
            else
            {
                switch (objType)
                {
                case BssomType.StringCode:
                    size = (int)ReadVariableNumberCore();
                    break;

                case BssomType.NativeCode:
                {
                    ReadStreamToBuffer(1);
                    objType = buffer[position - 1];
                    if (objType == NativeBssomType.CharCode)
                    {
                        size = BssomBinaryPrimitives.CharSize;
                    }
                    else if (objType == NativeBssomType.DateTimeCode)
                    {
                        size = BssomBinaryPrimitives.NativeDateTimeSize;
                    }
                    else if (objType == NativeBssomType.DecimalCode)
                    {
                        size = BssomBinaryPrimitives.DecimalSize;
                    }
                    else if (objType == NativeBssomType.GuidCode)
                    {
                        size = BssomBinaryPrimitives.GuidSize;
                    }
                    else
                    {
                        throw BssomSerializationOperationException.UnexpectedCodeRead(objType);
                    }

                    break;
                }

                case BssomType.Map1:
                case BssomType.Map2:
                case BssomType.Array2:
                    size = (int)ReadVariableNumberCore();
                    break;

                case BssomType.Array1:
                {
                    ReadStreamToBuffer(1);
                    if (buffer[position - 1] /*elementType*/ == BssomType.NativeCode)
                    {
                        ReadStreamToBuffer(1);
                    }

                    size = (int)ReadVariableNumberCore();
                    break;
                }

                default:
                    throw BssomSerializationOperationException.UnexpectedCodeRead(objType);
                }
            }

            return(size);
        }
Beispiel #9
0
 public int Size(ref BssomSizeContext context, DateTime value)
 {
     return(BssomBinaryPrimitives.DateTimeSize(context.Option.IsUseStandardDateTime));
 }