Skip to content

Commit e59750b

Browse files
committed
chore: script updates
1 parent f1b61ae commit e59750b

4 files changed

Lines changed: 197 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,5 @@ PublishScripts/
6666
# Local settings
6767
appsettings.*.json
6868
!appsettings.Development.json
69+
70+
CLAUDE.local.md

CLAUDE.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Critical Rules
6+
7+
**These rules override all other instructions:**
8+
9+
1. **NEVER commit directly to main** - Always create a feature branch and submit a pull request
10+
2. **Conventional commits** - Format: `type(scope): description`
11+
3. **GitHub Issues for TODOs** - Use `gh` CLI to manage issues, no local TODO files. Use conventional commit format for issue titles
12+
4. **Pull Request titles** - Use conventional commit format (same as commits)
13+
5. **Branch naming** - Use format: `type/short-description` (e.g., `feat/settings-dialog`)
14+
6. **Working an issue** - Always create a new branch from an updated main branch
15+
7. **Check branch status before pushing** - Verify the remote tracking branch still exists. If a PR was merged/deleted, create a new branch from main instead
16+
8. **WinUI 3 for all UI** - All UI must use WinUI 3/XAML with modern styling (Fluent Design, theme resources, no hardcoded colors except brand purple #68217A)
17+
18+
---
19+
20+
### GitHub CLI Commands
21+
22+
```bash
23+
gh issue list # List open issues
24+
gh issue view <number> # View details
25+
gh issue create --title "type(scope): description" --body "..."
26+
gh issue close <number>
27+
```
28+
29+
### Conventional Commit Types
30+
31+
| Type | Description |
32+
|------|-------------|
33+
| `feat` | New feature |
34+
| `fix` | Bug fix |
35+
| `docs` | Documentation only |
36+
| `refactor` | Code change that neither fixes a bug nor adds a feature |
37+
| `test` | Adding or updating tests |
38+
| `chore` | Maintenance tasks |
39+
| `ci` | CI/CD changes |
40+
41+
---
42+
43+
## Project Overview
44+
45+
VSToolbox is a WinUI 3 desktop application for managing Visual Studio installations. It provides a system tray application to quickly launch VS instances, open developer command prompts, and access installation folders.
46+
47+
## Build Commands
48+
49+
```bash
50+
# Build the project
51+
dotnet build src/CodingWithCalvin.VSToolbox/CodingWithCalvin.VSToolbox.csproj
52+
53+
# Run the application
54+
dotnet run --project src/CodingWithCalvin.VSToolbox/CodingWithCalvin.VSToolbox.csproj
55+
```
56+
57+
## Architecture
58+
59+
### Project Structure
60+
61+
- **CodingWithCalvin.VSToolbox** - Main WinUI 3 application
62+
- **CodingWithCalvin.VSToolbox.Core** - Core library with models and services
63+
64+
### Key Components
65+
66+
- `App.xaml.cs` - Application entry point, window management, single-instance support
67+
- `MainPage.xaml` - Main UI with Installed/Settings tabs
68+
- `MainViewModel.cs` - ViewModel for VS instance discovery and launching
69+
- `TrayIconService.cs` - System tray icon management
70+
- `SettingsService.cs` - User settings persistence (JSON file in %LOCALAPPDATA%)
71+
72+
### Features
73+
74+
- Discovers installed Visual Studio instances via vswhere
75+
- Launch VS instances directly
76+
- Open VS Developer Command Prompt (CMD/PowerShell)
77+
- Open installation folder in Explorer
78+
- System tray integration with show/hide support
79+
- Configurable startup and minimize/close behavior
80+
81+
## Technology Stack
82+
83+
- .NET 10.0 (Preview)
84+
- WinUI 3 / Windows App SDK
85+
- Windows 10.0.19041.0 target
86+
- Unpackaged deployment (WindowsPackageType=None)
87+
88+
## UI Guidelines
89+
90+
- Purple theme color: `#68217A`
91+
- Square window corners (no rounded corners)
92+
- Custom title bar with minimize/close buttons (no maximize)
93+
- System tray integration
94+
95+
## Scripts
96+
97+
Helper scripts in `scripts/` folder:
98+
- `extract_icon.ps1` - Extract icon from VS devenv.exe
99+
- `extract_large_icon.ps1` - Extract large (256x256) icon from VS devenv.exe

scripts/extract_icon.ps1

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Extract icon from Visual Studio devenv.exe
2+
# Usage: .\extract_icon.ps1 [-ExePath <path>] [-OutputPath <path>]
3+
4+
param(
5+
[string]$ExePath = 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.exe',
6+
[string]$OutputPath = "$PSScriptRoot\..\src\CodingWithCalvin.VSToolbox\Assets\vs_icon.png"
7+
)
8+
9+
Add-Type -AssemblyName System.Drawing
10+
11+
if (-not (Test-Path $ExePath)) {
12+
Write-Error "Visual Studio executable not found at: $ExePath"
13+
exit 1
14+
}
15+
16+
$icon = [System.Drawing.Icon]::ExtractAssociatedIcon($ExePath)
17+
$bitmap = $icon.ToBitmap()
18+
19+
# Ensure output directory exists
20+
$outputDir = Split-Path -Parent $OutputPath
21+
if (-not (Test-Path $outputDir)) {
22+
New-Item -ItemType Directory -Path $outputDir -Force | Out-Null
23+
}
24+
25+
$bitmap.Save($OutputPath, [System.Drawing.Imaging.ImageFormat]::Png)
26+
Write-Host "Icon saved to $OutputPath"

scripts/extract_large_icon.ps1

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Extract large icon (256x256) from Visual Studio devenv.exe
2+
# Usage: .\extract_large_icon.ps1 [-ExePath <path>] [-OutputPath <path>] [-Size <int>]
3+
4+
param(
5+
[string]$ExePath = 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.exe',
6+
[string]$OutputPath = "$PSScriptRoot\..\src\CodingWithCalvin.VSToolbox\Assets\vs_icon_256.png",
7+
[int]$Size = 256
8+
)
9+
10+
Add-Type -TypeDefinition @"
11+
using System;
12+
using System.Drawing;
13+
using System.Runtime.InteropServices;
14+
15+
public class IconExtractor
16+
{
17+
[DllImport("user32.dll", CharSet = CharSet.Auto)]
18+
public static extern int PrivateExtractIcons(
19+
string lpszFile,
20+
int nIconIndex,
21+
int cxIcon,
22+
int cyIcon,
23+
IntPtr[] phicon,
24+
int[] piconid,
25+
int nIcons,
26+
int flags);
27+
28+
public static Icon ExtractIcon(string file, int size)
29+
{
30+
IntPtr[] hIcon = new IntPtr[1];
31+
int[] id = new int[1];
32+
int count = PrivateExtractIcons(file, 0, size, size, hIcon, id, 1, 0);
33+
if (count > 0 && hIcon[0] != IntPtr.Zero)
34+
{
35+
return Icon.FromHandle(hIcon[0]);
36+
}
37+
return null;
38+
}
39+
}
40+
"@ -ReferencedAssemblies System.Drawing
41+
42+
if (-not (Test-Path $ExePath)) {
43+
Write-Error "Visual Studio executable not found at: $ExePath"
44+
exit 1
45+
}
46+
47+
# Ensure output directory exists
48+
$outputDir = Split-Path -Parent $OutputPath
49+
if (-not (Test-Path $outputDir)) {
50+
New-Item -ItemType Directory -Path $outputDir -Force | Out-Null
51+
}
52+
53+
# Extract icon at requested size
54+
$icon = [IconExtractor]::ExtractIcon($ExePath, $Size)
55+
if ($icon -ne $null) {
56+
$bitmap = $icon.ToBitmap()
57+
$bitmap.Save($OutputPath, [System.Drawing.Imaging.ImageFormat]::Png)
58+
Write-Host "${Size}x${Size} icon saved to $OutputPath"
59+
} else {
60+
Write-Host "Could not extract ${Size}x${Size} icon, trying 128..."
61+
$icon = [IconExtractor]::ExtractIcon($ExePath, 128)
62+
if ($icon -ne $null) {
63+
$bitmap = $icon.ToBitmap()
64+
$bitmap.Save($OutputPath, [System.Drawing.Imaging.ImageFormat]::Png)
65+
Write-Host "128x128 icon saved to $OutputPath"
66+
} else {
67+
Write-Error "Could not extract icon from $ExePath"
68+
exit 1
69+
}
70+
}

0 commit comments

Comments
 (0)