public static ReadMarkdownAsOverwrite ( IHostService host, FileAndType ft ) : IEnumerable |
||
host | IHostService | |
ft | FileAndType | |
return | IEnumerable |
protected virtual void BuildOverwrite(IHostService host, FileModel model) { var overwrites = MarkdownReader.ReadMarkdownAsOverwrite(host, model.FileAndType).ToList(); model.Content = overwrites; model.LinkToFiles = overwrites.SelectMany(o => o.LinkToFiles).ToImmutableHashSet(); model.LinkToUids = overwrites.SelectMany(o => o.LinkToUids).ToImmutableHashSet(); model.Uids = (from item in overwrites select new UidDefinition( item.Uid, model.LocalPathFromRoot, item.Documentation.StartLine + 1)).ToImmutableArray(); }
protected virtual void BuildOverwrite(IHostService host, FileModel model) { var overwrites = MarkdownReader.ReadMarkdownAsOverwrite(host, model.FileAndType).ToList(); model.Content = overwrites; model.LinkToFiles = overwrites.SelectMany(o => o.LinkToFiles).ToImmutableHashSet(); model.LinkToUids = overwrites.SelectMany(o => o.LinkToUids).ToImmutableHashSet(); model.FileLinkSources = overwrites.SelectMany(o => o.FileLinkSources).GroupBy(i => i.Key, i => i.Value).ToImmutableDictionary(i => i.Key, i => i.SelectMany(l => l).ToImmutableList()); model.UidLinkSources = overwrites.SelectMany(o => o.UidLinkSources).GroupBy(i => i.Key, i => i.Value).ToImmutableDictionary(i => i.Key, i => i.SelectMany(l => l).ToImmutableList()); model.Uids = (from item in overwrites select new UidDefinition( item.Uid, model.LocalPathFromRoot, item.Documentation.StartLine + 1)).ToImmutableArray(); foreach (var d in overwrites.SelectMany(s => s.Dependency)) { host.ReportDependencyTo(model, d, DependencyTypeName.Include); } }
public static FileModel Read(FileAndType file) { if (file == null) { throw new ArgumentNullException(nameof(file)); } if (file.Type != DocumentType.Overwrite) { throw new NotSupportedException(file.Type.ToString()); } var overwrites = MarkdownReader.ReadMarkdownAsOverwrite(file.BaseDir, file.File); if (overwrites == null || overwrites.Count == 0) { return(null); } var displayLocalPath = overwrites[0].Documentation?.Remote?.RelativePath ?? Path.Combine(file.BaseDir, file.File).ToDisplayPath(); return(new FileModel(file, overwrites, serializer: new BinaryFormatter()) { Uids = (from item in overwrites select new UidDefinition( item.Uid, displayLocalPath, item.Documentation.StartLine + 1 )).ToImmutableArray(), Properties = { LinkToFiles = new HashSet <string>(), LinkToUids = new HashSet <string>(), }, LocalPathFromRepoRoot = displayLocalPath, }); }