A Windows desktop application for managing your brick set collection with automatic inventory tracking.
- 📦 Set Management: Add, view, and organize your sets
- 🔍 Automatic Inventory Scraping: Fetches set details, parts, and images
- 🎨 Color Search: Find bricks by color across all your sets
- 📍 Location Tracking: Keep track of where each set is stored (up to 100 characters)
- 🔢 Quantity Management: Track multiple copies of the same set
- 📊 Multiple Views: Gallery view with images or sortable list view
- 🏷️ Version Tracking: Support for old and new inventory versions
- 💾 Local Database: All data stored locally in SQLite
- 🖼️ Image Caching: Set and part images stored locally for fast access
- 🔎 Smart Search: Word-based search across set names, numbers, and part names
- 📈 Statistics: Total sets counter showing unique sets and total quantity
- Windows 10/11 (64-bit)
- No additional dependencies (self-contained)
- Windows 10/11 (64-bit)
- .NET 7.0 SDK - Download
- Visual Studio 2022 (optional, recommended for development)
- Workload: ".NET desktop development"
- Inno Setup 6 (for creating installer) - Download
-
Download
BrickSetManagerSetup.exefromInstaller/Output/BrickSetManagerSetup.exein the repository -
Verify the installer (optional but recommended):
# Calculate SHA256 hash of the downloaded installer powershell -Command "Get-FileHash -Path 'BrickSetManagerSetup.exe' -Algorithm SHA256"
Expected SHA256 Hash:
1D87D3CD3AFC3CAD13BFE60EE0F5DB09393015AD6B4841F7C074B762DBA2CE8BThe hash should match exactly. If it doesn't match, do not run the installer.
-
Run the installer
-
Follow the installation wizard
-
Launch "Brick Set Manager" from the Start Menu
-
Clone the repository
git clone https://github.com/scotjam/BrickSetManager cd BrickSetManager -
Navigate to the main project directory
cd BrickSetManager -
Restore dependencies
dotnet restore
-
Run the application
dotnet run
cd BrickSetManager
dotnet buildThe executable will be in bin\Debug\net7.0-windows\BrickSetManager.exe
cd BrickSetManager
dotnet build -c ReleaseThe executable will be in bin\Release\net7.0-windows\BrickSetManager.exe
- Inno Setup 6 must be installed at
C:\Program Files (x86)\Inno Setup 6\ - The application must be published first
# From the repository root directory
cd BrickSetManager
dotnet publish -c Release -r win-x64 --self-contained true
cd ..\Installer
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" setup.issAlternative (with full paths):
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /O"<path-to-repo>\Installer\Output\" "<path-to-repo>\Installer\setup.iss"The installer will be created at Installer\Output\BrickSetManagerSetup.exe (~49MB)
-
Publish the application (creates self-contained package):
cd BrickSetManager dotnet publish -c Release -r win-x64 --self-contained true
This creates a self-contained release in:
bin\Release\net7.0-windows\win-x64\publish\ -
Compile the installer using Inno Setup:
Option A - Command Line:
cd ..\Installer "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" setup.iss
Option B - GUI:
- Open
Installer\setup.issin Inno Setup Compiler - Click Build → Compile
- Wait for compilation to complete
- Open
-
Find the installer:
- Location:
Installer\Output\BrickSetManagerSetup.exe - Size: ~49MB (self-contained, includes .NET 7.0 runtime)
- Location:
The installer is self-contained, meaning it includes:
- The entire .NET 7.0 runtime
- WPF framework libraries
- Your application and all dependencies
Advantage: Users don't need to install .NET 7.0 separately - just run the installer and go!
BrickSetManager/ # Repository root
├── BrickSetManager/ # Main WPF application
│ ├── Database/ # SQLite database layer
│ │ ├── DatabaseManager.cs # Database initialization & migrations
│ │ ├── SetRepository.cs # Set data access
│ │ ├── InventoryRepository.cs
│ │ └── BrickRepository.cs
│ ├── Models/ # Data models
│ │ ├── BrickSet.cs
│ │ ├── BrickDetail.cs
│ │ └── InventoryItem.cs
│ ├── Services/ # Business logic
│ │ ├── Scraper.cs # Web scraping service
│ │ ├── ImageDownloader.cs
│ │ └── SetQueueProcessor.cs # Background queue processing
│ ├── Windows/ # Additional windows
│ │ ├── AddSetWindow.xaml
│ │ ├── SetDetailsWindow.xaml
│ │ ├── SearchColorWindow.xaml
│ │ └── BricksWindow.xaml
│ ├── Converters/ # WPF value converters
│ └── MainWindow.xaml # Main application window
├── Installer/ # Inno Setup installer configuration
│ ├── setup.iss # Installer script
│ └── Output/ # Generated installers
├── DebugScraper/ # Standalone scraper testing tool
└── README.md # This file
The application uses SQLite for local storage. The database is automatically created on first run at:
%APPDATA%\BrickSetManager\BrickSets.db
SetsOwned: Stores set information
- SetNumber (PRIMARY KEY)
- SetName
- SetImage (BLOB)
- DateAdded
- BrickLinkURL
- Quantity
- InventoryVersion
- ReleaseYear
- PieceCount
- HasMultipleVersions
- SetLocation
BrickDetails: Stores unique brick information
- PartNumber (PRIMARY KEY)
- ColorID (PRIMARY KEY)
- ColorName
- PartName
- PartImage (BLOB)
- PartURL
- PriceGuideURL
- Length
- Width
SetInventory: Links sets to their bricks
- SetNumber (FOREIGN KEY)
- PartNumber (FOREIGN KEY)
- ColorID (FOREIGN KEY)
- Quantity
- Click "Add Set" button in the toolbar
- Enter the set number:
- Format:
21044or21044-1 - If you omit
-1, it will be added automatically
- Format:
- The application will automatically:
- Fetch set details
- Download set and part images
- Parse the complete inventory
- Detect if multiple inventory versions exist
- Extract release year and piece count
- Store everything in the local database
Gallery View (Default):
- Large set images with badges
- Shows quantity badge (e.g., "x2" if you own 2 copies)
- Shows version badge (vOld/vNew) only if multiple versions exist
- Click any set to view details
List View:
- Sortable table with columns:
- Image thumbnail
- Set Number
- Set Name
- Pieces
- Year
- Version
- Location
- Date Added
- Click column headers to sort
- Double-click a row to view details
Toggle Views: Click the "Toggle View" button in the toolbar
- Click on any set (gallery view) or double-click (list view)
- View complete inventory with:
- Part images
- Part names and numbers
- Quantities
- Colors
- Total part count
- Search within the inventory using the search box
- Click set name or number to open on BrickLink
- Edit location directly in the details window
- Click "Search" button in the toolbar
- Select a color from the dropdown:
- Choose "Any color" to search across all colors
- Or select a specific color
- Optionally filter by part name/number in the search box
- Click "Search" to view results
- Results show total count (e.g., "Found 45 brick(s) in Red")
Right-click any set (works in both gallery and list view):
- Add Copy: Increase quantity by 1
- Remove Copy: Decrease quantity by 1
- Set Quantity...: Enter a specific quantity
Track where each set is physically stored (up to 100 characters):
Method 1 - Context Menu:
- Right-click any set → "Set Location..."
- Enter location (e.g., "Shelf A3", "Basement bin #5")
Method 2 - Set Details:
- Open set details window
- Edit the location field directly
- Changes save automatically when you leave the field
Use the search box in the toolbar to find sets:
- Searches set names and numbers
- Word-based search: Each word is searched independently
- Example: "castle dragon" finds any set containing both "castle" AND "dragon"
- Results update as you type
Clear Database:
- Click "Clear DB" button (red button in toolbar)
- First confirmation: Review what will be deleted
- Second confirmation: Final warning
- All sets, inventory, and bricks are permanently deleted
Note: This action cannot be undone! The database will be empty but the structure remains.
The DebugScraper project is a console application for testing the scraper independently:
cd DebugScraper
dotnet runThis will:
- Fetch a test set
- Display extracted data (name, year, pieces, multiple versions)
- Save the HTML to a file for inspection
- Count the number of parts found
- Show sample inventory items
- System.Data.SQLite.Core: SQLite database for .NET
- HtmlAgilityPack: HTML parsing and web scraping
- .NET 7.0 Windows Desktop Runtime: WPF framework
The codebase follows a clear separation of concerns:
- Database layer: All database operations in
*Repository.csfiles - Business logic: Services for scraping, image downloading, and queue processing
- UI: XAML for layout, code-behind for event handlers
- Models: Simple POCOs for data transfer
The database automatically migrates on startup. To add new columns:
- Edit
DatabaseManager.cs - Add column check in
MigrateDatabase():bool hasYourNewColumn = false; // Add check in the while (reader.Read()) loop
- Add migration logic:
if (!hasYourNewColumn) { string addColumn = "ALTER TABLE SetsOwned ADD COLUMN YourColumn TEXT"; using (var cmd = new SQLiteCommand(addColumn, connection)) { cmd.ExecuteNonQuery(); } }
- Update
CreateTables()to include the column for new databases
- Ensure you're running Windows 10/11 (64-bit)
- Try running as administrator
- Check Windows Event Viewer for error details
- Check your internet connection
- Verify the set exists (try opening the URL manually)
- HTML structure may have changed
- Try again later (site may be temporarily unavailable)
- Images are downloaded on first add
- If images fail to download, they won't display
- Delete the set and re-add it to try downloading again
- Close the application
- Delete the database file:
%APPDATA%\BrickSetManager\BrickSets.db - Restart the application (it will recreate the database with the latest schema)
- Ensure .NET 7.0 SDK is installed:
dotnet --versionshould show 7.0.x - Clean and rebuild:
dotnet clean && dotnet build - Restore packages:
dotnet restore - Check that all NuGet packages are restored
- Verify Inno Setup 6 is installed at the expected path
- Ensure the publish step completed successfully
- Check that
bin\Release\net7.0-windows\win-x64\publish\exists and contains files - Try running ISCC.exe directly to see detailed error messages
The scraper mimics natural browser behavior:
- Downloads HTML pages sequentially (set page, then inventory page)
- Natural delays between requests (500-1500ms)
- Downloads images in batches of 6 (like browser parallel connections)
- Small delays between image batches (100-300ms)
- User-Agent header matches common browsers
Set names with special characters are properly decoded:
&→&á→áé→é- All other HTML entities
The scraper automatically detects if a set has multiple inventory versions by:
- Checking the latest inventory page for "Older version" links
- Setting
HasMultipleVersionsflag in database - Showing version badges only when multiple versions exist
This project is provided as-is for personal use. BrickLink and LEGO are trademarks of their respective owners.
- BrickLink: Data source for set and part information
- HtmlAgilityPack: HTML parsing library
- SQLite: Embedded database engine
- Inno Setup: Installer creation tool
Disclaimer: This application is not affiliated with or endorsed by the LEGO Group or BrickLink. It is an independent tool created by fans for managing personal LEGO collections. Please respect BrickLink's terms of service and use the scraping functionality responsibly.