maple-DrawioSupport
1.1.8
dotnet add package maple-DrawioSupport --version 1.1.8
NuGet\Install-Package maple-DrawioSupport -Version 1.1.8
<PackageReference Include="maple-DrawioSupport" Version="1.1.8" />
<PackageVersion Include="maple-DrawioSupport" Version="1.1.8" />
<PackageReference Include="maple-DrawioSupport" />
paket add maple-DrawioSupport --version 1.1.8
#r "nuget: maple-DrawioSupport, 1.1.8"
#:package maple-DrawioSupport@1.1.8
#addin nuget:?package=maple-DrawioSupport&version=1.1.8
#tool nuget:?package=maple-DrawioSupport&version=1.1.8
Readme DrawioSupport
Overview
DrawioSupport provides utilities for rendering, processing, and extracting information from draw.io diagram files. It includes classes for rendering diagrams to images, extracting tab names, and parsing diagram content.
Main Classes
DIOModelExtractor
Provides static methods for extracting tab names, parsing models, and extracting text elements from draw.io files.
Example: Extract Tab Names
using (FileStream stream = File.Open("diagram.drawio", FileMode.Open))
{
var tabNames = DIOModelExtractor.GetTabNames(stream).ToArray(); // tabNames: ["Page-1", "Page-2"]
}
Example: Extract Text Elements
var xml = "<mxfile><diagram><mxCell value='Element1' /></diagram></mxfile>";
var xdoc = DIOModelExtractor.LoadModel(xml);
var elements = DIOModelExtractor.GetTextElements(xdoc); // elements: ["Element1"]
Example: Strip HTML Tags
var result = DIOModelExtractor.StripHtmlTags("<p>This is a <b>test</b></p>"); // result: "This is a test"
DrawIOFileEnumerator
Fast crawler that finds drawio files in a given directory.
class TestEnumerator(string directory)
: DrawIOFileEnumerator<Result>(directory)
{
protected override Result TransformEx(ref FileSystemEntry entry, FS.IFileInfo fileInfo, DIOFileTypes fileType)
{
return new Result { FileInfo = fileInfo, FileType = fileType };
}
}
public record Result
{
/// <summary>Location of file found</summary>
public required FS.IFileInfo FileInfo { get; set; }
/// <summary>Type of file found (e.g. .drawio, .drawio.png, ...)</summary>
public required DIOFileTypes FileType { get; set; }
}
List<DIOCrawlResult> files = new();
var enumerator = new TestEnumerator(TestDataHelper.ResolveTestdataDirectory("DrawIO"));
while (enumerator.MoveNext())
{
Result current = enumerator.Current;
files.Add(current);
}
DrawioRenderer
Render a draw.io diagram to png/svg file format. Each tab in the draw.io file will be rendered to a separate image file. The output files will be named according to the source file name appended with the sequence nr (e.g. -1.drawio.png, -2.drawio.svg ).
IFileInfo sourceFile = new FileInfo("diagram.drawio");
IDirectoryInfo targetDir = new DirectoryInfo("c:\\output");
IEnumerable<RenderResult> res = DrawioRenderer.ConvertTo(sourceFile, targetDir);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- MetadataExtractor (>= 2.8.1)
- System.IO.Abstractions (>= 22.0.15)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.