public static XMindConfiguration WithInMemoryWriter( this XMindConfiguration config ) { return(config.WriteTo .Writer( new InMemoryWriter( new InMemoryWriterOutputConfig($"[in-memory-writer]")))); }
// TODO: add API to write to stream, minor because it is always possible to implement IXMindWriter /// <summary> /// Writes file to <paramref name="basePath"/> /// </summary> /// <param name="config"></param> /// <param name="basePath"></param> /// <param name="zip"></param> /// <returns></returns> public static XMindConfiguration WithFileWriter( this XMindConfiguration config, string?basePath = default, bool zip = true) { var result = config .WriteTo.Writers(FileWriterFactory.CreateStandardWriters(basePath)) .WriteTo.SetWriterBinding(FileWriterFactory.CreateStandardResolvers()); if (zip) { result.WriteTo.SetFinalizeAction(CreateZipXMindFolderCallback(basePath)); } return(result); }
/// <summary> /// Creates a new XMind workbook if loadContent is false, otherwise the file content will be loaded. /// </summary> /// <param name="fileName">XMind file to create / load</param> /// <param name="loadContent">If true, the current data from the file will be loaded, otherwise an empty workbook will be created.</param> internal XMindWorkBook(string fileName, bool loadContent, XMindConfiguration globalConfiguration, XMindConfigurationCache config) { _fileName = fileName; _xMindSettings = config; this._globalConfiguration = globalConfiguration; if (loadContent) { Load(); } else { var builder = new XMindDocumentBuilder(); _metaData = builder.CreateDefaultMetaFile(); _manifestData = builder.CreateDefaultManifestFile(); _contentData = builder.CreateDefaultContentFile(); } }
/// <summary> /// Write file to default location - "xmind-output" /// </summary> /// <param name="config"></param> /// <param name="zip"></param> /// <returns></returns> public static XMindConfiguration WithFileWriter( this XMindConfiguration config, bool zip = true) { return(config.WithFileWriter(basePath: null, zip: zip)); }