CsfStudio is a commandβline tool for working with Red Alert 2 and Yuri's Revenge string table files (.csf). It supports bidirectional conversion between multiple formats, set operations on label collections, map label checking, translation helpers, and encoding fixes.
- π Format conversion β CSF β INI / JSON / YAML / LLF / TXT / Excel (XLSX/XLS) / CSV
- π§© Set operations β union, subtraction, intersection, symmetric difference, case override
- π Diff & compare β full diff and short stat between two CSF files
- π Search & export β find labels by pattern, export label lists
- πΊοΈ Map label check β scan
.map,.mpr,.yrmfiles to find missing labels in CSF - π Translation helpers β generate translation templates, side-by-side comparisons, update helpers
- π Encoding fix β reinterpret CSF text using a different codepage (e.g. Windows-1251, GB18030)
- π¦ Batch processing β process all files in a folder at once
- π§ Preserves extra data (WRTS) β all operations keep the optional binary block
- π Label ordering β maintain original order or sort alphabetically (
--order-by-key) - ποΈ Dry-run mode β preview output without writing files
| Format | Read | Write | Extra data | Metadata | Multiβline |
|---|---|---|---|---|---|
| CSF (binary) | β | β | β (WRTS) | β (version, language) | β |
| INI | β | β | β (text) | β | β |
| JSON | β | β | β (text) | β | β |
| YAML | β | β | β (text) | β | β (literal) |
| LLF | β | β | β (comment) | β (comments) | β |
| TXT (CSFTool) | β | β | β
(!extra|) |
β
(!metadata|) |
β (escaped) |
| Excel (XLSX/XLS) | β | β | β (text) | β (separate sheet) | β |
| CSV | β | β | β (text) | β
(#version=) |
β (RFC 4180) |
All conversions preserve label order (original or sorted) and extra data (WRTS) where applicable.
- .NET Framework 4.0 or higher
- Visual Studio 2019 / 2022 (or any C# compiler)
git clone https://github.com/YoVVassup/Ra2CsfFile.git
cd Ra2CsfFile
nuget restore SadPencil.Ra2CsfFile.sln
msbuild SadPencil.Ra2CsfFile.sln /p:Configuration=ReleaseThe executable CsfStudio.exe will be placed in CsfStudio\bin\Release\. All dependencies (NPOI, YamlDotNet, Newtonsoft.Json, etc.) are embedded using Costura.Fody β no extra DLLs required.
# View file statistics
CsfStudio.exe -i stringtable01.csf --stats
# Convert CSF to INI
CsfStudio.exe -i stringtable01.csf -o stringtable01.ini --to-ini
# Compare two files
CsfStudio.exe -i old.csf,new.csf --diff
# Search for labels
CsfStudio.exe -i stringtable01.csf --search "Soviet"
# Validate a file
CsfStudio.exe -i stringtable01.csf --validateCsfStudio.exe -i <input> [-i <input2> ...] -o <output> --<operation> [options]
Convert a single file from one format to another.
| Command | Output format |
|---|---|
--to-csf |
.csf (binary game format) |
--to-ini |
.ini (human-readable) |
--to-json |
.json |
--to-yaml |
.yaml |
--to-llf |
.llf (Label Language File) |
--to-txt |
.txt (CSFTool format) |
--to-excel |
.xlsx or .xls |
--to-csv |
.csv |
CsfStudio.exe -i stringtable01.csf -o stringtable01.ini --to-ini
CsfStudio.exe -i stringtable01.ini -o stringtable01.xlsx --to-excel
CsfStudio.exe -i stringtable01.csv -o stringtable01.csf --to-csf --csv-delimiter semicolon
CsfStudio.exe -i stringtable01.csf -o output.json --to-json --dry-runOperations that combine or compare two or more input files.
| Command | Description |
|---|---|
--merge |
Union: all labels from all files |
--subtract |
A minus B: labels in first but not in others |
--intersection |
Labels present in all files; differing values replaced with --diff-placeholder |
--symmetric-difference |
Labels present in exactly one file (values must match) |
--override-case |
Keep values from current file, but use label case from upstream file |
CsfStudio.exe -i stringtable01.csf,stringtable02.csf -o merged.csf --merge
CsfStudio.exe -i stringtable01.csf,stringtable02.csf -o common.csf --intersection
CsfStudio.exe -i upstream.csf,current.csf -o fixed.csf --override-case
CsfStudio.exe -i old.csf,new.csf -o merged.csf --merge --merge-strategy last-wins| Command | Description |
|---|---|
--diff |
Full diff: show all added, removed, and changed labels |
--diff-stat |
Short summary: counts of added/removed/changed/unchanged |
CsfStudio.exe -i old.csf,new.csf --diff
CsfStudio.exe -i old.csf,new.csf -o diff_report.txt --diff
CsfStudio.exe -i old.csf,new.csf --diff-stat| Command | Description |
|---|---|
--search <pattern> |
Find labels by substring (case-insensitive) |
--search regex:<pattern> |
Find labels by regular expression |
--export-labels |
Export sorted list of all label names |
CsfStudio.exe -i stringtable01.csf --search "Soviet"
CsfStudio.exe -i stringtable01.csf --search "regex:^UI:" -o matches.txt
CsfStudio.exe -i stringtable01.csf --export-labels -o labels.txt| Command | Description |
|---|---|
--stats |
Show file statistics (count, size, language, version) |
--validate |
Validate file for errors (exit code: 0=ok, 1=errors, 2=warnings) |
CsfStudio.exe -i stringtable01.csf --stats
CsfStudio.exe -i stringtable01.csf --validateScan map files (.map, .mpr, .yrm) and list all labels used in maps but missing from the CSF.
CsfStudio.exe -i ra2md.csf --check-maps --map-folder "C:\RA2\Maps"
CsfStudio.exe -i ra2md.csf --check-maps --map-folder "C:\RA2\Maps" -o missing_labels.txt| Command | Description | Inputs |
|---|---|---|
--translation-new |
Create translation template | 1 (upstream) |
--translation-tile |
Side-by-side comparison | 2 (upstream, translated) |
--translation-update |
Update translation after upstream changes | 3 (old_upstream, new_upstream, old_translated) |
--translation-override |
Merge: use translated if exists, otherwise upstream | 2 (upstream, translated) |
CsfStudio.exe -i upstream.csf -o template.ini --translation-new
CsfStudio.exe -i upstream.csf,translated.csf -o compare.ini --translation-tile
CsfStudio.exe -i old_up.csf,new_up.csf,old_trans.csf -o updated.ini --translation-update
CsfStudio.exe -i upstream.csf,translated.csf -o merged.csf --translation-overrideReinterpret CSF text using a different codepage.
CsfStudio.exe -i broken.csf -o fixed.csf --fix-encoding windows-1251
CsfStudio.exe -i broken.csf -o fixed.csf --fix-encoding gb18030Supported encodings: gb18030, gb2312, windows-1251, windows-1252, iso-8859-1, utf-8, unicode
Process all supported files in a folder at once.
CsfStudio.exe --batch --batch-folder "C:\RA2\Strings" --to-json
CsfStudio.exe --batch --batch-folder "C:\RA2\Strings" --output-folder "C:\Output" --to-ini
CsfStudio.exe --batch --batch-folder "C:\RA2\Strings" --to-csv --recursive| Option | Description |
|---|---|
-i, --input <file> |
Input file(s), comma-separated for multiple |
-o, --output <file> |
Output file path |
--csv-delimiter <delim> |
CSV delimiter: auto, comma, semicolon, tab, pipe, space |
--order-by-key |
Sort labels alphabetically when saving |
--diff-placeholder <text> |
Placeholder for differing values (default: TODO_Different_Value) |
--merge-strategy <strategy> |
Conflict resolution: first-wins (default), last-wins, error |
--dry-run |
Preview output without writing files |
--force |
Overwrite existing output file without prompt |
--output-encoding <enc> |
Output encoding: utf-8 (default), ascii, unicode |
--quiet |
Suppress non-essential output |
--verbose |
Show additional information |
--recursive |
Include subfolders in batch processing |
-h, --help |
Show help |
- Extra data (WRTS) is preserved in all operations.
- Extra data is stored as UTF-8 text in all text formats.
--translation-tilesupports.ini,.json,.yaml,.csv,.xlsxoutput.- When using
--translation-update, removed labels get a_DELETEsuffix. - Map label check parses
UIName,Actions(types 11/103), andRankingsection.
MIT License β see LICENSE for details.