diff --git a/CSTNet.Tests/CSTHelper.cs b/CSTNet.Tests/CSTHelper.cs
index e203e46..6033d94 100644
--- a/CSTNet.Tests/CSTHelper.cs
+++ b/CSTNet.Tests/CSTHelper.cs
@@ -1,7 +1,7 @@
using System;
using System.IO;
-namespace CSTNet.Tests
+namespace Sixam.CST.Tests
{
static class CSTHelper
{
diff --git a/CSTNet.Tests/MultilineTests.cs b/CSTNet.Tests/MultilineTests.cs
index 4db5f89..802653b 100644
--- a/CSTNet.Tests/MultilineTests.cs
+++ b/CSTNet.Tests/MultilineTests.cs
@@ -1,7 +1,7 @@
using System;
using Xunit;
-namespace CSTNet.Tests
+namespace Sixam.CST.Tests
{
public class MultilineTests
{
diff --git a/CSTNet.Tests/SingleLineTests.cs b/CSTNet.Tests/SingleLineTests.cs
index bc217f9..fc69158 100644
--- a/CSTNet.Tests/SingleLineTests.cs
+++ b/CSTNet.Tests/SingleLineTests.cs
@@ -1,7 +1,8 @@
// This project is licensed under the MIT license.
+
using Xunit;
-namespace CSTNet.Tests
+namespace Sixam.CST.Tests
{
public class SingleLineTests
{
diff --git a/CSTNet.sln.licenseheader b/CSTNet.sln.licenseheader
deleted file mode 100644
index 167f123..0000000
--- a/CSTNet.sln.licenseheader
+++ /dev/null
@@ -1,3 +0,0 @@
-extensions: designer.cs generated.cs
-extensions: .cs .cpp .h
-// This project is licensed under the MIT license.
\ No newline at end of file
diff --git a/CSTNet/CaretSeparatedText.cs b/CSTNet/CaretSeparatedText.cs
index 8c7a81a..3df866b 100644
--- a/CSTNet/CaretSeparatedText.cs
+++ b/CSTNet/CaretSeparatedText.cs
@@ -1,26 +1,26 @@
// This project is licensed under the MIT license.
+// See the LICENSE file in the project root for more information.
+
using System;
using System.Collections.Generic;
+using System.Linq;
-namespace CSTNet
+namespace Sixam.CST
{
- public static class CaretSeparatedText
+ public class CaretSeparatedText
{
+
const char CARET = '^';
- static readonly string _lf = "\u000A";
- static readonly string _cr = "\u000D";
- static readonly string _crlf = "\u000D\u000A";
- static readonly string _ls = "\u2028";
+ const string LF = "\u000A";
+ const string CR = "\u000D";
+ const string CRLF = "\u000D\u000A";
+ const string LS = "\u2028";
///
- /// Gets the value from the integer-based key.
+ /// Gets the value from the digit-based key.
///
/// Returns the entry
- public static string Parse(string content, int key)
- {
- var entries = NormalizeEntries(content);
- return GetEntry(entries, key.ToString());
- }
+ public static string Parse(string content, int key) => Parse(content, key.ToString());
///
/// Gets the value from the string-based key.
@@ -40,34 +40,28 @@ namespace CSTNet
{
if (!content.Contains(Environment.NewLine))
{
- if (content.Contains(_lf))
- content = content.Replace(_lf, Environment.NewLine);
+ if (content.Contains(LF))
+ content = content.Replace(LF, Environment.NewLine);
- if (content.Contains(_cr))
- content = content.Replace(_cr, Environment.NewLine);
+ if (content.Contains(CR))
+ content = content.Replace(CR, Environment.NewLine);
- if (content.Contains(_crlf))
- content = content.Replace(_crlf, Environment.NewLine);
+ if (content.Contains(CRLF))
+ content = content.Replace(CRLF, Environment.NewLine);
- if (content.Contains(_ls))
- content = content.Replace(_ls, Environment.NewLine);
+ if (content.Contains(LS))
+ content = content.Replace(LS, Environment.NewLine);
}
var lines = content.Split(new[] { $"{CARET}{Environment.NewLine}" },
StringSplitOptions.RemoveEmptyEntries);
- var entries = new List();
- foreach (var line in lines)
- {
- // Skip comments
- if (line.StartsWith("//") || line.StartsWith("#") ||
- line.StartsWith("/*") || line.EndsWith("*/"))
- continue;
-
- entries.Add(line);
- }
-
- return entries;
+ return lines.Where(line =>
+ !line.StartsWith("//") &&
+ !line.StartsWith("#") &&
+ !line.StartsWith("/*") &&
+ !line.EndsWith("*/"))
+ .AsEnumerable();
}
static string GetEntry(IEnumerable entries, string key)
@@ -90,3 +84,9 @@ namespace CSTNet
}
}
}
+
+namespace CSTNet
+{
+ [Obsolete("CaretSeparatedText has moved to the Sixam.CST namespace.")]
+ public class CaretSeparatedText : Sixam.CST.CaretSeparatedText { }
+}
diff --git a/CSTNet/Sixam.CST.csproj b/CSTNet/Sixam.CST.csproj
index 129d2db..cb0805a 100644
--- a/CSTNet/Sixam.CST.csproj
+++ b/CSTNet/Sixam.CST.csproj
@@ -2,9 +2,13 @@
netstandard2.0
- 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.
+ 1.0.300
+ Tony Bark, Sixam Software
+
+ 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. ([key] ^[value]^)
+
+ CST.NET is a parser for the CST format.
+
https://github.com/sixamsoft/cst-dotnet
MIT
CST.Net
diff --git a/Sixam.CST.sln b/Sixam.CST.sln
index a166832..c31541d 100644
--- a/Sixam.CST.sln
+++ b/Sixam.CST.sln
@@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
changelog.md = changelog.md
README.md = README.md
+ Sixam.CST.sln.licenseheader = Sixam.CST.sln.licenseheader
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sixam.CST.Tests", "CSTNet.Tests\Sixam.CST.Tests.csproj", "{B6A98C64-1419-4B9A-99CA-72BB11D29472}"
diff --git a/Sixam.CST.sln.licenseheader b/Sixam.CST.sln.licenseheader
new file mode 100644
index 0000000..df4e2e0
--- /dev/null
+++ b/Sixam.CST.sln.licenseheader
@@ -0,0 +1,4 @@
+extensions: designer.cs generated.cs
+extensions: .cs .cpp .h
+// This project is licensed under the MIT license.
+// See the LICENSE file in the project root for more information.
\ No newline at end of file
diff --git a/changelog.md b/changelog.md
index db502f8..f80230e 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,11 +1,18 @@
# Change Log
+
+## 1.0.300
+
+- Switched to Sixam.CST namespace and marked CSTNet namespace as obsolete.
+- Performance improvements.
+
## 1.0.2
- Fixed the multiple line parsing in the v2 format.
- Replaced "``[ENTRY NOT FOUND]``" message with "``***MISSING***``".
+
## 1.0.1
-Despite only being a point release, this includes a major refinement to the normalizing algorithm.
+Despite only being a patch release, this includes a major refinement to the normalizing algorithm.
### Rewrote normalizing algorithm