diff --git a/CSTNet/CaretSeparatedText.cs b/CSTNet/CaretSeparatedText.cs
index 7244695..8c7a81a 100644
--- a/CSTNet/CaretSeparatedText.cs
+++ b/CSTNet/CaretSeparatedText.cs
@@ -38,46 +38,36 @@ namespace CSTNet
/// This stage ensures there are no crashes during parsing.
static IEnumerable NormalizeEntries(string content)
{
-
- /*
- I tried putting the end carets with the different
- line endings in with the split function but it didn't work
- */
- if (!content.Contains($"{CARET}{Environment.NewLine}"))
+ if (!content.Contains(Environment.NewLine))
{
- if (content.Contains($"{CARET}{_lf}"))
- content = content.Replace($"{CARET}{_lf}",
- $"{CARET}{Environment.NewLine}");
+ if (content.Contains(_lf))
+ content = content.Replace(_lf, Environment.NewLine);
- if (content.Contains($"{CARET}{_cr}"))
- content = content.Replace($"{CARET}{_cr}",
- $"{CARET}{Environment.NewLine}");
+ if (content.Contains(_cr))
+ content = content.Replace(_cr, Environment.NewLine);
- if (content.Contains($"{CARET}{_crlf}"))
- content = content.Replace($"{CARET}{_crlf}",
- $"{CARET}{Environment.NewLine}");
+ if (content.Contains(_crlf))
+ content = content.Replace(_crlf, Environment.NewLine);
- if (content.Contains($"{CARET}{_ls}"))
- content = content.Replace($"{CARET}{_ls}",
- $"{CARET}{Environment.NewLine}");
+ if (content.Contains(_ls))
+ content = content.Replace(_ls, Environment.NewLine);
}
-
- var entries = content.Split(new[] { $"{CARET}{Environment.NewLine}" },
+ var lines = content.Split(new[] { $"{CARET}{Environment.NewLine}" },
StringSplitOptions.RemoveEmptyEntries);
- var newContent = new List();
+ var entries = new List();
- foreach (var entry in entries)
+ foreach (var line in lines)
{
// Skip comments
- if (entry.StartsWith(@"//") || entry.StartsWith("#") ||
- entry.StartsWith("/*") || entry.EndsWith("*/"))
+ if (line.StartsWith("//") || line.StartsWith("#") ||
+ line.StartsWith("/*") || line.EndsWith("*/"))
continue;
- newContent.Add(entry);
+ entries.Add(line);
}
- return newContent;
+ return entries;
}
static string GetEntry(IEnumerable entries, string key)
@@ -85,32 +75,18 @@ namespace CSTNet
// Search through list
foreach (var entry in entries)
{
- // Locate index, trim carets and return translation
+ // If the line doesn't start with the key, keep searching.
if (!entry.StartsWith(key))
continue;
+ // Locate index, trim carets and return translation.
var startIndex = entry.IndexOf(CARET);
var line = entry.Substring(startIndex);
- if (!line.Contains(Environment.NewLine))
- {
- if (line.Contains(_lf))
- line = line.Replace(_lf, Environment.NewLine);
-
- if (line.Contains(_cr))
- line = line.Replace(_cr, Environment.NewLine);
-
- if (line.Contains(_crlf))
- line = line.Replace(_crlf, Environment.NewLine);
-
- if (line.Contains(_ls))
- line = line.Replace(_ls, Environment.NewLine);
- }
-
return line.TrimStart(CARET).TrimEnd(CARET);
}
- return "[ENTRY NOT FOUND]";
+ return "***MISSING***";
}
}
}
diff --git a/CSTNet/Sixam.CST.csproj b/CSTNet/Sixam.CST.csproj
index d008079..feed6e6 100644
--- a/CSTNet/Sixam.CST.csproj
+++ b/CSTNet/Sixam.CST.csproj
@@ -2,7 +2,7 @@
netstandard2.0
- 1.0.1
+ 1.0.2
Tony Bark
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. CST.NET is a library for prasing the CST format.
https://github.com/tonytins/cstnet
diff --git a/README.md b/README.md
index aee0a64..e6b301a 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,7 @@
[](https://opensource.org/licenses/MIT) [](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. (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.
-
-Sixam.CST is a library for parsing the CST format. Though, production version were capable of
+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. Sixam.CST is a library for parsing the CST format.
## Usage
@@ -13,7 +11,7 @@ Sixam.CST is a library for parsing the CST format. Though, production version we
```
```csharp
-#r "nuget:CSTNet,1.0.1"
+#r "nuget:CSTNet,1.0.2"
using System;
using System.IO;
using CSTNet;
@@ -26,10 +24,10 @@ Console.WriteLine(example);
See working example on [.NET Fiddle](https://dotnetfiddle.net/ecKb2h).
-In production, CST files were used in The Sims Online to provide translations. Each translation was split into their respective directories:
+In production, CST files were used in The Sims Online (TSO) 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``
+- ``uitext/english.dir/_154_miscstrings.cst``
+- ``uitext/swedish.dir/_154_miscstrings.cst``
Sixam.CST only provides the basic parsing functionality.
@@ -40,7 +38,6 @@ Sixam.CST only provides the basic parsing functionality.
## Known issues
- Skipping comments is a little buggy.
-- Multiline parsing with the v2 format is still unpredictable.
## Requirements
### Prerequisites
diff --git a/changelog.md b/changelog.md
index 10c494b..07764a8 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,9 @@
# Change Log
+## 1.0.2
+
+- Fixed the multiline parsing in the v2 format.
+
## 1.0.1
Despite only being a point release, this includes a major refinement to the normalizing algorithm.