SadPencil.Ra2CsfFile.Ini 3.0.0

dotnet add package SadPencil.Ra2CsfFile.Ini --version 3.0.0
                    
NuGet\Install-Package SadPencil.Ra2CsfFile.Ini -Version 3.0.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="SadPencil.Ra2CsfFile.Ini" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SadPencil.Ra2CsfFile.Ini" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="SadPencil.Ra2CsfFile.Ini" />
                    
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 SadPencil.Ra2CsfFile.Ini --version 3.0.0
                    
#r "nuget: SadPencil.Ra2CsfFile.Ini, 3.0.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 SadPencil.Ra2CsfFile.Ini@3.0.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=SadPencil.Ra2CsfFile.Ini&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=SadPencil.Ra2CsfFile.Ini&version=3.0.0
                    
Install as a Cake Tool

SadPencil.Ra2CsfFile

.NET Library

This repository publishes two .NET Standard 2.0 libraries:

  • SadPencil.Ra2CsfFile loads, edits, and saves string table files (.csf) for Red Alert 2.
  • SadPencil.Ra2CsfFile.Ini (de)serializes the string table from/to .ini files.

SadPencil.Ra2CsfFile.Ini references SadPencil.Ra2CsfFile, and it is the only one of the two libraries that contains ini code: the CsfFileIniHelper class and the bundled patched ini parser. A project that only works with .csf files needs SadPencil.Ra2CsfFile alone.

Example use

See ExampleApp/Program.cs file. The example app references both libraries.

License

MIT

Notes

Reference: https://modenc.renegadeprojects.com/CSF_File_Format

Bundled ini parser

SadPencil.Ra2CsfFile.Ini ships a patched ini-parser as SadPencil.Ra2CsfFile.IniParser.dll, with the IniParser.* namespaces, so a label value keeps its whitespace through the conversion.

Do not reference ini-parser or ini-parser-netstandard as well: they define the same types as the bundled copy, and the upstream parser trims the whitespace of a label value. The build reports SPCSFINI001 when a project that references SadPencil.Ra2CsfFile.Ini also references an upstream INIFileParser assembly.

Version History

v3.0.0: split the ini support out of SadPencil.Ra2CsfFile into the new SadPencil.Ra2CsfFile.Ini package, which is the only package that carries ini code, including the bundled patched ini-parser as SadPencil.Ra2CsfFile.IniParser 2.6.0; remove the obsolete CsfFile.LoadFromIniFile, CsfFile.WriteIniFile and CsfFile.GetCsfLang methods; normalize the line breaks of label values loaded from a csf file to LF; preserve the whitespace of label values loaded from an ini file; drop the WhiteSpaceWarning key from generated ini files; remove CsfFileIniHelper.TrimMultiLine; fix a bug where labels were not sorted when writing an ini file; warn at build time when the upstream ini parser is referenced too; reject an ini key that ends with whitespace instead of trimming it; enable Encoding1252WriteWorkaround by default, so that both workarounds are on by default
v2.2.5: update existing label with correct key case
v2.2.4: add trimmable line warning comment when generating an ini file
v2.2.3: ignore case when sorting keys; use natural sort order to make sure "key10" is placed after "key9"
v2.2.2: add OrderByKey option
v2.2.1: fix a bug where labels were not case-insensitive after cloning; support case-insensitive labels in INI
v2.2.0: allow CSF labels with capitcal letters included
v2.1.3: handle invalid CSF values with extra zeros
v2.1.2: disable Encoding1252WriteWorkaround by default; add CLSCompliant attribute to namespace SadPencil.Ra2CsfFile
v2.1.1: fix that some label names are not loaded successfully from .ini files
v2.1.0: api breaking change: change the behavior of Csf.AddLabel() with Add&Replace, so that the original ra2.csf file can be loaded
v2.0.2: remove the space around the "=" sign of ini file to fix a bug processing values contains " = " pattern
v2.0.1: fix a bug that CSF file with non-lowercase label name can not be loaded
v2.0.0: migrate to .NET Standard 2.0; replace dependency MadMilkman.Ini with ini-parser-netstandard; add Csf.RemoveLabel() method.
v1.3.1: api breaking change: Labels.Add will be replaced with AddLabel; add encoding 1252 workaround options for the original RA2 fonts; add clone constructor for CsfFile. 
v1.2.2: space in labels is now tolerated so that the library will not complain about the string table file in RA2.
v1.2.1: fix a bug where some labels of the ini file is not loaded.
v1.2.0: api breaking change: CsfFile.Labels will now store only one value for a label, as the rest values (if any) are not used by the game; api change: deprecate CsfFile.GetCsfLang() with CsfLangHelper.GetCsfLang(); api change: deprecate CsfFile.LoadFromIniFile() with CsfFileIniHelper.LoadFromIniFile(); api change: deprecate CsfFile.WriteIniFile() with CsfFileIniHelper.WriteIniFile().
v1.1.1: add XML documentation; re-release the library with Release configuration.
v1.1.0: fix a bug where multi-line text will be trimmed mistakenly; invalid chars in label name will now be checked.
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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
3.0.0 89 11/7/2026

new package: the ini support of SadPencil.Ra2CsfFile moves here, together with the bundled patched ini-parser as SadPencil.Ra2CsfFile.IniParser 2.6.0; preserve the whitespace of label values loaded from an ini file; drop the WhiteSpaceWarning key from generated ini files; remove CsfFileIniHelper.TrimMultiLine; fix a bug where labels were not sorted when writing an ini file; reject an ini key that ends with whitespace instead of trimming it; warn at build time when the upstream ini parser is referenced too