Exemplo n.º 1
0
        public Int32 ReadElement(ref BssomReader reader, BssomSerializerOptions option, BssomFieldOffsetInfo offsetInfo)
        {
            if (offsetInfo.Array1ElementTypeIsNativeType == false && offsetInfo.Array1ElementType == BssomType.Int32Code)
            {
                return(reader.ReadInt32WithOutTypeHead());
            }

            return(BssomSerializationArgumentException.InvalidOffsetInfoFormat <Int32>());
        }
Exemplo n.º 2
0
        public Guid ReadElement(ref BssomReader reader, BssomSerializerOptions option, BssomFieldOffsetInfo offsetInfo)
        {
            if (offsetInfo.Array1ElementTypeIsNativeType == true && offsetInfo.Array1ElementType == NativeBssomType.GuidCode)
            {
                return(reader.ReadGuidWithOutTypeHead());
            }

            return(BssomSerializationArgumentException.InvalidOffsetInfoFormat <Guid>());
        }
Exemplo n.º 3
0
        public static IArray1ElementWriter GetArray1ElementWriter(Type type)
        {
            if (containers.TryGetValue(type, out IArray1ElementWriter array1ElementWriter))
            {
                return(array1ElementWriter);
            }

            return(BssomSerializationArgumentException.InvalidOffsetInfoFormat <IArray1ElementWriter>());
        }
Exemplo n.º 4
0
 public void WriteElement(ref BssomWriter writer, BssomSerializerOptions option, BssomFieldOffsetInfo offsetInfo, Int32 value)
 {
     if (offsetInfo.Array1ElementTypeIsNativeType == false && offsetInfo.Array1ElementType == BssomType.Int32Code)
     {
         writer.WriteWithOutTypeHead(value);
     }
     else
     {
         BssomSerializationArgumentException.InvalidOffsetInfoFormat <Int32>();
     }
 }
Exemplo n.º 5
0
 public void WriteElement(ref BssomWriter writer, BssomSerializerOptions option, BssomFieldOffsetInfo offsetInfo, Decimal value)
 {
     if (offsetInfo.Array1ElementTypeIsNativeType == true && offsetInfo.Array1ElementType == NativeBssomType.DecimalCode)
     {
         writer.WriteWithOutTypeHead(value);
     }
     else
     {
         BssomSerializationArgumentException.InvalidOffsetInfoFormat <Decimal>();
     }
 }
Exemplo n.º 6
0
 public DateTime ReadElement(ref BssomReader reader, BssomSerializerOptions option, BssomFieldOffsetInfo offsetInfo)
 {
     if (offsetInfo.Array1ElementTypeIsNativeType == false && offsetInfo.Array1ElementType == BssomType.TimestampCode)
     {
         return(reader.ReadStandDateTimeWithOutTypeHead());
     }
     else if (offsetInfo.Array1ElementTypeIsNativeType == true && offsetInfo.Array1ElementType == NativeBssomType.DateTimeCode)
     {
         return(reader.ReadNativeDateTimeWithOutTypeHead());
     }
     else
     {
         return(BssomSerializationArgumentException.InvalidOffsetInfoFormat <DateTime>());
     }
 }
Exemplo n.º 7
0
 public void WriteElement(ref BssomWriter writer, BssomSerializerOptions option, BssomFieldOffsetInfo offsetInfo, DateTime value)
 {
     if (offsetInfo.Array1ElementTypeIsNativeType == false && offsetInfo.Array1ElementType == BssomType.TimestampCode)
     {
         writer.Write(value, true, false);
     }
     else if (offsetInfo.Array1ElementTypeIsNativeType == true && offsetInfo.Array1ElementType == NativeBssomType.DateTimeCode)
     {
         writer.Write(value, false, false);
     }
     else
     {
         BssomSerializationArgumentException.InvalidOffsetInfoFormat <DateTime>();
     }
 }
Exemplo n.º 8
0
 public static IArray1ElementWriter GetArray1ElementWriter(bool isNativeType, byte type)
 {
     if (!isNativeType)
     {
         if (type > BssomType.MinFixLenTypeCode && type <= BssomType.TimestampCode)
         {
             return(buildInTypeContainers[type - BssomType.MinFixLenTypeCode - 1]);
         }
     }
     else
     {
         if (type <= NativeBssomType.MaxCode)
         {
             IArray1ElementWriter writer = nativeTypeContainers[type];
             if (writer != null)
             {
                 return(writer);
             }
         }
     }
     return(BssomSerializationArgumentException.InvalidOffsetInfoFormat <IArray1ElementWriter>());
 }