VOOZH about

URL: https://www.nuget.org/packages/War3Net.Common/

⇱ NuGet Gallery | War3Net.Common 6.0.2




👁 Image
War3Net.Common 6.0.2

dotnet add package War3Net.Common --version 6.0.2
 
 
NuGet\Install-Package War3Net.Common -Version 6.0.2
 
 
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="War3Net.Common" Version="6.0.2" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="War3Net.Common" Version="6.0.2" />
 
Directory.Packages.props
<PackageReference Include="War3Net.Common" />
 
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 War3Net.Common --version 6.0.2
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: War3Net.Common, 6.0.2"
 
 
#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 War3Net.Common@6.0.2
 
 
#: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=War3Net.Common&version=6.0.2
 
Install as a Cake Addin
#tool nuget:?package=War3Net.Common&version=6.0.2
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

War3Net.Common

About

War3Net.Common provides shared utilities for the War3Net modding library. It contains extension methods, encoding providers, and type conversion utilities commonly used when working with Warcraft III binary file formats.

Key features

  • Extension methods for BinaryReader and BinaryWriter to handle Warcraft III-specific data types
  • Rawcode conversion between 4-character strings and 32-bit integers
  • Type-safe enum conversion with validation for binary data parsing
  • Stream utilities for efficient copying and reading operations
  • Color format conversions (RGBA, BGRA)
  • Pre-configured UTF-8 encoding providers without byte order marks

How to Use

Convert rawcodes

Warcraft III uses 4-character "rawcodes" to identify units, abilities, and other objects. These are stored as 32-bit integers in binary files.

using War3Net.Common.Extensions;

// Convert a rawcode string to integer
int unitId = "hpea".FromRawcode(); // Human Peasant

// Convert an integer back to rawcode string
string rawcode = unitId.ToRawcode(); // "hpea"

Read binary data with extension methods

using System.IO;
using War3Net.Common.Extensions;

using var reader = new BinaryReader(stream);

// Read a null-terminated UTF-8 string
string name = reader.ReadChars();

// Read a fixed-length string
string fixedString = reader.ReadString(32);

// Read a 32-bit boolean (0 or 1)
bool enabled = reader.ReadBool();

// Read color values
Color rgbaColor = reader.ReadColorRgba();
Color bgraColor = reader.ReadColorBgra();

// Read typed enum values
MyEnum value = reader.ReadInt32<MyEnum>();

Type-safe enum conversion

using War3Net.Common;

// Convert raw binary values to enums with validation
var myEnum = EnumConvert<MyEnum>.FromInt32(value);

// Use raw conversion when validation is not needed
var rawEnum = EnumConvert<MyEnum>.FromInt32Raw(value);

Use UTF-8 encoding without BOM

using War3Net.Common.Providers;

// Lenient encoding (does not throw on invalid bytes)
Encoding utf8 = UTF8EncodingProvider.UTF8;

// Strict encoding (throws on invalid bytes)
Encoding strictUtf8 = UTF8EncodingProvider.StrictUTF8;

Main Types

The main types provided by this library are:

  • War3Net.Common.EnumConvert<TEnum> - Type-safe conversion from primitive types to enums with validation
  • War3Net.Common.Extensions.BinaryReaderExtensions - Extension methods for reading Warcraft III data types
  • War3Net.Common.Extensions.BinaryWriterExtensions - Extension methods for writing Warcraft III data types
  • War3Net.Common.Extensions.StreamExtensions - Extension methods for stream operations
  • War3Net.Common.Extensions.Int32Extensions - Rawcode and color conversion from integers
  • War3Net.Common.Extensions.StringExtensions - Rawcode conversion from strings
  • War3Net.Common.Providers.UTF8EncodingProvider - Pre-configured UTF-8 encodings

Related Packages

Feedback and contributing

War3Net.Common is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Disclaimer

This README was generated with the assistance of AI and may contain inaccuracies. Please verify the information and consult the source code for authoritative details.

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 was computed.  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 was computed.  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 (4)

Showing the top 4 NuGet packages that depend on War3Net.Common:

Package Downloads
War3Net.CodeAnalysis.Jass

Parse and render JASS source files.

War3Net.IO.Compression

Compression algorithms for MPQ archives.

War3Net.IO.Slk

Read and write SLK data files.

War3Net.Drawing.Blp

Read and write BLP texture files.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.0.2 563 3/1/2026
6.0.1 538 2/1/2026
6.0.0 454 1/25/2026
5.8.0 3,312 9/6/2025
5.6.1 8,754 1/7/2023
5.6.0 1,725 12/20/2022
5.5.5 3,864 11/13/2022
5.5.3 2,229 10/29/2022
5.5.2 2,096 10/25/2022
5.5.0 3,211 8/20/2022
5.4.5 2,480 5/27/2022
5.4.0 5,962 2/13/2022
5.0.2 5,935 2/14/2021
5.0.1 1,649 12/25/2020
5.0.0 1,801 12/14/2020
0.3.2 2,405 11/11/2020
0.3.1 1,028 10/29/2020
0.3.0 1,666 10/27/2020
0.2.0 1,602 9/14/2020
0.1.3 2,425 6/21/2020
Loading failed