How league-of-dae-legends/squadforger works
Project Type and Purpose
• This is a C#-based WPF desktop application following the MVVM (Model-View-ViewModel) pattern.
• Purpose: take two ARAM teams as input (manually or via CSV), generate a pool of champions for each team (either from a local JSON or via Riot’s Data Dragon API), and optionally post the results to Discord via a webhook.
File Structure Analysis
• Top-level:
├── SquadForger (WPF project folder)
│ ├── App.xaml(.cs): application entrypoint
│ ├── MainWindow.xaml(.cs): host window
│ ├── View/: WPF XAML UIs (DiscordView, SquadView)
│ ├── ViewModel/: VM classes (MainVM, SquadVM, DiscordVM)
│ ├── Model/: domain entities (Champions, Team, LeagueVersion)
│ ├── Repository/: parsing & champion-selection abstractions (ITeamNamesRepository, IRandomPicker) and implementations (CSVTeamsParser, DefaultChampionPicker)
│ ├── Services/: infrastructure (ServiceLocator, EventAggregator, event classes, DiscordService)
│ ├── Converter/: WPF converters (TextToVisibilityConverter)
│ ├── Resources/: champion.json (local data)
│ ├── Theme/: UI styling
│ └── App.config, FodyWeavers.xml: config & IL-weaving
• packages.config: NuGet dependencies
• SquadForger.sln/.csproj: solution & project definitions
Architectural Patterns & Design Principles
• MVVM separation: View ↔ ViewModel ↔ Model
• Dependency lookup via a ServiceLocator (similar to DI)
• Event-driven communication between components via EventAggregator
• Repository pattern for input sources and champion-picker strategies
• Fody weaving to inject boilerplate (e.g., INotifyPropertyChanged)
Main Components & Their Interactions
• Presentation Layer
• Views (XAML) + Converters + Themes
• ViewModels handle user actions (e.g., “Generate Safe”, “Generate Custom”, “Send to Discord”)
• Domain Layer
• Model classes hold Teams, Champions data structures
• Repository Layer
• ITeamNamesRepository: abstracts input (manual vs CSV)
• IRandomPicker: abstracts pool generation logic (local vs remote)
• Data Sources
• Local: Resources/champion.json
• Remote: Riot’s Data Dragon HTTP API
• Services & Infrastructure
• ServiceLocator: resolves IRepository, IRandomPicker, DiscordService, EventAggregator
• EventAggregator: decoupled messaging between VMs & services
• DiscordService: builds payload and issues HTTP POST to Discord webhook
• External Dependencies
• HTTP Client to Riot and Discord
• Newtonsoft.Json (or Fody-weaved JSON serializers)