public VariableDetailRespose FindByCpuName(string name) { var collection = new VariableInfoCollection(); collection.Open(ConfigurationProvider.VariableSettingsFile); var response = collection.FindByCpu(name); if (response == null) { return(new VariableDetailRespose { CpuName = name, VariableNames = null, Errors = new ErrorResponse { Error = $"No entry exists with the Cpu name {name}" } }); } return(new VariableDetailRespose { CpuName = response.CpuName, VariableNames = response.Variables }); }
public async Task <VariableDetailRespose> FindByCpuNameAsync(string name) { var response = await Task.Run(() => { var collection = new VariableInfoCollection(); collection.Open(ConfigurationProvider.VariableSettingsFile); return(collection.FindByCpu(name)); }).ConfigureAwait(false); if (response == null) { return(new VariableDetailRespose { CpuName = name, VariableNames = null, Errors = new ErrorResponse { Error = $"No entry exists with the Cpu name {name}" } }); } return(new VariableDetailRespose { CpuName = response.CpuName, VariableNames = response.Variables }); }
public async Task AddCpuRange(string[] cpus) { await Task.Run(() => { var collection = new VariableInfoCollection(); collection.Open(ConfigurationProvider.VariableSettingsFile); collection.AddCpuRange(cpus); collection.Save(ConfigurationProvider.VariableSettingsFile); }).ConfigureAwait(false); }
public async Task RemoveRange(string cpuName, IEnumerable <string> variableNames) { await Task.Run(() => { var collection = new VariableInfoCollection(); collection.Open(ConfigurationProvider.VariableSettingsFile); collection.RemoveRange(cpuName, variableNames); collection.Save(ConfigurationProvider.VariableSettingsFile); }).ConfigureAwait(false); }
public async Task <List <VariableDetailRespose> > GetAll() { var list = new List <VariableDetailRespose>(); var response = await Task.Run(() => { var collection = new VariableInfoCollection(); collection.Open(ConfigurationProvider.VariableSettingsFile); return(collection.GetAll()); }).ConfigureAwait(false); foreach (var v in response) { list.Add(new VariableDetailRespose() { CpuName = v.CpuName, VariableNames = v.Variables }); } return(list); }