private static void InitServiceMap(ServicesSettings servicesSettings) { ServiceMap = new Dictionary <int, Service>(); for (int i = 0; i < servicesSettings.Services.Length; i++) { var service = servicesSettings.Services[i]; service.Id = i + 1; service.IsParent = true; ServiceMap.Add(service.Id, service); int y = 10; for (int j = 1; j < servicesSettings.Services[i].Services.Length + 1; j++) { if ((j) % 10 == 0) { y *= 10; } int id = ((i + 1) * y) + j; var childService = servicesSettings.Services[i].Services[j - 1]; childService.Id = id; childService.Url = service.Url + childService.Url; childService.Hide = service.Hide; childService.Tags ??= new string[0]; childService.Tags = childService.Tags.Concat(service.Tags ??= new string[] { }).ToArray(); childService.ResponseTemplate ??= service.ResponseTemplate ?? Constant.Template.QUOTE; ServiceMap.Add(id, childService); } } }
public static void Initialize(ServicesSettings servicesSettings) { InitServiceMap(servicesSettings); InitTaggedServiceMap(); }