# doctorraz/changedbmod architecture

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

- Interactive diagram: https://gitdiagram.com/doctorraz/changedbmod
- Repository: https://github.com/doctorraz/changedbmod

## Overview

##### Project type and purpose
- This is a .NET–based CAD extension (plugin) for switching MultiCAD databases.
- The solution contains two plugin projects (AC and NC), targeting different CAD platforms (likely “AutoCAD” and “NanoCAD” or similar).
- The shared code under `src/` implements the core command logic and services.

##### File structure
- Top-level:
- AC/ChangedbMod_AC_2024.csproj – Plugin for the AC platform
- NC/ChangedbMod_NC.csproj – Plugin for the NC platform
- src/ – Shared core library
- src/CadCommands/ – Commands exposed to the CAD host
- src/Interfaces/ – Abstractions for messaging and user interaction
- src/Servise/ – Implementations of services, constants, utilities
- There’s a single solution file (`ChangeDBmod.sln`), plus standard .NET configuration files.

##### Insights from README
- The tool is invoked as a CAD command `drz_changedb`.
- Its job: switch the active database in a MultiCAD environment.
- No external services or databases—just reading/writing config and calling the host’s API.

##### Main components and their relationships
a. CAD Host Applications
- AutoCAD (AC) and NanoCAD (NC) as separate plugin hosts.
b. Plugin Assemblies
- AC plugin (ChangedbMod_AC) and NC plugin (ChangedbMod_NC).
- Both reference the shared core library under `src/`.
c. Core Library (“src”)
- CadCommands: defines and registers the `drz_changedb` command.
- Interfaces: defines IAllMessageService, IInputBoxService, IMessageService, IQuestionService.
- Services: implements messaging (MessageService), collects command metadata (CmdInfo/ListCMDInfo), holds constants (SysConstant), gathers host info (SysInfo), and performs filesystem work (UtilitesWorkFil).
d. File System Interaction
- UtilitiesWorkFil reads/writes the CAD database configuration files.
e. User Interaction Flow
- Command entry → CadCommand invokes Services → Services use Interfaces to prompt user or display messages → UtilitiesWorkFil updates the DB file → Confirmations via MessageService.

##### Architectural patterns and design principles
- Dependency inversion: interfaces in `src/Interfaces` decouple command logic from messaging & UI.
- Single Responsibility: Services folder splits responsibilities (messaging, I/O, metadata).
- Plugin modularity: two thin shim projects (AC/NC) reference a common core.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% CAD Hosts
    subgraph "CAD Hosts"
        ACHost["AutoCAD Host"]:::host
        NCHost["NanoCAD Host"]:::host
    end

    %% Plugin Assemblies
    subgraph "Plugin Assemblies"
        ACPlugin["ChangedbMod_AC_2024.dll"]:::plugin
        NCPlugin["ChangedbMod_NC.dll"]:::plugin
    end

    %% Core Library
    subgraph "Core Library (src)" 
        subgraph "CadCommands"
            CadCommand["CadCommand (drz_changedb)"]:::core
        end
        subgraph "Interfaces"
            IAll["«interface» IAllMessageService"]:::interface
            IInput["«interface» IInputBoxService"]:::interface
            IMess["«interface» IMessageService"]:::interface
            IQuest["«interface» IQuestionService"]:::interface
        end
        subgraph "Services"
            CmdInfo["CmdInfo"]:::service
            ListCMD["ListCMDInfo"]:::service
            MessageService["«class» MessageService"]:::service
            SysConstant["SysConstant"]:::service
            SysInfo["SysInfo"]:::service
            UtilitesWorkFil["UtilitesWorkFil"]:::service
        end
    end

    %% File System
    FileSystem["DB Config Files"]:::storage

    %% Repository Files
    subgraph "Repository Files"
        Solution["ChangeDBmod.sln"]:::docs
        README["README.md"]:::docs
        LICENSE["LICENSE"]:::docs
        GITI[".gitignore"]:::docs
        GITA[".gitattributes"]:::docs
    end

    %% Relationships
    ACHost -->|"loads plugin"| ACPlugin
    NCHost -->|"loads plugin"| NCPlugin
    ACPlugin -->|"references"| CadCommand
    NCPlugin -->|"references"| CadCommand
    CadCommand -->|"uses interface"| IAll
    CadCommand -->|"uses interface"| IInput
    CadCommand -->|"uses interface"| IMess
    CadCommand -->|"uses interface"| IQuest
    IAll -->|"implemented by"| MessageService
    IInput -->|"implemented by"| MessageService
    IMess -->|"implemented by"| MessageService
    IQuest -->|"implemented by"| MessageService
    MessageService -->|"uses"| UtilitesWorkFil
    UtilitesWorkFil -->|"reads/writes"| FileSystem
    SysInfo -->|"reads host info"| ACHost
    SysInfo -->|"reads host info"| NCHost

    %% Click Events
    click ACPlugin "https://github.com/doctorraz/changedbmod/blob/master/AC/ChangedbMod_AC_2024.csproj"
    click NCPlugin "https://github.com/doctorraz/changedbmod/blob/master/NC/ChangedbMod_NC.csproj"
    click CoreLibrary "https://github.com/doctorraz/changedbmod/tree/master/src/"
    click CadCommand "https://github.com/doctorraz/changedbmod/blob/master/src/CadCommands/CadCommand.cs"
    click IAll "https://github.com/doctorraz/changedbmod/blob/master/src/Interfaces/IAllMessageService.cs"
    click IInput "https://github.com/doctorraz/changedbmod/blob/master/src/Interfaces/IInputBoxService.cs"
    click IMess "https://github.com/doctorraz/changedbmod/blob/master/src/Interfaces/IMessageService.cs"
    click IQuest "https://github.com/doctorraz/changedbmod/blob/master/src/Interfaces/IQuestionService.cs"
    click CmdInfo "https://github.com/doctorraz/changedbmod/blob/master/src/Servise/CmdInfo.cs"
    click ListCMD "https://github.com/doctorraz/changedbmod/blob/master/src/Servise/ListCMDInfo.cs"
    click MessageService "https://github.com/doctorraz/changedbmod/blob/master/src/Servise/MessageService.cs"
    click SysConstant "https://github.com/doctorraz/changedbmod/blob/master/src/Servise/SysConstant.cs"
    click SysInfo "https://github.com/doctorraz/changedbmod/blob/master/src/Servise/SysInfo.cs"
    click UtilitesWorkFil "https://github.com/doctorraz/changedbmod/blob/master/src/Servise/UtilitesWorkFil.cs"
    click Solution "https://github.com/doctorraz/changedbmod/blob/master/ChangeDBmod.sln"
    click README "https://github.com/doctorraz/changedbmod/blob/master/README.md"
    click LICENSE "https://github.com/doctorraz/changedbmod/tree/master/LICENSE"
    click GITI "https://github.com/doctorraz/changedbmod/blob/master/.gitignore"
    click GITA "https://github.com/doctorraz/changedbmod/blob/master/.gitattributes"

    %% Styles
    classDef host fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef plugin fill:#add8e6,stroke:#333,stroke-width:1px
    classDef core fill:#90ee90,stroke:#333,stroke-width:1px
    classDef interface fill:#ffa500,stroke:#333,stroke-width:1px
    classDef service fill:#98fb98,stroke:#333,stroke-width:1px
    classDef storage fill:#ffff99,stroke:#333,stroke-width:1px
    classDef docs fill:#ffcccb,stroke:#333,stroke-width:1px
```
