public override FileModel Load(FileAndType file, ImmutableDictionary <string, object> metadata) { if (file.Type != DocumentType.Article) { throw new NotSupportedException(); } var content = MarkdownReader.ReadMarkdownAsConceptual(file.File); foreach (var item in metadata) { if (!content.ContainsKey(item.Key)) { content[item.Key] = item.Value; } } content[Constants.PropertyName.SystemKeys] = SystemKeys; var localPathFromRoot = PathUtility.MakeRelativePath(EnvironmentContext.BaseDirectory, EnvironmentContext.FileAbstractLayer.GetPhysicalPath(file.File)); return(new FileModel( file, content, serializer: new BinaryFormatter()) { LocalPathFromRoot = localPathFromRoot, }); }
public override FileModel Load(FileAndType file, ImmutableDictionary <string, object> metadata) { if (file.Type != DocumentType.Article) { throw new NotSupportedException(); } var content = MarkdownReader.ReadMarkdownAsConceptual(file.BaseDir, file.File); foreach (var item in metadata) { if (!content.ContainsKey(item.Key)) { content[item.Key] = item.Value; } } var displayLocalPath = PathUtility.MakeRelativePath(EnvironmentContext.BaseDirectory, file.FullPath); return(new FileModel( file, content, serializer: Environment.Is64BitProcess?null: new BinaryFormatter()) { LocalPathFromRepoRoot = (content["source"] as SourceDetail)?.Remote?.RelativePath, LocalPathFromRoot = displayLocalPath }); }