# rikupin1105/sportscoder_for_volleyball architecture

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

- Interactive diagram: https://gitdiagram.com/rikupin1105/sportscoder_for_volleyball
- Repository: https://github.com/rikupin1105/sportscoder_for_volleyball

## Overview

##### Project Type and Purpose
- This is a Windows desktop application built with .NET (WPF + MVVM) called “SportsCoder for Volleyball,” designed to capture and judge volleyball plays in real time.
- It includes a supporting .NET wrapper library (NDILibDotNet2) for the NDI (Network Device Interface) SDK to send/receive video streams over the network, plus a WAP project for Microsoft Store packaging.

##### File-Structure Analysis
- Top-level solution (SportsCoderForVolleyball.sln) contains three subprojects:
- NDILibDotNet2 — a class-library that P/Invokes into the native NDI SDK.
- SportsCoderForVolleyball — the WPF/MVVM application (Views, ViewModels, Models, Converters).
- WapProj — a UWP wrapper for appx packaging and Store deployment.
- Configuration & packaging files: .csproj (build), Package.appxmanifest, WapProj.wapproj.
- Documentation under docs/ describes commands, manual, judgement logic, and FAQs.

##### Architectural Patterns and Major Components
a. MVVM Layers in SportsCoderForVolleyball
- Views: XAML files (MainWindow, ScoreBoard, ControlWindow, Dialogs)
- ViewModels: orchestrate UI state and user commands (MainWindowViewModel, ScoreBoardViewModel, etc.)
- Models: domain entities (Game, Point, Control, Option, Data)
- Converters: IValueConverter implementations to adapt Models → Views
b. NDI Integration Layer
- NDILibDotNet2 library:
- AudioFrame.cs, VideoFrame.cs – managed wrappers
- Finder, Sender, Source, Router classes – high-level managed APIs
- Pinvoke folder – C# bindings for native Processing.NDI.*.dll
c. Packaging Layer
- WapProj: bundles the WPF app for Microsoft Store distribution.

##### Interactions and Data Flows
- UI (Views) ←→ ViewModels: two-way data binding, commands trigger ViewModel methods
- ViewModels → Models: update game state, track points, options
- ViewModels call NDILibDotNet2 APIs to send and receive video/audio frames over the network
- NDILibDotNet2 uses P/Invoke to the native NDI SDK and handles discovery (Finder), streaming (Sender/Source), routing.
- Packaging project does not participate at runtime but encapsulates the WPF app for deployment.

- Clear labels for every component and project name (NDILibDotNet2, SportsCoderForVolleyball, WapProj).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Views["Views (XAML UIs)"]:::presentation
        ViewModels["ViewModels"]:::presentation
    end

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        Models["Models"]:::domain
        Converters["Converters"]:::domain
    end

    %% Integration Layer
    subgraph "Integration Layer"
        direction TB
        NDILib["NDILibDotNet2"]:::integration
        NativeSDK["Native NDI SDK"]:::external
        Network["NDI Network"]:::external
    end

    %% Deployment Layer
    subgraph "Deployment Layer"
        direction TB
        WapProj["WapProj (Store Packaging)"]:::packaging
    end

    %% Data Flows and Interactions
    Views -->|"DataBinding"| ViewModels
    ViewModels -->|"Update State"| Models
    ViewModels -->|"Use IValueConverter"| Converters
    ViewModels -->|"Invoke SendFrame()/ReceiveFrame() "| NDILib
    NDILib -->|"P/Invoke Calls"| NativeSDK
    NativeSDK -->|"Stream Over"| Network
    Network -->|"OnFrameReceived"| NativeSDK
    NDILib -->|"RaiseFrameEvent"| ViewModels

    %% Click Events
    click Views "https://github.com/rikupin1105/sportscoder_for_volleyball/tree/main/src/SportsCoderForVolleyball/Views"
    click ViewModels "https://github.com/rikupin1105/sportscoder_for_volleyball/tree/main/src/SportsCoderForVolleyball/ViewModels"
    click Models "https://github.com/rikupin1105/sportscoder_for_volleyball/tree/main/src/SportsCoderForVolleyball/Models"
    click Converters "https://github.com/rikupin1105/sportscoder_for_volleyball/tree/main/src/SportsCoderForVolleyball/Converter"
    click NDILib "https://github.com/rikupin1105/sportscoder_for_volleyball/tree/main/src/NDILibDotNet2"
    click WapProj "https://github.com/rikupin1105/sportscoder_for_volleyball/tree/main/src/WapProj"

    %% Styles
    classDef presentation fill:#D0E6FF,stroke:#0066CC,stroke-width:1px
    classDef domain fill:#DFFFD0,stroke:#339900,stroke-width:1px
    classDef integration fill:#FFE5CC,stroke:#FF6600,stroke-width:1px
    classDef external fill:#FFD0D0,stroke:#CC0000,stroke-width:1px,stroke-dasharray: 5 5
    classDef packaging fill:#E0E0E0,stroke:#666666,stroke-width:1px
```
