public static SvmrResults ProcessFileWithSettings(string filename, ProcessingSettings settings) { // Open file and load JObject from the file var content = File.ReadAllText(filename); var json = JObject.Parse(content); TestDataJsonFormat_0_1.CheckSignature(json); var methodId = TestDataJsonFormat_0_1.GetMethodId(json); if (methodId != SvmrMethodId.MethodId) { throw new NotSupportedException($"Method with id '{methodId}' is not supported!"); } // extract the method-specific json var testDataJson = TestDataJsonFormat_0_1.GetTestData(json); var hrvRawData = TestDataJsonFormat_0_1.GetTestData <SvmrRawData>(json); var dp = new SvmrDataProcessor(); if (settings != null) { dp.Set(settings); } return((SvmrResults)dp.ProcessData(hrvRawData)); }
public static IDictionary <TestInfo, JObject> GetTestData(int inspectionId) { _log.InfoFormat("Getting test data for inspection {0}", inspectionId); var containers = new Dictionary <TestInfo, JObject>(2); int i = 0; foreach (string fileName in _testDataFileNames) { i++; if (fileName.Contains(inspectionId.ToString())) { var fullPath = GetTestDataPath(fileName); var content = File.ReadAllText(fullPath); // parse json & check signature var json = JObject.Parse(content); TestDataJsonFormat_0_1.CheckSignature(json); var methodId = TestDataJsonFormat_0_1.GetMethodId(json); // extract the method-specific json var testDataJson = TestDataJsonFormat_0_1.GetTestData(json); var basicTestData = TestDataJsonFormat_0_1.GetTestData <TestRawData>(json); // return the data (base data + the json data that the specific data can be extracted from) containers.Add(basicTestData.TestInfo, testDataJson); } } return(containers); }