|
|
||
|---|---|---|
| .forgejo/workflows | ||
| DBSwitch | ||
| .gitattributes | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| DBSwitch.sln.DotSettings | ||
| DBSwitch.slnx | ||
| README.md | ||
DB-Switch
A console-based database switching utility for managing and mounting multiple Komax HMI databases using symbolic junctions.
Overview
DB-Switch simplifies the process of switching between different database versions by:
- Managing multiple database instances in a compressed format
- Creating and removing Windows junction points to mount databases
- Providing an interactive fuzzy-search interface
- Cloning and creating new database instances
First-Time Configuration
On first startup, DB-Switch will prompt you to configure the following settings:
Required Settings
-
BasePath: The base path where the Komax HMI installation is located
- Example:
C:\Program Files\Komax - The database will be mounted at:
{BasePath}\Data\KomaxHMI\Database
- Example:
-
DatabasesPath: The directory where all database versions are stored
- Example:
C:\Databases\AllDatabases - This folder should contain subdirectories for each database version
- Example:
These settings are saved to appsettings.json and can be manually edited later.
Example appsettings.json
{
"UserSettings": {
"BasePath": "C:\Program Files\Komax",
"DatabasesPath": "C:\Databases\AllDatabases"
}
}
Features & Usage
Basic Navigation
- Type to filter: Start typing to fuzzy-match database names or enter an index number
- Enter: Select the database when only one match remains, or select by exact index
- Tab: Apply current filter and narrow down the database list
- Escape: Reset filter and show all databases
Function Keys
| Key | Function | Description |
|---|---|---|
| F1 | Edit Mode | Toggle advanced edit mode for additional operations |
| F2 | Create DB | Create a new empty database |
Edit Mode Operations (F1)
When edit mode is activated, you can choose from the following actions for any database:
- Select: Mount the selected database (same as normal selection)
- Clone: Create a copy of the database with a new name
- Prompts for a new database name
- Creates a complete copy in the DatabasesPath
- If cloning the currently mounted database, the HMI application will be closed
Create Empty Database (F2)
Creates a new empty database directory:
- Prompts for a database name
- Creates the directory structure in DatabasesPath
- Adds it to the available databases list
How It Works
Database Mounting Process
- Unmount Current: Kills any running HMI processes and removes the current junction
- Compress: Packs the current database into a
.zipfile for storage - Decompress: Unpacks the selected database (if compressed)
- Mount: Creates a Windows junction point to the selected database directory
- Ready: Database is now active and ready for use
Database Storage
- Databases are stored compressed (as
.zipfiles) when not in use - Only the mounted database is decompressed
- This saves disk space when managing multiple database versions
Display Information
The main interface shows:
- Currently Mounted Database: Displayed in red at the top
- Database List: All available databases with their index numbers
- MOUNTED indicator: Shows which database (if any) is currently active
- Highlighted Matches: Fuzzy-matched characters are highlighted in yellow
Requirements
- Windows OS (uses
mklinkcommand for junctions) - Administrator privileges (required for creating symbolic links)
- .NET 8 Runtime
Notes
- The application automatically terminates the
Komax.Program.KomaxHMIprocess when switching databases - Database operations show progress indicators for compression/decompression
- Press any key to exit after a database is successfully mounted
Troubleshooting
Database not mounting: Ensure the application is run with administrator privileges
HMI process not found: The application will continue without error if the HMI process isn't running
Directory already exists: When creating or cloning, ensure the new database name is unique