Removed CaretSeparatedText class

- Made CST class static
- Removed a few left overs
- Unit tests now target .NET 8
This commit is contained in:
Tony Bark 2023-11-28 10:26:54 -05:00
parent 65c36f83cd
commit 84624111ea
8 changed files with 68 additions and 66 deletions

View file

@ -6,10 +6,7 @@ using System.Runtime.InteropServices;
namespace CSTNet;
[Obsolete("Use CST class instead.")]
public class CaretSeparatedText : CST { }
public class CST
public static class CST
{
const char CARET = '^';
const string LF = "\u000A";
@ -33,7 +30,7 @@ public class CST
return GetEntry(entries, key);
}
#if NET8_0
#if (NET8_0 && DEBUG)
[UnmanagedCallersOnly(EntryPoint = "parse")]
public static IntPtr Parse(IntPtr content, IntPtr key)
{
@ -56,16 +53,20 @@ public class CST
{
// If not, check for and replace other line ending types.
if (content.Contains(LF))
content = content.Replace(LF, Environment.NewLine);
content = content.Replace(LF,
Environment.NewLine);
if (content.Contains(CR))
content = content.Replace(CR, Environment.NewLine);
content = content.Replace(CR,
Environment.NewLine);
if (content.Contains(CRLF))
content = content.Replace(CRLF, Environment.NewLine);
content = content.Replace(CRLF,
Environment.NewLine);
if (content.Contains(LS))
content = content.Replace(LS, Environment.NewLine);
content = content.Replace(LS,
Environment.NewLine);
}
// Split the content by the caret and newline characters.

View file

@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.1;net8.0</TargetFrameworks>
<Version>2.0.200-beta1</Version>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<Version>2.1.100</Version>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>

View file

@ -34,7 +34,7 @@ public class UIText : IUIText
/// Loads the language file for the specified language and base directory.
/// </summary>
/// <param name="language">Language to load</param>
/// <param name="basePath">Base directory for the language files.</param>
/// <param name="baseBath">Base directory for the language files.</param>
public UIText(string language, params string[] baseBath)
{
Language = language;