.NET Parser for The Sims Online's CST format.
Find a file
Tony Bark e6c8bc914a
v1.0.1 (#1)
The normalizing algorithm has been rewritten to be more efficient and hopefully more reliable. The new algorithm de-constructs each line after converting it to the system's native line ending. Then it searches for the key and returns value. The rewrite also normalizes line endings to match the system's within the entry itself before returning the final output. This should make things more stable and predictable.

- Skipping comments is a little buggy.
- Multiline parsing with the v2 format is still unpredictable.
2020-12-11 01:54:20 -05:00
.github Uncommented push to NuGet 2020-12-11 01:52:10 -05:00
.vscode Added VSCode tasks 2020-12-08 19:09:34 -05:00
CSTNet 1.0.1 merge conflict fixes 2020-12-11 01:22:09 -05:00
CSTNet.Tests Merge branch 'releases/1.0' into master 2020-12-11 01:29:45 -05:00
notebooks Rewrote normalizing algorithm 2020-12-11 01:05:46 -05:00
.editorconfig Add project files. 2020-12-08 17:56:38 -05:00
.gitattributes Add .gitignore and .gitattributes. 2020-12-08 17:56:36 -05:00
.gitignore Rewrote normalizing algorithm 2020-12-11 01:05:46 -05:00
changelog.md Rewrote normalizing algorithm 2020-12-11 01:05:46 -05:00
code_of_conduct.md Migrated CST notebook from .NET Labs 2020-12-08 18:46:52 -05:00
CSTNet.sln 1.0.1 merge conflict fixes 2020-12-11 01:22:09 -05:00
CSTNet.sln.licenseheader Add project files. 2020-12-08 17:56:38 -05:00
LICENSE Add project files. 2020-12-08 17:56:38 -05:00
README.md Fixed using statement in usage section of README. 2020-12-11 01:46:47 -05:00

QuickFennec.CST

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.

QuickFennec.CST is a library for parsing the CST format.

Usage

#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);

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.cst
  • uitext/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

License

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