Beispiel #1
0
 internal static void GetTypeValue(TypeHoldingThing typeHolder, ValueHoldingThing valueHolder, SerReader analyzer)
 {
     switch (typeHolder.BinaryType)
     {
         case BinaryTypeEnumeration.Primitive:
             switch (typeHolder.PrimitiveType)
             {
                 case PrimitiveTypeEnumeration.Boolean:
                     valueHolder.Value = analyzer.reader.ReadBoolean();
                     break;
                 case PrimitiveTypeEnumeration.Byte:
                     valueHolder.Value = analyzer.reader.ReadByte();
                     break;
                 case PrimitiveTypeEnumeration.Char:
                     valueHolder.Value = analyzer.reader.ReadChar();
                     break;
                 case PrimitiveTypeEnumeration.DateTime:
                     valueHolder.Value = DateTime.FromBinary(analyzer.reader.ReadInt64());
                     break;
                 case PrimitiveTypeEnumeration.Decimal:
                     string decimalValue = analyzer.reader.ReadString();
                     valueHolder.Value = decimal.Parse(decimalValue);
                     break;
                 case PrimitiveTypeEnumeration.Double:
                     valueHolder.Value = analyzer.reader.ReadDouble();
                     break;
                 case PrimitiveTypeEnumeration.Int16:
                     valueHolder.Value = analyzer.reader.ReadInt16();
                     break;
                 case PrimitiveTypeEnumeration.Int32:
                     valueHolder.Value = analyzer.reader.ReadInt32();
                     break;
                 case PrimitiveTypeEnumeration.Int64:
                     valueHolder.Value = analyzer.reader.ReadInt64();
                     break;
                 case PrimitiveTypeEnumeration.Null:
                     valueHolder.Value = null;
                     break;
                 case PrimitiveTypeEnumeration.SByte:
                     valueHolder.Value = analyzer.reader.ReadSByte();
                     break;
                 case PrimitiveTypeEnumeration.Single:
                     valueHolder.Value = analyzer.reader.ReadSingle();
                     break;
                 case PrimitiveTypeEnumeration.String:
                     valueHolder.Value = analyzer.ReadAndFixString();
                     break;
                 case PrimitiveTypeEnumeration.TimeSpan:
                     valueHolder.Value = TimeSpan.FromTicks(analyzer.reader.ReadInt64());
                     break;
                 case PrimitiveTypeEnumeration.UInt16:
                     valueHolder.Value = analyzer.reader.ReadUInt16();
                     break;
                 case PrimitiveTypeEnumeration.UInt32:
                     valueHolder.Value = analyzer.reader.ReadUInt32();
                     break;
                 case PrimitiveTypeEnumeration.UInt64:
                     valueHolder.Value = analyzer.reader.ReadUInt64();
                     break;
             }
             break;
         case BinaryTypeEnumeration.String:
             valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
             break;
         case BinaryTypeEnumeration.Object:
             valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
             break;
         case BinaryTypeEnumeration.SystemClass:
             valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
             break;
         case BinaryTypeEnumeration.Class:
             valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
             break;
         case BinaryTypeEnumeration.ObjectArray:
             valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
             break;
         case BinaryTypeEnumeration.StringArray:
             valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
             break;
         case BinaryTypeEnumeration.PrimitiveArray:
             valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
             break;
     }
 }
Beispiel #2
0
        internal static void GetTypeValue(TypeHoldingThing typeHolder, ValueHoldingThing valueHolder, SerReader analyzer)
        {
            switch (typeHolder.BinaryType)
            {
            case BinaryTypeEnumeration.Primitive:
                switch (typeHolder.PrimitiveType)
                {
                case PrimitiveTypeEnumeration.Boolean:
                    valueHolder.Value = analyzer.reader.ReadBoolean();
                    break;

                case PrimitiveTypeEnumeration.Byte:
                    valueHolder.Value = analyzer.reader.ReadByte();
                    break;

                case PrimitiveTypeEnumeration.Char:
                    valueHolder.Value = analyzer.reader.ReadChar();
                    break;

                case PrimitiveTypeEnumeration.DateTime:
                    valueHolder.Value = DateTime.FromBinary(analyzer.reader.ReadInt64());
                    break;

                case PrimitiveTypeEnumeration.Decimal:
                    string decimalValue = analyzer.reader.ReadString();
                    valueHolder.Value = decimal.Parse(decimalValue);
                    break;

                case PrimitiveTypeEnumeration.Double:
                    valueHolder.Value = analyzer.reader.ReadDouble();
                    break;

                case PrimitiveTypeEnumeration.Int16:
                    valueHolder.Value = analyzer.reader.ReadInt16();
                    break;

                case PrimitiveTypeEnumeration.Int32:
                    valueHolder.Value = analyzer.reader.ReadInt32();
                    break;

                case PrimitiveTypeEnumeration.Int64:
                    valueHolder.Value = analyzer.reader.ReadInt64();
                    break;

                case PrimitiveTypeEnumeration.Null:
                    valueHolder.Value = null;
                    break;

                case PrimitiveTypeEnumeration.SByte:
                    valueHolder.Value = analyzer.reader.ReadSByte();
                    break;

                case PrimitiveTypeEnumeration.Single:
                    valueHolder.Value = analyzer.reader.ReadSingle();
                    break;

                case PrimitiveTypeEnumeration.String:
                    valueHolder.Value = analyzer.ReadAndFixString();
                    break;

                case PrimitiveTypeEnumeration.TimeSpan:
                    valueHolder.Value = TimeSpan.FromTicks(analyzer.reader.ReadInt64());
                    break;

                case PrimitiveTypeEnumeration.UInt16:
                    valueHolder.Value = analyzer.reader.ReadUInt16();
                    break;

                case PrimitiveTypeEnumeration.UInt32:
                    valueHolder.Value = analyzer.reader.ReadUInt32();
                    break;

                case PrimitiveTypeEnumeration.UInt64:
                    valueHolder.Value = analyzer.reader.ReadUInt64();
                    break;
                }
                break;

            case BinaryTypeEnumeration.String:
                valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
                break;

            case BinaryTypeEnumeration.Object:
                valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
                break;

            case BinaryTypeEnumeration.SystemClass:
                valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
                break;

            case BinaryTypeEnumeration.Class:
                valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
                break;

            case BinaryTypeEnumeration.ObjectArray:
                valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
                break;

            case BinaryTypeEnumeration.StringArray:
                valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
                break;

            case BinaryTypeEnumeration.PrimitiveArray:
                valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
                break;
            }
        }
        internal static void GetTypeValue(TypeHoldingThing typeHolder, ValueHoldingThing valueHolder, BinarySerializationStreamAnalyzer analyzer)
        {
            MemberInfo member  = typeHolder as MemberInfo;
            string     varName = (member == null) ? "???" : member.Name;

            switch (typeHolder.BinaryType)
            {
            case BinaryTypeEnumeration.Primitive:
                switch (typeHolder.PrimitiveType)
                {
                case PrimitiveTypeEnumeration.Boolean:
                    valueHolder.Value = analyzer.reader.ReadBoolean();
                    break;

                case PrimitiveTypeEnumeration.Byte:
                    valueHolder.Value = analyzer.reader.ReadByte();
                    break;

                case PrimitiveTypeEnumeration.Char:
                    valueHolder.Value = analyzer.reader.ReadChar();
                    break;

                case PrimitiveTypeEnumeration.DateTime:
                    valueHolder.Value = DateTime.FromBinary(analyzer.reader.ReadInt64());
                    break;

                case PrimitiveTypeEnumeration.Decimal:
                    string decimalValue = analyzer.reader.ReadString();
                    valueHolder.Value = decimal.Parse(decimalValue);
                    valueHolder.Value = analyzer.reader.ReadDecimal();
                    break;

                case PrimitiveTypeEnumeration.Double:
                    valueHolder.Value = analyzer.reader.ReadDouble();
                    break;

                case PrimitiveTypeEnumeration.Int16:
                    valueHolder.Value = analyzer.reader.ReadInt16();
                    break;

                case PrimitiveTypeEnumeration.Int32:
                    valueHolder.Value = analyzer.reader.ReadInt32();
                    break;

                case PrimitiveTypeEnumeration.Int64:
                    valueHolder.Value = analyzer.reader.ReadInt64();
                    break;

                case PrimitiveTypeEnumeration.Null:
                    valueHolder.Value = null;
                    break;

                case PrimitiveTypeEnumeration.SByte:
                    valueHolder.Value = analyzer.reader.ReadSByte();
                    break;

                case PrimitiveTypeEnumeration.Single:
                    valueHolder.Value = analyzer.reader.ReadSingle();
                    break;

                case PrimitiveTypeEnumeration.String:
                    valueHolder.Value = analyzer.reader.ReadString();
                    break;

                case PrimitiveTypeEnumeration.TimeSpan:
                    valueHolder.Value = TimeSpan.FromTicks(analyzer.reader.ReadInt64());
                    break;

                case PrimitiveTypeEnumeration.UInt16:
                    valueHolder.Value = analyzer.reader.ReadUInt16();
                    break;

                case PrimitiveTypeEnumeration.UInt32:
                    valueHolder.Value = analyzer.reader.ReadUInt32();
                    break;

                case PrimitiveTypeEnumeration.UInt64:
                    valueHolder.Value = analyzer.reader.ReadUInt64();
                    break;
                }
                LogInternal(Enum.GetName(typeof(PrimitiveTypeEnumeration), typeHolder.PrimitiveType) + " " + varName + " value=" + valueHolder.Value);
                break;

            case BinaryTypeEnumeration.String:
                valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
                break;

            case BinaryTypeEnumeration.Object:
                valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
                break;

            case BinaryTypeEnumeration.SystemClass:
                valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
                break;

            case BinaryTypeEnumeration.Class:
                valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
                break;

            case BinaryTypeEnumeration.ObjectArray:
                valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
                break;

            case BinaryTypeEnumeration.StringArray:
                valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
                break;

            case BinaryTypeEnumeration.PrimitiveArray:
                valueHolder.ValueRefID = analyzer.ParseRecord(typeHolder.RelevantObject);
                break;
            }
        }