2 Commits

Author SHA1 Message Date
Matt Nadareski
9ef17819a3 Split tests as well 2025-12-02 08:21:25 -05:00
Matt Nadareski
b4d87e53a0 Try out split libraries in the same repo 2025-12-02 08:15:48 -05:00
33 changed files with 359 additions and 142 deletions

121
README.MD
View File

@@ -2,126 +2,7 @@
[![Build and Test](https://github.com/SabreTools/SabreTools.IO/actions/workflows/build_and_test.yml/badge.svg)](https://github.com/SabreTools/SabreTools.IO/actions/workflows/build_and_test.yml)
This library compries of I/O functionality used by other SabreTools projects.
Find the link to the Nuget package [here](https://www.nuget.org/packages/SabreTools.IO).
## Namespaces
Below are a list of the included namespaces and their overall utility.
### `SabreTools.IO`
Generic helper classes that involve custom functionality and utility.
### `SabreTools.IO.Compression`
Various compression implementations that are used across multiple projects. Most of the implementations are be ports of existing C and C++ code.
#### Supported Compressions
| Compression Name | Decompress | Compress | Notes |
| --- | --- | --- | --- |
| Blast | Yes | No | |
| BZip2 | Yes | Yes | Sourced from DotNetZip |
| Deflate | Yes | Yes | Sourced from DotNetZip |
| LZ | Yes | No | KWAJ, QBasic 4.5, and SZDD variants; KWAJ incomplete |
| LZX | No | No | |
| MSZIP | Yes | No | |
| Quantum | Yes* | No | Partial implementation based on standalone archives; not working |
**Note:** If something is marked with a `*` it means that it need testing.
#### External Libraries
| Library Name | Use |
| --- | ---|
| [DotNetZip](https://github.com/DinoChiesa/DotNetZip) | BZip2 and DEFLATE implementations; minor edits have been made |
| [ZLibPort](https://github.com/Nanook/zlib-C-To-CSharp-Port) | Adds zlib code for internal and external use; minor edits have been made |
### `SabreTools.IO.Encryption`
Various encryption implementations that are used across multiple projects. Most of the implementations are be ports of existing C and C++ code.
#### Supported Encryption Schemes
| Encryption Scheme | Encrypt | Decrypt | Notes |
| --- | --- | --- | --- |
| AES/CTR | Yes | Yes | Subset of functionality exposed from [The Bouncy Castle Cryptography Library For .NET](https://github.com/bcgit/bc-csharp) |
| MoPaQ | No | Yes | Used to encrypt and decrypt MoPaQ tables for processing |
### `SabreTools.IO.Extensions`
Extensions for `BinaryReader`, `byte[]`, and `Stream` to help with reading and writing various data types. Some data types are locked behind .NET version support.
This namespace also contains other various extensions that help with common functionality and safe access.
### `SabreTools.IO.Interfaces`
Common interfaces used mainly internal to the library.
| Interface | Notes |
| --- | --- |
| `IMatch<T>` | Represents a matcher for a generic type |
| `IMatchSet<T, U>` | Represents a set of `IMatch<T>` types |
### `SabreTools.IO.Logging`
Logic for a logging system, including writing to console and textfile outputs. There are 4 possible log levels for logging statements to be invoked with. There is also a stopwatch implementation included for logging statements with automatic timespan tracking.
### `SabreTools.IO.Matching`
Classes designed to make matching contents and paths easier. These classes allow for both grouped and single matching as well as post-processing of matched information.
### `SabreTools.IO.Readers` and `SabreTools.IO.Writers`
Reading and writing support for the following file types:
- ClrMamePro-derived Metadata files
- Standard and non-standard INI files
- Separated-Value files (e.g. CSV, SSV, TSV)
For a generic INI implementation, see `SabreTools.IO.IniFile`.
### `SabreTools.IO.Streams`
Custom `Stream` implementations that are required for specialized use:
- `BufferedStream`: A format that is not a true stream implementation used for buffered, single-byte reads
- `ReadOnlyBitStream`: A readonly stream implementation allowing bitwise reading
- `ReadOnlyCompositeStream`: A readonly stream implementation that wraps multiple source streams in a set order
- `ViewStream`: A readonly stream implementation representing a view into source data
### `SabreTools.IO.Transform`
File and stream implementations of common data transformations:
- Combine using either ordered concatenation or interleaving
- Split by even/odd chunks or based on block size
- Convert data either by bit-swapping, byte-swapping, word-swapping, or word/byte-swapping
### `SabreTools.Numerics`
Custom numeric types and related functionality.
#### Supported Numeric Types
| Type Name | Description |
| --- | --- |
| `BothInt8` | Both-endian `Int8` value |
| `BothUInt8` | Both-endian `UInt8` value |
| `BothInt16` | Both-endian `Int16` value |
| `BothUInt16` | Both-endian `UInt16` value |
| `BothInt32` | Both-endian `Int32` value |
| `BothUInt32` | Both-endian `UInt32` value |
| `BothInt64` | Both-endian `Int64` value |
| `BothUInt64` | Both-endian `UInt64` value |
**Both-endian** or **bi-endian** numbers are represented by a little-endian value followed by a big-endian value, where both values are the same number.
### `SabreTools.Text.Compare`
Classes focused on string comparison by natural sorting. For example, "5" would be sorted before "100".
This set of libraries enable special I/O-focused functionality used by other SabreTools projects. See the README files in each project directory for more details.
## Releases

View File

@@ -7,22 +7,98 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreTools.IO", "SabreTools
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreTools.IO.Test", "SabreTools.IO.Test\SabreTools.IO.Test.csproj", "{A9767735-5042-48A1-849C-96035DB1DD53}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreTools.Text", "SabreTools.Text\SabreTools.Text.csproj", "{EC8FD8AD-579F-4B8B-A65E-119E5294ADC1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreTools.Numerics", "SabreTools.Numerics\SabreTools.Numerics.csproj", "{565EAC34-B533-4C5C-9B81-77AE4B33A027}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreTools.Numerics.Test", "SabreTools.Numerics.Test\SabreTools.Numerics.Test.csproj", "{35F068EF-A652-4435-8890-1E6239EEBEFB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreTools.Text.Test", "SabreTools.Text.Test\SabreTools.Text.Test.csproj", "{71513020-B588-4A66-8122-E1639A39B8A8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{87CE4411-80D9-49FF-894C-761F1C20D9A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87CE4411-80D9-49FF-894C-761F1C20D9A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87CE4411-80D9-49FF-894C-761F1C20D9A5}.Debug|x64.ActiveCfg = Debug|Any CPU
{87CE4411-80D9-49FF-894C-761F1C20D9A5}.Debug|x64.Build.0 = Debug|Any CPU
{87CE4411-80D9-49FF-894C-761F1C20D9A5}.Debug|x86.ActiveCfg = Debug|Any CPU
{87CE4411-80D9-49FF-894C-761F1C20D9A5}.Debug|x86.Build.0 = Debug|Any CPU
{87CE4411-80D9-49FF-894C-761F1C20D9A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87CE4411-80D9-49FF-894C-761F1C20D9A5}.Release|Any CPU.Build.0 = Release|Any CPU
{87CE4411-80D9-49FF-894C-761F1C20D9A5}.Release|x64.ActiveCfg = Release|Any CPU
{87CE4411-80D9-49FF-894C-761F1C20D9A5}.Release|x64.Build.0 = Release|Any CPU
{87CE4411-80D9-49FF-894C-761F1C20D9A5}.Release|x86.ActiveCfg = Release|Any CPU
{87CE4411-80D9-49FF-894C-761F1C20D9A5}.Release|x86.Build.0 = Release|Any CPU
{A9767735-5042-48A1-849C-96035DB1DD53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A9767735-5042-48A1-849C-96035DB1DD53}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9767735-5042-48A1-849C-96035DB1DD53}.Debug|x64.ActiveCfg = Debug|Any CPU
{A9767735-5042-48A1-849C-96035DB1DD53}.Debug|x64.Build.0 = Debug|Any CPU
{A9767735-5042-48A1-849C-96035DB1DD53}.Debug|x86.ActiveCfg = Debug|Any CPU
{A9767735-5042-48A1-849C-96035DB1DD53}.Debug|x86.Build.0 = Debug|Any CPU
{A9767735-5042-48A1-849C-96035DB1DD53}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A9767735-5042-48A1-849C-96035DB1DD53}.Release|Any CPU.Build.0 = Release|Any CPU
{A9767735-5042-48A1-849C-96035DB1DD53}.Release|x64.ActiveCfg = Release|Any CPU
{A9767735-5042-48A1-849C-96035DB1DD53}.Release|x64.Build.0 = Release|Any CPU
{A9767735-5042-48A1-849C-96035DB1DD53}.Release|x86.ActiveCfg = Release|Any CPU
{A9767735-5042-48A1-849C-96035DB1DD53}.Release|x86.Build.0 = Release|Any CPU
{EC8FD8AD-579F-4B8B-A65E-119E5294ADC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EC8FD8AD-579F-4B8B-A65E-119E5294ADC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EC8FD8AD-579F-4B8B-A65E-119E5294ADC1}.Debug|x64.ActiveCfg = Debug|Any CPU
{EC8FD8AD-579F-4B8B-A65E-119E5294ADC1}.Debug|x64.Build.0 = Debug|Any CPU
{EC8FD8AD-579F-4B8B-A65E-119E5294ADC1}.Debug|x86.ActiveCfg = Debug|Any CPU
{EC8FD8AD-579F-4B8B-A65E-119E5294ADC1}.Debug|x86.Build.0 = Debug|Any CPU
{EC8FD8AD-579F-4B8B-A65E-119E5294ADC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EC8FD8AD-579F-4B8B-A65E-119E5294ADC1}.Release|Any CPU.Build.0 = Release|Any CPU
{EC8FD8AD-579F-4B8B-A65E-119E5294ADC1}.Release|x64.ActiveCfg = Release|Any CPU
{EC8FD8AD-579F-4B8B-A65E-119E5294ADC1}.Release|x64.Build.0 = Release|Any CPU
{EC8FD8AD-579F-4B8B-A65E-119E5294ADC1}.Release|x86.ActiveCfg = Release|Any CPU
{EC8FD8AD-579F-4B8B-A65E-119E5294ADC1}.Release|x86.Build.0 = Release|Any CPU
{565EAC34-B533-4C5C-9B81-77AE4B33A027}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{565EAC34-B533-4C5C-9B81-77AE4B33A027}.Debug|Any CPU.Build.0 = Debug|Any CPU
{565EAC34-B533-4C5C-9B81-77AE4B33A027}.Debug|x64.ActiveCfg = Debug|Any CPU
{565EAC34-B533-4C5C-9B81-77AE4B33A027}.Debug|x64.Build.0 = Debug|Any CPU
{565EAC34-B533-4C5C-9B81-77AE4B33A027}.Debug|x86.ActiveCfg = Debug|Any CPU
{565EAC34-B533-4C5C-9B81-77AE4B33A027}.Debug|x86.Build.0 = Debug|Any CPU
{565EAC34-B533-4C5C-9B81-77AE4B33A027}.Release|Any CPU.ActiveCfg = Release|Any CPU
{565EAC34-B533-4C5C-9B81-77AE4B33A027}.Release|Any CPU.Build.0 = Release|Any CPU
{565EAC34-B533-4C5C-9B81-77AE4B33A027}.Release|x64.ActiveCfg = Release|Any CPU
{565EAC34-B533-4C5C-9B81-77AE4B33A027}.Release|x64.Build.0 = Release|Any CPU
{565EAC34-B533-4C5C-9B81-77AE4B33A027}.Release|x86.ActiveCfg = Release|Any CPU
{565EAC34-B533-4C5C-9B81-77AE4B33A027}.Release|x86.Build.0 = Release|Any CPU
{35F068EF-A652-4435-8890-1E6239EEBEFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35F068EF-A652-4435-8890-1E6239EEBEFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35F068EF-A652-4435-8890-1E6239EEBEFB}.Debug|x64.ActiveCfg = Debug|Any CPU
{35F068EF-A652-4435-8890-1E6239EEBEFB}.Debug|x64.Build.0 = Debug|Any CPU
{35F068EF-A652-4435-8890-1E6239EEBEFB}.Debug|x86.ActiveCfg = Debug|Any CPU
{35F068EF-A652-4435-8890-1E6239EEBEFB}.Debug|x86.Build.0 = Debug|Any CPU
{35F068EF-A652-4435-8890-1E6239EEBEFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35F068EF-A652-4435-8890-1E6239EEBEFB}.Release|Any CPU.Build.0 = Release|Any CPU
{35F068EF-A652-4435-8890-1E6239EEBEFB}.Release|x64.ActiveCfg = Release|Any CPU
{35F068EF-A652-4435-8890-1E6239EEBEFB}.Release|x64.Build.0 = Release|Any CPU
{35F068EF-A652-4435-8890-1E6239EEBEFB}.Release|x86.ActiveCfg = Release|Any CPU
{35F068EF-A652-4435-8890-1E6239EEBEFB}.Release|x86.Build.0 = Release|Any CPU
{71513020-B588-4A66-8122-E1639A39B8A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{71513020-B588-4A66-8122-E1639A39B8A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71513020-B588-4A66-8122-E1639A39B8A8}.Debug|x64.ActiveCfg = Debug|Any CPU
{71513020-B588-4A66-8122-E1639A39B8A8}.Debug|x64.Build.0 = Debug|Any CPU
{71513020-B588-4A66-8122-E1639A39B8A8}.Debug|x86.ActiveCfg = Debug|Any CPU
{71513020-B588-4A66-8122-E1639A39B8A8}.Debug|x86.Build.0 = Debug|Any CPU
{71513020-B588-4A66-8122-E1639A39B8A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{71513020-B588-4A66-8122-E1639A39B8A8}.Release|Any CPU.Build.0 = Release|Any CPU
{71513020-B588-4A66-8122-E1639A39B8A8}.Release|x64.ActiveCfg = Release|Any CPU
{71513020-B588-4A66-8122-E1639A39B8A8}.Release|x64.Build.0 = Release|Any CPU
{71513020-B588-4A66-8122-E1639A39B8A8}.Release|x86.ActiveCfg = Release|Any CPU
{71513020-B588-4A66-8122-E1639A39B8A8}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

99
SabreTools.IO/README.MD Normal file
View File

@@ -0,0 +1,99 @@
# SabreTools.IO
This library comprises of I/O functionality used by other SabreTools projects.
Find the link to the Nuget package [here](https://www.nuget.org/packages/SabreTools.IO).
## Namespaces
Below are a list of the included namespaces and their overall utility.
### `SabreTools.IO`
Generic helper classes that involve custom functionality and utility.
### `SabreTools.IO.Compression`
Various compression implementations that are used across multiple projects. Most of the implementations are be ports of existing C and C++ code.
#### Supported Compressions
| Compression Name | Decompress | Compress | Notes |
| --- | --- | --- | --- |
| Blast | Yes | No | |
| BZip2 | Yes | Yes | Sourced from DotNetZip |
| Deflate | Yes | Yes | Sourced from DotNetZip |
| LZ | Yes | No | KWAJ, QBasic 4.5, and SZDD variants; KWAJ incomplete |
| LZX | No | No | |
| MSZIP | Yes | No | |
| Quantum | Yes* | No | Partial implementation based on standalone archives; not working |
**Note:** If something is marked with a `*` it means that it need testing.
#### External Libraries
| Library Name | Use |
| --- | ---|
| [DotNetZip](https://github.com/DinoChiesa/DotNetZip) | BZip2 and DEFLATE implementations; minor edits have been made |
| [ZLibPort](https://github.com/Nanook/zlib-C-To-CSharp-Port) | Adds zlib code for internal and external use; minor edits have been made |
### `SabreTools.IO.Encryption`
Various encryption implementations that are used across multiple projects. Most of the implementations are be ports of existing C and C++ code.
#### Supported Encryption Schemes
| Encryption Scheme | Encrypt | Decrypt | Notes |
| --- | --- | --- | --- |
| AES/CTR | Yes | Yes | Subset of functionality exposed from [The Bouncy Castle Cryptography Library For .NET](https://github.com/bcgit/bc-csharp) |
| MoPaQ | No | Yes | Used to encrypt and decrypt MoPaQ tables for processing |
### `SabreTools.IO.Extensions`
Extensions for `BinaryReader`, `byte[]`, and `Stream` to help with reading and writing various data types. Some data types are locked behind .NET version support.
This namespace also contains other various extensions that help with common functionality and safe access.
### `SabreTools.IO.Interfaces`
Common interfaces used mainly internal to the library.
| Interface | Notes |
| --- | --- |
| `IMatch<T>` | Represents a matcher for a generic type |
| `IMatchSet<T, U>` | Represents a set of `IMatch<T>` types |
### `SabreTools.IO.Logging`
Logic for a logging system, including writing to console and textfile outputs. There are 4 possible log levels for logging statements to be invoked with. There is also a stopwatch implementation included for logging statements with automatic timespan tracking.
### `SabreTools.IO.Matching`
Classes designed to make matching contents and paths easier. These classes allow for both grouped and single matching as well as post-processing of matched information.
### `SabreTools.IO.Readers` and `SabreTools.IO.Writers`
Reading and writing support for the following file types:
- ClrMamePro-derived Metadata files
- Standard and non-standard INI files
- Separated-Value files (e.g. CSV, SSV, TSV)
For a generic INI implementation, see `SabreTools.IO.IniFile`.
### `SabreTools.IO.Streams`
Custom `Stream` implementations that are required for specialized use:
- `BufferedStream`: A format that is not a true stream implementation used for buffered, single-byte reads
- `ReadOnlyBitStream`: A readonly stream implementation allowing bitwise reading
- `ReadOnlyCompositeStream`: A readonly stream implementation that wraps multiple source streams in a set order
- `ViewStream`: A readonly stream implementation representing a view into source data
### `SabreTools.IO.Transform`
File and stream implementations of common data transformations:
- Combine using either ordered concatenation or interleaving
- Split by even/odd chunks or based on block size
- Convert data either by bit-swapping, byte-swapping, word-swapping, or word/byte-swapping

View File

@@ -33,6 +33,11 @@
<InternalsVisibleTo Include="SabreTools.IO.Test" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SabreTools.Numerics\SabreTools.Numerics.csproj" />
<ProjectReference Include="..\SabreTools.Text\SabreTools.Text.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BouncyCastle.NetCore" Version="1.9.0" Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`)) OR $(TargetFramework.StartsWith(`net40`))" />
<PackageReference Include="BouncyCastle.NetCore" Version="2.2.1" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`))" />

View File

@@ -1,8 +1,7 @@
using System;
using SabreTools.Numerics;
using Xunit;
namespace SabreTools.IO.Test.Numerics
namespace SabreTools.Numerics.Test
{
public class BothInt16Tests
{

View File

@@ -1,8 +1,7 @@
using System;
using SabreTools.Numerics;
using Xunit;
namespace SabreTools.IO.Test.Numerics
namespace SabreTools.Numerics.Test
{
public class BothInt32Tests
{

View File

@@ -1,8 +1,7 @@
using System;
using SabreTools.Numerics;
using Xunit;
namespace SabreTools.IO.Test.Numerics
namespace SabreTools.Numerics.Test
{
public class BothInt64Tests
{

View File

@@ -1,8 +1,7 @@
using System;
using SabreTools.Numerics;
using Xunit;
namespace SabreTools.IO.Test.Numerics
namespace SabreTools.Numerics.Test
{
public class BothInt8Tests
{

View File

@@ -1,8 +1,7 @@
using System;
using SabreTools.Numerics;
using Xunit;
namespace SabreTools.IO.Test.Numerics
namespace SabreTools.Numerics.Test
{
public class BothUInt16Tests
{

View File

@@ -1,8 +1,7 @@
using System;
using SabreTools.Numerics;
using Xunit;
namespace SabreTools.IO.Test.Numerics
namespace SabreTools.Numerics.Test
{
public class BothUInt32Tests
{

View File

@@ -1,8 +1,7 @@
using System;
using SabreTools.Numerics;
using Xunit;
namespace SabreTools.IO.Test.Numerics
namespace SabreTools.Numerics.Test
{
public class BothUInt64Tests
{

View File

@@ -1,8 +1,7 @@
using System;
using SabreTools.Numerics;
using Xunit;
namespace SabreTools.IO.Test.Numerics
namespace SabreTools.Numerics.Test
{
public class BothUInt8Tests
{

View File

@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>CS0618</WarningsNotAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SabreTools.Numerics\SabreTools.Numerics.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,20 @@
# SabreTools.Numerics
This library comprises of custom numeric types used by other SabreTools projects.
Find the link to the Nuget package [here](https://www.nuget.org/packages/SabreTools.Numerics).
## Supported Numeric Types
| Type Name | Description |
| --- | --- |
| `BothInt8` | Both-endian `Int8` value |
| `BothUInt8` | Both-endian `UInt8` value |
| `BothInt16` | Both-endian `Int16` value |
| `BothUInt16` | Both-endian `UInt16` value |
| `BothInt32` | Both-endian `Int32` value |
| `BothUInt32` | Both-endian `UInt32` value |
| `BothInt64` | Both-endian `Int64` value |
| `BothUInt64` | Both-endian `UInt64` value |
**Both-endian** or **bi-endian** numbers are represented by a little-endian value followed by a big-endian value, where both values are the same number.

View File

@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- Assembly Properties -->
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IncludeSymbols>true</IncludeSymbols>
<LangVersion>latest</LangVersion>
<NoWarn>CS0618</NoWarn>
<Nullable>enable</Nullable>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>1.9.0</Version>
<!-- Package Properties -->
<Authors>Matt Nadareski</Authors>
<Description>Common numeric types by other SabreTools projects</Description>
<Copyright>Copyright (c) Matt Nadareski 2019-2025</Copyright>
<PackageProjectUrl>https://github.com/SabreTools/</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/SabreTools/SabreTools.IO</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>both-endian numeric type signed unsigned</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="SabreTools.Numerics.Test" />
</ItemGroup>
</Project>

View File

@@ -3,7 +3,7 @@ using System.Linq;
using SabreTools.Text.Compare;
using Xunit;
namespace SabreTools.IO.Test.Compare
namespace SabreTools.Text.Test.Compare
{
public class NaturalComparerTests
{

View File

@@ -1,7 +1,7 @@
using SabreTools.Text.Compare;
using Xunit;
namespace SabreTools.IO.Test.Compare
namespace SabreTools.Text.Test.Compare
{
public class NaturalComparerUtilTests
{

View File

@@ -3,7 +3,7 @@ using System.Linq;
using SabreTools.Text.Compare;
using Xunit;
namespace SabreTools.IO.Test.Compare
namespace SabreTools.Text.Test.Compare
{
public class NaturalReversedComparerTests
{

View File

@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>CS0618</WarningsNotAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SabreTools.Text\SabreTools.Text.csproj" />
</ItemGroup>
</Project>

14
SabreTools.Text/README.MD Normal file
View File

@@ -0,0 +1,14 @@
# SabreTools.Text
This library comprises of text functionality used by other SabreTools projects.
Find the link to the Nuget package [here](https://www.nuget.org/packages/SabreTools.Text).
## `SabreTools.Text.Compare`
Classes focused on string comparison by natural sorting. For example, "5" would be sorted before "100".
| Class | Description |
| --- | --- |
| `NaturalComparer` | Orders string inputs from lowest to highest value, if applicable |
| `NaturalReversedComparer` | Orders string inputs from highest to lowest value, if applicable |

View File

@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- Assembly Properties -->
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IncludeSymbols>true</IncludeSymbols>
<LangVersion>latest</LangVersion>
<NoWarn>CS0618</NoWarn>
<Nullable>enable</Nullable>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>1.9.0</Version>
<!-- Package Properties -->
<Authors>Matt Nadareski</Authors>
<Description>Common text utilities by other SabreTools projects</Description>
<Copyright>Copyright (c) Matt Nadareski 2019-2025</Copyright>
<PackageProjectUrl>https://github.com/SabreTools/</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/SabreTools/SabreTools.IO</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>text-comparison comparison text </PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="SabreTools.Text.Test" />
</ItemGroup>
</Project>