# codecentrix/open-twebst architecture

> Architecture diagram of the GitHub repository codecentrix/open-twebst, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/codecentrix/open-twebst
- Repository: https://github.com/codecentrix/open-twebst

## Overview

##### Main Components

a) Core Components Layer:
- OpenTwebstLib (COM Library)
- BrowserPlugin (IE Plugin Integration)
- Common Services
- Debug Services

b) User Interface Layer:
- Macro Recorder (OpenTwebst folder - C# GUI application)
- Code Generator Components

c) Integration Layer:
- Language Bindings (C#, VB.NET, C++, Python, VBA)
- COM Interface Layer

**[Top Layer - Client Applications]**

- Language Bindings
- C# Integration
- VB.NET Integration
- Python Integration
- VBA/Excel Integration
- C++ Integration

**[Middle Layer - Core Framework]**

- OpenTwebst Macro Recorder (GUI)
- Code Generators
- C# Generator
- VB Generator
- JavaScript Generator
- Python Generator
- Recording Engine

**[Bottom Layer - COM Infrastructure]**

- OpenTwebstLib (COM Library)
- Browser Control
- Element Management
- Frame Management
- Core Services

- Browser Plugin
- Event Handlers
- Element Finders
- Async Actions

- Common Services
- Debug Services
- Marshal Services
- HTML Helpers

##### Important Relationships

- COM interface exposure points to external applications
- Event flow from IE through the plugin to the library
- Code generation flow from recorder to output files

##### Additional Details

- Component types
- Communication patterns
- Integration points
- File extensions for generated code
- Supported IE versions (6-11)

##### Technical Notes

Annotations for:
- COM registration requirements
- Protected mode compatibility
- Windows version support
- Hardware event simulation capabilities
- Synchronization mechanisms

##### Implementation Details

- The COM-based architecture
- The separation between native IE interaction and high-level automation
- The macro recording and code generation pipeline
- The async action handling system
- The element search and manipulation capabilities

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef clientLayer fill:#a8d1f0,stroke:#333
    classDef coreLayer fill:#90EE90,stroke:#333
    classDef comLayer fill:#FFB347,stroke:#333
    classDef commonLayer fill:#D3D3D3,stroke:#333
    classDef interface fill:#FFE4B5,stroke:#333

    %% Legend
    subgraph Legend
        L1[Client Applications]:::clientLayer
        L2[Core Framework]:::coreLayer
        L3[COM Infrastructure]:::comLayer
        L4[Common Services]:::commonLayer
        L5[Interface Points]:::interface
    end

    %% Client Applications Layer
    subgraph ClientApps
        LangBindings{"Language Bindings"}
        CSharp["C# Integration"]:::clientLayer
        VBNet["VB.NET Integration"]:::clientLayer
        Python["Python Integration"]:::clientLayer
        VBA["VBA/Excel Integration"]:::clientLayer
        CPP["C++ Integration"]:::clientLayer
    end

    %% Core Framework Layer
    subgraph CoreFramework
        MacroRecorder["OpenTwebst Macro Recorder"]:::coreLayer
        CodeGen["Code Generators"]:::coreLayer
        CSharpGen["C# Generator"]:::coreLayer
        VBGen["VB Generator"]:::coreLayer
        JSGen["JavaScript Generator"]:::coreLayer
        PyGen["Python Generator"]:::coreLayer
        RecEngine["Recording Engine"]:::coreLayer
    end

    %% COM Infrastructure Layer
    subgraph COMInfra
        OpenTwebstLib["OpenTwebstLib"]:::comLayer
        BrowserControl["Browser Control"]:::comLayer
        ElementMgmt["Element Management"]:::comLayer
        FrameMgmt["Frame Management"]:::comLayer
        CoreServices["Core Services"]:::comLayer
        
        BrowserPlugin["Browser Plugin"]:::comLayer
        EventHandlers["Event Handlers"]:::comLayer
        ElementFinders["Element Finders"]:::comLayer
        AsyncActions["Async Actions"]:::comLayer
    end

    %% Common Services Layer
    subgraph CommonServices
        DebugServices["Debug Services"]:::commonLayer
        MarshalServices["Marshal Services"]:::commonLayer
        HTMLHelpers["HTML Helpers"]:::commonLayer
    end

    %% Relationships
    LangBindings --> MacroRecorder
    MacroRecorder --> CodeGen
    CodeGen --> CSharpGen & VBGen & JSGen & PyGen
    MacroRecorder --> RecEngine
    RecEngine --> OpenTwebstLib
    OpenTwebstLib --> BrowserControl & ElementMgmt & FrameMgmt & CoreServices
    BrowserPlugin --> EventHandlers & ElementFinders & AsyncActions
    CommonServices --> DebugServices & MarshalServices & HTMLHelpers

    %% Click events for component mapping
    click OpenTwebstLib "https://github.com/codecentrix/open-twebst/tree/master/OpenTwebstLib"
    click BrowserPlugin "https://github.com/codecentrix/open-twebst/tree/master/BrowserPlugin"
    click ElementFinders "https://github.com/codecentrix/open-twebst/blob/master/BrowserPlugin/FindElement.cpp"
    click EventHandlers "https://github.com/codecentrix/open-twebst/blob/master/BrowserPlugin/FireEventAsyncAction.cpp"
    click AsyncActions "https://github.com/codecentrix/open-twebst/blob/master/BrowserPlugin/AsyncAction.h"
    click DebugServices "https://github.com/codecentrix/open-twebst/blob/master/Dbgserv/DebugServices.cpp"
    click MacroRecorder "https://github.com/codecentrix/open-twebst/blob/master/OpenTwebst/Recorder.cs"
    click CSharpGen "https://github.com/codecentrix/open-twebst/blob/master/OpenTwebst/CSharpGenerator.cs"
    click VBGen "https://github.com/codecentrix/open-twebst/blob/master/OpenTwebst/VbNetGenerator.cs"
    click JSGen "https://github.com/codecentrix/open-twebst/blob/master/OpenTwebst/JsGenerator.cs"
    click PyGen "https://github.com/codecentrix/open-twebst/blob/master/OpenTwebst/PyGenerator.cs"
    click CSharp "https://github.com/codecentrix/open-twebst/tree/master/Samples/C#"
    click VBNet "https://github.com/codecentrix/open-twebst/blob/master/Samples/VB.Net"
    click CPP "https://github.com/codecentrix/open-twebst/tree/master/Samples/C++"
    click HTMLHelpers "https://github.com/codecentrix/open-twebst/blob/master/Common/HtmlHelpers.cpp"
    click MarshalServices "https://github.com/codecentrix/open-twebst/blob/master/Common/MarshalService.cpp"
```
