ODSSharp 1.0.0

Object Data Structure is a fast byte based file format designed for video games.

There is a newer version of this package available.
See the version list below for details.
Install-Package ODSSharp -Version 1.0.0
dotnet add package ODSSharp --version 1.0.0
<PackageReference Include="ODSSharp" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ODSSharp --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ODSSharp, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ODSSharp as a Cake Addin
#addin nuget:?package=ODSSharp&version=1.0.0

// Install ODSSharp as a Cake Tool
#tool nuget:?package=ODSSharp&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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 offical C# port of the Java version of ODS. The API is kept as true to the Java version as possible while still compling 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 abou the changes from the Java version.

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 respectivly.
Finally there are ObjectTags. ObjectTags store other tags. For more information about the possibilites 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.
Picture Of the Visualizer
Click here to go to the visualizer repository.

Offical Language Ports

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.

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 offical C# port of the Java version of ODS. The API is kept as true to the Java version as possible while still compling 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 abou the changes from the Java version.

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 respectivly.
Finally there are ObjectTags. ObjectTags store other tags. For more information about the possibilites 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.
Picture Of the Visualizer
Click here to go to the visualizer repository.

Offical Language Ports

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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.5 62 4/29/2021
1.0.2 120 12/16/2020
1.0.1 149 12/9/2020
1.0.0 212 8/20/2020