Skip to content

Commit fb6b252

Browse files
authored
Merge pull request #2 from psuong/develop
v2.0.0
2 parents e5d1fab + de41fa6 commit fb6b252

19 files changed

Lines changed: 848 additions & 220 deletions

.editorconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,10 @@ csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental
168168
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
169169
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
170170
csharp_style_prefer_not_pattern = true:suggestion
171+
172+
########################
173+
# Diagnostics Severity #
174+
########################
175+
dotnet_diagnostic.IDE0058.severity = none # Disable unused variables
176+
dotnet_diagnostic.IDE0130.severity = none # Disable namespace not matching folder structure
177+
dotnet_diagnostic.IDE0160.severity = none # Disable scoped namespace suggestions

.github/workflows/main.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010

1111
jobs:
1212
build:
13+
if: github.ref == 'refs/heads/main'
1314
runs-on: windows-latest
1415
steps:
1516
- name: Checkout repository
@@ -18,7 +19,7 @@ jobs:
1819
- name: Set up .NET SDK
1920
uses: actions/setup-dotnet@v2
2021
with:
21-
dotnet-version: '8.0.x'
22+
dotnet-version: '10.0.x'
2223

2324
- name: Restore dependencies
2425
run: dotnet restore
@@ -42,4 +43,4 @@ jobs:
4243
uses: actions/upload-artifact@v4
4344
with:
4445
name: windows-aot-build
45-
path: ./bin/Release/net8.0/win-x64/publish/
46+
path: ./bin/Release/net10.0/win-x64/publish/

.gitignore

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
###############
2+
# Directories #
3+
###############
14
/bin
25
/obj
6+
/.vs
7+
/.vscode
8+
/packages
39

4-
config.toml
10+
#########
11+
# Files #
12+
#########
13+
*.log*
14+
*.toml
515
*.zip
616
*.binlog
7-
dnSpy/
8-
lua/
9-
omnisharp/
10-
slang/
11-
tracy/

Config.cs

Lines changed: 0 additions & 83 deletions
This file was deleted.

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 Porrith Suong
3+
Copyright (c) 2026 psuong
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Program.cs

Lines changed: 0 additions & 122 deletions
This file was deleted.

binget.csproj

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,63 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
<ImplicitUsings>false</ImplicitUsings>
7+
<Nullable>disable</Nullable>
8+
<RootNamespace>BinGet</RootNamespace>
9+
<InformationalVersion>2.0.0.0</InformationalVersion>
10+
<FileVersion>2.0.0</FileVersion>
11+
<Company>psuong</Company>
12+
<Copyright>MIT Licensed</Copyright>
13+
</PropertyGroup>
14+
15+
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
16+
<!-- Native AOT -->
717
<PublishAot>true</PublishAot>
818
<PublishTrimmed>true</PublishTrimmed>
919
<TrimMode>full</TrimMode>
10-
<Nullable>disable</Nullable>
20+
21+
<!-- Size optimizations -->
22+
<InvariantGlobalization>true</InvariantGlobalization>
23+
<DebuggerSupport>false</DebuggerSupport>
24+
<EventSourceSupport>false</EventSourceSupport>
25+
<UseSystemResourceKeys>true</UseSystemResourceKeys>
26+
27+
<!-- Remove stack trace data -->
28+
<StackTraceSupport>false</StackTraceSupport>
29+
<IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>
30+
31+
<!-- Optimize for size -->
32+
<OptimizationPreference>Size</OptimizationPreference>
33+
34+
<!-- Strip symbols/debug info -->
35+
<DebugType>None</DebugType>
36+
<DebugSymbols>false</DebugSymbols>
37+
<StripSymbols>true</StripSymbols>
38+
39+
<!-- AOT/trimming analysis -->
40+
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
41+
<EnableAotAnalyzer>true</EnableAotAnalyzer>
1142
</PropertyGroup>
1243

1344
<ItemGroup>
14-
<PackageReference Include="Tomlyn" Version="0.18.0" />
45+
<EmbeddedResource Include="templates\manifest.scriban" />
1546
</ItemGroup>
1647

17-
<PropertyGroup>
18-
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
48+
<ItemGroup>
49+
<PackageReference Include="ConsoleAppFramework" Version="5.7.13">
50+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
51+
<PrivateAssets>all</PrivateAssets>
52+
</PackageReference>
53+
<PackageReference Include="Scriban" Version="7.2.5" />
54+
<PackageReference Include="Spectre.Console" Version="0.57.2" />
55+
<PackageReference Include="Tomlyn" Version="2.10.1" />
56+
<PackageReference Include="Utf8StreamReader" Version="1.3.2" />
57+
<PackageReference Include="ZLogger" Version="2.5.10" />
58+
</ItemGroup>
59+
60+
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
61+
<NoWarn>$(NoWarn);IL2026;IL3053;IL2104</NoWarn>
1962
</PropertyGroup>
20-
</Project>
63+
64+
</Project>

src/Data/ArrayPoolScope.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Buffers;
3+
4+
namespace BinGet.Data;
5+
6+
/// <summary>
7+
/// Wraps ArrayPool{T} in an easy to use <see cref="IDisposable"/> scope.
8+
/// </summary>
9+
/// <typeparam name="T">Any type that needs to be pooled.</typeparam>
10+
/// <remarks>
11+
/// Primary constructor to request an <see cref="Array"/> of <typeparamref name="T"/>.
12+
/// </remarks>
13+
/// <param name="size">The total number of elements in the <see cref="Array"/>.</param>
14+
public readonly struct ArrayPoolScope<T>(int size) : IDisposable {
15+
private readonly T[] buffer = ArrayPool<T>.Shared.Rent(size);
16+
17+
/// <summary>
18+
/// Returns the array as a continuous block of memory.
19+
/// </summary>
20+
/// <returns><see cref="Memory{T}"/></returns>
21+
public readonly Memory<T> AsMemory() {
22+
return buffer.AsMemory();
23+
}
24+
25+
/// <summary>
26+
/// Returns the <see cref="Array"/> back to the <see cref="ArrayPool{T}"/>.
27+
/// </summary>
28+
public void Dispose() {
29+
ArrayPool<T>.Shared.Return(buffer);
30+
}
31+
}

0 commit comments

Comments
 (0)