AnnoMods.BBDom
3.0.1
dotnet add package AnnoMods.BBDom --version 3.0.1
NuGet\Install-Package AnnoMods.BBDom -Version 3.0.1
<PackageReference Include="AnnoMods.BBDom" Version="3.0.1" />
paket add AnnoMods.BBDom --version 3.0.1
#r "nuget: AnnoMods.BBDom, 3.0.1"
// Install AnnoMods.BBDom as a Cake Addin
#addin nuget:?package=AnnoMods.BBDom&version=3.0.1
// Install AnnoMods.BBDom as a Cake Tool
#tool nuget:?package=AnnoMods.BBDom&version=3.0.1
AnnoMods.BBDom
A library for working with BlueBytes proprietary DOM format for Anno 1800.
For the full documentation, visit: https://github.com/anno-mods/FileDBReader/wiki
Some short codesnippets to get you started:
IO
Loading
using var inStream = new MemoryStream();
var doc = BBDocument.LoadStream(inStream);
Writing
BBDocument doc;
using var outStream = new MemoryStream();
doc.WriteToStream(outStream);
V3 is used as the default version.
To use a custom version for writing, use:
doc.WriteToStream(outStream, BBDocumentVersion.V3);
Creating your own Documents
BBDocument doc;
//create Nodes
var tag = doc.CreateTag("MyNodeName");
var attrib1 = doc.CreateAttrib("MyAttribName");
var attrib2 = doc.CreateAttrib("MyAttribWithContent", 53);
var stringAttrib = doc.CreateAttrib("MyStringAttribName", "Content", Encoding.UTF8);
//create Node Structure
tag.AddChildren(attrib1, attrib2, stringAttrib);
doc.AddRoot(tag);
Serialization
For serialization to a stream, you do
BBDocument doc;
MyType obj;
BBConvert.SerializeObject(obj, new BBSerializerOptions(), new MemoryStream());
If you wish to instead serialize to a BBDocument, you can do the following:
BBDocument doc;
MyType obj;
BBConvert.SerializeObjectToDocument(obj, new BBSerializerOptions());
For more info how to create object models for serialization, check out the Documentation on Github
Xml ↔ BBDocument
The library allows for conversion between Bluebytes custom formats and an XML representation of it, representing the Binary Data in the BBDocument as Hex Strings.
BBDocument doc;
XmlDocument xmlDoc = doc.ToXmlDocument();
XmlDocument doc;
BBDocument bbDoc = doc.ToBBDocument();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.