# seikimatt/source-captioncompiler-watch architecture

> Architecture diagram of the GitHub repository seikimatt/source-captioncompiler-watch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/seikimatt/source-captioncompiler-watch
- Repository: https://github.com/seikimatt/source-captioncompiler-watch

## Overview

##### Main Components

a. User Interface Layer (WPF)
- MainWindow component
- XAML-based UI elements
- Event handlers for user interactions

b. File System Watcher Component
- Directory monitoring system
- File change detection mechanism
- .txt file filter

c. Compilation Service Layer
- Caption compiler wrapper
- Process execution handler
- Integration with external captioncompiler.exe

d. Utility Services
- Configuration management
- Constants handling
- File system utilities

##### Component Relationships

- Top Layer: WPF UI (MainWindow.xaml)
- Middle Layer: File System Watcher and Event Handlers
- Bottom Layer: Compilation Service and External Tool Integration

##### Specific Elements

- Rectangle: UI components
- Hexagon: File System Watcher
- Circle: Compilation Service
- Diamond: External compiler tool

b. Connections:

##### Key Interactions to Highlight

- [WPF UI] ←→ [File System Watcher]
- ↓              ↓
- [Event Handlers]  [File Detection]
- ↓              ↓
- [Compilation Service]
- ↓
- [External Compiler Tool]

##### Additional Details

Specific elements:
- File path configurations
- Supported file types (.txt)
- Compiler output locations
- Error handling flows
- Configuration settings

##### Technical Specifications

Technologies:
- .NET Framework/Core (based on .csproj)
- WPF for UI
- File System Watcher API
- Process execution for external tool

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI["User Interface Layer"]
        MW["MainWindow"]
        XAML["XAML UI Elements"]
        EH["Event Handlers"]
    end

    subgraph FSW["File System Layer"]
        Watch["File System Watcher"]
        Filter["File Filter (.txt)"]
        FD["File Detection"]
    end

    subgraph CS["Compilation Layer"]
        CompSvc["Compilation Service"]
        ProcExec["Process Executor"]
        ExtComp["External Compiler"]
    end

    subgraph US["Utility Services"]
        Config["Configuration Manager"]
        Const["Constants"]
        FSUtil["File System Utilities"]
    end

    %% Relationships
    MW --> XAML
    MW --> EH
    EH --> Watch
    Watch --> Filter
    Filter --> FD
    FD --> CompSvc
    CompSvc --> ProcExec
    ProcExec --> ExtComp
    Config --> MW
    Config --> CompSvc
    Const --> CompSvc
    FSUtil --> CompSvc
    FSUtil --> Watch

    %% Click Events
    click MW "https://github.com/SeikiMatt/source-captioncompiler-watch/blob/main/SourceCaptioncompilerWatch/MainWindow.xaml"
    click XAML "https://github.com/SeikiMatt/source-captioncompiler-watch/blob/main/SourceCaptioncompilerWatch/MainWindow.xaml"
    click EH "https://github.com/SeikiMatt/source-captioncompiler-watch/blob/main/SourceCaptioncompilerWatch/MainWindow.xaml.cs"
    click ExtComp "https://github.com/SeikiMatt/source-captioncompiler-watch/blob/main/SourceCaptioncompilerWatch/Dist/captioncompiler/captioncompiler.exe"
    click Const "https://github.com/SeikiMatt/source-captioncompiler-watch/blob/main/SourceCaptioncompilerWatch/Constants.cs"
    click FSUtil "https://github.com/SeikiMatt/source-captioncompiler-watch/blob/main/SourceCaptioncompilerWatch/Util.cs"

    %% Styling
    classDef ui fill:#a8d1f0,stroke:#333,stroke-width:2px
    classDef fsw fill:#90EE90,stroke:#333,stroke-width:2px
    classDef comp fill:#FFB366,stroke:#333,stroke-width:2px
    classDef util fill:#D3D3D3,stroke:#333,stroke-width:2px

    class MW,XAML,EH ui
    class Watch,Filter,FD fsw
    class CompSvc,ProcExec,ExtComp comp
    class Config,Const,FSUtil util

    %% Legend
    subgraph Legend
        UI_L["UI Component"]:::ui
        FSW_L["File System Component"]:::fsw
        COMP_L["Compilation Component"]:::comp
        UTIL_L["Utility Component"]:::util
    end
```
