public static Microsoft.Sarif.Viewer.Models.AnnotatedCodeLocationModel ToAnnotatedCodeLocationModel(this Location location) { AnnotatedCodeLocationModel model = new AnnotatedCodeLocationModel(); PhysicalLocation physicalLocation = null; if (location.ResultFile != null) { physicalLocation = location.ResultFile; } else if (location.AnalysisTarget != null) { physicalLocation = location.AnalysisTarget; } if (physicalLocation != null) { model.Region = physicalLocation.Region; Uri uri = physicalLocation.Uri; if (uri != null) { model.FilePath = uri.ToPath(); } } model.LogicalLocation = location.FullyQualifiedLogicalName; return model; }
public static Microsoft.Sarif.Viewer.Models.AnnotatedCodeLocationModel ToAnnotatedCodeLocationModel(this AnnotatedCodeLocation location) { AnnotatedCodeLocationModel model = new AnnotatedCodeLocationModel(); if (location.PhysicalLocation != null) { model.Region = location.PhysicalLocation.Region; Uri uri = location.PhysicalLocation.Uri; if (uri != null) { model.FilePath = uri.ToPath(); } } model.Message = location.Message; model.Kind = location.Kind.ToString(); model.LogicalLocation = location.FullyQualifiedLogicalName; if (location.Essential) { model.IsEssential = location.Essential; } else { model.IsEssential = location.Importance == AnnotatedCodeLocationImportance.Essential; } return model; }