コード例 #1
0
		public void BuildSerializeExpression(MessageMemberInfo member, BinarySerializationContext context)
		{
			context.Code.Add(
				Expression.Call(
					context.QueueParameter,
					MessageQueueMethods.WriteFloat,
					Expression.Add(context.PositionParameter, Expression.Constant(member.Offset)),
					member.GetProperty(context.MessageParameter)));
		}
コード例 #2
0
		public Expression BuildDeserializeExpression(MessageMemberInfo member, BinarySerializationContext context)
		{
			return
				Expression.Convert(
					Expression.Call(
						context.QueueParameter,
						MessageQueueMethods.ReadFloat,
						Expression.Add(context.PositionParameter, Expression.Constant(member.Offset))),
					member.Type);
		}
コード例 #3
0
		public Expression BuildDynamicSizeEvaluator(MessageMemberInfo member, BinarySerializationContext context)
		{
			return
				Expression.RightShift(
					Expression.Add(
						Expression.Constant(4),
						Expression.Call(
							((Func<string, int>)CircularArrayQueue.ExtensionMethods.GetByteCount).Method,
							member.GetProperty(context.MessageParameter))),
					Expression.Constant(2));
		}
コード例 #4
0
		public Expression BuildDeserializeExpression(MessageMemberInfo member, BinarySerializationContext context)
		{
			return
				Expression.Call(
					((Func<IMessageQueue, int, string>)CircularArrayQueue.ExtensionMethods.ReadStringContent).Method,
					context.QueueParameter,
					Expression.Add(
						context.PositionParameter,
						Expression.Call(
							context.QueueParameter,
							MessageQueueMethods.ReadInt32,
							Expression.Add(Expression.Constant(member.Offset), context.PositionParameter))));
		}
コード例 #5
0
		public void BuildSerializeExpression(MessageMemberInfo member, BinarySerializationContext context)
		{
			Expression expression = member.GetProperty(context.MessageParameter);
			if (member.Type != typeof(int))
			{
				expression = Expression.Convert(expression, typeof(int));
			}
			context.Code.Add(
				Expression.Call(
					context.QueueParameter,
					MessageQueueMethods.WriteInt32,
					Expression.Add(context.PositionParameter, Expression.Constant(member.Offset)),
					expression));
		}
コード例 #6
0
		public void BuildSerializeExpression(MessageMemberInfo member, BinarySerializationContext context)
		{
			context.Code.Add(
				Expression.Call(
					context.QueueParameter,
					MessageQueueMethods.WriteInt32,
					Expression.Add(context.PositionParameter, Expression.Constant(member.Offset)),
					Expression.Subtract(context.DynamicPositionParameter, context.PositionParameter)));
			context.Code.Add(
				Expression.Assign(
					context.DynamicPositionParameter,
					Expression.Call(
						((Func<IMessageQueue, int, string, int>)CircularArrayQueue.ExtensionMethods.WriteStringContent).Method,
						context.QueueParameter,
						context.DynamicPositionParameter,
						member.GetProperty(context.MessageParameter))));
		}
コード例 #7
0
		public Expression BuildDynamicSizeEvaluator(MessageMemberInfo member, BinarySerializationContext context)
		{
			return null;
		}
コード例 #8
0
		public static void BuildDeSerializationAndAssignment(
			this ITypeBinarySerializer binarySerializer, MessageMemberInfo member, BinarySerializationContext context)
		{
			Expression expression = member.GetProperty(context.MessageParameter);
			context.Code.Add(Expression.Assign(expression, binarySerializer.BuildDeserializeExpression(member, context)));
		}