From 84624111ea229265f93028d6372e93675a5f259f Mon Sep 17 00:00:00 2001 From: Tony Bark Date: Tue, 28 Nov 2023 10:26:54 -0500 Subject: [PATCH] Removed CaretSeparatedText class - Made CST class static - Removed a few left overs - Unit tests now target .NET 8 --- .editorconfig | 22 +++++------- CSTNet.Tests/CSTNet.Tests.csproj | 61 ++++++++++++++++---------------- CSTNet.sln | 3 +- CSTNet/CST.cs | 19 +++++----- CSTNet/CSTNet.csproj | 4 +-- CSTNet/UIText.cs | 2 +- README.md | 2 +- doc/changelog.md | 21 +++++++---- 8 files changed, 68 insertions(+), 66 deletions(-) diff --git a/.editorconfig b/.editorconfig index bbae09f..b4e4ee7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 \ No newline at end of file +csharp_prefer_braces = when_multiline:silent \ No newline at end of file diff --git a/CSTNet.Tests/CSTNet.Tests.csproj b/CSTNet.Tests/CSTNet.Tests.csproj index e0f2c87..faee7a8 100644 --- a/CSTNet.Tests/CSTNet.Tests.csproj +++ b/CSTNet.Tests/CSTNet.Tests.csproj @@ -1,37 +1,36 @@ - - net6.0 - enable - enable - false - Sixam.CST.Tests - + + net8.0 + enable + enable + false + - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + - - - + + + - - - PreserveNewest - - - PreserveNewest - - + + + PreserveNewest + + + PreserveNewest + + - + \ No newline at end of file diff --git a/CSTNet.sln b/CSTNet.sln index e118a08..7c221ed 100644 --- a/CSTNet.sln +++ b/CSTNet.sln @@ -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}" diff --git a/CSTNet/CST.cs b/CSTNet/CST.cs index 1d60f73..37da99b 100644 --- a/CSTNet/CST.cs +++ b/CSTNet/CST.cs @@ -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. diff --git a/CSTNet/CSTNet.csproj b/CSTNet/CSTNet.csproj index f12b66e..a9aa843 100644 --- a/CSTNet/CSTNet.csproj +++ b/CSTNet/CSTNet.csproj @@ -1,8 +1,8 @@ - net6.0;netstandard2.1;net8.0 - 2.0.200-beta1 + net6.0;net8.0 + 2.1.100 enable latest enable diff --git a/CSTNet/UIText.cs b/CSTNet/UIText.cs index ac899d5..b60b16c 100644 --- a/CSTNet/UIText.cs +++ b/CSTNet/UIText.cs @@ -34,7 +34,7 @@ public class UIText : IUIText /// Loads the language file for the specified language and base directory. /// /// Language to load - /// Base directory for the language files. + /// Base directory for the language files. public UIText(string language, params string[] baseBath) { Language = language; diff --git a/README.md b/README.md index 6bbb3c6..68f9d37 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

GitHub license - GitHub Workflow Status + GitHub Workflow Status GitHub commit activity
Code Climate maintainability diff --git a/doc/changelog.md b/doc/changelog.md index e618f41..e94d8fc 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -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 ``//.dir`` directories and searching CST files by their Id number. (e.g. _*154*_miscstrings.cst). By defualt, the base path is ``//uitext/.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 `//.dir` directories and searching CST files by their Id number. (e.g. \_*154*\_miscstrings.cst). By defualt, the base path is `//uitext/.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. \ No newline at end of file