public IMetrics CreateMetrics(List <Module> source) { IMetrics metrics = null; try { metrics = (IMetrics)_mcCeibCreator.CreateMetrics(source); } catch (Exception e) { _logger.LogError(e, "Exception in McCeib Metrics"); } try { IHalstedMetrics mcMetrics = _halstedCreator.CreateMetrics(source); if (metrics != null) { metrics.HMetrics = mcMetrics.HMetrics; } } catch (Exception e) { _logger.LogError(e, "Exception in Halsted Metrics"); } return(metrics ?? new Metrics()); }
public async Task <IActionResult> LoadStringAndAnalyze([FromBody] StringSourceViewModel stringSourceViewModel) { try { var memorySource = await _stringSourceLoader.LoadData(stringSourceViewModel); var metrics = _metricsCreator.CreateMetrics(memorySource); return(new JsonResult(new { success = true, metrics }, new JsonSerializerSettings() { Converters = new List <JsonConverter>() { new StringEnumConverter() } })); } catch (Exception ex) { return(new JsonResult(new { success = false, exception = ex.ToString() })); } }