Initial commit

This commit is contained in:
leefer
2026-08-02 18:08:19 +08:00
commit 89c48131b2
47 changed files with 4743 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
param(
[ValidateSet('Debug', 'Release')]
[string]$Configuration = 'Release',
[switch]$SkipRestore
)
$ErrorActionPreference = 'Stop'
$projectRoot = Split-Path -Parent $PSScriptRoot
$dotnetExe = Join-Path $projectRoot '.tools\dotnet\dotnet.exe'
$nugetConfig = Join-Path $projectRoot 'NuGet.Config'
$outputRoot = Join-Path $projectRoot 'artifacts\WindowsToolbox'
if (-not (Test-Path -LiteralPath $dotnetExe)) {
throw 'Local .NET SDK was not found under .tools\dotnet.'
}
$env:DOTNET_CLI_HOME = Join-Path $projectRoot '.tools\dotnet-home'
$env:NUGET_PACKAGES = Join-Path $projectRoot '.tools\nuget'
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = '1'
$env:DOTNET_CLI_TELEMETRY_OPTOUT = '1'
New-Item -ItemType Directory -Force -Path $outputRoot | Out-Null
if (-not $SkipRestore) {
& $dotnetExe restore (Join-Path $projectRoot 'WindowsToolbox.sln') --configfile $nugetConfig
if ($LASTEXITCODE -ne 0) { throw 'Restore failed.' }
}
$commonArguments = @(
'--configuration', $Configuration,
'--framework', 'net8.0-windows',
'--self-contained', 'false',
'--no-restore',
'--output', $outputRoot,
'-p:DebugType=None',
'-p:DebugSymbols=false'
)
& $dotnetExe publish (Join-Path $projectRoot 'src\WindowsToolbox.ElevatedHost\WindowsToolbox.ElevatedHost.csproj') @commonArguments
if ($LASTEXITCODE -ne 0) { throw 'Elevated host publish failed.' }
& $dotnetExe publish (Join-Path $projectRoot 'src\WindowsToolbox.Cli\WindowsToolbox.Cli.csproj') @commonArguments
if ($LASTEXITCODE -ne 0) { throw 'CLI publish failed.' }
& $dotnetExe publish (Join-Path $projectRoot 'src\WindowsToolbox.App\WindowsToolbox.App.csproj') @commonArguments
if ($LASTEXITCODE -ne 0) { throw 'WPF app publish failed.' }
Copy-Item -LiteralPath (Join-Path $projectRoot 'README.md') -Destination (Join-Path $outputRoot 'README.md') -Force
Write-Host "Published to: $outputRoot" -ForegroundColor Green
Write-Host 'Run WindowsToolbox.App.exe to start.' -ForegroundColor Green
+62
View File
@@ -0,0 +1,62 @@
from pathlib import Path
from PIL import Image, ImageDraw
ROOT = Path(__file__).resolve().parents[1]
ASSETS = ROOT / "assets"
SCALE = 4
SIZE = 256
CANVAS = SIZE * SCALE
def scaled_points(points):
return [(x * SCALE, y * SCALE) for x, y in points]
mask = Image.new("L", (CANVAS, CANVAS), 0)
mask_draw = ImageDraw.Draw(mask)
mask_draw.rounded_rectangle(
(8 * SCALE, 8 * SCALE, 248 * SCALE, 248 * SCALE),
radius=54 * SCALE,
fill=255,
)
background = Image.new("RGBA", (CANVAS, CANVAS), (0, 0, 0, 0))
pixels = background.load()
for y in range(CANVAS):
ratio = y / max(1, CANVAS - 1)
red = round(59 + (29 - 59) * ratio)
green = round(130 + (78 - 130) * ratio)
blue = round(246 + (216 - 246) * ratio)
for x in range(CANVAS):
pixels[x, y] = (red, green, blue, mask.getpixel((x, y)))
draw = ImageDraw.Draw(background, "RGBA")
highlight = Image.new("RGBA", (CANVAS, CANVAS), (0, 0, 0, 0))
highlight_draw = ImageDraw.Draw(highlight, "RGBA")
highlight_draw.ellipse(
(-60 * SCALE, -110 * SCALE, 250 * SCALE, 150 * SCALE),
fill=(255, 255, 255, 22),
)
background.alpha_composite(highlight)
w_shape = [
(44, 66), (78, 66), (105, 157), (128, 98),
(129, 98), (152, 157), (179, 66), (212, 66),
(174, 192), (139, 192), (128, 161), (116, 192),
(82, 192),
]
shadow_shape = [(x, y + 4) for x, y in w_shape]
draw.polygon(scaled_points(shadow_shape), fill=(10, 35, 90, 45))
draw.polygon(scaled_points(w_shape), fill=(255, 255, 255, 255))
icon = background.resize((SIZE, SIZE), Image.Resampling.LANCZOS)
ASSETS.mkdir(parents=True, exist_ok=True)
icon.save(ASSETS / "WindowsToolbox.png", "PNG", optimize=True)
icon.save(
ASSETS / "WindowsToolbox.ico",
"ICO",
sizes=[(16, 16), (20, 20), (24, 24), (32, 32), (40, 40), (48, 48), (64, 64), (128, 128), (256, 256)],
)
print(ASSETS / "WindowsToolbox.ico")