예제 #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)));
		}