private string GetMethodName(Header header, bool outgoing) { if (header.ServiceId == 254) { return("Response"); } ServiceDescriptor serviceDescriptor = null; serviceDescriptor = (!outgoing ? this.serviceHelper.GetExportedServiceById(header.ServiceId) : this.serviceHelper.GetImportedServiceById(header.ServiceId)); return(serviceDescriptor != null ? serviceDescriptor.GetMethodName(header.MethodId) : "No Descriptor"); }
private void LogOutgoingPacket(BattleNetPacket packet, bool wasMetered) { if (this.m_logSource == null) { LogAdapter.Log(LogLevel.Warning, "tried to log with null log source, skipping"); return; } bool flag = false; IProtoBuf protoBuf = (IProtoBuf)packet.GetBody(); Header header = packet.GetHeader(); uint serviceId = header.ServiceId; uint methodId = header.MethodId; string text = (!wasMetered) ? "QueueRequest" : "QueueRequest (METERED)"; if (!string.IsNullOrEmpty(protoBuf.ToString())) { ServiceDescriptor importedServiceById = this.serviceHelper.GetImportedServiceById(serviceId); string text2 = (importedServiceById != null) ? importedServiceById.GetMethodName(methodId) : "null"; if (!text2.Contains("KeepAlive")) { this.m_logSource.LogDebug("{0}: type = {1}, header = {2}, request = {3}", new object[] { text, text2, header.ToString(), protoBuf.ToString() }); } } else { ServiceDescriptor importedServiceById2 = this.serviceHelper.GetImportedServiceById(serviceId); string text3 = (importedServiceById2 != null) ? importedServiceById2.GetMethodName(methodId) : null; if (text3 != "bnet.protocol.connection.ConnectionService.KeepAlive" && text3 != null) { this.m_logSource.LogDebug("{0}: type = {1}, header = {2}", new object[] { text, text3, header.ToString() }); } else { flag = true; } } if (!flag) { this.m_logSource.LogDebugStackTrace("LogOutgoingPacket: ", 32, 1); } }
private void LogOutgoingPacket(BattleNetPacket packet, bool wasMetered) { string methodName; if (this.m_logSource == null) { LogAdapter.Log(LogLevel.Warning, "tried to log with null log source, skipping"); return; } bool flag = false; IProtoBuf body = (IProtoBuf)packet.GetBody(); Header header = packet.GetHeader(); uint serviceId = header.ServiceId; uint methodId = header.MethodId; string str = (!wasMetered ? "QueueRequest" : "QueueRequest (METERED)"); if (string.IsNullOrEmpty(body.ToString())) { ServiceDescriptor importedServiceById = this.serviceHelper.GetImportedServiceById(serviceId); if (importedServiceById != null) { methodName = importedServiceById.GetMethodName(methodId); } else { methodName = null; } string str1 = methodName; if (!(str1 != "bnet.protocol.connection.ConnectionService.KeepAlive") || str1 == null) { flag = true; } else { this.m_logSource.LogDebug("{0}: type = {1}, header = {2}", new object[] { str, str1, header.ToString() }); } } else { ServiceDescriptor serviceDescriptor = this.serviceHelper.GetImportedServiceById(serviceId); string str2 = (serviceDescriptor != null ? serviceDescriptor.GetMethodName(methodId) : "null"); if (!str2.Contains("KeepAlive")) { this.m_logSource.LogDebug("{0}: type = {1}, header = {2}, request = {3}", new object[] { str, str2, header.ToString(), body.ToString() }); } } if (!flag) { this.m_logSource.LogDebugStackTrace("LogOutgoingPacket: ", 32, 1); } }