cstdotnet/README.md
Tony Bark cd95b7c6ae Rewrote normalizing algorithm
The mormalizing algorithm was rewritten to be more efficient and hopefully more reliable. See changelog.md for more info.
2020-12-11 01:05:46 -05:00

1.7 KiB

CSTNet

License: MIT Contributor Covenant

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. Any text which is not enclosed with carets is considered a comment and ignored. Neither strings nor comments may use the caret character.

CSTNet is a library for parsing the CST format.

Usage

#r "nuget:CSTNet,1.0.0"
using System;
using System.IO;
using CSTNet;

var file = File.ReadAllText("example.cst");
var example = CaretSeparatedText.Parse(file, 1);

Console.WriteLine(example);

In production, CST files were used in The Sims Online to provide translations. Each translation was split into their respective directories:

  • uitext/english.dir/hints/_154_miscstrings.cst
  • uitext/swedish.dir/hints/_154_miscstrings.cst

CST.NET only provides the basic parsing functionality.

To-do

  • Support for arguments (e.g. %1)

Known issues

  • Reading multiple lines

Requirements

Prerequisites

License

I license this project under the MIT license - see LICENSE for details.