private static IReadOnlyList <AssemblyDebugSourceDocumentViewModel> CreateSourcesViewModels(AssemblyDebugData debugData) { var list = new List <AssemblyDebugSourceDocumentViewModel>(debugData.Sources.Count); var lookup = debugData.SourceLink.ToDictionary(sm => sm.Base.Substring(0, sm.Base.Length - 1), sm => sm.Location.Substring(0, sm.Location.Length - 1)); foreach (var doc in debugData.Sources) { var path = doc.Name; string location = null; // see if any keys match the base foreach (var key in lookup.Keys) { if (doc.Name.StartsWith(key, StringComparison.Ordinal)) { path = doc.Name.Substring(key.Length); location = lookup[key] + path; break; } } list.Add(new AssemblyDebugSourceDocumentViewModel(doc, path, location)); } return(list); }
private static IReadOnlyList <AssemblyDebugSourceDocumentViewModel> CreateSourcesViewModels(AssemblyDebugData debugData) { var list = new List <AssemblyDebugSourceDocumentViewModel>(debugData.Sources.Count); foreach (var doc in debugData.Sources) { list.Add(new AssemblyDebugSourceDocumentViewModel(doc, doc.Name, doc.Url, doc.IsEmbedded)); } return(list); }
public AssemblyDebugDataViewModel(AssemblyDebugData debugData) { _debugData = debugData ?? throw new ArgumentNullException(nameof(debugData)); Sources = CreateSourcesViewModels(debugData); }
private static IReadOnlyList <AssemblyDebugSourceDocumentViewModel> CreateSourcesViewModels(AssemblyDebugData debugData) { var list = new List <AssemblyDebugSourceDocumentViewModel>(debugData.Sources.Count); var lookup = debugData.SourceLink.ToDictionary(sm => sm.Base[0..^ 1], sm => sm.Location[0..^ 1]);