# mitechmess/makemkv_autokey_gui architecture

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

- Interactive diagram: https://gitdiagram.com/mitechmess/makemkv_autokey_gui
- Repository: https://github.com/mitechmess/makemkv_autokey_gui

## Overview

##### Main Components
- GUI Application: The core is a Windows Forms GUI built in Visual Basic (files like Form1.vb, Form2.vb, ApplicationEvents.vb, and the “My Project” folder contents). This component is responsible for interfacing with the user, capturing button clicks, and displaying process feedback.
- Python Script Module: Located in the “python-standalone” directory, this contains the primary logic (makemkv_key_reg_final.py) and associated dependencies (requirements.txt). This module is called from the GUI to update the MakeMKV key.
- Binary Resource: The “Resources” folder includes the makemkv_key_reg_final.exe. This might serve as an alternative or bundled version of the Python-based solution.
- External Dependencies: The project relies on the .NET runtime and Visual C++ Redistributable (as noted in the README). Also, if running the standalone script, a Python 3.10 runtime is required.

##### Relationships and Interactions
- The GUI component acts as the user’s starting point. When the user presses the update button, the application triggers a process (either by calling the Python script via a shell command or by another inter-process communication method) to update the key.
- The Python script (or the bundled .exe) performs the logic to retrieve or register the new key and then passes back status information.
- The GUI then updates the user based on the output from the script.
- Dependency on external runtimes (the .NET runtime for the GUI, Python 3.10 if using the standalone script, and the C++ redistributable) as supporting building blocks that support application execution.

##### Architectural Patterns / Design Principles
- Layered or Modular Approach: Although the project is small, it separates the user interface from the key-updating logic. Treat the GUI as one layer and the Python (or exe) script as another.
- Loose Coupling: The communication between GUI and key updating module is done using process invocation, ensuring that changes in one module (like improving the Python script) require minimal changes to the GUI.
- Resource Bundling: Note that the project includes all dependencies (like the complete Python environment in “python-standalone”) to ease deployment, even if that leads to a larger file size.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% GUI Layer
    subgraph "GUI Layer"
        GUI1("Windows Forms GUI"):::gui
        GUI_F1("Form1.vb"):::gui
        GUI_F2("Form2.vb"):::gui
        GUI_AE("ApplicationEvents.vb"):::gui
        GUI_MP("My Project Folder"):::gui
    end

    %% Key Update Component
    subgraph "Key Update Component"
        subgraph "Python Script Module"
            PY1("makemkv_key_reg_final.py"):::module
            PY2("requirements.txt"):::module
        end
        subgraph "Binary Resource"
            BIN1("makemkv_key_reg_final.exe"):::module
        end
    end

    %% External Dependencies
    subgraph "External Dependencies"
        DOTNET(".NET Runtime"):::dependency
        PYTHON("Python 3.10"):::dependency
        VC("Visual C++ Redistributable"):::dependency
    end

    %% Connections between components
    GUI1 -->|"TriggerUpdate"| PY1
    GUI1 -->|"TriggerUpdate"| BIN1
    PY1 -->|"StatusFeedback"| GUI1
    BIN1 -->|"StatusFeedback"| GUI1

    %% Connections to external dependencies
    GUI1 -->|"Requires"| DOTNET
    PY1 -->|"Requires"| PYTHON
    BIN1 -->|"Requires"| VC

    %% Click Events for GUI files
    click GUI_F1 "https://github.com/mitechmess/makemkv_autokey_gui/blob/master/Form1.vb"
    click GUI_F2 "https://github.com/mitechmess/makemkv_autokey_gui/blob/master/Form2.vb"
    click GUI_AE "https://github.com/mitechmess/makemkv_autokey_gui/blob/master/ApplicationEvents.vb"
    click GUI_MP "https://github.com/mitechmess/makemkv_autokey_gui/tree/master/My Project"

    %% Click Events for Python Script Module files
    click PY1 "https://github.com/mitechmess/makemkv_autokey_gui/blob/master/python-standalone/makemkv_key_reg_final.py"
    click PY2 "https://github.com/mitechmess/makemkv_autokey_gui/blob/master/python-standalone/requirements.txt"

    %% Click Event for Binary Resource
    click BIN1 "https://github.com/mitechmess/makemkv_autokey_gui/blob/master/Resources/makemkv_key_reg_final.exe"

    %% Classes
    classDef gui fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef module fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef dependency fill:#90EE90,stroke:#333,stroke-dasharray: 5 5,stroke-width:2px;
```
