# bertoladk/geogebradataextractor architecture

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

- Interactive diagram: https://gitdiagram.com/bertoladk/geogebradataextractor
- Repository: https://github.com/bertoladk/geogebradataextractor

## Overview

##### Main Components
- Common Library:
- Contains all core functionality for parsing Geogebra files.
- Files: GGBReader.cs, GGBXML.cs, GeoGebraPoint.cs, OutputGenerator.cs, and its associated .csproj.
- Represents the business logic and data processing part of the tool.
- Command-Line (CLI) Backend:
- Represented by the GeogebraDataExtractor project.
- Contains the Program.cs which likely ties together the use of functionalities from the Common library.
- This component acts as a service layer to use the extraction logic in a console mode (or non-GUI mode).
- Graphical User Interface (GUI):
- Represented by the GeogebraDataExtractorGUI project.
- Contains WPF files (App.xaml, MainWindow.xaml) and associated code-behind files.
- Provides a user-friendly interface for running the extraction, likely by calling the Common library code.
- Testing/Example Files:
- The TestingFiles directory holds sample input files (e.g., .ggb, .csv, .txt) to test or demonstrate the extractor’s functionality.
- Useful to show example inputs and validate that different components handle data correctly.

##### Relationships and Interactions
- Both the CLI backend and GUI interface depend on the Common library.
- Data Flow:
- User interaction (via the GUI) or command-line input triggers the extraction process.
- The extraction process reads the Geogebra file, processes it in the Common component, and generates output via the OutputGenerator.
- The processed data is then either displayed (in the GUI) or output to a file/console (in the CLI).
- External dependencies (if any) might be minimal, but ensure to note the file I/O operations (reading Geogebra files and writing output files).

##### Architectural Patterns and Design Principles
- Separation of Concerns:
- The project separates core data extraction (Common) from presentation/interaction (GUI) and execution/scripting (CLI).
- Reusability:
- The Common library’s isolation allows for reuse by both command-line and GUI projects.
- Clear layering:
- Presentation Layer (GUI) and Application Layer (CLI) are layered on top of the business logic layer (Common).

## Diagram (Mermaid)

```mermaid
graph TB
    %% Subgraph for User Interfaces
    subgraph "User Interfaces"
        CLI["CLI Interface<br/>(Command-Line)"]:::cli
        GUI["GUI Interface<br/>(Graphical UI)"]:::gui
    end

    %% Core extraction engine in the center
    CE["Common Extraction Engine<br/>(Core extraction logic for parsing Geogebra files)"]:::common

    %% External Testing / Sample Files resource
    TF["Testing / Sample Files<br/>(Sample input files)"]:::external

    %% Arrows indicating invocation/control flow
    CLI -->|"Invokes"| CE
    GUI -->|"Invokes"| CE
    TF -->|"ProvidesInput"| CE

    %% Arrows indicating output/data flow
    CE -->|"GeneratesOutput"| CLI
    CE -->|"GeneratesOutput"| GUI

    %% Click Events for components
    click CE "https://github.com/bertoladk/geogebradataextractor/tree/master/Common/"
    click CLI "https://github.com/bertoladk/geogebradataextractor/blob/master/GeogebraDataExtractor/Program.cs"
    click GUI "https://github.com/bertoladk/geogebradataextractor/blob/master/GeogebraDataExtractorGUI/App.xaml"
    click TF "https://github.com/bertoladk/geogebradataextractor/tree/master/TestingFiles/"

    %% Styles for nodes
    classDef common fill:#B3E5FC,stroke:#0277BD,stroke-width:2px;
    classDef cli fill:#C8E6C9,stroke:#388E3C,stroke-width:2px;
    classDef gui fill:#FFCDD2,stroke:#C62828,stroke-width:2px;
    classDef external fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px;
```
