SadPencil.Ra2CsfFile 2.1.2

dotnet add package SadPencil.Ra2CsfFile --version 2.1.2
NuGet\Install-Package SadPencil.Ra2CsfFile -Version 2.1.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="SadPencil.Ra2CsfFile" Version="2.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SadPencil.Ra2CsfFile --version 2.1.2
#r "nuget: SadPencil.Ra2CsfFile, 2.1.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.
// Install SadPencil.Ra2CsfFile as a Cake Addin
#addin nuget:?package=SadPencil.Ra2CsfFile&version=2.1.2

// Install SadPencil.Ra2CsfFile as a Cake Tool
#tool nuget:?package=SadPencil.Ra2CsfFile&version=2.1.2

This is a .NET Standard 2.0 Library to load, edit, and save string table files (.csf) for Red Alert 2. Also, (de)serialize the string table from/to .ini files.

Example use (also available here):

using SadPencil.Ra2CsfFile;

// New empty string table.
CsfFile csf = new CsfFile();

// Edit labels.
csf.AddLabel("gui:test-label-1", "This is the first line.\nThis is the second line =-;#!");
csf.AddLabel("gui:test-label-2", "Hi there!");
Console.WriteLine(csf.Labels["gui:test-label-2"]);
csf.RemoveLabel("gui:test-label-2");
csf.AddLabel(CsfFile.LowercaseLabelName("GUI:Test-Label-3"), "Invoke CsfFile.LowercaseLabelName() as the label name is case-insensitive.");

// Write as a csf file
string csfFilename = "example.csf";
using (FileStream fs = File.Open(csfFilename, FileMode.Create))
{
    csf.WriteCsfFile(fs);
}

// Load csf file
using (FileStream fs = File.Open(csfFilename, FileMode.Open))
{
    csf = CsfFile.LoadFromCsfFile(fs);
}

Console.WriteLine($"This csf file has {csf.Labels.Count} labels. The language is {csf.Language}.");

// Save as an ini file
string iniFilename = "example.ini";
using (FileStream fs = File.Open(iniFilename, FileMode.Create))
{
    CsfFileIniHelper.WriteIniFile(csf, fs);
}

// Load ini file
using (FileStream fs = File.Open(iniFilename, FileMode.Open))
{
    csf = CsfFileIniHelper.LoadFromIniFile(fs);
}

if (csf.Labels["gui:test-label-1"] == "This is the first line.\nThis is the second line =-;#!")
{
    Console.WriteLine("Yes. It is expected.");
}
else
{
    Console.WriteLine("Unexpected behavior.");
}
Product 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. 
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.2 280 12/25/2021
2.1.1 493 12/4/2021
2.1.0 261 12/4/2021
2.0.2 270 12/4/2021
2.0.1 271 12/4/2021
1.3.1 279 12/4/2021
1.2.2 246 12/4/2021
1.2.1 241 12/4/2021
1.1.1 264 11/27/2021

disable Encoding1252WriteWorkaround by default; add CLSCompliant attribute to namespace SadPencil.Ra2CsfFile