static object ReadBody(uint rawEMsg, Stream stream, ISteamSerializableHeader header)
        {
            var eMsg    = MsgUtil.GetMsg(rawEMsg);
            var isProto = MsgUtil.IsProtoBuf(rawEMsg);

            var targetJobName = new Lazy <string>(() => ((MsgHdrProtoBuf)header).Proto.target_job_name);

            object body;

            switch (eMsg)
            {
            case EMsg.ServiceMethod:
            case EMsg.ServiceMethodCallFromClient:
                body = UnifiedMessagingHelpers.ReadServiceMethodBody(targetJobName.Value, stream, x => x.GetParameters().First().ParameterType);
                break;

            case EMsg.ServiceMethodResponse:
                body = UnifiedMessagingHelpers.ReadServiceMethodBody(targetJobName.Value, stream, x => x.ReturnType);
                break;

            default:
                body = ReadMessageBody(rawEMsg, stream);
                break;
            }

            return(body);
        }
示例#2
0
        static object ReadBody(uint rawEMsg, Stream stream, ISteamSerializableHeader header)
        {
            var eMsg    = MsgUtil.GetMsg(rawEMsg);
            var isProto = MsgUtil.IsProtoBuf(rawEMsg);

            var targetJobName = new Lazy <string>(() => ((MsgHdrProtoBuf)header).Proto.target_job_name);

            object body;

            // Unified Notifications
            if (isProto && eMsg == EMsg.ServiceMethod && !string.IsNullOrEmpty(targetJobName.Value))
            {
                body = UnifiedMessagingHelpers.ReadServiceMethodBody(targetJobName.Value, stream, x => x.GetParameters().First().ParameterType);
            }
            else
            {
                body = ReadMessageBody(rawEMsg, stream);
            }

            return(body);
        }
        static object ReadBody(uint rawEMsg, Stream stream, ISteamSerializableHeader header)
        {
            var eMsg    = MsgUtil.GetMsg(rawEMsg);
            var isProto = MsgUtil.IsProtoBuf(rawEMsg);

            var targetJobName = new Lazy <string>(() => ((MsgHdrProtoBuf)header).Proto.target_job_name);

            object body;

            switch (eMsg)
            {
            case EMsg.ServiceMethod:
            case EMsg.ServiceMethodSendToClient:
            case EMsg.ServiceMethodCallFromClient:
                body = UnifiedMessagingHelpers.ReadServiceMethodBody(targetJobName.Value, stream, x => x.GetParameters().First().ParameterType);
                break;

            case EMsg.ServiceMethodResponse:
                body = UnifiedMessagingHelpers.ReadServiceMethodBody(targetJobName.Value, stream, x => x.ReturnType);
                break;

            case EMsg.ClientServiceMethodLegacy:
                var tempBody = (CMsgClientServiceMethodLegacy)RuntimeTypeModel.Default.Deserialize(stream, null, typeof(CMsgClientServiceMethodLegacy));
                using (var ms = new MemoryStream(tempBody.serialized_method))
                {
                    body = UnifiedMessagingHelpers.ReadServiceMethodBody(tempBody.method_name, ms, x => x.GetParameters().First().ParameterType);
                }

                break;

            default:
                body = ReadMessageBody(rawEMsg, stream);
                break;
            }

            return(body);
        }