コード例 #1
0
        static RpcResult HandleBadServerSalt(BinaryReader br, TgSystemMessageHandlerContext ctx)
        {
            br.ReadInt32();
            var msg = BadMsgNotification.ServerSaltTag.DeserializeTag(br);

            ctx.NewSalt = msg.NewServerSalt;

            return(RpcResult.OfFail(msg.BadMsgId, new TgBadSaltException()));
        }
コード例 #2
0
        static RpcResult HandleBadMsgNotification(BinaryReader br)
        {
            EnsureTypeNumber(br, BadMsgNotification.Tag.TypeNumber);
            var badMsg = BadMsgNotification.Tag.DeserializeTag(br);

            return(badMsg
                   .Apply(RpcBadMsgNotificationHandler.ToException)
                   .Apply(exc => RpcResult.OfFail(badMsg.BadMsgId, exc)));
        }
コード例 #3
0
        static RpcResult HandleRpcResult(BinaryReader br)
        {
            EnsureTypeNumber(br, RpcResultTypeNumber);
            var reqMsgId  = br.ReadInt64();
            var innerCode = PeekTypeNumber(br);

            switch (innerCode)
            {
            case RpcError.TypeNumber:
                EnsureTypeNumber(br, RpcError.TypeNumber);
                return(RpcError.DeserializeTag(br)
                       .Apply(RpcResultErrorHandler.ToException)
                       .Apply(exc => RpcResult.OfFail(reqMsgId, exc)));

            case GZipPackedTypeNumber:
                return(ReadGZipPacked(br).Apply(msgBr => RpcResult.OfSuccess(reqMsgId, msgBr)));

            default:
                return(RpcResult.OfSuccess(reqMsgId, br));
            }
        }