How rithik-b/playlistmanager works
Project Type & Purpose
• The project is a game mod for Beat Saber that manages playlists. It allows users to view, modify, and download songs for playlists by hooking into Beat Saber via Harmony patches.
• External dependencies include SongCore, BeatSaverSharp, BeatSaberMarkupLanguage (BSML), SiraUtil, and BeatSaberPlaylistsLib. These are critical as they indicate points where the mod integrates with the Beat Saber ecosystem.
Analyzing the File Structure
• Core Logic and Plugin Entry:
• Files like Plugin.cs and PlaylistManager.csproj are central. They represent the mod’s entry point and overall project configuration.
• Dependency Injection and Installers:
• The Installers folder (PlaylistManagerAppInstaller.cs, PlaylistManagerGameInstaller.cs, PlaylistManagerMenuInstaller.cs) sets up the mod’s components using Zenject, binding interfaces and classes for runtime DI.
• Runtime Patching:
• The HarmonyPatches and AffinityPatches folders contain classes that patch Beat Saber’s native behavior (like UI updates and level refreshing). These illustrate the modification layers that the mod uses.
• Business Logic and Management:
• The Managers folder (PlaylistDataManager.cs, PlaylistUIManager.cs) contains the core logic for CRUD operations on playlists, acting as the intermediary between data and UI.
• Downloading and Synchronization:
• The Downloaders folder (PlaylistSequentialDownloader.cs) and parts of the Utilities folder manage download logic for missing songs.
• User Interface Layer:
• The UI folder, along with its sub-folders for Views and ViewControllers, houses BSML files and controllers that render and handle mod UI interactions. Components like PlaylistManagerFlowCoordinator and various modal controllers form the UI layer.
• Domain Models:
• The Types folder holds models (Contributor, CoverImage, DownloadQueueEntry, etc.) which encapsulate the data structure for playlists, songs, and other metadata.
• Configuration and Helpers:
• The Configuration folder and Utilities folder add configuration capabilities and common helper functions across the project.
a. Main Components to Include:
• Plugin Entry & Mod Initialization: Represented by Plugin.cs, initiating the mod and hooking into Beat Saber.
• Dependency Injection Installers: Separate installer components that wire up dependencies (App, Game, Menu installers).
• Harmony & Affinity Patches: Representing runtime modifications that hook the game’s behavior.
• Business Logic Managers: Such as PlaylistDataManager and PlaylistUIManager that handle playlist operations and data/state management.
• Downloaders & Utilities: A module for handling song downloads and supporting utilities.
• Data Models: Types representing contributors, cover images, download queue entries, etc.
• External Integrations: Mark external services and libraries such as SongCore, BeatSaverSharp, BSML, SiraUtil, and BeatSaberPlaylistsLib.
b. Relationships and Interactions:
• Data flow/direction from the Plugin (initialization) to the Installers that configure all managers and UI components.
c. Architectural Patterns and Design Principles:
• Use of Dependency Injection (via Zenject installers) as a core principle.
• Separation of concerns between UI (view controllers and BSML files) and business logic (managers and interfaces).
• Use of aspect-oriented programming with Harmony patches to modify behavior without altering base code.
d. Relevant Technologies & Frameworks:
• Zenject (for DI)
• Harmony (for patching)
• BSML (for UI rendering)
• External libraries: SongCore, BeatSaverSharp, BeatSaberPlaylistsLib, and SiraUtil