private void InitializeInternalState(RPCMeterConfig config, ServiceCollectionHelper serviceHelper) { List <string> list = new List <string>(); List <string> list2 = new List <string>(); int methodCount = config.MethodCount; for (int i = 0; i < methodCount; i++) { RPCMethodConfig rpcmethodConfig = config.Method[i]; RPCConnectionMetering.StaticData staticData = new RPCConnectionMetering.StaticData(); staticData.FromProtocol(rpcmethodConfig); if (!rpcmethodConfig.HasServiceName) { if (this.m_data.GlobalDefault == null) { this.m_data.GlobalDefault = staticData; this.m_log.LogDebug("Adding global default {0}", new object[] { staticData }); } else { this.m_log.LogWarning("Static data has two defaults, ignoring additional ones."); } } else { string serviceName = rpcmethodConfig.ServiceName; ServiceDescriptor importedServiceByName = serviceHelper.GetImportedServiceByName(serviceName); if (importedServiceByName == null) { if (!list2.Contains(serviceName)) { this.m_log.LogDebug("Ignoring not imported service {0}", new object[] { serviceName }); list2.Add(serviceName); } } else { staticData.ServiceId = importedServiceByName.Id; if (rpcmethodConfig.HasMethodName) { string methodName = rpcmethodConfig.MethodName; string text = string.Format("{0}.{1}", serviceName, methodName); MethodDescriptor methodDescriptorByName = importedServiceByName.GetMethodDescriptorByName(text); if (methodDescriptorByName == null) { this.m_log.LogDebug("Configuration specifies an unused method {0}, ignoring.", new object[] { methodName }); goto IL_231; } if (this.m_data.MethodDefaults.ContainsKey(text)) { this.m_log.LogWarning("Default for method {0} already exists, ignoring extras.", new object[] { text }); goto IL_231; } staticData.MethodId = methodDescriptorByName.Id; this.m_data.MethodDefaults[text] = staticData; this.m_log.LogDebug("Adding Method default {0}", new object[] { staticData }); } else { if (this.m_data.ServiceDefaults.ContainsKey(serviceName)) { this.m_log.LogWarning("Default for service {0} already exists, ignoring extras.", new object[] { serviceName }); goto IL_231; } this.m_data.ServiceDefaults[serviceName] = staticData; this.m_log.LogDebug("Adding Service default {0}", new object[] { staticData }); } list.Add(serviceName); } } IL_231 :; } foreach (KeyValuePair <uint, ServiceDescriptor> keyValuePair in serviceHelper.ImportedServices) { if (!list.Contains(keyValuePair.Value.Name) && this.m_data.GlobalDefault == null) { this.m_log.LogDebug("Configuration for service {0} was not found and will not be metered.", new object[] { keyValuePair.Value.Name }); } } }
private void InitializeInternalState(RPCMeterConfig config, ServiceCollectionHelper serviceHelper) { string serviceName; string str; List <string> strs = new List <string>(); List <string> strs1 = new List <string>(); int methodCount = config.MethodCount; for (int i = 0; i < methodCount; i++) { RPCMethodConfig item = config.Method[i]; RPCConnectionMetering.StaticData staticDatum = new RPCConnectionMetering.StaticData(); staticDatum.FromProtocol(item); if (item.HasServiceName) { serviceName = item.ServiceName; ServiceDescriptor importedServiceByName = serviceHelper.GetImportedServiceByName(serviceName); if (importedServiceByName != null) { staticDatum.ServiceId = importedServiceByName.Id; if (!item.HasMethodName) { if (this.m_data.ServiceDefaults.ContainsKey(serviceName)) { goto Label1; } this.m_data.ServiceDefaults[serviceName] = staticDatum; this.m_log.LogDebug("Adding Service default {0}", new object[] { staticDatum }); } else { string methodName = item.MethodName; str = string.Format("{0}.{1}", serviceName, methodName); MethodDescriptor methodDescriptorByName = importedServiceByName.GetMethodDescriptorByName(str); if (methodDescriptorByName != null) { if (this.m_data.MethodDefaults.ContainsKey(str)) { goto Label2; } staticDatum.MethodId = methodDescriptorByName.Id; this.m_data.MethodDefaults[str] = staticDatum; this.m_log.LogDebug("Adding Method default {0}", new object[] { staticDatum }); } else { this.m_log.LogDebug("Configuration specifies an unused method {0}, ignoring.", new object[] { methodName }); goto Label0; } } strs.Add(serviceName); } else if (!strs1.Contains(serviceName)) { this.m_log.LogDebug("Ignoring not imported service {0}", new object[] { serviceName }); strs1.Add(serviceName); } } else if (this.m_data.GlobalDefault != null) { this.m_log.LogWarning("Static data has two defaults, ignoring additional ones."); } else { this.m_data.GlobalDefault = staticDatum; this.m_log.LogDebug("Adding global default {0}", new object[] { staticDatum }); } Label0: } foreach (KeyValuePair <uint, ServiceDescriptor> importedService in serviceHelper.ImportedServices) { if (strs.Contains(importedService.Value.Name) || this.m_data.GlobalDefault != null) { continue; } this.m_log.LogDebug("Configuration for service {0} was not found and will not be metered.", new object[] { importedService.Value.Name }); } return; Label1: BattleNetLogSource mLog = this.m_log; mLog.LogWarning("Default for service {0} already exists, ignoring extras.", new object[] { serviceName }); goto Label0; Label2: BattleNetLogSource battleNetLogSource = this.m_log; battleNetLogSource.LogWarning("Default for method {0} already exists, ignoring extras.", new object[] { str }); goto Label0; }