Skip to content

Commit 6c044b3

Browse files
committed
Updated deps and to .net9.0
1 parent cfc6fd1 commit 6c044b3

File tree

10 files changed

+326
-38
lines changed

10 files changed

+326
-38
lines changed

Hexa.NET.Unsafe.Analyzers.Tests/Hexa.NET.Unsafe.Analyzers.Tests.csproj

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

@@ -11,15 +11,23 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="coverlet.collector" Version="6.0.0" />
15-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0" />
16-
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.10.0" />
17-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
14+
<PackageReference Include="coverlet.collector" Version="6.0.2">
15+
<PrivateAssets>all</PrivateAssets>
16+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
17+
</PackageReference>
18+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0" />
19+
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.11.0" />
20+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
1821
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.NUnit" Version="1.1.2" />
19-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
20-
<PackageReference Include="NUnit" Version="3.14.0" />
21-
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
22-
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
22+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
23+
<PackageReference Include="NUnit" Version="4.2.2" />
24+
<PackageReference Include="NUnit.Analyzers" Version="4.3.0">
25+
<PrivateAssets>all</PrivateAssets>
26+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
27+
</PackageReference>
28+
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
29+
<PackageReference Include="System.Formats.Asn1" Version="9.0.0" />
30+
<PackageReference Include="System.Text.Json" Version="9.0.0" />
2331
</ItemGroup>
2432

2533
<ItemGroup>

Hexa.NET.Unsafe.Analyzers/Hexa.NET.Unsafe.Analyzers.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
</PropertyGroup>
3434

3535
<ItemGroup>
36-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" PrivateAssets="all" />
37-
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
38-
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.10.0" />
36+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" PrivateAssets="all" />
37+
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" PrivateAssets="all" />
38+
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.11.0" />
3939
</ItemGroup>
4040

4141

Hexa.NET.Utilities.Tests/Hexa.NET.Utilities.Tests.csproj

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

@@ -12,11 +12,17 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="coverlet.collector" Version="6.0.0" />
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
17-
<PackageReference Include="NUnit" Version="3.14.0" />
18-
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
19-
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
15+
<PackageReference Include="coverlet.collector" Version="6.0.2">
16+
<PrivateAssets>all</PrivateAssets>
17+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18+
</PackageReference>
19+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
20+
<PackageReference Include="NUnit" Version="4.2.2" />
21+
<PackageReference Include="NUnit.Analyzers" Version="4.3.0">
22+
<PrivateAssets>all</PrivateAssets>
23+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
24+
</PackageReference>
25+
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
2026
</ItemGroup>
2127

2228
<ItemGroup>

Hexa.NET.Utilities/Hexa.NET.Utilities.csproj

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net8.0;netstandard2.1</TargetFrameworks>
4+
<TargetFrameworks>net9.0;net8.0;net6.0;netstandard2.1</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
88
<LangVersion>12</LangVersion>
9-
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
9+
1010
</PropertyGroup>
1111

1212
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
@@ -19,7 +19,7 @@
1919
<PropertyGroup>
2020
<PackageId>Hexa.NET.Utilities</PackageId>
2121
<AssemblyVersion>1.0.0</AssemblyVersion>
22-
<PackageVersion>2.1.6</PackageVersion>
22+
<PackageVersion>2.1.11</PackageVersion>
2323
<Authors>Juna</Authors>
2424
<AssemblyName>Hexa.NET.Utilities</AssemblyName>
2525
<PackageProjectUrl>https://github.com/HexaEngine/Hexa.NET.Utilities</PackageProjectUrl>
@@ -29,6 +29,11 @@
2929
<PackageTags>HexaEngine Hexa HexaGen C# .NET DotNet Sharp Windows macOS Native</PackageTags>
3030
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
3131
<PackageReadmeFile>README.md</PackageReadmeFile>
32+
33+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
34+
<NoWarn>$(NoWarn);1591</NoWarn>
35+
36+
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
3237
</PropertyGroup>
3338

3439
<ItemGroup>
@@ -37,7 +42,7 @@
3742
</ItemGroup>
3843

3944
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
40-
<PackageReference Include="System.Memory" Version="4.5.5" />
45+
<PackageReference Include="System.Memory" Version="4.6.0" />
4146
</ItemGroup>
4247

4348

Hexa.NET.Utilities/StdString.cs

Lines changed: 83 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ public StdString()
173173
/// </summary>
174174
public StdString(int capacity)
175175
{
176-
data = AllocT<byte>(capacity);
177-
this.capacity = capacity;
178-
ZeroMemoryT(data, capacity);
176+
data = AllocT<byte>(capacity + 1);
177+
this.capacity = capacity + 1;
178+
ZeroMemoryT(data, capacity + 1);
179179
}
180180

181181
/// <summary>
@@ -191,6 +191,16 @@ public StdString(string s)
191191
Encoding.UTF8.GetBytes(s, new Span<byte>(data, byteCount));
192192
}
193193

194+
/// <summary>
195+
/// Initializes a new instance of the <see cref="StdString"/> struct.
196+
/// </summary>
197+
public StdString(byte* data, int size, int capacity)
198+
{
199+
this.data = data;
200+
this.size = size;
201+
this.capacity = capacity;
202+
}
203+
194204
/// <summary>
195205
/// Gets a pointer to the internal data.
196206
/// </summary>
@@ -376,17 +386,26 @@ public void Append(byte c)
376386
size++;
377387
}
378388

389+
/// <summary>
390+
/// Appends a UTF8 string to the end of the current <see cref="StdString"/>.
391+
/// </summary>
392+
/// <param name="c">The pointer to append.</param>
393+
/// <param name="length">The length of the pointer</param>
394+
public void Append(byte* c, int length)
395+
{
396+
EnsureCapacity(size + length);
397+
MemcpyT(c, data + size, length);
398+
size += length;
399+
}
400+
379401
/// <summary>
380402
/// Appends a byte to the end of the current <see cref="StdString"/>.
381403
/// </summary>
382404
/// <param name="c">The byte to append.</param>
383405
public void Append(byte* c)
384406
{
385-
while (*c != (byte)'\0')
386-
{
387-
Append(*c);
388-
c++;
389-
}
407+
int len = StrLen(c);
408+
Append(c, len);
390409
}
391410

392411
/// <summary>
@@ -400,6 +419,62 @@ public void Append(StdString c)
400419
size += c.size;
401420
}
402421

422+
/// <summary>
423+
/// Appends the contents of a byte Span to the end of the current <see cref="StdString"/>.
424+
/// </summary>
425+
/// <param name="c">The pointer to append.</param>
426+
public void Append(ReadOnlySpan<byte> c)
427+
{
428+
fixed (byte* pc = c)
429+
{
430+
Append(pc, c.Length);
431+
}
432+
}
433+
434+
/// <summary>
435+
/// Appends the contents of a UTF16 string to the end of the current <see cref="StdString"/>.
436+
/// </summary>
437+
/// <param name="c">The pointer to append.</param>
438+
/// <param name="length">The length of the pointer</param>
439+
public void Append(char* c, int length)
440+
{
441+
int charCount = Encoding.UTF8.GetByteCount(c, length);
442+
EnsureCapacity(size + charCount);
443+
Encoding.UTF8.GetBytes(c, length, data + size, charCount);
444+
size += charCount;
445+
}
446+
447+
/// <summary>
448+
/// Appends the contents of a UTF16 null-terminated string to the end of the current <see cref="StdString"/>.
449+
/// </summary>
450+
/// <param name="c">The pointer to append.</param>
451+
public void Append(char* c)
452+
{
453+
int length = StrLen(c);
454+
Append(c, length);
455+
}
456+
457+
/// <summary>
458+
/// Appends the contents of another <see cref="StdWString"/> to the end of the current <see cref="StdString"/>.
459+
/// </summary>
460+
/// <param name="c">The <see cref="StdWString"/> to append.</param>
461+
public void Append(StdWString c)
462+
{
463+
Append(c.Data, c.Size);
464+
}
465+
466+
/// <summary>
467+
/// Appends the contents of a char Span to the end of the current <see cref="StdString"/>.
468+
/// </summary>
469+
/// <param name="c">The Span to append.</param>
470+
public void Append(ReadOnlySpan<char> c)
471+
{
472+
fixed (char* pc = c)
473+
{
474+
Append(pc, c.Length);
475+
}
476+
}
477+
403478
/// <summary>
404479
/// Clears the contents of the current <see cref="StdString"/>.
405480
/// </summary>

0 commit comments

Comments
 (0)