2020-12-11 04:16:06 -05:00
# Sixam.CST
2020-12-08 17:56:38 -05:00
2020-12-08 18:46:52 -05:00
[](https://opensource.org/licenses/MIT) [](code_of_conduct.md)
2020-12-12 03:32:09 -05:00
Caret-Separated Text (or CST) is a key-value pair format represented by digits or words as keys and the value as text enclosed between carets. (e.g. ``<key> ^<text>^` `) Any text which is not enclosed with carets is considered a comment and ignored. Neither strings nor comments may use the caret character. Sixam.CST is a library for parsing the CST format.
2020-12-08 17:56:38 -05:00
2020-12-08 20:13:18 -05:00
## Usage
2020-12-08 17:56:38 -05:00
2020-12-11 02:14:05 -05:00
```text
1 ^The quick brown fox jumps over the lazy dog.^
```
2020-12-08 17:56:38 -05:00
```csharp
2020-12-12 03:32:09 -05:00
#r "nuget:CSTNet,1.0.2"
2020-12-08 17:56:38 -05:00
using System;
using System.IO;
2020-12-11 01:46:47 -05:00
using CSTNet;
2020-12-08 17:56:38 -05:00
var file = File.ReadAllText("example.cst");
var example = CaretSeparatedText.Parse(file, 1);
Console.WriteLine(example);
```
2020-12-11 02:28:17 -05:00
See working example on [.NET Fiddle ](https://dotnetfiddle.net/ecKb2h ).
2020-12-12 03:32:09 -05:00
In production, CST files were used in The Sims Online (TSO) to provide translations. Each translation was split into their respective directories:
2020-12-08 20:13:18 -05:00
2020-12-12 03:32:09 -05:00
- ``uitext/english.dir/_154_miscstrings.cst` `
- ``uitext/swedish.dir/_154_miscstrings.cst` `
2020-12-08 20:13:18 -05:00
2020-12-11 04:16:06 -05:00
Sixam.CST only provides the basic parsing functionality.
2020-12-08 20:13:18 -05:00
2020-12-08 17:56:38 -05:00
## To-do
2020-12-08 18:46:52 -05:00
- [ ] Support for arguments (e.g. ``%1` `)
2020-12-09 22:34:45 -05:00
## Known issues
2020-12-11 01:44:45 -05:00
- Skipping comments is a little buggy.
2020-12-09 22:34:45 -05:00
2020-12-08 18:46:52 -05:00
## Requirements
### Prerequisites
- [.NET ](https://dotnet.microsoft.com/download ) 5+ or Core 3.1
- [.NET Interactive ](https://github.com/dotnet/interactive/blob/main/README.md ) for notebooks
- [VSCode Extension ](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.dotnet-interactive-vscode ) (does not require Jupyter)
- [nteract ](https://nteract.io/ ) (requires Jupyter)
2020-12-08 17:56:38 -05:00
## License
I license this project under the MIT license - see [LICENSE ](LICENSE ) for details.