# nyakowint/xsoverlay-keyboard-osc architecture

> Architecture diagram of the GitHub repository nyakowint/xsoverlay-keyboard-osc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nyakowint/xsoverlay-keyboard-osc
- Repository: https://github.com/nyakowint/xsoverlay-keyboard-osc

## Overview

##### Core Components
- XSOverlay (Host Application)
- BepInEx Framework (Plugin Host)
- KeyboardOSC Plugin Core
- Plugin Settings UI
- Chat Mode System

##### External Integrations
- VRChat OSC Interface
- Twitch API Integration
- Local Web Server (for Twitch auth)

##### Component Relationships

- [XSOverlay]
- ↓
- [BepInEx Framework]
- ↓
- [KeyboardOSC Plugin]
- ┬─────────┬──────────┐
- ↓         ↓         ↓          ↓
- [UI]    [Chat]    [Twitch]   [Tools]

##### Component Details

- [Plugin Core]
- Initialization
- Component Management
- Event Handling

- [Chat System]
- Message Processing
- OSC Communication
- Shortcut Handling

- [Twitch Integration]
- Authentication
- Chat Broadcasting
- Message Handling

- [Settings UI]
- Configuration Interface
- Theme Management
- User Preferences

##### Technical Elements
- BepInEx configuration system
- Web server ports (42071)
- OSC communication ports
- File system interactions
- Input handling system

##### Implementation Notes
- Use standardized UML notation where appropriate
- Notes for critical configuration requirements
- Document version compatibility information

- The plugin's integration points with XSOverlay
- The message flow from keyboard input to VRChat/Twitch
- The configuration and settings management system
- The authentication flow for Twitch integration

Remember to:
- Version information and compatibility notes
- Document all external dependencies and requirements

This will provide a clear understanding of how the plugin integrates with XSOverlay and manages communication between various components while maintaining its core keyboard enhancement functionality.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Host
        XSO[XSOverlay]
        BepInEx[BepInEx Framework]
        click BepInEx "https://github.com/nyakowint/xsoverlay-keyboard-osc/blob/main/BepInEx.cfg"
    end

    subgraph Plugin["Plugin Core"]
        Core[Plugin Core]:::core
        Settings[Settings Management]:::core
        Patches[System Patches]:::core
        Tools[Utility Tools]:::core
        click Core "https://github.com/nyakowint/xsoverlay-keyboard-osc/blob/main/KeyboardOSC/Plugin.cs"
        click Settings "https://github.com/nyakowint/xsoverlay-keyboard-osc/blob/main/KeyboardOSC/PluginSettings.cs"
        click Patches "https://github.com/nyakowint/xsoverlay-keyboard-osc/blob/main/KeyboardOSC/Patches.cs"
        click Tools "https://github.com/nyakowint/xsoverlay-keyboard-osc/blob/main/KeyboardOSC/Tools.cs"
    end

    subgraph UI["User Interface"]
        SettingsUI[Settings UI]:::ui
        ChatToggle[Chat Toggle Interface]:::ui
        click SettingsUI "https://github.com/nyakowint/xsoverlay-keyboard-osc/blob/main/SettingsKO.html"
        click ChatToggle "https://github.com/nyakowint/xsoverlay-keyboard-osc/blob/main/KeyboardOSC/ToggleChatButton.cs"
    end

    subgraph XScripts["XScripts Components"]
        ReparentBar[Reparent Bar]:::xscript
        RescaleCam[Rescale Camera]:::xscript
        click ReparentBar "https://github.com/nyakowint/xsoverlay-keyboard-osc/blob/main/KeyboardOSC/XScripts/ReparentBar.cs"
        click RescaleCam "https://github.com/nyakowint/xsoverlay-keyboard-osc/blob/main/KeyboardOSC/XScripts/RescaleCamToCanvas.cs"
    end

    subgraph Chat["Chat System"]
        ChatMode[Chat Mode System]:::chat
        click ChatMode "https://github.com/nyakowint/xsoverlay-keyboard-osc/blob/main/KeyboardOSC/ChatMode.cs"
    end

    subgraph Twitch["Twitch Integration"]
        TwitchCore[Twitch Core]:::twitch
        TwitchHelix[Twitch Helix API]:::twitch
        TwitchModels[Twitch Models]:::twitch
        TwitchAuth[Twitch Auth UI]:::twitch
        click TwitchCore "https://github.com/nyakowint/xsoverlay-keyboard-osc/blob/main/KeyboardOSC/Twitch/Core.cs"
        click TwitchHelix "https://github.com/nyakowint/xsoverlay-keyboard-osc/blob/main/KeyboardOSC/Twitch/Helix.cs"
        click TwitchModels "https://github.com/nyakowint/xsoverlay-keyboard-osc/blob/main/KeyboardOSC/Twitch/Models.cs"
        click TwitchAuth "https://github.com/nyakowint/xsoverlay-keyboard-osc/blob/main/twitchAuth.html"
    end

    subgraph External["External Services"]
        VRC[VRChat OSC]:::external
        TwitchAPI[Twitch API]:::external
    end

    %% Connections
    XSO --> BepInEx
    BepInEx --> Core

    Core --> Settings
    Core --> Patches
    Core --> Tools
    Core --> ChatMode
    Core --> TwitchCore

    Settings --> SettingsUI
    ChatMode --> ChatToggle
    ChatMode --> VRC

    TwitchCore --> TwitchHelix
    TwitchCore --> TwitchModels
    TwitchCore --> TwitchAuth
    TwitchHelix --> TwitchAPI

    Core --> ReparentBar
    Core --> RescaleCam

    %% Styles
    classDef core fill:#a8d5ff,stroke:#333
    classDef ui fill:#98ff98,stroke:#333
    classDef chat fill:#ffb366,stroke:#333
    classDef twitch fill:#b366ff,stroke:#333
    classDef external fill:#ff9999,stroke:#333
    classDef xscript fill:#fff666,stroke:#333

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[User Interface]:::ui
        L3[Chat System]:::chat
        L4[Twitch Features]:::twitch
        L5[External Services]:::external
        L6[XScripts]:::xscript
    end
```
