Moved second README and change log from source to /doc

This commit is contained in:
Tony Bark 2023-08-10 22:41:12 -04:00
parent df5ebd3954
commit 6bc99bb7cc
6 changed files with 43 additions and 73 deletions

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net6.0;netstandard2.1;net8.0</TargetFrameworks>
<Version>2.0.103</Version>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
@ -17,8 +17,4 @@
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
</PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>

View file

@ -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. ``<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. 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.

View file

@ -6,18 +6,18 @@
<img src="https://img.shields.io/github/commit-activity/w/tonytins/cstdotnet" alt="GitHub commit activity">
<a href="code_of_conduct.md"></br>
<img src="https://img.shields.io/codeclimate/maintainability-percentage/tonytins/cstdotnet" alt="Code Climate maintainability">
<img src="https://img.shields.io/codeclimate/tech-debt/tonytins/cstdotnet" alt="Code Climate technical debt"> <a href="https://www.nuget.org/packages/tonybark.updatetools"><img src="https://img.shields.io/nuget/v/cstnet.svg" /></a></br><img src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg" alt="Contributor Covenant"></a></br>
<img src="https://img.shields.io/nuget/dt/CSTNet" alt="NuGet Downloads"> <a href="https://www.nuget.org/packages/tonybark.updatetools"><img src="https://img.shields.io/nuget/v/cstnet.svg" /></a></br><img src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg" alt="Contributor Covenant"></a></br>
</p>
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. ``<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.
## 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

39
doc/README.md Normal file
View file

@ -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. ``<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. 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);
```

View file

@ -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/<languae>.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" },
};
```