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

@ -9,7 +9,7 @@ root = true
[*]
charset = utf-8
end_of_line = crlf
indent_style = space
indent_style = tab
indent_size = 4
insert_final_newline = false
trim_trailing_whitespace = true
@ -49,15 +49,15 @@ csharp_style_var_elsewhere = true:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# Use camel_case for private or internal constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
# Use UPPER_CASE for private or internal constant fields
dotnet_naming_rule.constants_should_be_upper_case.severity = suggestion
dotnet_naming_rule.constants_should_be_upper_case.symbols = constants
dotnet_naming_rule.constants_should_be_upper_case.style = constant_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.required_modifiers = const
dotnet_naming_symbols.constants.applicable_kinds = field, local
dotnet_naming_symbols.constants.required_modifiers = const
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
dotnet_naming_style.constant_style.capitalization = all_upper
# Comment this group and uncomment out the next group if you don't want _ prefixed fields.
@ -109,7 +109,6 @@ csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = do_not_ignore
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
@ -126,7 +125,4 @@ csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = when_multiline:silent
csharp_style_namespace_declarations = file_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_prefer_braces = when_multiline:silent

View file

@ -1,37 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<RootNamespace>Sixam.CST.Tests</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CSTNet\CSTNet.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CSTNet\CSTNet.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="uitext\lorem.dir\_101_v1.cst">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="uitext\lorem.dir\_102_v2.cst">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Update="uitext\lorem.dir\_101_v1.cst">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="uitext\lorem.dir\_102_v2.cst">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
</Project>

View file

@ -6,9 +6,8 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CCFCE2DB-C18F-4D88-B025-19ED62BD2A1D}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
changelog.md = changelog.md
README.md = README.md
usage.md = usage.md
doc\changelog.md = doc\changelog.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSTNet", "CSTNet\CSTNet.csproj", "{C5372E74-D1DF-4D15-B597-D1F517ECD0D8}"

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;

View file

@ -2,7 +2,7 @@
<p align="center">
<a href="https://github.com/tonytins/cstdotnet/blob/main/LICENSE"><img src="https://img.shields.io/github/license/tonytins/cstdotnet" alt="GitHub license"></a>
<a href="https://github.com/tonytins/cstdotnet/actions?query=workflow%3Adotnet.yml"><img src="https://img.shields.io/github/actions/workflow/status/tonytins/cstdotnet/dotnet.yml" alt="GitHub Workflow Status"></a>
<a href="https://github.com/tonytins/cstdotnet/actions?query=workflow%3Abuild.yml"><img src="https://img.shields.io/github/actions/workflow/status/tonytins/cstdotnet/build.yml" alt="GitHub Workflow Status"></a>
<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">

View file

@ -1,10 +1,17 @@
# Change Log
## 2.0.200
## 2.1.100
- Preliminary support for .NET 8
- Native compatibility
- Parser function can now be consumed from non-.NET programming languages
- Removed `CaretSeparatedText` in favor of `CST` class
- Due to technical reasons, .NET Standard Standard support was removed
### Experimental
- Parser function can now be consumed from non-.NET programming languages.
## 2.0.104
- Support for .NET 8
## 2.0.102
@ -16,7 +23,7 @@ This version supports both .NET Standard 2.1 and .NET 6 and brings with it (much
### UIText class and interface
Based on FreeSO's API, the ``UIText`` class allows for traversing in ``/<directory>/<language>.dir`` directories and searching CST files by their Id number. (e.g. _*154*_miscstrings.cst). By defualt, the base path is ``/<program directory>/uitext/<language>.dir``. You may also create your own implementation based on these APIs using the ``IUIText`` interface which mine also uses.
Based on FreeSO's API, the `UIText` class allows for traversing in `/<directory>/<language>.dir` directories and searching CST files by their Id number. (e.g. \_*154*\_miscstrings.cst). By defualt, the base path is `/<program directory>/uitext/<language>.dir`. You may also create your own implementation based on these APIs using the `IUIText` interface which mine also uses.
For more info, see [usage.md](./usage.md).
@ -32,7 +39,7 @@ For more info, see [usage.md](./usage.md).
## 1.0.2
- Fixed the multiple line parsing in the v2 format.
- Replaced "``[ENTRY NOT FOUND]``" message with "``***MISSING***``".
- Replaced "`[ENTRY NOT FOUND]`" message with "`***MISSING***`".
## 1.0.1
@ -49,4 +56,4 @@ The normalizing algorithm has been rewritten to be more efficient and hopefully
## 1.0.0
- Initial release.
- Initial release.