public static IEnumerable <Type> GetGCMessageBodyTypeCandidates(uint rawEMsg, uint gcAppid)
        {
            var gcMsg = MsgUtil.GetGCMsg(rawEMsg);

            if (MessageTypeOverrides.GCBodyMap.ContainsKey(gcMsg))
            {
                return(Enumerable.Repeat(MessageTypeOverrides.GCBodyMap[gcMsg], 1));
            }

            var gcMsgName = EMsgExtensions.GetGCMessageName(rawEMsg);

            var typeMsgName = gcMsgName
                              .Replace("k_", string.Empty)
                              .Replace("ESOMsg", string.Empty)
                              .TrimStart('_')
                              .Replace("EMsg", string.Empty)
                              .TrimStart("GC");

            var possibleTypes = from type in typeof(CMClient).Assembly.GetTypes()
                                from typePrefix in GetPossibleGCTypePrefixes(gcAppid)
                                where type.GetInterfaces().Contains(typeof(IExtensible))
                                where type.FullName.StartsWith(typePrefix) && type.FullName.EndsWith(typeMsgName)
                                select type;

            return(possibleTypes);
        }
Exemple #2
0
        string ReadInnerMessageNameCore()
        {
            switch (EMsg)
            {
            case SteamKit2.EMsg.ClientToGC:
            case SteamKit2.EMsg.ClientFromGC:
            {
                var proto  = ReadAsProtobufMsg <CMsgGCClient>();
                var gcEMsg = proto.Body.msgtype;
                var gcName = EMsgExtensions.GetGCMessageName(gcEMsg, proto.Body.appid);

                var headerToTrim = "k_EMsg";
                if (gcName.StartsWith(headerToTrim))
                {
                    gcName = gcName.Substring(headerToTrim.Length);
                }

                return(gcName);
            }

            case SteamKit2.EMsg.ServiceMethod:
            case SteamKit2.EMsg.ServiceMethodSendToClient:
            case SteamKit2.EMsg.ServiceMethodCallFromClient:
            case SteamKit2.EMsg.ServiceMethodResponse:
            {
                var fileData = File.ReadAllBytes(FileInfo.FullName);
                var hdr      = new MsgHdrProtoBuf();
                using (var ms = new MemoryStream(fileData))
                {
                    hdr.Deserialize(ms);
                }

                return(hdr.Proto.target_job_name);
            }

            case SteamKit2.EMsg.ClientServiceMethodLegacy:
            {
                var proto = ReadAsProtobufMsg <CMsgClientServiceMethodLegacy>();
                return(proto.Body.method_name);
            }

            case SteamKit2.EMsg.ClientServiceMethodLegacyResponse:
            {
                var proto = ReadAsProtobufMsg <CMsgClientServiceMethodLegacyResponse>();
                return(proto.Body.method_name);
            }

            default:
                return(string.Empty);
            }
        }
        static TreeNode BuildGCBodyNode(CMsgGCClient body)
        {
            var node   = new TreeNode("Game Coordinator Message");
            var gcBody = body as CMsgGCClient;

            using (var ms = new MemoryStream(gcBody.payload))
            {
                var gc = new
                {
                    emsg   = EMsgExtensions.GetGCMessageName(gcBody.msgtype),
                    header = ReadGameCoordinatorHeader(gcBody.msgtype, ms),
                    body   = ReadMessageBody(gcBody.msgtype, ms, gcBody.appid),
                };

                AddObjectValue(node, gc);
            }

            return(node);
        }