# sanheiii/mageki architecture

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

- Interactive diagram: https://gitdiagram.com/sanheiii/mageki
- Repository: https://github.com/sanheiii/mageki

## Overview

##### Project Type & Purpose
- Mageki is a cross-platform mobile application built using Xamarin. Its purpose is to let a mobile device act as a control interface (via USB or LAN) for a device running the “ongeki-io” service.
- The repository shows a multi-project solution with dedicated code for Android, iOS, and UWP, alongside shared logic that contains UI definitions, drawing components, IO communication (TCP/UDP), and dependency interfaces.

##### Analyzing the File Structure
- At the top level, you see the solution file (Mageki.sln) and separate directories for each platform: Mageki.Android, Mageki.iOS, Mageki.UWP.
- There is a shared core project (Mageki) that houses shared resources such as:
- UI elements (Views, XAML pages, TouchTracking),
- Drawables (custom drawn components for the controller interface),
- IO components (TcpIO, UdpIO, StaticIO, etc.),
- Dependency service interfaces (ICloseApplication, INfcService).
- Each platform-specific project contains its own implementation of dependency services (e.g., NfcService and CloseApplication) and custom renderers to support native look and functionality.
- Configuration files (manifests, csproj files, AssemblyInfo) exist for handling platform-specific build and deployment details.

##### Key Architectural Insights from the README
- The README emphasizes the theme and connection with “ongeki-io” (external device connection via USB or LAN) while also hinting at user interactions (touch interfaces, custom drawing) and dependency inversion (with native implementations provided per platform).
- There is a clear separation between shared logic (business, control flow, IO, rendering commands) and platform-specific UI and service implementations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction
    U("User (Touch Input)"):::user

    %% Shared Core Module Subgraph
    subgraph "Shared Core Module"
        SC("Core (Mageki)"):::shared
        V("Views"):::shared
        T("TouchTracking"):::shared
        D("Custom Drawables"):::shared
        IO("IO Components (TCP/UDP)"):::shared
        DS("Dependency Service Interfaces"):::shared
    end

    %% Platform-Specific Modules Subgraph
    subgraph "Platform-Specific Modules"
        A("Android Module"):::platform
        I("iOS Module"):::platform
        W("UWP Module"):::platform
    end

    %% External Device
    E("External Device: ongeki-io"):::external

    %% Data Flow Connections
    U -->|"initiates"| SC

    SC -->|"contains"| V
    SC -->|"contains"| T
    SC -->|"contains"| D
    SC -->|"contains"| IO
    SC -->|"contains"| DS

    V -->|"sendsCommand"| IO
    T -->|"sendsTouchInfo"| IO
    V -->|"triggers"| DS
    T -->|"triggers"| DS

    IO -->|"TCP/UDPComms"| E

    DS -->|"nativeCall"| A
    DS -->|"nativeCall"| I
    DS -->|"nativeCall"| W

    %% Click Events for Shared Core and its components
    click SC "https://github.com/sanheiii/mageki/tree/master/Mageki/"
    click V "https://github.com/sanheiii/mageki/tree/master/Mageki/Views"
    click T "https://github.com/sanheiii/mageki/tree/master/Mageki/TouchTracking"
    click D "https://github.com/sanheiii/mageki/tree/master/Mageki/Drawables"
    click IO "https://github.com/sanheiii/mageki/tree/master/Mageki/IO"
    click DS "https://github.com/sanheiii/mageki/tree/master/Mageki/DependencyServices"
    
    %% Click Events for Platform-Specific Modules
    click A "https://github.com/sanheiii/mageki/blob/master/Mageki/Mageki.Android"
    click I "https://github.com/sanheiii/mageki/blob/master/Mageki/Mageki.iOS"
    click W "https://github.com/sanheiii/mageki/blob/master/Mageki/Mageki.UWP"

    %% Styles
    classDef shared fill:#ccf,stroke:#006,stroke-width:2px;
    classDef platform fill:#cfc,stroke:#393,stroke-width:2px;
    classDef external fill:#ffc,stroke:#cc6,stroke-width:2px;
    classDef user fill:#fdd,stroke:#d00,stroke-width:2px;
```
