mirror of
https://github.com/tonytins/cstdotnet.git
synced 2026-02-10 20:24:47 -05:00
2 KiB
2 KiB
QuickFennec.CST
Caret-Separated Text (or CST) is a key-value pair format represented by numbers or words as keys and the value is the string enclosed between carets that contains the contents. (e.g. <key> ^<value>^) Any text which is not enclosed with carets is considered a comment and ignored. Neither strings nor comments may use the caret character.
QuickFennec.CST is a library for parsing the CST format. Though, production version were capable of
Usage
1 ^The quick brown fox jumps over the lazy dog.^
#r "nuget:CSTNet,1.0.1"
using System;
using System.IO;
using CSTNet;
var file = File.ReadAllText("example.cst");
var example = CaretSeparatedText.Parse(file, 1);
Console.WriteLine(example);
See working example on .NET Fiddle.
In production, CST files were used in The Sims Online to provide translations. Each translation was split into their respective directories:
uitext/english.dir/misc/_154_miscstrings.cstuitext/swedish.dir/misc/_154_miscstrings.cst
QuickFennec.CST only provides the basic parsing functionality.
To-do
- Support for arguments (e.g.
%1)
Known issues
- Skipping comments is a little buggy.
- Multiline parsing with the v2 format is still unpredictable.
Requirements
Prerequisites
- .NET 5+ or Core 3.1
- .NET Interactive for notebooks
- VSCode Extension (does not require Jupyter)
- nteract (requires Jupyter)
License
I license this project under the MIT license - see LICENSE for details.