mirror of
https://github.com/tonytins/cstdotnet.git
synced 2025-03-15 06:01:25 +00:00
Removed CaretSeparatedText class
- Made CST class static - Removed a few left overs - Unit tests now target .NET 8
This commit is contained in:
parent
65c36f83cd
commit
84624111ea
8 changed files with 68 additions and 66 deletions
|
@ -9,7 +9,7 @@ root = true
|
||||||
[*]
|
[*]
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
end_of_line = crlf
|
end_of_line = crlf
|
||||||
indent_style = space
|
indent_style = tab
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
insert_final_newline = false
|
insert_final_newline = false
|
||||||
trim_trailing_whitespace = true
|
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_locals_parameters_members = true:suggestion
|
||||||
dotnet_style_predefined_type_for_member_access = true:suggestion
|
dotnet_style_predefined_type_for_member_access = true:suggestion
|
||||||
|
|
||||||
# Use camel_case for private or internal constant fields
|
# Use UPPER_CASE for private or internal constant fields
|
||||||
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
|
dotnet_naming_rule.constants_should_be_upper_case.severity = suggestion
|
||||||
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
|
dotnet_naming_rule.constants_should_be_upper_case.symbols = constants
|
||||||
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
|
dotnet_naming_rule.constants_should_be_upper_case.style = constant_style
|
||||||
|
|
||||||
dotnet_naming_symbols.constant_fields.applicable_kinds = field
|
dotnet_naming_symbols.constants.applicable_kinds = field, local
|
||||||
dotnet_naming_symbols.constant_fields.required_modifiers = const
|
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.
|
# 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_keywords_in_control_flow_statements = true
|
||||||
csharp_space_after_semicolon_in_for_statement = true
|
csharp_space_after_semicolon_in_for_statement = true
|
||||||
csharp_space_around_binary_operators = before_and_after
|
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_colon_in_inheritance_clause = true
|
||||||
csharp_space_before_comma = false
|
csharp_space_before_comma = false
|
||||||
csharp_space_before_dot = false
|
csharp_space_before_dot = false
|
||||||
|
@ -126,7 +125,4 @@ csharp_space_between_parentheses = false
|
||||||
csharp_space_between_square_brackets = false
|
csharp_space_between_square_brackets = false
|
||||||
csharp_using_directive_placement = outside_namespace:silent
|
csharp_using_directive_placement = outside_namespace:silent
|
||||||
csharp_prefer_simple_using_statement = true:suggestion
|
csharp_prefer_simple_using_statement = true:suggestion
|
||||||
csharp_prefer_braces = when_multiline:silent
|
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
|
|
|
@ -1,37 +1,36 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<RootNamespace>Sixam.CST.Tests</RootNamespace>
|
</PropertyGroup>
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
|
||||||
<PackageReference Include="xunit" Version="2.4.1" />
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="coverlet.collector" Version="3.1.2">
|
<PackageReference Include="coverlet.collector" Version="3.1.2">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\CSTNet\CSTNet.csproj" />
|
<ProjectReference Include="..\CSTNet\CSTNet.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="uitext\lorem.dir\_101_v1.cst">
|
<None Update="uitext\lorem.dir\_101_v1.cst">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Update="uitext\lorem.dir\_102_v2.cst">
|
<None Update="uitext\lorem.dir\_102_v2.cst">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
|
@ -6,9 +6,8 @@ MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CCFCE2DB-C18F-4D88-B025-19ED62BD2A1D}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CCFCE2DB-C18F-4D88-B025-19ED62BD2A1D}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
.editorconfig = .editorconfig
|
.editorconfig = .editorconfig
|
||||||
changelog.md = changelog.md
|
|
||||||
README.md = README.md
|
README.md = README.md
|
||||||
usage.md = usage.md
|
doc\changelog.md = doc\changelog.md
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSTNet", "CSTNet\CSTNet.csproj", "{C5372E74-D1DF-4D15-B597-D1F517ECD0D8}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSTNet", "CSTNet\CSTNet.csproj", "{C5372E74-D1DF-4D15-B597-D1F517ECD0D8}"
|
||||||
|
|
|
@ -6,10 +6,7 @@ using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace CSTNet;
|
namespace CSTNet;
|
||||||
|
|
||||||
[Obsolete("Use CST class instead.")]
|
public static class CST
|
||||||
public class CaretSeparatedText : CST { }
|
|
||||||
|
|
||||||
public class CST
|
|
||||||
{
|
{
|
||||||
const char CARET = '^';
|
const char CARET = '^';
|
||||||
const string LF = "\u000A";
|
const string LF = "\u000A";
|
||||||
|
@ -33,7 +30,7 @@ public class CST
|
||||||
return GetEntry(entries, key);
|
return GetEntry(entries, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NET8_0
|
#if (NET8_0 && DEBUG)
|
||||||
[UnmanagedCallersOnly(EntryPoint = "parse")]
|
[UnmanagedCallersOnly(EntryPoint = "parse")]
|
||||||
public static IntPtr Parse(IntPtr content, IntPtr key)
|
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 not, check for and replace other line ending types.
|
||||||
if (content.Contains(LF))
|
if (content.Contains(LF))
|
||||||
content = content.Replace(LF, Environment.NewLine);
|
content = content.Replace(LF,
|
||||||
|
Environment.NewLine);
|
||||||
|
|
||||||
if (content.Contains(CR))
|
if (content.Contains(CR))
|
||||||
content = content.Replace(CR, Environment.NewLine);
|
content = content.Replace(CR,
|
||||||
|
Environment.NewLine);
|
||||||
|
|
||||||
if (content.Contains(CRLF))
|
if (content.Contains(CRLF))
|
||||||
content = content.Replace(CRLF, Environment.NewLine);
|
content = content.Replace(CRLF,
|
||||||
|
Environment.NewLine);
|
||||||
|
|
||||||
if (content.Contains(LS))
|
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.
|
// Split the content by the caret and newline characters.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net6.0;netstandard2.1;net8.0</TargetFrameworks>
|
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
|
||||||
<Version>2.0.200-beta1</Version>
|
<Version>2.1.100</Version>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class UIText : IUIText
|
||||||
/// Loads the language file for the specified language and base directory.
|
/// Loads the language file for the specified language and base directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="language">Language to load</param>
|
/// <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)
|
public UIText(string language, params string[] baseBath)
|
||||||
{
|
{
|
||||||
Language = language;
|
Language = language;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<p align="center">
|
<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/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">
|
<img src="https://img.shields.io/github/commit-activity/w/tonytins/cstdotnet" alt="GitHub commit activity">
|
||||||
<a href="code_of_conduct.md"></br>
|
<a href="code_of_conduct.md"></br>
|
||||||
<img src="https://img.shields.io/codeclimate/maintainability-percentage/tonytins/cstdotnet" alt="Code Climate maintainability">
|
<img src="https://img.shields.io/codeclimate/maintainability-percentage/tonytins/cstdotnet" alt="Code Climate maintainability">
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
## 2.0.200
|
## 2.1.100
|
||||||
|
|
||||||
- Preliminary support for .NET 8
|
- Removed `CaretSeparatedText` in favor of `CST` class
|
||||||
- Native compatibility
|
- Due to technical reasons, .NET Standard Standard support was removed
|
||||||
- Parser function can now be consumed from non-.NET programming languages
|
|
||||||
|
### Experimental
|
||||||
|
|
||||||
|
- Parser function can now be consumed from non-.NET programming languages.
|
||||||
|
|
||||||
|
## 2.0.104
|
||||||
|
|
||||||
|
- Support for .NET 8
|
||||||
|
|
||||||
## 2.0.102
|
## 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
|
### 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).
|
For more info, see [usage.md](./usage.md).
|
||||||
|
|
||||||
|
@ -32,7 +39,7 @@ For more info, see [usage.md](./usage.md).
|
||||||
## 1.0.2
|
## 1.0.2
|
||||||
|
|
||||||
- Fixed the multiple line parsing in the v2 format.
|
- 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
|
## 1.0.1
|
||||||
|
|
||||||
|
@ -49,4 +56,4 @@ The normalizing algorithm has been rewritten to be more efficient and hopefully
|
||||||
|
|
||||||
## 1.0.0
|
## 1.0.0
|
||||||
|
|
||||||
- Initial release.
|
- Initial release.
|
Loading…
Add table
Reference in a new issue