# rex706/sam architecture

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

- Interactive diagram: https://gitdiagram.com/rex706/sam
- Repository: https://github.com/rex706/sam

## Overview

Based on our inspection of the file tree and the README, SAM – Steam Account Manager is a Windows desktop application built using WPF on the .NET Framework. Its primary goal is to allow users to log into and quickly switch between multiple Steam accounts. The solution is divided into logical parts such as a UI, core business logic, resource/configuration management, and auxiliary utilities.

##### Main Components
- Entry Point & Application Setup:
– Files like App.xaml and App.xaml.cs indicate the WPF application’s entry point.
– The project file (SAM.csproj) and solution file (SAM.sln) denote the overall solution.
- Presentation / UI Layer:
– The Views directory contains various XAML views (AccountsWindow, AccountInfoDialog, PasswordWindow, etc.) which form the application’s windows and dialogs.
– The “Wpf” folder includes custom converters (e.g., PriorityMultiValueConverter.cs) used to bind data to the UI.
- Business Logic / Core Functionality:
– The Core folder holds classes that encapsulate business operations like account management (Account.cs, AccountUtils.cs), encryption (StringCipher.cs), update handling (UpdateHelper.cs), configuration (IniFile.cs), and utility functions for window and input management.
- Configuration, Resources, and Settings:
– Files in App.config, the Resources folder (like localconfig.vdf), and the Properties folder (assembly info, settings, etc.) indicate where application settings and resource binding are managed.

##### Out the Relationships and Data Flow
- User interactions begin at the UI layer (Windows and dialogs in Views) which then call into the business logic in Core.
- For example, when a user selects an account from AccountsWindow, methods in the Core are invoked to handle login actions, update account states, or encrypt credentials.
- The UI may also utilize converters and custom controls from the Wpf folder to bind data properly.
- Configuration and resources are loaded at startup (via App.xaml and App.config) and then passed to the Core modules as needed.
- Additionally, external interactions like the Steam API integration (for login status, API key usage, friend status, etc.) are managed by the business logic, even if not explicitly isolated in a separate directory.

##### Important Architectural Patterns and Technologies
- Separation of concerns is evident by splitting the project into the presentation layer (Views, Wpf) and business logic layer (Core).
- The use of WPF and XAML points towards patterns like MVVM, even if explicit ViewModel directories aren’t present; the mapping between views and model logic can be indicated as a key design principle.
- Aspect oriented programming elements might be in play with Fody (as seen in FodyWeavers.xml) to handle tasks such as property notifications or logging without cluttering core logic.
- The project makes use of various utility classes which suggest modular design and reusability within the Core.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Layer
    subgraph "Application Layer"
        A1["App.xaml"]:::appFront
        A2["App.xaml.cs"]:::appFront
        A3["SAM.csproj"]:::project
        A4["SAM.sln"]:::project
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        UI1["AccountsWindow (View)"]:::ui
        UI2["AccountInfoDialog (View)"]:::ui
        UI3["PasswordWindow (View)"]:::ui
        UI4["ExposedInfoWindow (View)"]:::ui
        UI5["ImportDelimitedWindow (View)"]:::ui
        UI6["SetTimeoutWindow (View)"]:::ui
        UI7["SettingsWindow (View)"]:::ui
        UI8["WPF Converter: PriorityMultiValueConverter"]:::ui
    end

    %% Business/Core Layer
    subgraph "Business/Core Layer"
        BL1["Account Management (Core)"]:::core
        BL2["Encryption (StringCipher)"]:::core
        BL3["Update Handling (UpdateHelper)"]:::core
        BL4["Configuration Utility (IniFile, SAMSettings)"]:::core
        BL5["Utility Functions (WindowUtils, etc.)"]:::core
    end

    %% Configuration/Resource Layer
    subgraph "Configuration/Resource"
        CR1["App.config"]:::config
        CR2["Resources (localconfig.vdf)"]:::config
        CR3["Properties (AssemblyInfo, Settings)"]:::config
    end

    %% Auxiliary/Tooling Components
    subgraph "Auxiliary/Tooling"
        AT1["FodyWeavers.xml"]:::aux
        AT2["FodyWeavers.xsd"]:::aux
        AT3["app.manifest"]:::aux
        AT4["latest.txt"]:::aux
    end

    %% Connections: Application Initialization
    A1 -->|"initializes"| UI1
    A1 -->|"initializes"| UI2
    A1 -->|"initializes"| UI3
    A1 -->|"initializes"| UI4
    A1 -->|"initializes"| UI5
    A1 -->|"initializes"| UI6
    A1 -->|"initializes"| UI7

    %% Connections: UI to Core
    UI1 -->|"triggers_account_login"| BL1
    UI2 -->|"requests_account_info"| BL1
    UI3 -->|"handles_password"| BL2
    UI1 -->|"updates_configuration"| BL4

    %% UI Enhancement
    UI8 -->|"supports_data_binding"| UI1

    %% Core Interactions within Business Logic
    BL1 -->|"invokes_encryption"| BL2
    BL1 -->|"handles_account_state"| BL3

    %% Core uses configuration resources
    BL4 -->|"loads_config"| CR1
    CR2 -->|"provides_resources"| BL1
    CR3 -->|"applies_settings"| BL4

    %% Style Definitions
    classDef appFront fill:#FAD7A0,stroke:#A93226,stroke-width:2px;
    classDef project fill:#FAD7A0,stroke:#A93226,stroke-width:2px;
    classDef ui fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef core fill:#A9DFBF,stroke:#145A32,stroke-width:2px;
    classDef config fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef aux fill:#D7BDE2,stroke:#6C3483,stroke-width:2px;

    %% Click Events for Application Layer
    click A1 "https://github.com/rex706/sam/blob/master/App.xaml"
    click A2 "https://github.com/rex706/sam/blob/master/App.xaml.cs"
    click A3 "https://github.com/rex706/sam/blob/master/SAM.csproj"
    click A4 "https://github.com/rex706/sam/blob/master/SAM.sln"

    %% Click Events for Presentation Layer
    click UI1 "https://github.com/rex706/sam/blob/master/Views/AccountsWindow.xaml"
    click UI2 "https://github.com/rex706/sam/blob/master/Views/AccountInfoDialog.xaml"
    click UI3 "https://github.com/rex706/sam/blob/master/Views/PasswordWindow.xaml"
    click UI4 "https://github.com/rex706/sam/blob/master/Views/ExposedInfoWindow.xaml"
    click UI5 "https://github.com/rex706/sam/blob/master/Views/ImportDelimitedWindow.xaml"
    click UI6 "https://github.com/rex706/sam/blob/master/Views/SetTimeoutWindow.xaml"
    click UI7 "https://github.com/rex706/sam/blob/master/Views/SettingsWindow.xaml"
    click UI8 "https://github.com/rex706/sam/blob/master/Wpf/PriorityMultiValueConverter.cs"

    %% Click Events for Business/Core Layer (representative files)
    click BL1 "https://github.com/rex706/sam/blob/master/Core/Account.cs"
    click BL2 "https://github.com/rex706/sam/blob/master/Core/StringCipher.cs"
    click BL3 "https://github.com/rex706/sam/blob/master/Core/UpdateHelper.cs"
    click BL4 "https://github.com/rex706/sam/blob/master/Core/IniFile.cs"
    click BL5 "https://github.com/rex706/sam/blob/master/Core/WindowUtils.cs"

    %% Click Events for Configuration/Resource
    click CR1 "https://github.com/rex706/sam/blob/master/App.config"
    click CR2 "https://github.com/rex706/sam/blob/master/Resources/localconfig.vdf"
    click CR3 "https://github.com/rex706/sam/blob/master/Properties/Settings.settings"

    %% Click Events for Auxiliary/Tooling
    click AT1 "https://github.com/rex706/sam/blob/master/FodyWeavers.xml"
    click AT2 "https://github.com/rex706/sam/blob/master/FodyWeavers.xsd"
    click AT3 "https://github.com/rex706/sam/blob/master/app.manifest"
    click AT4 "https://github.com/rex706/sam/blob/master/latest.txt"
```
