public ModulesData GetAllModules() { ModulesData results = new ModulesData(); string typeBatch; foreach (string typeName in Data.ModuleTypes) { typeBatch = GetModules(typeName); } throw new NotImplementedException(); return results; }
private ModulesData GetModules() { ModulesData results = new ModulesData(); results.AllModules = new Dictionary<long, Module>(); string key = File.ReadAllText("api.secret");// @"11749197d5c8ca823ed4beb2199922aa"; ApiDAO api = new ApiDAO(key); List<Module> typeResults = new List<Module>(); foreach ( string type in ModuleTypes) { string json = api.GetModules(type); typeResults = GetModules(json); foreach(Module m in typeResults) { results.AllModules[m.ID] = m; } } results.AllTypes = ModuleTypes; results.DataCreatedAt = DateTime.Now.ToUniversalTime(); HashSet<String> propNames = new HashSet<string>(); foreach(Module m in results.AllModules.Values) { foreach(string name in m.ModuleAttributes.Keys) { if(!propNames.Contains(name)) { propNames.Add(name); } } } results.AllModuleProperties = propNames.ToList(); return results; }
//deserializes json returned by api //should i use this? public static ModulesData FromJson(string json) { ModulesData results = new ModulesData(); return results; }
private ModulesData DeserializeModules(string filePath = null) { if (String.IsNullOrEmpty(filePath)) { filePath = dataFileName; } if (!File.Exists(filePath)) { return null; } ModulesData results = new ModulesData(); string json = File.ReadAllText(filePath); results = JsonConvert.DeserializeObject<ModulesData>(json); return results; }