ODSSharp 1.0.5
dotnet add package ODSSharp --version 1.0.5
NuGet\Install-Package ODSSharp -Version 1.0.5
<PackageReference Include="ODSSharp" Version="1.0.5" />
paket add ODSSharp --version 1.0.5
#r "nuget: ODSSharp, 1.0.5"
// Install ODSSharp as a Cake Addin
#addin nuget:?package=ODSSharp&version=1.0.5
// Install ODSSharp as a Cake Tool
#tool nuget:?package=ODSSharp&version=1.0.5
ObjectDataStructure C# (ODSSharp)
Object Data Structure is a file format inspired by NBT. Everything in this file format is made of tags. ODS is not human-readable, data is stored in bytes.
This is the official C# port of the Java version of ODS. The API is kept as true to the Java version as possible while still complying with C# standards.
The documentation of ODSSharp is not complete yet. You can use the Java Documentation instead. It is almost the same besides the fact that methods are camel cased in Java.
Changes from the Java Version
Please read the wiki for more information about the changes from the Java version.
Installation
Install ODSSharp via the .NET CLI
dotnet add package ODSSharp --version 1.0.5
or via Nuget
Usage
As stated above ODS uses tags. There are many primative tags: StringTag, IntTag, ShortTag, LongTag, ByteTag, DoubleTag, FloatTag. There are also the ListTag and DirectoryTag. They both store primative tags in a list and directory format respectively. Finally there are ObjectTags. ObjectTags store other tags. For more information about the possibilities be sure to check out the wiki and/or the Java Documentation!
You will need to use the following:
using ODS;
using ODS.Tags;
// If you want to use the class serialization V
using ODS.Serializer;
ODSUtil Utility Class
The ODS class is full of useful methods that allow the easy serialization of primative objects.
The ODS class also allows the serialization of custom objects.
Note: Due to the nature of C# and generics, the Utility class is not as useful/functional as the Java version. Lists cannot be serialized in classes for now.
Example for saving
ObjectDataStructure ods = new ObjectDataStructure(new FileInfo(Directory.GetCurrentDirectory() + "\\test3.ods"));
List<ITag> tags = new List<ITag>();
tags.Add(new StringTag("ExampleKey", "This is an example string!"));
tags.Add(new IntTag("ExampleInt", 754));
ObjectTag car = new ObjectTag("Car");
car.AddTag(new StringTag("type", "Jeep"));
car.AddTag(new IntTag("gas", 30));
List<IntTag> coordsList = new List<IntTag>() { new IntTag("", 10), new IntTag("", 5), new IntTag("", 10) };
car.AddTag(new ListTag<IntTag>("coords", coordsList));
ObjectTag owner = new ObjectTag("Owner");
owner.AddTag(new StringTag("firstName", "Jeff"));
owner.AddTag(new StringTag("lastName", "Bob"));
owner.AddTag(new IntTag("Age", 30));
car.AddTag(owner);
tags.Add(car);
ods.Save(tags);
Example for loading
StringTag tag = (StringTag) ods.Get("ExampleKey");
Console.WriteLine("The value of the ExampleKey is: " + tag.GetValue());
ObjectTag myCar = (ObjectTag) ods.Get("Car");
StringTag myCarType = (StringTag)myCar.GetTag("type");
Console.WriteLine("The car is a " + myCarType.GetValue());
StringTag ownerFirstName = (StringTag) ods.Get("Car.Owner.firstName");
StringTag ownerLastName = (StringTag)ods.Get("Car.Owner.lastName");
Console.WriteLine("The owner of the car is " + ODSUtil.UnWrap(ownerFirstName) + " " + ODSUtil.UnWrap(ownerLastName));
ODS Visualizer
This tool allows you inspect ods files. The tool is coded in Java so you will need to install Java to use it.
Click here to go to the visualizer repository.
Offical Language Ports
- ODS (Java)
- C++ (Coming Soon)
ODS Specifications
The specifications for the ODS format can be found here on the main respository
Contributing to the project
Feel free to contribute any bug fixes or performance optimizations to this repository.
Any changes to the API must be suggested on the main repository.
Dependencies
This project uses SharpZipLib for ZLib compression. Their code is licensed under MIT
.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- SharpZipLib (>= 1.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.