Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,10 @@ csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion

########################
# Diagnostics Severity #
########################
dotnet_diagnostic.IDE0058.severity = none # Disable unused variables
dotnet_diagnostic.IDE0130.severity = none # Disable namespace not matching folder structure
dotnet_diagnostic.IDE0160.severity = none # Disable scoped namespace suggestions
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

jobs:
build:
if: github.ref == 'refs/heads/main'
runs-on: windows-latest
steps:
- name: Checkout repository
Expand All @@ -18,7 +19,7 @@ jobs:
- name: Set up .NET SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: '8.0.x'
dotnet-version: '10.0.x'

- name: Restore dependencies
run: dotnet restore
Expand All @@ -42,4 +43,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: windows-aot-build
path: ./bin/Release/net8.0/win-x64/publish/
path: ./bin/Release/net10.0/win-x64/publish/
17 changes: 11 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
###############
# Directories #
###############
/bin
/obj
/.vs
/.vscode
/packages

config.toml
#########
# Files #
#########
*.log*
*.toml
*.zip
*.binlog
dnSpy/
lua/
omnisharp/
slang/
tracy/
83 changes: 0 additions & 83 deletions Config.cs

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2025 Porrith Suong
Copyright (c) 2026 psuong

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
122 changes: 0 additions & 122 deletions Program.cs

This file was deleted.

56 changes: 50 additions & 6 deletions binget.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,63 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>false</ImplicitUsings>
<Nullable>disable</Nullable>
<RootNamespace>BinGet</RootNamespace>
<InformationalVersion>2.0.0.0</InformationalVersion>
<FileVersion>2.0.0</FileVersion>
<Company>psuong</Company>
<Copyright>MIT Licensed</Copyright>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<!-- Native AOT -->
<PublishAot>true</PublishAot>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>full</TrimMode>
<Nullable>disable</Nullable>

<!-- Size optimizations -->
<InvariantGlobalization>true</InvariantGlobalization>
<DebuggerSupport>false</DebuggerSupport>
<EventSourceSupport>false</EventSourceSupport>
<UseSystemResourceKeys>true</UseSystemResourceKeys>

<!-- Remove stack trace data -->
<StackTraceSupport>false</StackTraceSupport>
<IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>

<!-- Optimize for size -->
<OptimizationPreference>Size</OptimizationPreference>

<!-- Strip symbols/debug info -->
<DebugType>None</DebugType>
<DebugSymbols>false</DebugSymbols>
<StripSymbols>true</StripSymbols>

<!-- AOT/trimming analysis -->
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<EnableAotAnalyzer>true</EnableAotAnalyzer>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Tomlyn" Version="0.18.0" />
<EmbeddedResource Include="templates\manifest.scriban" />
</ItemGroup>

<PropertyGroup>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<ItemGroup>
<PackageReference Include="ConsoleAppFramework" Version="5.7.13">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Scriban" Version="7.2.5" />
<PackageReference Include="Spectre.Console" Version="0.57.2" />
<PackageReference Include="Tomlyn" Version="2.10.1" />
<PackageReference Include="Utf8StreamReader" Version="1.3.2" />
<PackageReference Include="ZLogger" Version="2.5.10" />
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<NoWarn>$(NoWarn);IL2026;IL3053;IL2104</NoWarn>
</PropertyGroup>
</Project>

</Project>
31 changes: 31 additions & 0 deletions src/Data/ArrayPoolScope.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Buffers;

namespace BinGet.Data;

/// <summary>
/// Wraps ArrayPool{T} in an easy to use <see cref="IDisposable"/> scope.
/// </summary>
/// <typeparam name="T">Any type that needs to be pooled.</typeparam>
/// <remarks>
/// Primary constructor to request an <see cref="Array"/> of <typeparamref name="T"/>.
/// </remarks>
/// <param name="size">The total number of elements in the <see cref="Array"/>.</param>
public readonly struct ArrayPoolScope<T>(int size) : IDisposable {
private readonly T[] buffer = ArrayPool<T>.Shared.Rent(size);

/// <summary>
/// Returns the array as a continuous block of memory.
/// </summary>
/// <returns><see cref="Memory{T}"/></returns>
public readonly Memory<T> AsMemory() {
return buffer.AsMemory();
}

/// <summary>
/// Returns the <see cref="Array"/> back to the <see cref="ArrayPool{T}"/>.
/// </summary>
public void Dispose() {
ArrayPool<T>.Shared.Return(buffer);
}
}
Loading