Cursor rule
.cursor/rules/ugtlive-project-guide.mdcUniversal Game Translator Live project overview and structure
Cursor rules
Quality
69/100
Scores the file, not the repository.Length
1,121 words
27 headings · 2 code blocksRepository
103
— · pushed 17 days agoLast changed
3 days ago
First indexed 3 days ago.1234567# Universal Game Translator Live - Project Guide89## Overview10Universal Game Translator Live (UGTLive) is a Windows WPF application that provides real-time screen translation using OCR and Large Language Models (LLMs). The application captures screen regions, performs OCR, and translates text using services like Gemini, ChatGPT, Ollama, Google Translate, or llama.cpp.1112## Project Structure1314### Core Application Files15- [src/App.xaml](mdc:src/App.xaml) - WPF application entry point16- [src/MainWindow.xaml.cs](mdc:src/MainWindow.xaml.cs) - Main application window and control logic17- [src/Logic.cs](mdc:src/Logic.cs) - Core translation and OCR processing logic18- [src/ConfigManager.cs](mdc:src/ConfigManager.cs) - Settings and configuration management1920### UI Components21- [src/MonitorWindow.xaml.cs](mdc:src/MonitorWindow.xaml.cs) - Screen capture preview window22- [src/ChatBoxWindow.xaml.cs](mdc:src/ChatBoxWindow.xaml.cs) - Translation overlay/chat display23- [src/SettingsWindow.xaml.cs](mdc:src/SettingsWindow.xaml.cs) - Application settings interface24- [src/ChatBoxOptionsWindow.xaml.cs](mdc:src/ChatBoxOptionsWindow.xaml.cs) - ChatBox customization options25- [src/ChatBoxSelectorWindow.xaml.cs](mdc:src/ChatBoxSelectorWindow.xaml.cs) - ChatBox region selector26- [src/LogWindow.xaml.cs](mdc:src/LogWindow.xaml.cs) - Log viewer window2728### Dialog Windows29- [src/UpdateAvailableDialog.xaml.cs](mdc:src/UpdateAvailableDialog.xaml.cs) - Version update notification30- [src/TtsVoiceSelectorDialog.xaml.cs](mdc:src/TtsVoiceSelectorDialog.xaml.cs) - TTS voice selection31- [src/ServiceInstallDialog.xaml.cs](mdc:src/ServiceInstallDialog.xaml.cs) - Python service installation32- [src/ServiceDiagnosticDialog.xaml.cs](mdc:src/ServiceDiagnosticDialog.xaml.cs) - Service diagnostics33- [src/ServerSetupDialog.xaml.cs](mdc:src/ServerSetupDialog.xaml.cs) - Server setup wizard34- [src/OllamaModelSelectorWindow.xaml.cs](mdc:src/OllamaModelSelectorWindow.xaml.cs) - Ollama model selection35- [src/GoogleVisionSetupDialog.xaml.cs](mdc:src/GoogleVisionSetupDialog.xaml.cs) - Google Vision setup36- [src/ShutdownDialog.xaml.cs](mdc:src/ShutdownDialog.xaml.cs) - Shutdown confirmation37- [src/NoTextInfoDialog.xaml.cs](mdc:src/NoTextInfoDialog.xaml.cs) - No text detected notification3839### OCR Services40- [src/WindowsOCRManager.cs](mdc:src/WindowsOCRManager.cs) - Windows built-in OCR integration41- [src/GoogleVisionOCRService.cs](mdc:src/GoogleVisionOCRService.cs) - Google Cloud Vision OCR42- [src/UniversalBlockDetector.cs](mdc:src/UniversalBlockDetector.cs) - Advanced text block detection and grouping43- [src/PythonServicesManager.cs](mdc:src/PythonServicesManager.cs) - Manages Python OCR services (EasyOCR, MangaOCR, PaddleOCR, DocTR)44- [src/PythonService.cs](mdc:src/PythonService.cs) - Individual Python service wrapper4546### Translation Services47- [src/ITranslationService.cs](mdc:src/ITranslationService.cs) - Translation service interface48- [src/GeminiTranslationService.cs](mdc:src/GeminiTranslationService.cs) - Google Gemini API integration49- [src/ChatGptTranslationService.cs](mdc:src/ChatGptTranslationService.cs) - OpenAI ChatGPT integration50- [src/OllamaTranslationService.cs](mdc:src/OllamaTranslationService.cs) - Local Ollama LLM integration51- [src/GoogleTranslateService.cs](mdc:src/GoogleTranslateService.cs) - Google Translate integration52- [src/LlamaCppTranslationService.cs](mdc:src/LlamaCppTranslationService.cs) - llama.cpp local translation53- [src/TranslationServiceFactory.cs](mdc:src/TranslationServiceFactory.cs) - Factory for creating translation services5455### Audio Services56- [src/GoogleTTSService.cs](mdc:src/GoogleTTSService.cs) - Google Text-to-Speech57- [src/ElevenLabsService.cs](mdc:src/ElevenLabsService.cs) - ElevenLabs TTS integration58- [src/OpenAIRealtimeAudioService.cs](mdc:src/OpenAIRealtimeAudioService.cs) - OpenAI real-time audio transcription59- [src/AudioPlaybackManager.cs](mdc:src/AudioPlaybackManager.cs) - Audio playback management60- [src/AudioPreloadService.cs](mdc:src/AudioPreloadService.cs) - TTS audio preloading6162### Utilities and Managers63- [src/HotkeyManager.cs](mdc:src/HotkeyManager.cs) - Global keyboard shortcuts management64- [src/MouseManager.cs](mdc:src/MouseManager.cs) - Mouse input handling65- [src/LogManager.cs](mdc:src/LogManager.cs) - Application logging66- [src/SplashManager.cs](mdc:src/SplashManager.cs) - Splash screen management67- [src/TextObject.cs](mdc:src/TextObject.cs) - Text region data structure68- [src/ErrorPopupManager.cs](mdc:src/ErrorPopupManager.cs) - Error popup management69- [src/GamepadManager.cs](mdc:src/GamepadManager.cs) - Gamepad input management70- [src/WebViewEnvironmentManager.cs](mdc:src/WebViewEnvironmentManager.cs) - WebView2 environment management71- [src/WebViewPool.cs](mdc:src/WebViewPool.cs) - WebView2 instance pooling72- [src/OverlayProfiler.cs](mdc:src/OverlayProfiler.cs) - Overlay performance profiling73- [src/CondaHelper.cs](mdc:src/CondaHelper.cs) - Conda environment management74- [src/ServiceConfigParser.cs](mdc:src/ServiceConfigParser.cs) - Python service config parsing75- [src/ServiceItemViewModel.cs](mdc:src/ServiceItemViewModel.cs) - Service UI view model76- [src/OllamaModelDownloader.cs](mdc:src/OllamaModelDownloader.cs) - Ollama model download management77- [src/HotkeyEntry.cs](mdc:src/HotkeyEntry.cs) - Hotkey entry data structure78- [src/TranslationEventArgs.cs](mdc:src/TranslationEventArgs.cs) - Translation event arguments7980### Python Services81- `app/services/EasyOCR/` - EasyOCR Python service82- `app/services/MangaOCR/` - MangaOCR Python service83- `app/services/PaddleOCR/` - PaddleOCR Python service84- `app/services/DocTR/` - DocTR Python service85- `app/services/shared/` - Shared Python utilities86- `app/services/util/` - Python installation utilities8788Each Python service directory contains:89- `server.py` - FastAPI server implementation90- `service_config.txt` - Service configuration91- `Install.bat` - Installation script92- `RunServer.bat` - Server launch script93- `DiagnosticTest.bat` - Diagnostic test script94- `Uninstall.bat` - Uninstallation script9596## Key Architectural Patterns9798### Singleton Pattern99The application uses singleton pattern for core managers:100- `Logic.Instance` - Main application logic101- `ConfigManager.Instance` - Configuration management102- `UniversalBlockDetector.Instance` - Text block detection (replaces BlockDetectionManager)103- `LogManager.Instance` - Logging104- `HotkeyManager.Instance` - Keyboard shortcuts (replaces KeyboardShortcuts)105- `PythonServicesManager.Instance` - Python OCR service management106- `AudioPlaybackManager.Instance` - Audio playback107- `AudioPreloadService.Instance` - Audio preloading108- `GamepadManager.Instance` - Gamepad input109110### Window Management111Each window inherits from WPF Window class and follows these patterns:112- Windows are typically created once and shown/hidden as needed113- Settings are persisted through ConfigManager114- Windows communicate through events and direct method calls on Logic.Instance115116### Translation Flow1171. Screen capture → OCR (Windows OCR, EasyOCR, MangaOCR, PaddleOCR, DocTR, or Google Vision) → Universal Block Detection → Translation Service → Display1182. Text blocks are grouped by UniversalBlockDetector1193. Translation includes context from previous translations1204. Results are displayed in ChatBox or as overlay121122## Development Guidelines123124### Code Style125- **Naming**: PascalCase for public members, camelCase for private, underscore prefix for fields126- **Layout**: 4-space indentation, Allman braces, System namespaces first127- **Properties**: Use GetVariableName/SetVariableName pattern in ConfigManager128- **UI Properties**: Direct Get/Set to GUI elements when possible129- **Error Handling**: Avoid try/catch blocks, check for null, log errors via LogManager130131### Project Configuration132- **Framework**: .NET 8.0 Windows133- **Output**: `app/` directory134- **Assembly**: `ugtlive.exe` (or `ugtlive_debug.exe` in Debug)135- **Dependencies**: NAudio, Microsoft.Windows.CsWinRT, WebView2136137### Key Features138- Multiple OCR backends (Windows OCR, EasyOCR, MangaOCR, PaddleOCR, DocTR, Google Vision)139- Multiple translation services (Gemini, ChatGPT, Ollama, Google Translate, llama.cpp)140- Real-time screen capture and translation141- Customizable overlay windows142- Audio transcription and TTS143- Context-aware translations144- Global keyboard shortcuts (via HotkeyManager)145- Gamepad support146- Python service management UI147148## Common Development Tasks149150### Adding a New Translation Service1511. Create a new class implementing `ITranslationService`1522. Add service configuration to `ConfigManager`1533. Update `TranslationServiceFactory` to create instances1544. Add UI controls in `SettingsWindow.xaml`155156### Adding New Settings1571. Add property to `ConfigManager` with getter/setter1582. Add UI controls to `SettingsWindow.xaml`1593. Wire up events in `SettingsWindow.xaml.cs`1604. Settings are automatically persisted161162### Adding a New Python OCR Service1631. Create service directory in `app/services/` (e.g., `app/services/NewOCR/`)1642. Create `service_config.txt` with required fields1653. Create `server.py` implementing FastAPI endpoints1664. Create batch scripts: `Install.bat`, `RunServer.bat`, `DiagnosticTest.bat`, `Uninstall.bat`1675. Service will be automatically discovered by `PythonServicesManager`168169### Debugging OCR Issues1701. Check `LogManager` output for errors1712. Use Monitor window to preview capture area1723. Verify Python server is running (for Python OCR services)1734. Check service diagnostics dialog1745. Review UniversalBlockDetector settings175176## Version Management177178When incrementing the version number, you must update it in **THREE places**:1791801. **[src/SplashManager.cs](mdc:src/SplashManager.cs)** - `CurrentVersion` constant181```csharp182 public const double CurrentVersion = 0.60; // Update this value183```1841852. **[media/latest_version_checker.json](mdc:media/latest_version_checker.json)** - `latest_version` field186```json187 {188 "name":"Universal Game Translator Live",189 "latest_version":0.60, // Update this value190 "message":"Download V{VERSION_STRING} now from rtsoft.com?\n\nV0.60: " // Update version in message191 }192```1931943. **[README.md](mdc:README.md)** - Version badge and history entry195 - Update the version badge: `[]`196 - Add a new history entry at the top: `**V0.60** - [description]`197198### Version Increment Rules199- Default increment: **0.01** (e.g., 0.25 → 0.26)200- Major features: **0.10** (e.g., 0.25 → 0.35)201- Complete rewrites: **1.00** (e.g., 0.99 → 1.00)202- **ALWAYS update all three files** to keep them in sync203- Version format is a double/float (e.g., 0.60, not "0.60")204205## Important Notes206- Application is Windows-only due to WPF and Windows OCR dependencies207- Python OCR services run locally on configurable ports208- First run downloads OCR language models209- Settings stored in `app/` directory (config.txt, service configs)210- All web calls are for version checking and API services only211
Also in SethRobinson/UGTLive
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| SethRobinson/UGTLive.cursor/rules/ui-ux-patterns.mdc · 103 | Cursor rules | stylearchtypesui+1 | 62/100 | 3 days ago | |
| SethRobinson/UGTLive.cursor/rules/architecture-patterns.mdc · 103 | Cursor rules | buildtestlint-formatstyle+6 | 77/100 | 3 days ago | |
| SethRobinson/UGTLive.cursor/rules/async-threading-patterns.mdc · 103 | Cursor rules | styleuido-not | 65/100 | 3 days ago | |
| SethRobinson/UGTLive.cursor/rules/code-style-conventions.mdc · 103 | Cursor rules | stylearchtypesdocs | 62/100 | 3 days ago | |
| SethRobinson/UGTLive.cursor/rules/configuration-management.mdc · 103 | Cursor rules | archsecuritydatabaseapi+1 | 65/100 | 3 days ago | |
| SethRobinson/UGTLive.cursor/rules/debugging-testing.mdc · 103 | Cursor rules | buildteststylearch+3 | 69/100 | 3 days ago | |
| SethRobinson/UGTLive.cursor/rules/locale-invariant-formatting.mdc · 103 | Cursor rules | lint-formatuido-not | 61/100 | 3 days ago | |
| SethRobinson/UGTLive.cursor/rules/service-integration-patterns.mdc · 103 | Cursor rules | buildteststylearch | 69/100 | 3 days ago | |
| SethRobinson/UGTLive.cursor/rules/translation-workflow.mdc · 103 | Cursor rules | testlint-formatarchapi+3 | 66/100 | 3 days ago | |
| SethRobinson/UGTLive.cursor/rules/versioning-workflow.mdc · 103 | Cursor rules | stylegitdeploymentagent-behaviour+1 | 62/100 | 3 days ago | |
| SethRobinson/UGTLive.cursor/rules/wpf-ui-patterns.mdc · 103 | Cursor rules | setuplint-formatstylearch+1 | 66/100 | 3 days ago | |
| SethRobinson/UGTLiveAGENTS.md · 103 | AGENTS.md | testgitsecurityperformance+1 | 74/100 | 3 days ago |
Diff against .cursor/rules/ui-ux-patterns.mdc Diff against .cursor/rules/architecture-patterns.mdc Diff against .cursor/rules/async-threading-patterns.mdc Diff against .cursor/rules/code-style-conventions.mdc Diff against .cursor/rules/configuration-management.mdc Diff against .cursor/rules/debugging-testing.mdc Diff against .cursor/rules/locale-invariant-formatting.mdc Diff against .cursor/rules/service-integration-patterns.mdc Diff against .cursor/rules/translation-workflow.mdc Diff against .cursor/rules/versioning-workflow.mdc Diff against .cursor/rules/wpf-ui-patterns.mdc Diff against AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| ThanhTrunggDEV/DontBeLazy.cursor/rules/rust-testing.mdc · 6 | Cursor rules | teststyletesting-strategy | 90/100 | 3 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/dart-testing.mdc · 6 | Cursor rules | teststyletypestesting-strategy | 85/100 | 3 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/dart-coding-style.mdc · 6 | Cursor rules | lint-formatstyletypesdo-not | 84/100 | 3 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/rust-security.mdc · 6 | Cursor rules | stylesecuritydatabasedo-not | 80/100 | 3 days ago | |
| imazen/imageflow.cursor/rules/ci.mdc · 4.4k | Cursor rules | setupbuildtestarch+3 | 79/100 | 3 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/rust-coding-style.mdc · 6 | Cursor rules | lint-formatstyle | 78/100 | 3 days ago | |
| ThanhTrunggDEV/DontBeLazy.cursor/rules/dart-hooks.mdc · 6 | Cursor rules | lint-formatarchtesting-strategygit+1 | 78/100 | 3 days ago | |
| SethRobinson/UGTLive.cursor/rules/architecture-patterns.mdc · 103 | Cursor rules | buildtestlint-formatstyle+6 | 77/100 | 3 days ago |
