示例#1
0
        /// <summary>
        /// Auto-generated deserialization/read method.
        /// Partial method implemented from shared partial definition.
        /// </summary>
        /// <param name="value">See external doc.</param>
        /// <param name="buffer">See external doc.</param>
        /// <param name="offset">See external doc.</param>
        public override void InternalRead(AuthChallengeData value, Span <byte> buffer, ref int offset)
        {
            //Type: AuthChallengeData Field: 1 Name: Protocol Type: ProtocolVersion;
            value.Protocol = GenericPrimitiveEnumTypeSerializerStrategy <ProtocolVersion, Byte> .Instance.Read(buffer, ref offset);

            //Type: AuthChallengeData Field: 2 Name: size Type: UInt16;
            value.size = GenericTypePrimitiveSerializerStrategy <UInt16> .Instance.Read(buffer, ref offset);

            //Type: AuthChallengeData Field: 3 Name: Game Type: GameType;
            value.Game = InternalEnumExtensions.Parse <GameType>(FixedSizeStringTypeSerializerStrategy <ASCIIStringTypeSerializerStrategy, StaticTypedNumeric_Int32_4, ASCIIStringTerminatorTypeSerializerStrategy> .Instance.Read(buffer, ref offset), true);
            //Type: AuthChallengeData Field: 4 Name: ExpansionVersionId Type: Byte;
            value.ExpansionVersionId = BytePrimitiveSerializerStrategy.Instance.Read(buffer, ref offset);
            //Type: AuthChallengeData Field: 5 Name: MajorPatchVersion Type: Byte;
            value.MajorPatchVersion = BytePrimitiveSerializerStrategy.Instance.Read(buffer, ref offset);
            //Type: AuthChallengeData Field: 6 Name: MinorPatchVersion Type: Byte;
            value.MinorPatchVersion = BytePrimitiveSerializerStrategy.Instance.Read(buffer, ref offset);
            //Type: AuthChallengeData Field: 7 Name: Build Type: ClientBuild;
            value.Build = GenericPrimitiveEnumTypeSerializerStrategy <ClientBuild, UInt16> .Instance.Read(buffer, ref offset);

            //Type: AuthChallengeData Field: 8 Name: Platform Type: PlatformType;
            value.Platform = InternalEnumExtensions.Parse <PlatformType>(FixedSizeStringTypeSerializerStrategy <ReversedASCIIStringTypeSerializerStrategy, StaticTypedNumeric_Int32_4, ASCIIStringTerminatorTypeSerializerStrategy> .Instance.Read(buffer, ref offset), true);
            //Type: AuthChallengeData Field: 9 Name: OperatingSystem Type: OperatingSystemType;
            value.OperatingSystem = InternalEnumExtensions.Parse <OperatingSystemType>(FixedSizeStringTypeSerializerStrategy <ReversedASCIIStringTypeSerializerStrategy, StaticTypedNumeric_Int32_4, ASCIIStringTerminatorTypeSerializerStrategy> .Instance.Read(buffer, ref offset), true);
            //Type: AuthChallengeData Field: 10 Name: Locale Type: LocaleType;
            value.Locale = InternalEnumExtensions.Parse <LocaleType>(FixedSizeStringTypeSerializerStrategy <ReversedASCIIStringTypeSerializerStrategy, StaticTypedNumeric_Int32_4> .Instance.Read(buffer, ref offset), true);
            //Type: AuthChallengeData Field: 11 Name: TimeZoneBias Type: UInt32;
            value.TimeZoneBias = GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Read(buffer, ref offset);

            //Type: AuthChallengeData Field: 12 Name: ipAddressInBytes Type: Byte[];
            value.ipAddressInBytes = FixedSizePrimitiveArrayTypeSerializerStrategy <byte, StaticTypedNumeric_Int32_4> .Instance.Read(buffer, ref offset);

            //Type: AuthChallengeData Field: 13 Name: Identity Type: String;
            value.Identity = DontTerminateLengthPrefixedStringTypeSerializerStrategy <ASCIIStringTypeSerializerStrategy, Byte> .Instance.Read(buffer, ref offset);
        }
        private IInvokationExpressionEmittable CreateSendSizeExpressionEmitter([NotNull] AttributeData sendSizeAttri)
        {
            if (sendSizeAttri == null)
            {
                throw new ArgumentNullException(nameof(sendSizeAttri));
            }

            //TODO: If this ever changes we're f****d.
            PrimitiveSizeType sizeType = InternalEnumExtensions.ParseFull <PrimitiveSizeType>(sendSizeAttri.ConstructorArguments.First().ToCSharpString(), true);

            return(CreateSendSizeExpressionEmitter(sizeType));
        }
示例#3
0
        private IInvokationExpressionEmittable CreateSendSizeExpressionEmitter([NotNull] AttributeData sendSizeAttri)
        {
            if (sendSizeAttri == null)
            {
                throw new ArgumentNullException(nameof(sendSizeAttri));
            }

            //TODO: If this ever changes we're f****d.
            PrimitiveSizeType sizeType = InternalEnumExtensions.ParseFull <PrimitiveSizeType>(sendSizeAttri.ConstructorArguments.First().ToCSharpString(), true);

            if (ActualType.ElementType.IsPrimitive())
            {
                return(new SendSizePrimitiveArrayInvokationExpressionEmitter(ActualType, Member, sizeType, Mode));
            }
            else
            {
                return(new SendSizeComplexArrayInvokationExpressionEmitter(ActualType, Member, sizeType, Mode));
            }
        }
示例#4
0
        /// <summary>
        /// Auto-generated deserialization/read method.
        /// Partial method implemented from shared partial definition.
        /// </summary>
        /// <param name = "value">See external doc.</param>
        /// <param name = "buffer">See external doc.</param>
        /// <param name = "offset">See external doc.</param>
        public override void InternalRead(TypeStub value, Span <byte> buffer, ref int offset)
        {
            //Type: BaseTypeStub Field: 1 Name: BaseIntField Type: Int32
            ;
            value.BaseIntField = GenericTypePrimitiveSerializerStrategy <Int32> .Instance.Read(buffer, ref offset);

            //Type: BaseTypeStub Field: 2 Name: BaseIntFieldArray Type: Int32[]
            ;
            value.BaseIntFieldArray = FixedSizePrimitiveArrayTypeSerializerStrategy <int, StaticTypedNumeric_Int32_2> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 1 Name: Hello Type: Int32
            ;
            value.Hello = GenericTypePrimitiveSerializerStrategy <Int32> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 2 Name: TestString Type: String
            ;
            value.TestString = LengthPrefixedStringTypeSerializerStrategy <UTF32StringTypeSerializerStrategy, UTF32StringTerminatorTypeSerializerStrategy, UInt16> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 3 Name: HelloAgain Type: UInt16
            ;
            value.HelloAgain = GenericTypePrimitiveSerializerStrategy <UInt16> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 4 Name: TestStringTwo Type: String
            ;
            value.TestStringTwo = DontTerminateLengthPrefixedStringTypeSerializerStrategy <ASCIIStringTypeSerializerStrategy, Int16> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 5 Name: KnownSizeStringTest Type: String
            ;
            value.KnownSizeStringTest = FixedSizeStringTypeSerializerStrategy <UTF16StringTypeSerializerStrategy, StaticTypedNumeric_Int32_1337> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 6 Name: DefaultStringTest Type: String
            ;
            value.DefaultStringTest = TerminatedStringTypeSerializerStrategy <UTF16StringTypeSerializerStrategy, UTF16StringTerminatorTypeSerializerStrategy> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 6 Name: DefaultStringTestNotTerminated Type: String
            ;
            value.DefaultStringTestNotTerminated = UTF16StringTypeSerializerStrategy.Instance.Read(buffer, ref offset);
            //Type: TypeStub Field: 8 Name: EnumTestValue Type: TestEnum
            ;
            value.EnumTestValue = GenericPrimitiveEnumTypeSerializerStrategy <TestEnum, UInt64> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 9 Name: LongArrayTestAddedSize Type: Int64[]
            ;
            value.LongArrayTestAddedSize = SendSizePrimitiveArrayTypeSerializerStrategy <long, Int16> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 10 Name: EnumTestValueSized Type: TestEnum
            ;
            value.EnumTestValueSized = GenericPrimitiveEnumTypeSerializerStrategy <TestEnum, Byte> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 11 Name: ComplexTypeTest Type: NestedTypeStub
            ;
            value.ComplexTypeTest = NestedTypeStub_Serializer.Instance.Read(buffer, ref offset);
            //Type: TypeStub Field: 12 Name: ComplexArrayTest Type: NestedTypeStub[]
            ;
            value.ComplexArrayTest = FixedSizeComplexArrayTypeSerializerStrategy <NestedTypeStub_Serializer, NestedTypeStub, StaticTypedNumeric_Int32_1776> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 13 Name: OptionalValue Type: Int32
            ;
            if (value.OptionalBoolCheck)
            {
                value.OptionalValue = GenericTypePrimitiveSerializerStrategy <Int32> .Instance.Read(buffer, ref offset);
            }
            //Type: TypeStub Field: 14 Name: TestCustomSerializerInt Type: Int32
            ;
            value.TestCustomSerializerInt = FreecraftCore.Serializer.CustomTypes.TestCustomSerializer.Instance.Read(buffer, ref offset);
            //Type: TypeStub Field: 15 Name: EnumStringTestValue Type: TestEnum
            ;
            value.EnumStringTestValue = InternalEnumExtensions.Parse <TestEnum>(TerminatedStringTypeSerializerStrategy <ASCIIStringTypeSerializerStrategy, ASCIIStringTerminatorTypeSerializerStrategy> .Instance.Read(buffer, ref offset), true);
            //Type: TypeStub Field: 16 Name: NestedPolymorphicTypeValue Type: BaseTypeStub
            ;
            value.NestedPolymorphicTypeValue = BaseTypeStub_Serializer.Instance.Read(buffer, ref offset);
            //Type: TypeStub Field: 17 Name: BigEndianIntTestValue Type: Int32
            ;
            value.BigEndianIntTestValue = BigEndianGenericTypePrimitiveSerializerStrategy <Int32> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 18 Name: EnumStringTestValueReversed Type: TestEnum
            ;
            value.EnumStringTestValueReversed = InternalEnumExtensions.Parse <TestEnum>(TerminatedStringTypeSerializerStrategy <ReversedASCIIStringTypeSerializerStrategy, ASCIIStringTerminatorTypeSerializerStrategy> .Instance.Read(buffer, ref offset), true);
            //Type: TypeStub Field: 19 Name: CustomTypeSerializerTest Type: TestCustomSerializerReferenceType
            ;
            value.CustomTypeSerializerTest = MyNamespace.TestCustomSerializerReferenceTypeSerializer.Instance.Read(buffer, ref offset);
            //Type: TypeStub Field: 20 Name: FieldTest Type: Int32
            ;
            value.FieldTest = GenericTypePrimitiveSerializerStrategy <Int32> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 21 Name: OpenGenericTest1 Type: OpenGenericVector
            ;
            value.OpenGenericTest1 = OpenGenericVector_Int32_Serializer.Instance.Read(buffer, ref offset);
            //Type: TypeStub Field: 22 Name: OpenGenericTest2 Type: OpenGenericVector
            ;
            value.OpenGenericTest2 = OpenGenericVector_Int64_Serializer.Instance.Read(buffer, ref offset);
            //Type: TypeStub Field: 22 Name: OpenGenericTest3 Type: OpenGenericVector
            ;
            value.OpenGenericTest3 = OpenGenericVector_Byte_Serializer.Instance.Read(buffer, ref offset);
            //Type: TypeStub Field: 23 Name: OpenGenericArray Type: OpenGenericVector[]
            ;
            value.OpenGenericArray = ComplexArrayTypeSerializerStrategy <OpenGenericVector_Byte_Serializer, OpenGenericVector <byte> > .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 24 Name: CustomTypeSerializerTestArray Type: TestCustomSerializerReferenceType[]
            ;
            value.CustomTypeSerializerTestArray = ComplexArrayTypeSerializerStrategy <MyNamespace.TestCustomSerializerReferenceTypeSerializer, TestCustomSerializerReferenceType> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 25 Name: CustomTypeSerializerPropertyAttri Type: TestCustomSerializerReferenceType
            ;
            value.CustomTypeSerializerPropertyAttri = MyNamespace.TestCustomSerializerReferenceTypeSerializerForPropertyTest.Instance.Read(buffer, ref offset);
            //Type: TypeStub Field: 26 Name: StringArrayTest Type: String[]
            ;
            value.StringArrayTest = SendSizeComplexArrayTypeSerializerStrategy <TerminatedStringTypeSerializerStrategy <ASCIIStringTypeSerializerStrategy, ASCIIStringTerminatorTypeSerializerStrategy>, string, Int32> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 27 Name: EnumArrayTest Type: TestEnum[]
            ;
            value.EnumArrayTest = SendSizeComplexArrayTypeSerializerStrategy <GenericPrimitiveEnumTypeSerializerStrategy <TestEnum, UInt64>, TestEnum, Int64> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 28 Name: NestedEnumTest Type: TestEnumNested
            ;
            value.NestedEnumTest = GenericPrimitiveEnumTypeSerializerStrategy <FreecraftCore.Serializer.CustomTypes.NestedTestType.TestEnumNested, UInt64> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 29 Name: CustomTypeSerializerTestArrayCompressed Type: TestCustomSerializerReferenceType[]
            ;
            value.CustomTypeSerializerTestArrayCompressed = WoWZLibCompressionTypeSerializerDecorator <SendSizeComplexArrayTypeSerializerStrategy <MyNamespace.TestCustomSerializerReferenceTypeSerializer, TestCustomSerializerReferenceType, Int16>, TestCustomSerializerReferenceType[]> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 97 Name: LongArrayTest Type: Int64[]
            ;
            value.LongArrayTest = SendSizePrimitiveArrayTypeSerializerStrategy <long, Int16> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 98 Name: KnownSizeArrayTest Type: UInt16[]
            ;
            value.KnownSizeArrayTest = FixedSizePrimitiveArrayTypeSerializerStrategy <ushort, StaticTypedNumeric_Int32_1337> .Instance.Read(buffer, ref offset);

            //Type: TypeStub Field: 99 Name: FinalArrayMemberWriteToEnd Type: Int32[]
            ;
            value.FinalArrayMemberWriteToEnd = PrimitiveArrayTypeSerializerStrategy <int> .Instance.Read(buffer, ref offset);

            value.OnAfterDeserialization();
        }
 public PolymorphicSerializerImplementationCompilationUnitEmitter([NotNull] INamedTypeSymbol typeSymbol, [NotNull] Compilation compilationUnit)
     : base(typeSymbol)
 {
     CompilationUnit        = compilationUnit ?? throw new ArgumentNullException(nameof(compilationUnit));
     PolymorphicKeySizeType = InternalEnumExtensions.ParseFull <PrimitiveSizeType>(TypeSymbol.GetAttributeExact <WireDataContractAttribute>().ConstructorArguments.First().ToCSharpString(), true);
 }
示例#6
0
 /// <summary>
 /// Auto-generated deserialization/read method.
 /// Partial method implemented from shared partial definition.
 /// </summary>
 /// <param name = "value">See external doc.</param>
 /// <param name = "buffer">See external doc.</param>
 /// <param name = "offset">See external doc.</param>
 public override void InternalRead(TestModel value, Span <byte> buffer, ref int offset)
 {
     //Type: TestModel Field: 1 Name: TestEnumField Type: TestEnum
     ;
     value.TestEnumField = InternalEnumExtensions.Parse <TestEnum>(FixedSizeStringTypeSerializerStrategy <ASCIIStringTypeSerializerStrategy, StaticTypedNumeric_Int32_4> .Instance.Read(buffer, ref offset), true);
 }