/// <inheritdoc/> public DocumentManager GetDocumentManager(string fallbackLanguage, IDocumentConvertStrategy convertStrategy) { return(new DocumentManager( basePath, fallbackLanguage, convertStrategy, GetConvertStrategy())); }
/// <summary> /// Read the whole document and convert it /// </summary> /// <param name="language">The language to use for the document to load</param> /// <param name="document">The name of the document to load</param> /// <param name="convertStrategy">The convert strategy to use</param> /// <returns>The whole document converted with the convert startegy</returns> public string ReadConvertedDocument( string language, string document, IDocumentConvertStrategy convertStrategy ) { return(convertStrategy?.GetConverted(ReadDocument(language, document))); }
/// <summary> /// Create a new instance of this manager class /// </summary> /// <param name="basePath">The base path of the document storage</param> /// <param name="fallbackLanguage">The fallback language to use</param> /// <param name="documentConvertStrategy">The strategy to use to convert to document into another format</param> /// <param name="connectorStrategy">The connector to use for loading the document</param> public DocumentManager( string basePath, string fallbackLanguage, IDocumentConvertStrategy documentConvertStrategy, IDocumentConnectorStrategy connectorStrategy) { this.basePath = basePath; this.documentConvertStrategy = documentConvertStrategy; this.connectorStrategy = connectorStrategy; this.connectorStrategy.SetFallbackLanguage(fallbackLanguage); }
/// <summary> /// Read the whole async document and convert it /// </summary> /// <param name="language">The language to use for the document to load</param> /// <param name="document">The name of the document to load</param> /// <param name="convertStrategy">The convert strategy to use</param> /// <returns>The whole document converted with the convert startegy</returns> public async Task <string> ReadConvertedDocumentAsync( string language, string document, IDocumentConvertStrategy convertStrategy ) { Task <string> returnTask = Task.Run(() => { return(convertStrategy?.GetConverted(ReadDocument(language, document))); }); return(await returnTask); }