/// <inheritdoc/> void IFileWriter.Save(string path, object item, object options) { if (string.IsNullOrEmpty(path) || item == null) { return; } var ic = options as IImageCache; if (options == null) { return; } var renderer = new SkiaSharpRenderer(_serviceProvider, true, 96.0); renderer.State.DrawShapeState.Flags = ShapeStateFlags.Printable; renderer.State.ImageCache = ic; var presenter = new ExportPresenter(); IProjectExporter exporter = new IcoSkiaSharpExporter(renderer, presenter); if (item is IPageContainer page) { var dataFlow = _serviceProvider.GetService <IDataFlow>(); var db = (object)page.Data.Properties; var record = (object)page.Data.Record; dataFlow.Bind(page.Template, db, record); dataFlow.Bind(page, db, record); exporter.Save(path, page); } else if (item is IDocumentContainer document) { throw new NotSupportedException("Saving documents as ico drawing is not supported."); } else if (item is IProjectContainer project) { throw new NotSupportedException("Saving projects as ico drawing is not supported."); } }
/// <inheritdoc/> void IFileWriter.Save(string path, object item, object options) { if (string.IsNullOrEmpty(path) || item == null) { return; } var ic = options as IImageCache; if (options == null) { return; } var renderer = new SkiaSharpRenderer(true, 96.0); renderer.State.DrawShapeState.Flags = ShapeStateFlags.Printable; renderer.State.ImageCache = ic; var presenter = new ExportPresenter(); IProjectExporter exporter = new IcoSkiaSharpExporter(renderer, presenter); if (item is PageContainer) { exporter.Save(path, item as PageContainer); } else if (item is DocumentContainer) { throw new NotSupportedException("Saving documents as ico drawing is not supported."); } else if (item is ProjectContainer) { throw new NotSupportedException("Saving projects as ico drawing is not supported."); } }