# sharklasers996/csharp-helper architecture

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

- Interactive diagram: https://gitdiagram.com/sharklasers996/csharp-helper
- Repository: https://github.com/sharklasers996/csharp-helper

## Overview

##### Main Components Identification

The system should be represented as a VS Code Extension with these primary components:

a) Command Handler Layer
- Entry point (extension.ts)
- Individual command handlers for each feature

b) Core Features Layer
- Dependency Injection Handler
- File Creation System
- Code Embedding System
- Namespace/Filename Fixers
- Method Async Toggler

c) Template System
- Template Storage
- Template Loader

d) Utility Layer
- Common utilities and helpers

**┌─────────────────────────────────────────────┐**
- VS Code Editor                │
- ┬───┘
- ↕️                     │
**┌─────────────────────────────────────────┴───┐**
- Extension Host                  │
- ┌─────────────────────────────────────┐    │
- Command Handler Layer        │    │
- ┬───────────────────┘    │
- ↓        ↓         ↓              │
- ┌─────────────────────────────────────┐    │
- Core Features Layer          │    │
- ┌───────────┐ ┌───────────┐         │    │
- Dependency │ │   File    │         │    │
- Injector  │ │ Creation  │   ...   │    │
- ┘ └───────────┘         │    │
- ┬───────────────────┘    │
- ↓        ↓         ↓              │
- ┌─────────────────────────────────────┐    │
- Template System             │    │
- ┬───────────────────┘    │
- ↓        ↓         ↓              │
- ┌─────────────────────────────────────┐    │
- Utility Layer               │    │
- ┘    │
- ┘

##### Component Relationships

- Bidirectional communication between VS Code Editor and Extension
- Unidirectional flow from Command Handlers to Core Features
- Dependencies between Core Features and Template System
- Utility Layer being accessed by all other layers

##### Important Details

- 🔧 for Dependency Injection
- 📄 for File Creation
- 📝 for Code Embedding
- 🔄 for Method Toggler
- 📁 for Namespace/Filename Fixers

##### Implementation Notes

- The extension's integration with VS Code
- The modular nature of the features
- The template-based approach for code generation
- The utility functions that support multiple features

- How the extension integrates with VS Code
- The flow of operations for each feature
- The relationship between different components
- Where to add new features or modify existing ones

Remember to maintain a balance between showing enough detail to understand the system while keeping it clean and readable. The focus should be on the architectural components and their interactions rather than implementation details.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph VSCode["VS Code Editor"]
        Editor[Code Editor Window]
    end

    subgraph ExtHost["Extension Host"]
        subgraph CmdLayer["Command Handler Layer"]
            ExtMain["Extension Main"]:::cmdhandler
        end

        subgraph CoreLayer["Core Features Layer"]
            DI["🔧 Dependency Injector"]:::core
            FC["📄 File Creator"]:::core
            CE["📝 Code Embedder"]:::core
            NSF["📁 Namespace Fixer"]:::core
            FF["📁 Filename Fixer"]:::core
            MAT["🔄 Method Async Toggler"]:::core
        end

        subgraph TempSys["Template System"]
            TS["Template Storage"]:::template
            subgraph Templates["Template Types"]
                CT["Class Templates"]:::template
                IT["Interface Templates"]:::template
                ET["Enum Templates"]:::template
                TT["Test Templates"]:::template
                subgraph CodeBlocks["Code Block Templates"]
                    IB["If Block Template"]:::template
                    TCB["Try-Catch Block Template"]:::template
                end
            end
        end

        subgraph TestFw["Testing Framework"]
            TR["Test Runner"]:::test
            TS1["Test Suite"]:::test
            ET1["Extension Tests"]:::test
        end

        Utils["Utility Functions"]:::util
    end

    %% Relationships
    Editor <--> ExtMain
    ExtMain --> DI & FC & CE & NSF & FF & MAT
    DI & FC & CE & NSF & FF & MAT --> TS
    TS --> Templates
    Utils --> CmdLayer & CoreLayer & TempSys
    TR --> TS1 --> ET1

    %% Click Events
    click ExtMain "https://github.com/sharklasers996/csharp-helper/blob/master/src/extension.ts"
    click DI "https://github.com/sharklasers996/csharp-helper/blob/master/src/inject-dependency.ts"
    click FC "https://github.com/sharklasers996/csharp-helper/blob/master/src/file-creator.ts"
    click CE "https://github.com/sharklasers996/csharp-helper/blob/master/src/code-embed.ts"
    click NSF "https://github.com/sharklasers996/csharp-helper/blob/master/src/namespace-fixer.ts"
    click FF "https://github.com/sharklasers996/csharp-helper/blob/master/src/filename-fixer.ts"
    click MAT "https://github.com/sharklasers996/csharp-helper/blob/master/src/method-async-toggler.ts"
    click TS "https://github.com/sharklasers996/csharp-helper/tree/master/templates/"
    click CT "https://github.com/sharklasers996/csharp-helper/blob/master/templates/class.txt"
    click IT "https://github.com/sharklasers996/csharp-helper/blob/master/templates/interface.txt"
    click ET "https://github.com/sharklasers996/csharp-helper/blob/master/templates/enum.txt"
    click TT "https://github.com/sharklasers996/csharp-helper/blob/master/templates/test.txt"
    click CodeBlocks "https://github.com/sharklasers996/csharp-helper/tree/master/templates/code-blocks/"
    click IB "https://github.com/sharklasers996/csharp-helper/blob/master/templates/code-blocks/if.txt"
    click TCB "https://github.com/sharklasers996/csharp-helper/blob/master/templates/code-blocks/trycatch.txt"
    click Utils "https://github.com/sharklasers996/csharp-helper/blob/master/src/utilities.ts"
    click TR "https://github.com/sharklasers996/csharp-helper/blob/master/src/test/runTest.ts"
    click TS1 "https://github.com/sharklasers996/csharp-helper/tree/master/src/test/suite/"
    click ET1 "https://github.com/sharklasers996/csharp-helper/blob/master/src/test/suite/extension.test.ts"

    %% Styling
    classDef cmdhandler fill:#e1f5fe,stroke:#01579b
    classDef core fill:#e8f5e9,stroke:#1b5e20
    classDef template fill:#fff3e0,stroke:#e65100
    classDef util fill:#fce4ec,stroke:#880e4f
    classDef test fill:#f3e5f5,stroke:#4a148c

    %% Legend
    subgraph Legend
        L1["🔧 Command Handler"]:::cmdhandler
        L2["📄 Core Feature"]:::core
        L3["📝 Template"]:::template
        L4["🔄 Utility"]:::util
        L5["📁 Test"]:::test
    end
```
