# biteworks/copyfoldertool architecture

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

- Interactive diagram: https://gitdiagram.com/biteworks/copyfoldertool
- Repository: https://github.com/biteworks/copyfoldertool

## Overview

From the project’s file tree and README, it is clear that CopyFolderTool is a simple Windows GUI application (built with .NET/WPF) that serves as a front end for the robust copying utility Robocopy. Its purpose is to simplify the process of copying folders—especially over network drives via VPN—by providing a graphical interface that integrates with the Windows context menu.

##### Main Components
- GUI Application: This component is built using WPF (as indicated by the App.xaml, MainWindow.xaml, and their corresponding code-behind files). It handles user interactions (selecting folders, displaying options, and launching the copying process).
- Integration with Robocopy: Although Robocopy itself isn’t part of the source, the application acts as a wrapper. Indicate a component (“Robocopy Utility”) that the GUI triggers through command-line calls.
- Installer and Context Menu Integration: The _install folder contains batch scripts and registry entries (.reg files) used to add or remove the right-click context menu. This can be shown as an “Installation/Context Menu Integration” component that interacts with the Windows shell.
- Configuration and Settings: The presence of settings files (user settings and application configuration) and assembly info implies a configuration management aspect that interacts with the main code to determine runtime behavior.

##### Relationships and Data Flow
- The Windows Explorer right-click triggers the context menu entry that starts the application.
- When a user activates the “CopyFolderTool” via the context menu, the GUI is launched.
- The GUI collects user inputs such as source/destination paths and options, then issues a command-line process call to execute Robocopy.
- Installer scripts communicate with the Windows registry to add or remove the context menu option.
- The configuration/settings files are loaded at application startup to define parameters (e.g., defaults, paths, and options).

##### Architectural Patterns and Design Principles
- Separation of Concerns: The design differentiates the user interface layer from the underlying process execution (i.e., invoking Robocopy).
- Modularity: The installer scripts, application GUI, and the external Robocopy utility form distinct modules that interact via clearly defined interfaces.
- Windows Integration: The architecture leverages Windows registry modifications to integrate seamlessly with the OS context menu.

##### Relevant Technologies, Frameworks, and Libraries
- .NET (likely .NET Framework given WPF usage) for the GUI.
- Windows Presentation Foundation (WPF) for the user interface (files like App.xaml, MainWindow.xaml).
- Batch scripting and registry files for installation logic.
- Robocopy as an external utility that handles the actual file copying process.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Nodes
    EXPL["Windows Explorer - Right-Click Context"]:::os

    %% Installation & Context Menu Integration Subgraph
    subgraph "Installation & Context Menu Integration"
        INST["Installer & Context Menu Integration"]:::installer
        INST_FILE1["AddToRightclickMenu.reg"]:::installer
        INST_FILE2["RemoveToRightclickMenu.reg"]:::installer
        INST_FILE3["install.bat"]:::installer
        INST_FILE4["uninstall.bat"]:::installer
        INST_FILE5["update.bat"]:::installer
    end

    %% CopyFolderTool Application Subgraph
    subgraph "CopyFolderTool Application"
        GUI["CopyFolderTool GUI Application (WPF)"]:::gui
        SUB1["User Input & Option Selection"]:::gui
        SUB2["Configuration Loading"]:::gui
        ROB["Robocopy Utility Invocation"]:::utility
        CONFIG["Configuration & Settings"]:::config
    end

    %% Relationships
    INST -->|"registers context menu"| EXPL
    EXPL -->|"launches"| GUI
    GUI -->|"processes inputs"| SUB1
    GUI -->|"loads"| SUB2
    CONFIG -->|"provides settings to"| SUB2
    GUI -->|"invokes"| ROB

    %% Click events for GUI Application Files
    click GUI "https://github.com/biteworks/copyfoldertool/blob/main/CopyFolderTool/App.xaml"
    click GUI "https://github.com/biteworks/copyfoldertool/blob/main/CopyFolderTool/MainWindow.xaml"
    click GUI "https://github.com/biteworks/copyfoldertool/blob/main/CopyFolderTool/App.xaml.cs"
    click GUI "https://github.com/biteworks/copyfoldertool/blob/main/CopyFolderTool/MainWindow.xaml.cs"

    %% Click events for Installer & Context Menu Integration Files
    click INST "https://github.com/biteworks/copyfoldertool/tree/main/_install"
    click INST_FILE1 "https://github.com/biteworks/copyfoldertool/blob/main/_install/AddToRightclickMenu.reg"
    click INST_FILE2 "https://github.com/biteworks/copyfoldertool/blob/main/_install/RemoveToRightclickMenu.reg"
    click INST_FILE3 "https://github.com/biteworks/copyfoldertool/blob/main/_install/install.bat"
    click INST_FILE4 "https://github.com/biteworks/copyfoldertool/blob/main/_install/uninstall.bat"
    click INST_FILE5 "https://github.com/biteworks/copyfoldertool/blob/main/_install/update.bat"

    %% Click events for Configuration and Settings Files
    click CONFIG "https://github.com/biteworks/copyfoldertool/blob/main/CopyFolderTool/App.config"
    click CONFIG "https://github.com/biteworks/copyfoldertool/blob/main/CopyFolderTool/Properties/AssemblyInfo.cs"
    click CONFIG "https://github.com/biteworks/copyfoldertool/blob/main/CopyFolderTool/Properties/Settings.settings"
    click CONFIG "https://github.com/biteworks/copyfoldertool/blob/main/CopyFolderTool/Properties/UserSettings.settings"

    %% Styles
    classDef os fill:#fce5cd,stroke:#b45f06,stroke-width:2px;
    classDef installer fill:#c9daf8,stroke:#0b5394,stroke-width:2px;
    classDef gui fill:#d9ead3,stroke:#38761d,stroke-width:2px;
    classDef utility fill:#ead1dc,stroke:#8e7cc3,stroke-width:2px;
    classDef config fill:#fff2cc,stroke:#bf9000,stroke-width:2px;
```
