# tazdraperm/poe2autosplit architecture

> Architecture diagram of the GitHub repository tazdraperm/poe2autosplit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tazdraperm/poe2autosplit
- Repository: https://github.com/tazdraperm/poe2autosplit

## Overview

##### Project Type and Purpose
**Poe2AutoSplit** is a **LiveSplit component** designed to enable auto-splitting functionality for the game **Path of Exile 2**. Its primary purpose is to automate the splitting process during gameplay, enhancing the live streaming and speedrunning experience by interfacing directly with LiveSplit.

**Key Indicators:**
- **Project Type:** LiveSplit component (plugin/extension)
- **Purpose:** Auto-splitting for Path of Exile 2 to automate splits based on in-game events.

##### File Structure
**Top-Level Directories and Files:**
- **.gitattributes & .gitignore:** Configure Git behavior.
- **Poe2AutoSplit.sln & Poe2AutoSplit.csproj:** Solution and project files for a C# application using .NET.
- **Poe2AutoSplit/Component:** Contains the core components of the application.
- **AutoSplitter:** Handles splitting logic based on game events.
- **AreaEvent.cs, BossEvent.cs, SplitEvent.cs, Splitter.cs:** Manage different types of events and the splitting mechanism.
- **ClientLog:** Manages log reading from the game's client.
- **LogReader.cs:** Reads and parses the Client.txt log file.
- **UI:** Manages the settings and user interface.
- **Settings.Designer.cs, Settings.cs, Settings.resx:** Define and manage UI components for configuration.
- **Poe2AutoSplitComponent.cs & Poe2AutoSplitComponentFactory.cs:** Integrate the component with LiveSplit.
- **Properties/AssemblyInfo.cs:** Contains assembly metadata.

**Architectural Patterns and Choices:**
- **Modular Architecture:** Separation into components like AutoSplitter, ClientLog, and UI.
- **Event-Driven Design:** Utilizes events (e.g., SplitEvent) to trigger actions.
- **Factory Pattern:** Implemented via Poe2AutoSplitComponentFactory for creating component instances.

**Configuration and Build:**
- **.csproj & .sln Files:** Indicate a C# project managed with Visual Studio.
- **AssemblyInfo.cs:** Manages assembly-level attributes and metadata.

##### README for Additional Insights
**Architecture and Dependencies:**
- **Integration with LiveSplit:** Acts as a plugin/component within LiveSplit.
- **Log File Monitoring:** Reads the **Client.txt** log file from Path of Exile 2 to detect in-game events.
- **UI for Configuration:** Provides a settings interface to customize splitting behavior.

**Key Features:**
- **Automatic Splits:** Based on area and boss events.
- **Settings Customization:** Users can select specific areas and bosses to trigger splits.
- **Split Generation:** Option to automatically generate splits based on user selections.

**a. Identify the Main Components:**
##### LiveSplit Integration
- **Poe2AutoSplitComponent:** Main plugin component for LiveSplit.
- **Poe2AutoSplitComponentFactory:** Factory for creating component instances.

##### AutoSplitter Module
- **Splitter:** Core logic for determining when to split.
- **Event Handlers:**
- **AreaEvent**
- **BossEvent**
- **SplitEvent**

##### Client Log Module
- **LogReader:** Reads and parses the Client.txt log file to detect game events.

##### User Interface (UI)
- **Settings Interface:** Allows users to configure which areas and bosses trigger splits.

##### External Systems
- **Path of Exile 2 Game:** Generates log entries that are read by LogReader.
- **LiveSplit Application:** Hosts and interacts with the Poe2AutoSplit component.

**b. Determine Relationships and Interactions:**
- **LiveSplit** loads **Poe2AutoSplitComponent** via **Poe2AutoSplitComponentFactory**.
- **Poe2AutoSplitComponent** initializes the **AutoSplitter** and **UI** modules.
- **LogReader** continuously monitors **Client.txt** from **Path of Exile 2**.
- Detected events from **LogReader** are passed to **AutoSplitter**.
- **AutoSplitter** processes events via **Event Handlers** (AreaEvent, BossEvent) and triggers **SplitEvent**.
- **SplitEvent** communicates with **LiveSplit** to perform the actual split.
- **UI** allows users to configure settings, which influence **AutoSplitter** behavior.

**c. Highlight Architectural Patterns and Design Principles:**
- **Modularity:** Clear separation of concerns among LiveSplit integration, AutoSplitter logic, log reading, and UI.
- **Event-Driven Architecture:** Utilizes events to decouple event detection from split execution.
- **Factory Pattern:** Simplifies component instantiation and enhances scalability.
- **Single Responsibility Principle:** Each class/module has a distinct responsibility.

**d. Include Relevant Technologies and Frameworks:**
- **Programming Language:** C# (.NET Framework)
- **Development Environment:** Visual Studio (implied by .sln and .csproj files)
- **LiveSplit API:** For integrating the component into the LiveSplit application.
- **UI Framework:** Likely Windows Forms or WPF for the settings interface.

##### Elements

- **Clear Labels for Each Component:**

- How **LogReader** sends data to **AutoSplitter**.
- **AutoSplitter** communicating with **LiveSplit**.
- User interactions with the **UI Settings** affecting **AutoSplitter**.

- **Integration Components:** e.g., LiveSplit elements in blue.
- **Core Logic:** e.g., AutoSplitter in green.
- **UI Elements:** e.g., Settings interface in orange.
- **External Systems:** e.g., Path of Exile 2 and LiveSplit in grey.

##### Detail and Essential Architectural Elements

- **Modular Breakdown:** Ensure each component and its sub-components (e.g., within AutoSplitter) are individually represented.
- **Technology Stack:** Highlight key technologies like C#/.NET and LiveSplit API connections.
- **Event Handling:** Clearly show the flow from log detection to event triggering to split execution.

##### LiveSplit Integration Layer
- Poe2AutoSplitComponent
- Poe2AutoSplitComponentFactory

##### Core AutoSplitter Module
- Splitter
- AreaEvent
- BossEvent
- SplitEvent

##### Client Log Module
- LogReader

##### User Interface Layer
- Settings Interface

##### External Systems
- Path of Exile 2 (generating Client.txt log)
- LiveSplit Application

**Interactions:**
- **LogReader** → **Splitter** (from Client.txt)
- **Splitter** triggers **SplitEvent** → **LiveSplit** performs split
- **UI Settings** → **Splitter** (configures which events to listen to)

**Visual Representation Tips:**
- Use rectangles for components.
- Related components within larger sections or containers.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Subgraphs and modules
    subgraph "LiveSplit Integration"
        Poe2Component["Poe2AutoSplitComponent"]:::integration
        Poe2ComponentFactory["Poe2AutoSplitComponentFactory"]:::integration
    end

    subgraph "AutoSplitter Module"
        Splitter["Splitter"]:::logic
        AreaEvent["AreaEvent"]:::logic
        BossEvent["BossEvent"]:::logic
        SplitEvent["SplitEvent"]:::logic
    end

    subgraph "Client Log Module"
        LogReader["LogReader"]:::log
    end

    subgraph "User Interface (UI)"
        Settings["Settings"]:::ui
        SettingsDesigner["Settings.Designer"]:::ui
        SettingsResx["Settings.resx"]:::ui
    end

    subgraph "External Systems"
        Game["Path of Exile 2"]:::external
        LiveSplitApp["LiveSplit Application"]:::external
    end

    %% Connections
    Game -->|"generates logs"| LogReader
    LogReader -->|"detects events"| Splitter
    Splitter -->|"triggers"| SplitEvent
    SplitEvent -->|"performs split"| LiveSplitApp
    Poe2ComponentFactory --> Poe2Component
    Poe2Component --> Splitter
    Poe2Component --> Settings
    Settings --> Splitter
    SettingsDesigner --> Settings
    SettingsResx --> Settings

    %% Click Events
    click Poe2Component "https://github.com/tazdraperm/poe2autosplit/blob/main/Poe2AutoSplit/Component/Poe2AutoSplitComponent.cs"
    click Poe2ComponentFactory "https://github.com/tazdraperm/poe2autosplit/blob/main/Poe2AutoSplit/Component/Poe2AutoSplitComponentFactory.cs"
    click Splitter "https://github.com/tazdraperm/poe2autosplit/blob/main/Poe2AutoSplit/Component/AutoSplitter/Splitter.cs"
    click AreaEvent "https://github.com/tazdraperm/poe2autosplit/blob/main/Poe2AutoSplit/Component/AutoSplitter/AreaEvent.cs"
    click BossEvent "https://github.com/tazdraperm/poe2autosplit/blob/main/Poe2AutoSplit/Component/AutoSplitter/BossEvent.cs"
    click SplitEvent "https://github.com/tazdraperm/poe2autosplit/blob/main/Poe2AutoSplit/Component/AutoSplitter/Event/SplitEvent.cs"
    click LogReader "https://github.com/tazdraperm/poe2autosplit/blob/main/Poe2AutoSplit/Component/ClientLog/LogReader.cs"
    click Settings "https://github.com/tazdraperm/poe2autosplit/blob/main/Poe2AutoSplit/Component/UI/Settings.cs"
    click SettingsDesigner "https://github.com/tazdraperm/poe2autosplit/blob/main/Poe2AutoSplit/Component/UI/Settings.Designer.cs"
    click SettingsResx "https://github.com/tazdraperm/poe2autosplit/blob/main/Poe2AutoSplit/Component/UI/Settings.resx"

    %% Styles
    classDef integration fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef logic fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef log fill:#FFFFE0,stroke:#000,stroke-width:1px;
    classDef ui fill:#FFA500,stroke:#000,stroke-width:1px;
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px;
```
