cstdotnet/README.md

49 lines
1.8 KiB
Markdown
Raw Normal View History

# QuickFennec.CST
2020-12-08 17:56:38 -05:00
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md)
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.
2020-12-08 17:56:38 -05:00
## Usage
2020-12-08 17:56:38 -05:00
```csharp
#r "nuget:CSTNet,1.0.1"
2020-12-08 17:56:38 -05:00
using System;
using System.IO;
using QuickFennec.CST;
2020-12-08 17:56:38 -05:00
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.
2020-12-08 17:56:38 -05:00
## 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](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.