VOOZH about

URL: https://www.nuget.org/packages/DMISharp/

⇱ NuGet Gallery | DMISharp 2.1.0



dotnet add package DMISharp --version 2.1.0
 
 
NuGet\Install-Package DMISharp -Version 2.1.0
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DMISharp" Version="2.1.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DMISharp" Version="2.1.0" />
 
Directory.Packages.props
<PackageReference Include="DMISharp" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DMISharp --version 2.1.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DMISharp, 2.1.0"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DMISharp@2.1.0
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DMISharp&version=2.1.0
 
Install as a Cake Addin
#tool nuget:?package=DMISharp&version=2.1.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

<h1 align="center"> <img src="./dmisharp.png" alt="DMISharp" width="256"/> <br/> DMISharp </h1>

DMISharp is a .NET 8.0 library for easily interacting with the BYOND DMI file format.

Developed with ease-of-use in mind, this library provides a simple means for importing, modifying, and exporting DMI files. Internally, images are handled using ImageSharp, a fantastic open-source library from SixLabors.

Installation

Install the current stable release from Nuget.

👁 NuGet

Getting Started

Important things to note:

  • Always dispose DMIFile / DMIState objects. They use unmanaged memory for their sprites.

Ingesting a DMI file from a path:

using var file = new DMIFile("test.dmi")
// do cool things

Ingesting a DMI file from a stream:

// Getting a memory stream from a database with the DMI file's data in the response
using var dmiData = database.GetFile("test.dmi")
using var file = new DMIFile(dmiData)
// do more cool things

Sorting a DMI file's states alphabetically, and saving the resulting DMI file:

using var file = new DMIFile("unsorted_states.dmi")
file.SortStates();
file.Save("sorted_states.dmi");

Sorting a DMI file's states using a provided comparer, and saving the resulting DMI file to a memory stream:

using var stream = new MemoryStream()
using var file = new DMIFile("unsorted_states.dmi")
file.SortStates(new CoolCustomComparer());
file.Save(stream);

Creating a new DMI file with 32x32 pixel states, and creating 3 states from 3 source images:

using var newDMI = new DMIFile(32, 32)
var sourceData = new List<string>() { "sord", "sordvert", "steve32" };

foreach (var source in sourceData)
{
 var img = Image.Load<Rgba32>($@"Data/Input/SourceImages/{source}.png");
 var newState = new DMIState(source, DirectionDepth.One, 1, 32, 32);
 newState.SetFrame(img, 0);
 newDMI.AddState(newState);
}

newDMI.Save(@"Data/Output/minecraft.dmi");

Creating a new DMI file with 32x32 pixel states, creating a state, and then modifying that state's frame and direction depth:

using var newDMI = new DMIFile(32, 32)

// Create state
var img = Image.Load<Rgba32>($@"Data/Input/SourceImages/steve32.png");
var newState = new DMIState("steve32", DirectionDepth.One, 1, 32, 32);
newState.SetFrame(img, 0);
newDMI.AddState(newState);

// Modifying state
newDMI.States.First().SetDirectionDepth(DirectionDepth.Four);
newDMI.States.First().SetFrameCount(10);

// At this point you would add the new frames for each direction, otherwise
// you cannot save the file.

// Saving
newDMI.Save(@"Data/Output/minecraft.dmi");

Questions?

Feel free to contact me on Discord at @bobbahbrown with any questions or concerns. Additionally, I can be found in the /tg/station discord server.

Product Versions Compatible and additional computed target framework versions.
.NET net6.0 net6.0 is compatible.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 is compatible.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 7,218 7/22/2024
2.0.2 7,136 7/8/2023
2.0.2-alpha.1 206 7/7/2023
2.0.1 6,988 7/7/2023
2.0.0 7,011 7/7/2023
1.7.0 143,577 3/13/2022
1.6.2 7,372 3/15/2021
1.6.1 7,275 3/10/2021
1.6.0 7,275 3/10/2021
1.5.1 7,295 1/18/2021
1.5.0 7,317 11/27/2020
1.4.1 7,539 11/5/2019
1.4.0 7,467 10/9/2019
1.3.4 7,581 10/8/2019
1.3.3 7,573 10/4/2019
1.3.2 7,600 10/4/2019
1.3.1 7,552 10/4/2019
1.2.1 7,571 10/4/2019
1.1.2 7,657 6/29/2019
Loading failed

See notes for this release on GitHub: https://github.com/bobbahbrown/DMISharp/releases/tag/2.1.0