# amrelsadany/findandcopydamagedimages architecture

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

- Interactive diagram: https://gitdiagram.com/amrelsadany/findandcopydamagedimages
- Repository: https://github.com/amrelsadany/findandcopydamagedimages

## Overview

##### Project type and purpose
- This is a .NET 6.0 console application named “FindAndCopyDamagedImages.”
- It scans directories, checks each image for corruption/damage, and copies damaged images to a target folder.

##### File structure
- Top-level:
- FindAndCopyDamagedImages.sln – the Visual Studio solution
- FindAndCopyDamagedImages/ – project folder
- Inside the project folder:
- Program.cs – CLI entry point
- App.config – configuration settings (e.g., input/output paths)
- Properties/PublishProfiles – publish profiles for folder-based deployment
- bin/, obj/ – compiled outputs and intermediate build artifacts
- Dependencies:
- System.Drawing.Common (native libs under runtimes/) for image processing
- .NET runtime (net6.0)
- No frontend or web tier – this is a standalone command-line tool.

##### README
- Minimal content (“Hello”) – no architecture described
- We infer domain from code and file names (image scanning, validation, file operations)

1. CLI Layer
– Program.cs / CommandLineParser
– Reads arguments and invokes core services
2. Configuration Loader
– Loads App.config (input path, output path, filters)
3. Core Processing Services
– FileDiscoveryService
- Enumerates files in source directory
– ImageValidationService
- Uses System.Drawing to attempt load/validate each image
– FileCopyService
- Copies damaged images to target folder
4. Logging Service
– Writes events to console and/or file (e.g., NLog or custom logger)
5. Infrastructure
– .NET 6.0 Runtime
– System.Drawing.Common native libraries
– OS File System (Windows, Linux, macOS)
- CLI → Configuration Loader (loads settings)
- CLI → FileDiscoveryService (pass input path)
- FileDiscoveryService → ImageValidationService (for each file)
- ImageValidationService → FileCopyService (when damage detected)
- All services → Logging Service (to record progress/errors)
- FileCopyService → OS File System (writes files)
- ImageValidationService → System.Drawing.Common / Native libs (load image)
c. Architectural patterns and design principles:
- Single Responsibility: each service has one role
- Dependency Injection: services should depend on abstractions (e.g., IFileSystem, ILogger)
- Pipeline / Chain of Responsibility: files flow through discovery → validation → copy
d. Technologies and frameworks:
- .NET 6.0 console host
- System.Configuration.ConfigurationManager (for App.config)
- System.Drawing.Common (image API)
- Potential DI container (e.g., Microsoft.Extensions.DependencyInjection)

##### Essential elements
- Notes on cross-platform native libraries under “Infrastructure”
- Annotations for configuration inputs (App.config) and publish profiles

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% CLI Layer
    subgraph "CLI Layer"
        CLI["Program.cs\n(CommandLineParser)"]:::cli
    end

    %% Configuration Loader
    subgraph "Configuration Loader"
        Config["Configuration Loader\nApp.config"]:::services
        Publish["Publish Profiles\nFolderProfile.pubxml"]:::external
    end

    %% Core Processing Services
    subgraph "Core Processing Services"
        Discovery["FileDiscoveryService"]:::services
        Validation["ImageValidationService"]:::services
        Copy["FileCopyService"]:::services
    end

    %% Logging Service
    Logging["Logging Service"]:::services

    %% Infrastructure
    subgraph "Infrastructure"
        Runtime[".NET 6.0 Runtime"]:::infra
        Native["System.Drawing.Common Native Libs\n(runtimes)"]:::infra
        subgraph "OS File System"
            OSX["osx-x64\n(native)"]:::infra
            Unix["unix/lib/net6.0"]:::infra
            Win["win/lib/net6.0"]:::infra
        end
    end

    %% Project Files
    subgraph "Project Files"
        Solution["FindAndCopyDamagedImages.sln"]:::external
        Project["FindAndCopyDamagedImages.csproj"]:::external
        README["README.md"]:::external
        Bin["bin"]:::external
        Obj["obj"]:::external
    end

    %% Connections
    CLI -->|"loadSettings()"| Config
    CLI -->|"startProcessing()"| Discovery
    Discovery -->|"ValidateImage()"| Validation
    Validation -->|"onDamage CopyFile()"| Copy
    Discovery -->|"log()"| Logging
    Validation -->|"log()"| Logging
    Copy -->|"log()"| Logging
    Copy -->|"write()"| OSX
    Copy -->|"write()"| Unix
    Copy -->|"write()"| Win
    Validation -->|"useLoadImage()"| Native
    Native -->|"hostedOn"| Runtime

    %% Click Events
    click CLI "https://github.com/amrelsadany/findandcopydamagedimages/blob/master/FindAndCopyDamagedImages/Program.cs"
    click Config "https://github.com/amrelsadany/findandcopydamagedimages/blob/master/FindAndCopyDamagedImages/App.config"
    click Publish "https://github.com/amrelsadany/findandcopydamagedimages/blob/master/FindAndCopyDamagedImages/Properties/PublishProfiles/FolderProfile.pubxml"
    click Discovery "https://github.com/amrelsadany/findandcopydamagedimages/blob/master/FindAndCopyDamagedImages/bin/Debug/net6.0/FindAndCopyDamagedImages.exe"
    click Native "https://github.com/amrelsadany/findandcopydamagedimages/tree/master/FindAndCopyDamagedImages/bin/Debug/net6.0/runtimes"
    click OSX "https://github.com/amrelsadany/findandcopydamagedimages/tree/master/FindAndCopyDamagedImages/bin/Debug/net6.0/runtimes/osx-x64/native"
    click Unix "https://github.com/amrelsadany/findandcopydamagedimages/blob/master/FindAndCopyDamagedImages/bin/Debug/net6.0/runtimes/unix/lib/net6.0"
    click Win "https://github.com/amrelsadany/findandcopydamagedimages/blob/master/FindAndCopyDamagedImages/bin/Debug/net6.0/runtimes/win/lib/net6.0"
    click Solution "https://github.com/amrelsadany/findandcopydamagedimages/blob/master/FindAndCopyDamagedImages.sln"
    click Project "https://github.com/amrelsadany/findandcopydamagedimages/blob/master/FindAndCopyDamagedImages/FindAndCopyDamagedImages.csproj"
    click README "https://github.com/amrelsadany/findandcopydamagedimages/blob/master/README.md"
    click Bin "https://github.com/amrelsadany/findandcopydamagedimages/tree/master/FindAndCopyDamagedImages/bin"
    click Obj "https://github.com/amrelsadany/findandcopydamagedimages/tree/master/FindAndCopyDamagedImages/obj"

    %% Styles
    classDef cli fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef services fill:#90EE90,stroke:#333,stroke-width:1px
    classDef infra fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#f0f0f0,stroke:#333,stroke-width:1px
```
