diff --git a/CSTNet/CSTNet.csproj b/CSTNet/CSTNet.csproj index f3387c1..925fd35 100644 --- a/CSTNet/CSTNet.csproj +++ b/CSTNet/CSTNet.csproj @@ -1,7 +1,7 @@ - net6.0;netstandard2.1 + net6.0;netstandard2.1;net8.0 2.0.103 enable latest @@ -17,8 +17,4 @@ BSD-3-Clause - - - - \ No newline at end of file diff --git a/CSTNet/README.md b/CSTNet/README.md deleted file mode 100644 index 8d3f021..0000000 --- a/CSTNet/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# CST.NET - -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. `` ^^``) Any text which is not enclosed with carets is considered a comment and ignored. Neither strings nor comments may use the caret character. CST.NET is a library for parsing the CST format. - -## License - -I license this project under the BSD-3-Clause license - see [LICENSE](LICENSE) for details. diff --git a/README.md b/README.md index 0f76755..af94de0 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,18 @@ GitHub commit activity
Code Climate maintainability - Code Climate technical debt

Contributor Covenant
+ NuGet Downloads
Contributor Covenant

CST.NET is a library for parsing the CST format. 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. `` ^^``) Any text which is not enclosed with carets is considered a comment and ignored. Neither strings nor comments may use the caret character. ## Changelog -See [changelog.md](./changelog.md) +See [changelog.md](./doc/changelog.md) ## Usage -See [usage.md](./usage.md). +See [/docs](./doc/README.md). ## To-do diff --git a/doc/README.md b/doc/README.md new file mode 100644 index 0000000..cf2d11b --- /dev/null +++ b/doc/README.md @@ -0,0 +1,39 @@ +# CST.NET + +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. `` ^^``) Any text which is not enclosed with carets is considered a comment and ignored. Neither strings nor comments may use the caret character. CST.NET is a library for parsing the CST format. + +## Usage + +### Basic Parsing + +If you want to create your own internal CST parsing framework, you can use the `CST` or `CaretSeparatedText` class directly. + +```text +1 ^The quick brown fox jumps over the lazy dog.^ +``` + +```csharp +#r "nuget:CSTNet,2.0.103" +using CSTNet; + +var file = File.ReadAllText("example.cst"); +var example = CST.Parse(file, 1); + +// "The quick brown fox jumps over the lazy dog." +Console.WriteLine(example); +``` + +### In Production + +```csharp +#r "nuget:CSTNet,2.0.103" +using CSTNet; + +var english = new UIText(); // UIText assumes English +var swedish = new UIText("swedish"); +var engExample = english.GetText(152, 1); // english.dir/_154_miscstrings.cst +var sweExample = swedish.GetText(152, 1); // swedish.dir/_154_miscstrings.cst + +Console.WriteLine(engExample); +Console.WriteLine(sweExample); +``` \ No newline at end of file diff --git a/changelog.md b/doc/changelog.md similarity index 100% rename from changelog.md rename to doc/changelog.md diff --git a/usage.md b/usage.md deleted file mode 100644 index 926ad3e..0000000 --- a/usage.md +++ /dev/null @@ -1,58 +0,0 @@ -# Usage - -## Basic Parsing - -If you want to create your own internal CST parsing framework, you can use the `CST` or `CaretSeparatedText` class directly. - -```text -1 ^The quick brown fox jumps over the lazy dog.^ -``` - -```csharp -#r "nuget:CSTNet,1.0.400-beta1" // If using notebooks -using CSTNet; - -var file = File.ReadAllText("example.cst"); -var example = CST.Parse(file, 1); - -// "The quick brown fox jumps over the lazy dog." -Console.WriteLine(example); -``` - -## In Production - -The Sims Online, and by extension FreeSO, are the only known example of CST files ever being used in production. CST.NET's APIs is based on FreeSO's and is meant to function both as drop-in replacement and general purpose API. - -```csharp -#r "nuget:CSTNet,1.0.300" -using CSTNet; - -var english = new UIText(); // UIText assumes English -var swedish = new UIText("swedish"); -var engExample = english.GetText(152, 1); // english.dir/_154_miscstrings.cst -var sweExample = swedish.GetText(152, 1); // swedish.dir/_154_miscstrings.cst - -Console.WriteLine(engExample); -Console.WriteLine(sweExample); -``` - -In The Sims Online, it was required translation were prefixed with numbers enclosed in underscores, known as the ID. The IDs were used to locate the right file without having to remember it's name. Meanwhile, each translation was split into their respective ``uitext/.dir`` directories: - -- ``uitext/english.dir/_154_miscstrings.cst`` -- ``uitext/swedish.dir/_154_miscstrings.cst`` - -Note that the ``UIText`` class uses the above mentioned ``CST.Parse()`` method internally. Any changes made to the CST class. - -### Changing base directories - -If you want to change the base directory, you can. Though, this is still a work in progress and not recommended. - -```csharp -#r "nuget:CSTNet,1.0.300" -using CSTNet; - -var example = new UIText() -{ - BasePath = new[] { "gamedata", "uitext" }, -}; -```