Skip to content

Free, open-source Windows optimization tool for performance, privacy, and simplicity.

refactor: replace legacy console app with new WPF GUI version

itsfatduck0653758e1174
diff --git a/.github/assets/app_dark.png b/.github/assets/app_dark.png
new file mode 100644
index 0000000..f18d16f
Binary files /dev/null and b/.github/assets/app_dark.png differ
diff --git a/.github/assets/app_light.png b/.github/assets/app_light.png
new file mode 100644
index 0000000..26cb7f0
Binary files /dev/null and b/.github/assets/app_light.png differ
diff --git a/.github/assets/app_screenshot.png b/.github/assets/app_screenshot.png
deleted file mode 100644
index 423bfca..0000000
Binary files a/.github/assets/app_screenshot.png and /dev/null differ
diff --git a/.gitignore b/.gitignore
index 75a5ed0..feec10c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
-# Created by https://www.toptal.com/developers/gitignore/api/csharp,rider,visualstudio,windows
-# Edit at https://www.toptal.com/developers/gitignore?templates=csharp,rider,visualstudio,windows
+# Created by https://www.toptal.com/developers/gitignore/api/csharp,windows,rider,visualstudio,visualstudiocode
+# Edit at https://www.toptal.com/developers/gitignore?templates=csharp,windows,rider,visualstudio,visualstudiocode
### Csharp ###
## Ignore Visual Studio temporary files, build results, and
@@ -8,7 +8,6 @@
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
-.vscode/
*.rsuser
*.suo
*.user
@@ -403,7 +402,7 @@ FodyWeavers.xsd
### Rider ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
-
+.idea/
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
@@ -479,6 +478,19 @@ fabric.properties
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
+### VisualStudioCode ###
+!.vscode/*.code-snippets
+
+# Local History for Visual Studio Code
+
+# Built Visual Studio Code Extensions
+*.vsix
+
+### VisualStudioCode Patch ###
+# Ignore all local history of files
+.history
+.ionide
+
### Windows ###
# Windows thumbnail cache files
Thumbs.db
@@ -681,6 +693,6 @@ $RECYCLE.BIN/
### VisualStudio Patch ###
# Additional files built by Visual Studio
-# End of https://www.toptal.com/developers/gitignore/api/csharp,rider,visualstudio,windows
-.gemini/
-gha-creds-*.json
+# End of https://www.toptal.com/developers/gitignore/api/csharp,windows,rider,visualstudio,visualstudiocode
+
+
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 0000000..0281c30
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,37 @@
+# Repository Guidelines
+
+## Project Structure & Module Organization
+This is a WPF app solution rooted at `optimizerDuck-wpf.slnx`. The main app project is `optimizerDuck/`, and the test project is `optimizerDuck.Test/`. Key folders:
+- `optimizerDuck/Core/`: core models, interfaces, and optimizers.
+- `optimizerDuck/Common/`: shared helpers and extensions.
+- `optimizerDuck/Services/`: app services and managers.
+- `optimizerDuck/UI/ViewModels/` and `optimizerDuck/UI/Views/`: MVVM UI layer.
+- `optimizerDuck/Resources/`: assets and localization (e.g., `Resources/Images`, `Resources/Languages`).
+
+## Build, Test, and Development Commands
+Run from the repo root:
+- `dotnet restore optimizerDuck-wpf.slnx` — restore NuGet packages.
+- `dotnet build optimizerDuck-wpf.slnx -c Release` — build the full solution.
+- `dotnet run --project optimizerDuck/optimizerDuck.csproj` — run the WPF app locally.
+- `dotnet test optimizerDuck-wpf.slnx` — run all tests (xUnit).
+
+## Coding Style & Naming Conventions
+- Language: C# with nullable reference types enabled (`net10.0-windows`).
+- Indentation: 4 spaces for C# and XAML.
+- Naming: PascalCase for types/methods, camelCase for locals, `I` prefix for interfaces.
+- Architecture: MVVM; keep view logic in ViewModels and UI logic in Views.
+- Toolkit: `CommunityToolkit.Mvvm` is used for view models and commands.
+
+## Testing Guidelines
+- Framework: xUnit (`optimizerDuck.Test/`).
+- Naming: use `ClassNameTests` and place tests alongside feature folders (e.g., `optimizerDuck.Test/Services/`).
+- Run: `dotnet test optimizerDuck-wpf.slnx`.
+
+## Commit & Pull Request Guidelines
+- Recent commits use a short prefix and colon, e.g., `Refactor: Improve registry & service error handling`.
+- Keep messages concise and imperative; avoid single-letter messages.
+- PRs should include a short summary, linked issue (if any), and screenshots for UI changes.
+
+## Configuration & Safety Notes
+- The app targets Windows (`net10.0-windows`) and runs as a WinExe; build on Windows.
+- Optimization actions may change system settings; document new apply/revert steps in `Core/` and `Services/`, and surface them in the UI with clear labels.
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
deleted file mode 100644
index af4a7f8..0000000
--- a/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,121 +0,0 @@
-# Contributor Covenant Code of Conduct
-
-## Our Pledge
-
-We as members, contributors, and leaders pledge to make participation in our
-community a harassment-free experience for everyone, regardless of age, body
-size, visible or invisible disability, ethnicity, sex characteristics, gender
-identity and expression, level of experience, education, socio-economic status,
-nationality, personal appearance, race, religion, or sexual identity
-and orientation.
-
-We pledge to act and interact in ways that are welcoming, open, inclusive,
-and respectful.
-
-## Our Standards
-
-Examples of behavior that contributes to a positive environment for our
-community include:
-
-* Demonstrating empathy and kindness toward other people
-* Being respectful of differing opinions, viewpoints, and experiences
-* Giving and gracefully accepting constructive feedback
-* Accepting responsibility and apologizing to those affected by our mistakes,
- and learning from the experience
-* Focusing on what is best not just for us as individuals, but for the
- overall community
-
-Examples of unacceptable behavior include:
-
-* The use of sexualized language or imagery, and sexual attention or
- advances of any kind
-* Trolling, insulting or derogatory comments, and personal or political attacks
-* Public or private harassment
-* Publishing others' private information, such as a physical or email
- address, without their explicit permission
-* Other conduct which could reasonably be considered inappropriate in a
- professional setting
-
-## Enforcement Responsibilities
-
-Community leaders are responsible for clarifying and enforcing our standards of
-acceptable behavior and will take appropriate and fair corrective action in
-response to any behavior that they deem inappropriate, threatening, offensive,
-or harmful.
-
-Community leaders have the right and responsibility to remove, edit, or reject
-comments, commits, code, wiki edits, issues, and other contributions that are
-not aligned to this Code of Conduct, and will communicate reasons for moderation
-decisions when appropriate.
-
-## Scope
-
-This Code of Conduct applies within all community spaces, and also applies when
-an individual is officially representing the community in public spaces.
-Examples of representing our community include using an official e-mail address,
-posting via an official social media account, or acting as an appointed
-representative at an online or offline event.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-reported to the community leaders responsible for enforcement at [[email protected]](mailto:[email protected]).
-All complaints will be reviewed and investigated promptly and fairly.
-
-All community leaders are obligated to respect the privacy and security of the
-reporter of any incident.
-
-## Enforcement Guidelines
-
-Community leaders will follow these Community Impact Guidelines in determining
-the consequences for any action they deem in violation of this Code of Conduct:
-
-### 1. Correction
-
-**Community Impact**: Use of inappropriate language or other behavior deemed
-unprofessional or unwelcome in the community.
-
-**Consequence**: A private, written warning from community leaders, providing
-clarity around the nature of the violation and an explanation of why the
-behavior was inappropriate. A public apology may be requested.
-
-### 2. Warning
-
-**Community Impact**: A violation through a single incident or series
-of actions.
-
-**Consequence**: A warning with consequences for continued behavior. No
-interaction with the people involved, including unsolicited interaction with
-those enforcing the Code of Conduct, for a specified period of time. This
-includes avoiding interaction in community spaces as well as external channels
-like social media. Violating these terms may lead to a temporary or
-permanent ban.
-
-### 3. Temporary Ban
-
-**Community Impact**: A serious violation of community standards, including
-sustained inappropriate behavior.
-
-**Consequence**: A temporary ban from any sort of interaction or public
-communication with the community for a specified period of time. No public or
-private interaction with the people involved, including unsolicited interaction
-with those enforcing the Code of Conduct, is allowed during this period.
-Violating these terms may lead to a permanent ban.
-
-### 4. Permanent Ban
-
-**Community Impact**: Demonstrating a pattern of violation of community
-standards, including sustained inappropriate behavior, harassment of an
-individual, or aggression toward or disparagement of classes of individuals.
-
-**Consequence**: A permanent ban from any sort of public interaction within
-the community.
-
-## Attribution
-
-This Code of Conduct is adapted from the [Contributor Covenant][homepage],
-version 2.0, available at
-[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
-
-[homepage]: https://www.contributor-covenant.org
-[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index d2eccf8..0000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,245 +0,0 @@
-# Contributing to optimizerDuck
-
-First off, thank you for considering contributing to optimizerDuck! We're thrilled you're here. This project is open to everyone, and we welcome any contributions, from fixing typos to implementing new features. Your help is essential for making optimizerDuck the best Windows optimization tool it can be.
-
-Our mission is to provide a free, open-source, and powerful tool that enhances system performance, privacy, and simplicity for everyone.
-
-## Code of Conduct
-
-This project and everyone participating in it is governed by the [optimizerDuck Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers via GitHub Issues or on our Discord server.
-
-## How Can I Contribute?
-
-### Reporting Bugs
-
-Bugs are tracked as [GitHub Issues](https://github.com/itsfatduck/optimizerDuck/issues). Before creating a bug report, please check the existing issues to see if someone has already reported it.
-
-When creating a bug report, please include as many details as possible. Fill out the required template, which will help us resolve issues faster.
-
-**Bug Report Template**:
-```markdown
-**Describe the bug**
-A clear and concise description of what the bug is.
-
-**To Reproduce**
-Steps to reproduce the behavior:
-1. Go to '...'
-2. Click on '....'
-3. Scroll down to '....'
-4. See error
-
-**Expected behavior**
-A clear and concise description of what you expected to happen.
-
-**Screenshots**
-If applicable, add screenshots to help explain your problem.
-
-**Environment**
-- OS: [e.g., Windows 11 Pro 23H2]
-- Version: [e.g., 1.3.0]
-
-**Logs**
-Please include any relevant logs. You can find the log file at `%APPDATA%\optimizerDuck\optimizerDuck.log`.
-```
-
-### Suggesting Features
-
-We love to hear your ideas for improving optimizerDuck! Feature suggestions are tracked as [GitHub Issues](https://github.com/itsfatduck/optimizerDuck/issues). Use the "Feature Request" template and provide a clear explanation of your suggestion.
-
-**Feature Request Template**:
-```markdown
-**Is your feature request related to a problem?**
-A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
-
-**Describe the solution you'd like**
-A clear and concise description of what you want to happen.
-
-**Describe alternatives you've considered**
-A clear and concise description of any alternative solutions or features you've considered.
-
-**Additional context**
-Add any other context or screenshots about the feature request here.
-```
-
-### Pull Requests
-
-Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests.
-
-1. Fork the repo and create your branch from `master`.
-2. If you've added code that should be tested, add tests.
-3. If you've changed APIs, update the documentation.
-4. Ensure the test suite passes.
-5. Make sure your code lints.
-6. Issue that pull request!
-
-## Development Setup
-
-Ready to contribute? Here’s how to set up optimizerDuck for local development.
-
-#### Prerequisites
-
-* [.NET 10.0 SDK](https://dotnet.microsoft.com/download/dotnet/10.0)
-* Git
-
-#### Setup Instructions
-
-```bash
-# 1. Clone the repository
-git clone https://github.com/itsfatduck/optimizerDuck.git
-
-# 2. Navigate to the project directory
-cd optimizerDuck
-
-# 3. Build the project to restore dependencies
-dotnet build
-
-# 4. Run the tests to ensure everything is working
-dotnet test
-
-# 5. Run the application
-dotnet run --project optimizerDuck
-```
-
-## Development Workflow
-
-#### Branch Naming
-
-To keep our branch structure organized, please follow this convention:
-> **Note:** Current repo doesn't follow this convention fully, but this is the direction for organizing branches in the future.
-
-* `feature/<description>` for new features (e.g., `feature/add-new-tweak`)
-* `fix/<description>` for bug fixes (e.g., `fix/resolve-crash-on-start`)
-* `docs/<description>` for documentation changes (e.g., `docs/update-readme`)
-* `refactor/<description>` for code refactoring (e.g., `refactor/optimize-registry-service`)
-* `chore/<description>` for build scripts, tooling, etc. (e.g., `chore/update-dependencies`)
-
-#### Commit Messages
-
-We follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. This makes the commit history easier to read and helps with automating changelogs.
-
-A commit message should be structured as follows:
-
-```
-type(scope): subject
-
-body
-
-footer
-```
-
-**Types**: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`
-
-**Examples**:
-
-```
-feat(Optimizers): add new tweak to disable Superfetch
-```
-
-```
-fix(UI): correct typo in the main menu prompt
-```
-
-```
-docs(CONTRIBUTING): add development setup instructions
-```
-
-## Coding Standards
-
-#### Style Guide
-
-* We follow the standard C# and .NET coding conventions.
-* Code formatting rules are defined in the `.editorconfig` file. Please ensure your editor respects these settings.
-* Use meaningful names for variables, methods, and classes.
-
-#### Best Practices
-
-* Write self-documenting code where possible.
-* Add XML comments (`///`) for public methods and complex logic.
-* Keep functions and methods small and focused on a single responsibility.
-* Aim for clarity and simplicity.
-
-## Testing
-
-#### Writing Tests
-
-* New features should be accompanied by unit tests.
-* Bug fixes should include a test case that reproduces the bug and verifies the fix.
-* Tests are located in the `optimizerDuck.Test` project.
-
-#### Running Tests
-
-You can run all tests from the root directory:
-
-```bash
-# Run all tests
-dotnet test
-
-# Run tests in watch mode
-dotnet watch test
-```
-
-## Documentation
-
-#### Code Documentation
-
-* Public APIs, classes, and methods should be documented using XML comments.
-* Explain complex algorithms or business logic with comments in the code.
-
-#### README Updates
-
-* If you add or change a feature, please update the `README.md` to reflect the changes.
-* Ensure any new tweaks are listed in the "Features" section.
-
-## Pull Request Process
-
-1. **Before Submitting**
- * Run `dotnet test` to ensure all tests pass locally.
- * Ensure your code adheres to the coding standards.
- * Update the `README.md` and any other relevant documentation.
- * Self-review your changes to catch any obvious issues.
-
-2. **PR Description Template**
- Please fill out the pull request template to help reviewers understand your contribution.
-
- ```markdown
- ## Description
- A brief description of the changes in this pull request.
-
- ## Type of Change
- - [ ] Bug fix (non-breaking change which fixes an issue)
- - [ ] New feature (non-breaking change which adds functionality)
- - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- - [ ] Documentation update
- - [ ] Refactor
-
- ## Related Issues
- Fixes #(issue number)
-
- ## Testing
- - [ ] All tests pass locally with my changes.
- - [ ] I have added tests that prove my fix is effective or that my feature works.
- - [ ] I have updated existing tests to accommodate my changes.
-
- ## Checklist
- - [ ] My code follows the style guidelines of this project.
- - [ ] I have performed a self-review of my own code.
- - [ ] I have commented on my code, particularly in hard-to-understand areas.
- - [ ] I have made corresponding changes to the documentation.
- - [ ] My changes generate no new warnings.
- ```
-
-3. **Review Process**
- * One or more maintainers will review your pull request.
- * Please be responsive to feedback and questions.
- * Once your PR is approved, it will be merged into the `master` branch.
-
-## Community
-
-#### Getting Help
-
-* **Discord:** Join our [Discord Server](https://discord.gg/tDUBDCYw9Q) to chat with the community and get help.
-* **GitHub Discussions:** Use [GitHub Discussions](https://github.com/itsfatduck/optimizerDuck/discussions) for questions, ideas, and to show off your results.
-
-## License
-
-By contributing to optimizerDuck, you agree that your contributions will be licensed under the [CC BY-NC-SA 4.0 License](./LICENSE).
diff --git a/GEMINI.md b/GEMINI.md
deleted file mode 100644
index 3c6d69d..0000000
--- a/GEMINI.md
+++ /dev/null
@@ -1,45 +0,0 @@
-# optimizerDuck
-
-## Project Overview
-
-optimizerDuck is a free and open-source Windows optimization tool built with .NET 10.0. It provides a simple and intuitive command-line interface for applying various tweaks to improve system performance, privacy, and user experience. The tool is designed to be modular, allowing users to select which tweaks to apply. It also prioritizes safety by prompting users to create a system restore point before making any changes.
-
-The application uses the following key technologies:
-
-* **.NET 10.0**: The core framework for the application.
-* **Spectre.Console**: A library for creating beautiful and interactive command-line interfaces.
-* **Serilog**: A flexible logging framework for .NET applications.
-* **Microsoft.PowerShell.SDK**: To interact with PowerShell for some of the tweaks.
-
-The project is structured into two main parts:
-
-* **optimizerDuck**: The main application, containing the core logic, UI, and optimization tweaks.
-* **optimizerDuck.Test**: A separate project for unit tests.
-
-## Building and Running
-
-To build and run the project, you will need the .NET 10.0 SDK installed.
-
-1. **Clone the repository:**
- ```bash
- git clone https://github.com/itsfatduck/optimizerDuck.git
- ```
-2. **Navigate to the project directory:**
- ```bash
- cd optimizerDuck
- ```
-3. **Build the project:**
- ```bash
- dotnet build
- ```
-4. **Run the project:**
- ```bash
- dotnet run --project optimizerDuck
- ```
-
-## Development Conventions
-
-* **Coding Style**: The project follows the standard C# coding conventions.
-* **Unit Tests**: The project has a separate test project (`optimizerDuck.Test`) for unit tests.
-* **Logging**: The project uses Serilog for logging. Logs are written to a file in the `%APPDATA%/optimizerDuck/` directory.
-* **Contributions**: Contributions are welcome. Please read the `CONTRIBUTING.md` file for more information.
diff --git a/README.md b/README.md
index 7ca4a90..89de31f 100644
--- a/README.md
+++ b/README.md
@@ -14,88 +14,71 @@
<br>
[![.NET Latest](https://img.shields.io/badge/.NET_Runtime-Latest-ef99dd)](https://dotnet.microsoft.com/en-us/download)
[![Supported OS](https://img.shields.io/badge/Supported-Windows_10+_x64-0078d4)](https://www.microsoft.com/en-us/software-download/)
-<br>
-[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/O4O11OH7NH)
-<img src="./.github/assets/app_screenshot.png" alt="optimizerDuck App Screenshot" title="optimizerDuck App Screenshot" width="800" />
+<div style="display: flex; justify-content: center; gap: 20px;">
+<img src="./.github/assets/app_dark.png" alt="optimizerDuck Dark Mode" title="optimizerDuck Dark Mode" width="400" />
+<img src="./.github/assets/app_light.png" alt="optimizerDuck Light Mode" title="optimizerDuck Light Mode" width="400" />
+</div>
</div>
-## 🚀 Quickstart
+## 🚀 Quick Start
-### Download
+### Download & Run
-1. [Download the latest release](https://github.com/itsfatduck/optimizerDuck/releases/latest)
-2. Run the `.exe` file
+1. Download the latest release from **GitHub**
+👉 https://github.com/itsfatduck/optimizerDuck/releases/latest
+2. Run the `.exe` file (no installer required)
> [!TIP]
-> Remember to restart your PC after applying tweaks to **take effect**
+> Remember to restart your PC after applying optimizations to see the changes take effect.
### Documentation
-- For more detailed guides, check out the [docs](./Docs/index.md).
-
-## 🔥 Key Optimizations
-
-With **optimizerDuck**, you can optimize Windows performance, privacy, and more-across five focused areas:
-
-| Optimization Category | Summary |
-|------|--------------------------|
-| ⚡ Performance | Boosts responsiveness, gaming speed, and GPU efficiency |
-| 🧹 Bloatware & Services | Removes unnecessary apps and disables non-essential services |
-| 🔋 Power | Applies a high-performance power plan and disables limiting power-saving features |
-| 🔐 Security & Privacy | Blocks telemetry, tracking, and unwanted AI integrations |
-| 🖥️ User Experience | Cleans up interface clutter, enables dark mode, improves input responsiveness |
-
-> [!NOTE]
-> See the full list in [Docs/Optimizations](./Docs/optimizations.md)
-
-## 🦆 Why optimizerDuck Exists
-
-> [!IMPORTANT]
-> A fast PC needs smart management. **True performance** is about how you use your system: not just the hardware.
-
-I built optimizerDuck because I needed it. Gaming on a **slow PC** taught me that smooth performance isn't free: you have to work for it. I wasted hours trying complex tools and tweaks. I learned that the best fixes are often simple: managing background apps and keeping your system clean.
-
-**Real optimization is about habits: not just tools.**
-
-optimizerDuck is a simple, honest tool built on that idea. Every setting is **tested** and **clear**. It's not just for speed: it's for giving you control over your PC when you need every bit of power.
+- 📖 Full documentation and advanced guides are available in the [Docs](./Docs/index.md).
## 💬 Community, Contributing & Support
-- 📖 [Documentation](./Docs/index.md) → detailed guides
+- 📖 [Documentation](./Docs/index.md) → detailed guides and tutorials
- 💬 [Discord](https://discord.gg/tDUBDCYw9Q) → chat & live support
-- 🐞 [Issues](https://github.com/itsfatduck/optimizerDuck/issues) → bug reports & feedback
+- 🐞 [Issues](https://github.com/itsfatduck/optimizerDuck/issues) → bug reports
- 💡 [Discussions](https://github.com/itsfatduck/optimizerDuck/discussions) → tips & feature requests
-- 🤝 [Contributing](./CONTRIBUTING.md) → how to join development (see [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md))
- ⭐ [Give us a star](https://github.com/itsfatduck/optimizerDuck) → your support keeps us going
-- ☕ [Ko-fi](https://ko-fi.com/O4O11OH7NH) → support the project
+- ❤️ [Support the project](./SUPPORT.md) → keep us motivated and inspired by your generosity 💖
+- 📚 [Third-Party Notices](./THIRD-PARTY-NOTICES.md) → open source acknowledgments
> [!TIP]
> Before asking for help, check the docs and existing issues — your answer may already be there.
## ⚠️ Disclaimer & DMCA
-optimizerDuck is provided "as is", without warranty of any kind.
-By using this tool, you agree that the authors are **not responsible** for any damage, data loss, or issues that may occur.
-Always create a restore point or backup before applying changes.
+optimizerDuck is provided **"as is"**, without warranty of any kind.
+
+By using this tool, you agree that the authors are **not responsible** for:
+- System instability
+- Data loss
+- Performance issues caused by third-party software or user modifications
+
+Always create a **restore point or backup** before applying system changes.
+
+## DMCA & Attribution
-### DMCA & Attribution Disclaimer
+optimizerDuck is an independent open‑source project built from scratch.
-optimizerDuck is an independent open‑source project built from scratch.
-While many tweaks are inspired by community forums and other open‑source projects (such as WinUtil), all code in this repository was written by the author unless otherwise stated.
+Some ideas and tweaks are inspired by community research and other open‑source tools (for example, WinUtil). Unless explicitly stated, **all code in this repository is original**.
-If you believe any part of this project infringes your copyright, please open an issue or submit a DMCA request via GitHub. We respect intellectual property and will review any valid request promptly.
+If you believe any part of this project violates your copyright, please open an issue or submit a DMCA request via GitHub. Valid requests will be reviewed promptly and respectfully.
## ⚖️ License
<img src=".github/assets/cc_by_nc_sa_4_0.png" alt="CC BY-NC-SA 4.0 License" title="CC BY-NC-SA 4.0 License" width="400" />
-This project is licensed under the [CC BY-NC-SA 4.0 License](https://creativecommons.org/licenses/by-nc-sa/4.0/).<br>see the [LICENSE](./LICENSE) file for details.
+This project is licensed under the **[CC BY-NC-SA 4.0 License](https://creativecommons.org/licenses/by-nc-sa/4.0/)**.<br>See the [LICENSE](./LICENSE) file for details.
## ⭐ Star History
-If optimizerDuck made your PC faster, **star this repo** and share it with friends.<br>Every ⭐ motivates new tweaks and updates!
+If optimizerDuck helped improve your PC, consider giving the repo a ⭐ and sharing it with others.<br>
+**Every star** helps motivate future improvements and features.
<a href="https://www.star-history.com/#itsfatduck/optimizerDuck&type=timeline&legend=top-left">
<picture>
diff --git a/SUPPORT.MD b/SUPPORT.MD
new file mode 100644
index 0000000..e69de29
diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md
new file mode 100644
index 0000000..7f9897f
--- /dev/null
+++ b/THIRD-PARTY-NOTICES.md
@@ -0,0 +1,312 @@
+<div align="center">
+ <img src="./.github/assets/optimizerDuck.png" alt="optimizerDuck Banner" title="optimizerDuck" width="600"/>
+</div>
+
+# Third-Party Software Notices
+
+**optimizerDuck** is built upon the shoulders of the amazing open-source community. To deliver the best experience, we rely on several third-party libraries and resources. Please note that while these components are integrated into our software, they remain the property of their respective owners and are governed by their own specific licenses.
+
+> [!TIP]
+> **Help us stay transparent!**
+> If you notice a missing attribution or an incorrect license credit, please let us know. We'll fix it as soon as possible.
+> 📬 **Get in touch:** Open an [Issue](https://github.com/itsfatduck/optimizerDuck/issues) or reach us at: [[email protected]](mailto:[email protected])
+
+---
+
+## License notice for [WPF UI](https://github.com/lepoco/wpfui)
+
+```text
+MIT License
+
+Copyright (c) 2021-2025 Leszek Pomianowski and WPF UI Contributors. https://lepo.co/
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+```
+
+---
+
+## License notice for [.NET Community Toolkit](https://github.com/CommunityToolkit/dotnet)
+
+```text
+Copyright © .NET Foundation and Contributors
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+```
+
+---
+
+## License notice for [Microsoft.Extensions.*](https://github.com/dotnet/extensions)
+
+```text
+The MIT License (MIT)
+
+Copyright (c) .NET Foundation. All rights reserved.
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+```
+
+---
+
+## License notice for [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json)
+
+```text
+The MIT License (MIT)
+
+Copyright (c) 2007 James Newton-King
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+```
+
+---
+
+## License notice for [Serilog](https://github.com/serilog/serilog)
+
+```text
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and
+distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright
+owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities
+that control, are controlled by, or are under common control with that entity.
+For the purposes of this definition, "control" means (i) the power, direct or
+indirect, to cause the direction or management of such entity, whether by
+contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
+outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising
+permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including
+but not limited to software source code, documentation source, and configuration
+files.
+
+"Object" form shall mean any form resulting from mechanical transformation or
+translation of a Source form, including but not limited to compiled object code,
+generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made
+available under the License, as indicated by a copyright notice that is included
+in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that
+is based on (or derived from) the Work and for which the editorial revisions,
+annotations, elaborations, or other modifications represent, as a whole, an
+original work of authorship. For the purposes of this License, Derivative Works
+shall not include works that remain separable from, or merely link (or bind by
+name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version
+of the Work and any modifications or additions to that Work or Derivative Works
+thereof, that is intentionally submitted to Licensor for inclusion in the Work
+by the copyright owner or by an individual or Legal Entity authorized to submit
+on behalf of the copyright owner. For the purposes of this definition,
+"submitted" means any form of electronic, verbal, or written communication sent
+to the Licensor or its representatives, including but not limited to
+communication on electronic mailing lists, source code control systems, and
+issue tracking systems that are managed by, or on behalf of, the Licensor for
+the purpose of discussing and improving the Work, but excluding communication
+that is conspicuously marked or otherwise designated in writing by the copyright
+owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
+of whom a Contribution has been received by Licensor and subsequently
+incorporated within the Work.
+
+2. Grant of Copyright License.
+
+Subject to the terms and conditions of this License, each Contributor hereby
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+irrevocable copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the Work and such
+Derivative Works in Source or Object form.
+
+3. Grant of Patent License.
+
+Subject to the terms and conditions of this License, each Contributor hereby
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+irrevocable (except as stated in this section) patent license to make, have
+made, use, offer to sell, sell, import, and otherwise transfer the Work, where
+such license applies only to those patent claims licensable by such Contributor
+that are necessarily infringed by their Contribution(s) alone or by combination
+of their Contribution(s) with the Work to which such Contribution(s) was
+submitted. If You institute patent litigation against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that the Work or a
+Contribution incorporated within the Work constitutes direct or contributory
+patent infringement, then any patent licenses granted to You under this License
+for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.
+
+You may reproduce and distribute copies of the Work or Derivative Works thereof
+in any medium, with or without modifications, and in Source or Object form,
+provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of
+this License; and
+You must cause any modified files to carry prominent notices stating that You
+changed the files; and
+You must retain, in the Source form of any Derivative Works that You distribute,
+all copyright, patent, trademark, and attribution notices from the Source form
+of the Work, excluding those notices that do not pertain to any part of the
+Derivative Works; and
+If the Work includes a "NOTICE" text file as part of its distribution, then any
+Derivative Works that You distribute must include a readable copy of the
+attribution notices contained within such NOTICE file, excluding those notices
+that do not pertain to any part of the Derivative Works, in at least one of the
+following places: within a NOTICE text file distributed as part of the
+Derivative Works; within the Source form or documentation, if provided along
+with the Derivative Works; or, within a display generated by the Derivative
+Works, if and wherever such third-party notices normally appear. The contents of
+the NOTICE file are for informational purposes only and do not modify the
+License. You may add Your own attribution notices within Derivative Works that
+You distribute, alongside or as an addendum to the NOTICE text from the Work,
+provided that such additional attribution notices cannot be construed as
+modifying the License.
+You may add Your own copyright statement to Your modifications and may provide
+additional or different license terms and conditions for use, reproduction, or
+distribution of Your modifications, or for any such Derivative Works as a whole,
+provided Your use, reproduction, and distribution of the Work otherwise complies
+with the conditions stated in this License.
+
+5. Submission of Contributions.
+
+Unless You explicitly state otherwise, any Contribution intentionally submitted
+for inclusion in the Work by You to the Licensor shall be under the terms and
+conditions of this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify the terms of
+any separate license agreement you may have executed with Licensor regarding
+such Contributions.
+
+6. Trademarks.
+
+This License does not grant permission to use the trade names, trademarks,
+service marks, or product names of the Licensor, except as required for
+reasonable and customary use in describing the origin of the Work and
+reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty.
+
+Unless required by applicable law or agreed to in writing, Licensor provides the
+Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+including, without limitation, any warranties or conditions of TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
+solely responsible for determining the appropriateness of using or
+redistributing the Work and assume any risks associated with Your exercise of
+permissions under this License.
+
+8. Limitation of Liability.
+
+In no event and under no legal theory, whether in tort (including negligence),
+contract, or otherwise, unless required by applicable law (such as deliberate
+and grossly negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special, incidental,
+or consequential damages of any character arising as a result of this License or
+out of the use or inability to use the Work (including but not limited to
+damages for loss of goodwill, work stoppage, computer failure or malfunction, or
+any and all other commercial damages or losses), even if such Contributor has
+been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability.
+
+While redistributing the Work or Derivative Works thereof, You may choose to
+offer, and charge a fee for, acceptance of support, warranty, indemnity, or
+other liability obligations and/or rights consistent with this License. However,
+in accepting such obligations, You may act only on Your own behalf and on Your
+sole responsibility, not on behalf of any other Contributor, and only if You
+agree to indemnify, defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason of your
+accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work
+
+To apply the Apache License to your work, attach the following boilerplate
+notice, with the fields enclosed by brackets "[]" replaced with your own
+identifying information. (Don't include the brackets!) The text should be
+enclosed in the appropriate comment syntax for the file format. We also
+recommend that a file or class name and description of purpose be included on
+the same "printed page" as the copyright notice for easier identification within
+third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+```
+
+---
\ No newline at end of file
diff --git a/build.bat b/build.bat
new file mode 100644
index 0000000..af87ca6
--- /dev/null
+++ b/build.bat
@@ -0,0 +1,39 @@
+@echo off
+echo hi itsfatduck bro :D
+
+echo Available build profiles:
+echo 1. Portable
+echo 2. Single
+set /p buildOption="Choose build profile (1/2): "
+if "%buildOption%"=="1" (
+ echo Publishing portable build...
+ dotnet publish optimizerDuck/optimizerDuck.csproj /p:PublishProfile=Portable
+ pause
+) else if "%buildOption%"=="2" (
+ echo Publishing single build...
+ dotnet publish optimizerDuck/optimizerDuck.csproj /p:PublishProfile=Single
+ pause
+) else (
+ echo Invalid choice
+ pause
+ exit /b 1
+)
+
+echo.
+echo Do you want to run tests? (y/n)
+set /p runTests="Run tests? (y/n): "
+if "%runTests%"=="y" (
+ echo Running tests...
+ dotnet test
+ pause
+ echo Tests passed!
+ pause
+) else (
+ echo Skipping tests...
+ pause
+ exit /b 0
+)
+
+echo.
+echo Build and test completed!
+pause
diff --git a/global.json b/global.json
deleted file mode 100644
index 69e101b..0000000
--- a/global.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "sdk": {
- "version": "10.0.100",
- "rollForward": "latestMinor",
- "allowPrerelease": false
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck-wpf.slnx b/optimizerDuck-wpf.slnx
new file mode 100644
index 0000000..379ec99
--- /dev/null
+++ b/optimizerDuck-wpf.slnx
@@ -0,0 +1,4 @@
+<Solution>
+ <Project Path="optimizerDuck.Test/optimizerDuck.Test.csproj"/>
+ <Project Path="optimizerDuck/optimizerDuck.csproj"/>
+</Solution>
diff --git a/optimizerDuck.Test/PowerShellErrorParserTests.cs b/optimizerDuck.Test/PowerShellErrorParserTests.cs
deleted file mode 100644
index 5307491..0000000
--- a/optimizerDuck.Test/PowerShellErrorParserTests.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-using optimizerDuck.Core.Extensions;
-
-namespace optimizerDuck.Test;
-
-public class PowerShellErrorParserTests
-{
- [Fact]
- public void ParseCliXml_ShouldReturnEmpty_WhenInputIsWhitespace()
- {
- var result = " ".ParseCliXml();
- Assert.Equal(string.Empty, result);
- }
-
- [Fact]
- public void ParseCliXml_ShouldParseSimpleClixml()
- {
- var xml = @"#< CLIXML
-<Objs Version='1.1.0.1'>
- <S>Access is denied</S>
-</Objs>";
-
- var result = xml.ParseCliXml();
- Assert.Contains("Access is denied", result);
- }
-
- [Fact]
- public void ParseCliXml_ShouldHandleEncodedNewlines()
- {
- var xml = @"#< CLIXML
-<Objs Version='1.1.0.1'>
- <S>Error_x000D__x000A_Second Line</S>
-</Objs>";
-
- var result = xml.ParseCliXml();
- Assert.Contains("Error", result);
- Assert.Contains("Second Line", result);
- }
-
- [Fact]
- public void ParseCliXml_ShouldHandleListOfObjects()
- {
- var xml = @"#< CLIXML
-<Objs Version='1.1.0.1'>
- <Obj RefId='0'>
- <TN RefId='0'>
- <T>System.String</T>
- </TN>
- <ToString>First</ToString>
- </Obj>
- <Obj RefId='1'>
- <TN RefId='1'>
- <T>System.String</T>
- </TN>
- <ToString>Second</ToString>
- </Obj>
-</Objs>";
-
- var result = xml.ParseCliXml();
- Assert.Contains("First", result);
- Assert.Contains("Second", result);
- }
-
- [Fact]
- public void ParseCliXml_ShouldFallback_WhenInvalidXml()
- {
- var invalidXml = "<S>Error message missing end tag";
- var result = invalidXml.ParseCliXml();
- Assert.Contains("Error message", result);
- }
-
- [Fact]
- public void ParseCliXml_ShouldWrapNonXmlText()
- {
- var text = "Access is denied";
- var result = text.ParseCliXml();
- Assert.Contains("Access is denied", result);
- }
-
- [Fact]
- public void ParseCliXml_ShouldIgnoreBOM()
- {
- var bom = "\uFEFF#< CLIXML<Objs><S>BOM handled</S></Objs>";
- var result = bom.ParseCliXml();
- Assert.Contains("BOM handled", result);
- }
-
- [Fact]
- public void ParseCliXml_ShouldReturnEmpty_OnEmptyObjs()
- {
- var xml = "#< CLIXML<Objs></Objs>";
- var result = xml.ParseCliXml();
- Assert.Equal(string.Empty, result);
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck.Test/RegistryServiceTests.cs b/optimizerDuck.Test/RegistryServiceTests.cs
deleted file mode 100644
index 1cad50c..0000000
--- a/optimizerDuck.Test/RegistryServiceTests.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-using Microsoft.Win32;
-using optimizerDuck.Core.Services;
-using optimizerDuck.Models;
-using optimizerDuck.UI.Logger;
-
-namespace optimizerDuck.Test;
-
-public class RegistryServiceTests
-{
- [Fact]
- public void Read()
- {
- var binary =
- RegistryService.Read<byte[]>(new RegistryItem(@"HKEY_LOCAL_MACHINE\SOFTWARE\Logitech\LGHUB\Data",
- "canary_machine_identifier"));
-
- Assert.NotNull(binary);
- }
-
- [Fact]
- public void Write_And_Read_Back_String_Value()
- {
- using var tracker = ServiceTracker.Begin();
- var testKeyPath = @"HKEY_CURRENT_USER\Software\optimizerDuckTests";
- var item = new RegistryItem(testKeyPath, "TestString", "hello", RegistryValueKind.String);
- try
- {
- var written = RegistryService.Write(item);
- Assert.True(written);
-
- var readBack = RegistryService.Read<string>(new RegistryItem(testKeyPath, "TestString"));
- Assert.Equal("hello", readBack);
- }
- finally
- {
- RegistryService.DeleteValue(new RegistryItem(testKeyPath, "TestString"));
- RegistryService.DeleteSubKey(new RegistryItem(testKeyPath));
- }
- }
-
- [Fact]
- public void DeleteValue_When_Missing_Is_Treated_As_Success()
- {
- var testKeyPath = @"HKEY_CURRENT_USER\Software\optimizerDuckTests_DeleteMissing";
- try
- {
- // Ensure key exists without the value
- RegistryService.Write(new RegistryItem(testKeyPath, "_bootstrap", 1, RegistryValueKind.DWord));
- RegistryService.DeleteValue(new RegistryItem(testKeyPath, "_bootstrap"));
-
- var result = RegistryService.DeleteValue(new RegistryItem(testKeyPath, "DoesNotExist"));
- Assert.True(result);
- }
- finally
- {
- RegistryService.DeleteSubKey(new RegistryItem(testKeyPath));
- }
- }
-
- [Fact]
- public void Write_Creates_SubKey_If_Missing()
- {
- var testKeyPath = @"HKEY_CURRENT_USER\Software\optimizerDuckTests_CreateKeyOnWrite\Sub";
- try
- {
- var result = RegistryService.Write(new RegistryItem(testKeyPath, "Flag", 1, RegistryValueKind.DWord));
- Assert.True(result);
-
- var readBack = RegistryService.Read<int>(new RegistryItem(testKeyPath, "Flag"));
- Assert.Equal(1, readBack);
- }
- finally
- {
- RegistryService.DeleteSubKey(
- new RegistryItem(@"HKEY_CURRENT_USER\Software\optimizerDuckTests_CreateKeyOnWrite"));
- }
- }
-
- [Fact]
- public void Read_Converts_Types_When_Possible()
- {
- using var tracker = ServiceTracker.Begin();
- var testKeyPath = @"HKEY_CURRENT_USER\Software\optimizerDuckTests_TypeConversion";
- try
- {
- var writeOk = RegistryService.Write(new RegistryItem(testKeyPath, "Numeric", 123, RegistryValueKind.DWord));
- Assert.True(writeOk);
-
- var asString = RegistryService.Read<string>(new RegistryItem(testKeyPath, "Numeric"));
- Assert.Equal("123", asString);
-
- var asLong = RegistryService.Read<long>(new RegistryItem(testKeyPath, "Numeric"));
- Assert.Equal(123L, asLong);
- }
- finally
- {
- RegistryService.DeleteSubKey(new RegistryItem(testKeyPath));
- }
- }
-
- [Fact]
- public void DeleteSubKey_Removes_Entire_Tree()
- {
- using var tracker = ServiceTracker.Begin();
- var basePath = @"HKEY_CURRENT_USER\Software\optimizerDuckTests_DeleteTree";
- var childPath = basePath + "\\Child";
- try
- {
- // Create nested structure
- Assert.True(RegistryService.Write(new RegistryItem(childPath, "Leaf", "x", RegistryValueKind.String)));
-
- // Delete base should remove child
- Assert.True(RegistryService.DeleteSubKey(new RegistryItem(basePath)));
-
- // Verify
- var existsAfter = RegistryService.Read<string>(new RegistryItem(childPath, "Leaf"));
- Assert.Null(existsAfter);
- }
- finally
- {
- // Ensure cleanup if anything left
- RegistryService.DeleteSubKey(new RegistryItem(basePath));
- }
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck.Test/Services/Managers/RevertManagerTests.cs b/optimizerDuck.Test/Services/Managers/RevertManagerTests.cs
new file mode 100644
index 0000000..56c4ad0
--- /dev/null
+++ b/optimizerDuck.Test/Services/Managers/RevertManagerTests.cs
@@ -0,0 +1,77 @@
+using Microsoft.Extensions.Logging.Abstractions;
+using Newtonsoft.Json;
+using optimizerDuck.Common.Helpers;
+using optimizerDuck.Core.Models.Revert;
+using optimizerDuck.Services.Managers;
+
+namespace optimizerDuck.Test.Services.Managers;
+
+public class RevertManagerTests
+{
+ [Fact]
+ public async Task IsAppliedAsync_And_GetRevertDataAsync_HandleMissingFile()
+ {
+ var id = Guid.NewGuid();
+
+ var isApplied = await RevertManager.IsAppliedAsync(id);
+ var data = await RevertManager.GetRevertDataAsync(id);
+
+ Assert.False(isApplied);
+ Assert.Null(data);
+ }
+
+ [Fact]
+ public async Task GetRevertDataAsync_ReadsValidPayload()
+ {
+ var id = Guid.NewGuid();
+ var path = Path.Combine(Shared.RevertDirectory, id + ".json");
+ Directory.CreateDirectory(Shared.RevertDirectory);
+
+ var payload = new RevertData
+ {
+ OptimizationId = id,
+ OptimizationName = "TestOptimization",
+ AppliedAt = DateTime.UtcNow,
+ Steps = new List<RevertStepData>()
+ };
+
+ try
+ {
+ var json = JsonConvert.SerializeObject(payload, Formatting.Indented);
+ await File.WriteAllTextAsync(path, json);
+
+ var data = await RevertManager.GetRevertDataAsync(id);
+
+ Assert.NotNull(data);
+ Assert.Equal(id, data!.OptimizationId);
+ }
+ finally
+ {
+ if (File.Exists(path))
+ File.Delete(path);
+ }
+ }
+
+ [Fact]
+ public async Task RevertAsync_WithInvalidJson_ReturnsFailure()
+ {
+ var id = Guid.NewGuid();
+ var path = Path.Combine(Shared.RevertDirectory, id + ".json");
+ Directory.CreateDirectory(Shared.RevertDirectory);
+
+ try
+ {
+ await File.WriteAllTextAsync(path, "{ invalid json }");
+
+ var manager = new RevertManager(NullLogger<RevertManager>.Instance);
+ var result = await manager.RevertAsync(id, "TestOptimization");
+
+ Assert.False(result.Success);
+ }
+ finally
+ {
+ if (File.Exists(path))
+ File.Delete(path);
+ }
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck.Test/Services/OptimizationServiceTests.cs b/optimizerDuck.Test/Services/OptimizationServiceTests.cs
new file mode 100644
index 0000000..a1470d7
--- /dev/null
+++ b/optimizerDuck.Test/Services/OptimizationServiceTests.cs
@@ -0,0 +1,215 @@
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Abstractions;
+using Newtonsoft.Json;
+using optimizerDuck.Common.Helpers;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Optimization;
+using optimizerDuck.Core.Models.Revert;
+using optimizerDuck.Core.Models.Revert.Steps;
+using optimizerDuck.Core.Models.UI;
+using optimizerDuck.Services;
+using optimizerDuck.Services.Managers;
+
+namespace optimizerDuck.Test.Services;
+
+public class OptimizationServiceTests
+{
+ [Fact]
+ public async Task ApplyAsync_Success_PersistsRevertDataFile()
+ {
+ await RunInStaThreadAsync(async () =>
+ {
+ var optimization = new FakeOptimization
+ {
+ ApplyImpl = _ =>
+ {
+ RevertManager.Record(new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 0" });
+ ServiceTracker.TrackStep("Test", "Test step", true);
+ return Task.FromResult(ApplyResult.True());
+ }
+ };
+
+ var revertPath = GetRevertFilePath(optimization.Id);
+
+ try
+ {
+ if (File.Exists(revertPath))
+ File.Delete(revertPath);
+
+ var service = CreateService();
+ var progress = new Progress<ProcessingProgress>(_ => { });
+
+ var result = await service.ApplyAsync(optimization, progress);
+
+ Assert.Equal(OptimizationSuccessResult.Success, result.Status);
+ Assert.True(File.Exists(revertPath));
+
+ var data = await RevertManager.GetRevertDataAsync(optimization.Id);
+ Assert.NotNull(data);
+ Assert.Equal(optimization.Id, data!.OptimizationId);
+ Assert.NotEmpty(data.Steps);
+ }
+ finally
+ {
+ if (File.Exists(revertPath))
+ File.Delete(revertPath);
+ }
+ });
+ }
+
+ [Fact]
+ public async Task ApplyAsync_FailureMessage_TriggersAutoRevert_And_RemovesRevertDataFile()
+ {
+ await RunInStaThreadAsync(async () =>
+ {
+ var optimization = new FakeOptimization
+ {
+ ApplyImpl = _ =>
+ {
+ RevertManager.Record(new ShellRevertStep { ShellType = ShellType.CMD, Command = "exit 0" });
+ ServiceTracker.TrackStep("Test", "Failed step", false, "fail", () => Task.FromResult(false));
+ return Task.FromResult(ApplyResult.False("apply failed"));
+ }
+ };
+
+ var revertPath = GetRevertFilePath(optimization.Id);
+
+ try
+ {
+ if (File.Exists(revertPath))
+ File.Delete(revertPath);
+
+ var service = CreateService();
+ var progress = new Progress<ProcessingProgress>(_ => { });
+
+ var result = await service.ApplyAsync(optimization, progress);
+
+ Assert.Equal(OptimizationSuccessResult.Failed, result.Status);
+ Assert.False(File.Exists(revertPath));
+ }
+ finally
+ {
+ if (File.Exists(revertPath))
+ File.Delete(revertPath);
+ }
+ });
+ }
+
+ [Fact]
+ public async Task RevertAsync_WithValidRevertData_RemovesFile()
+ {
+ await RunInStaThreadAsync(async () =>
+ {
+ var optimization = new FakeOptimization
+ {
+ ApplyImpl = _ => Task.FromResult(ApplyResult.True())
+ };
+
+ var revertPath = GetRevertFilePath(optimization.Id);
+
+ try
+ {
+ Directory.CreateDirectory(Shared.RevertDirectory);
+
+ var payload = new RevertData
+ {
+ OptimizationId = optimization.Id,
+ OptimizationName = optimization.OptimizationKey,
+ AppliedAt = DateTime.UtcNow,
+ Steps = new List<RevertStepData>
+ {
+ new()
+ {
+ Type = "Shell",
+ Data = new ShellRevertStep
+ {
+ ShellType = ShellType.CMD,
+ Command = "exit 0"
+ }.ToData()
+ }
+ }
+ };
+
+ var json = JsonConvert.SerializeObject(payload, Formatting.Indented);
+ await File.WriteAllTextAsync(revertPath, json);
+
+ var service = CreateService();
+ var progress = new Progress<ProcessingProgress>(_ => { });
+
+ var result = await service.RevertAsync(optimization, progress);
+
+ Assert.True(result.Success);
+ Assert.False(File.Exists(revertPath));
+ }
+ finally
+ {
+ if (File.Exists(revertPath))
+ File.Delete(revertPath);
+ }
+ });
+ }
+
+ private static OptimizationService CreateService()
+ {
+ var revertManager = new RevertManager(NullLogger<RevertManager>.Instance);
+ var loggerFactory = NullLoggerFactory.Instance;
+ var systemInfoService = new SystemInfoService(NullLogger<SystemInfoService>.Instance);
+ var streamService = new StreamService(NullLogger<StreamService>.Instance);
+ return new OptimizationService(revertManager, loggerFactory, systemInfoService, streamService);
+ }
+
+ private static string GetRevertFilePath(Guid id)
+ {
+ return Path.Combine(Shared.RevertDirectory, id + ".json");
+ }
+
+ private static Task RunInStaThreadAsync(Func<Task> action)
+ {
+ var tcs = new TaskCompletionSource();
+
+ var thread = new Thread(() =>
+ {
+ try
+ {
+ action().GetAwaiter().GetResult();
+ tcs.SetResult();
+ }
+ catch (Exception ex)
+ {
+ tcs.SetException(ex);
+ }
+ });
+
+ thread.SetApartmentState(ApartmentState.STA);
+ thread.Start();
+
+ return tcs.Task;
+ }
+
+ private sealed class FakeOptimization : IOptimization
+ {
+ public Guid Id { get; } = Guid.NewGuid();
+ public OptimizationRisk Risk { get; } = OptimizationRisk.Safe;
+
+ public Type? OwnerType { get; set; }
+ public string OwnerKey { get; } = "Test";
+ public string OptimizationKey { get; } = "TestOptimization";
+ public OptimizationRiskVisual RiskVisual { get; } = new();
+ public IEnumerable<OptimizationTagDisplay> TagDisplays { get; } = [];
+
+ public string Prefix { get; } = "Test";
+ public string ProgressPrefix { get; } = "Test";
+
+ public string Name { get; } = "Test";
+ public string ShortDescription { get; } = "Test";
+ public OptimizationState State { get; set; } = null!;
+
+ public Func<(IProgress<ProcessingProgress> progress, OptimizationContext context), Task<ApplyResult>> ApplyImpl { get; init; } =
+ _ => Task.FromResult(ApplyResult.True());
+
+ public Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ return ApplyImpl((progress, context));
+ }
+ }
+}
diff --git a/optimizerDuck.Test/Services/OptimizationServices/RegistryServiceTests.cs b/optimizerDuck.Test/Services/OptimizationServices/RegistryServiceTests.cs
new file mode 100644
index 0000000..84a65d2
--- /dev/null
+++ b/optimizerDuck.Test/Services/OptimizationServices/RegistryServiceTests.cs
@@ -0,0 +1,37 @@
+using optimizerDuck.Core.Models.Optimization.Services;
+using optimizerDuck.Services.OptimizationServices;
+
+namespace optimizerDuck.Test.Services.OptimizationServices;
+
+public class RegistryServiceTests
+{
+ [Fact]
+ public void Read_WithInvalidRoot_ReturnsDefault()
+ {
+ var item = new RegistryItem("BADROOT\\SomePath", "ValueName");
+
+ var result = RegistryService.Read<string>(item);
+
+ Assert.Null(result);
+ }
+
+ [Fact]
+ public void DeleteValue_WithInvalidRoot_ReturnsFalse()
+ {
+ var item = new RegistryItem("BADROOT\\SomePath", "ValueName");
+
+ var result = RegistryService.DeleteValue(item);
+
+ Assert.False(result);
+ }
+
+ [Fact]
+ public void Write_WithNullValue_ReturnsFalse()
+ {
+ var item = new RegistryItem("HKCU\\Software\\optimizerDuck.Test", "TestValue");
+
+ var result = RegistryService.Write(item);
+
+ Assert.False(result);
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck.Test/Services/OptimizationServices/ServiceProcessServiceTests.cs b/optimizerDuck.Test/Services/OptimizationServices/ServiceProcessServiceTests.cs
new file mode 100644
index 0000000..52312e2
--- /dev/null
+++ b/optimizerDuck.Test/Services/OptimizationServices/ServiceProcessServiceTests.cs
@@ -0,0 +1,21 @@
+using optimizerDuck.Core.Models.Optimization.Services;
+using optimizerDuck.Services.OptimizationServices;
+
+namespace optimizerDuck.Test.Services.OptimizationServices;
+
+public class ServiceProcessServiceTests
+{
+ [Fact]
+ public void ChangeServiceStartupType_WithMissingService_ReturnsFalse()
+ {
+ var item = new ServiceItem
+ {
+ Name = "optimizerDuck-Test-NonExistent",
+ StartupType = ServiceStartupType.Disabled
+ };
+
+ var result = ServiceProcessService.ChangeServiceStartupType(item);
+
+ Assert.False(result);
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck.Test/Services/OptimizationServices/ShellServiceTests.cs b/optimizerDuck.Test/Services/OptimizationServices/ShellServiceTests.cs
new file mode 100644
index 0000000..dc4a110
--- /dev/null
+++ b/optimizerDuck.Test/Services/OptimizationServices/ShellServiceTests.cs
@@ -0,0 +1,30 @@
+using optimizerDuck.Services.OptimizationServices;
+
+namespace optimizerDuck.Test.Services.OptimizationServices;
+
+public class ShellServiceTests
+{
+ [Fact]
+ public void Cmd_ExitZero_ReturnsSuccessExitCode()
+ {
+ var result = ShellService.CMD("exit 0");
+
+ Assert.Equal(0, result.ExitCode);
+ }
+
+ [Fact]
+ public void Cmd_ExitOne_ReturnsNonZeroExitCode()
+ {
+ var result = ShellService.CMD("exit 1");
+
+ Assert.NotEqual(0, result.ExitCode);
+ }
+
+ [Fact]
+ public void PowerShell_SimpleCommand_ReturnsSuccessExitCode()
+ {
+ var result = ShellService.PowerShell("Write-Output 'ok'");
+
+ Assert.Equal(0, result.ExitCode);
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck.Test/Services/SystemInfoServiceTests.cs b/optimizerDuck.Test/Services/SystemInfoServiceTests.cs
new file mode 100644
index 0000000..48663d0
--- /dev/null
+++ b/optimizerDuck.Test/Services/SystemInfoServiceTests.cs
@@ -0,0 +1,25 @@
+using Microsoft.Extensions.Logging.Abstractions;
+using optimizerDuck.Services;
+
+namespace optimizerDuck.Test.Services;
+
+public class SystemInfoServiceTests
+{
+ [Fact]
+ public async Task RefreshAsync_SetsSnapshot()
+ {
+ var service = new SystemInfoService(NullLogger<SystemInfoService>.Instance);
+
+ var snapshot = await service.RefreshAsync();
+
+ Assert.Equal(snapshot, service.Snapshot);
+ }
+
+ [Fact]
+ public void LogSummary_DoesNotThrow()
+ {
+ var service = new SystemInfoService(NullLogger<SystemInfoService>.Instance);
+
+ service.LogSummary();
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck.Test/SystemInfoServiceTests.cs b/optimizerDuck.Test/SystemInfoServiceTests.cs
deleted file mode 100644
index 27b2a8f..0000000
--- a/optimizerDuck.Test/SystemInfoServiceTests.cs
+++ /dev/null
@@ -1,164 +0,0 @@
-using Microsoft.Extensions.Logging;
-using optimizerDuck.Core.Services;
-using optimizerDuck.UI.Logger;
-using Spectre.Console;
-
-namespace optimizerDuck.Test;
-
-public class SystemInfoServiceTests
-{
- private static readonly ILogger Log = Logger.CreateLogger<SystemInfoServiceTests>();
-
- [Fact]
- public void GetDetailedPanel_WithValidSnapshot_ReturnsPanel()
- {
- // Arrange
- var snapshot = CreateValidSystemSnapshot();
-
- // Act
- var panel = SystemInfoService.GetDetailedPanel(snapshot, Log);
-
- // Assert
- Assert.NotNull(panel);
- Assert.IsType<Panel>(panel);
- Assert.Equal(90, panel.Width);
- Assert.Equal(BoxBorder.Rounded, panel.Border);
- }
-
- [Fact]
- public void GetDetailedPanel_WithSingleGpu_RendersGpuInformation()
- {
- // Arrange
- var gpu = new GpuInfo("NVIDIA RTX 3080", "537.13", GpuVendor.NVIDIA, 10240, "PCI\\VEN_10DE", "PCI_VEN_10DE");
- var snapshot = CreateValidSystemSnapshot() with { Gpus = [gpu], PrimaryGpu = gpu };
-
- // Act
- var panel = SystemInfoService.GetDetailedPanel(snapshot, Log);
-
- // Assert
- Assert.NotNull(panel);
- }
-
- [Fact]
- public void GetDetailedPanel_WithMultipleGpus_RendersAllGpus()
- {
- // Arrange
- var gpu1 = new GpuInfo("NVIDIA RTX 3080", "537.13", GpuVendor.NVIDIA, 10240, "PCI\\VEN_10DE", "PCI_VEN_10DE");
- var gpu2 = new GpuInfo("Intel UHD Graphics", "27.20", GpuVendor.Intel, 1536, "PCI\\VEN_8086", "PCI_VEN_8086");
- var snapshot = CreateValidSystemSnapshot() with { Gpus = [gpu1, gpu2], PrimaryGpu = gpu1 };
-
- // Act
- var panel = SystemInfoService.GetDetailedPanel(snapshot, Log);
-
- // Assert
- Assert.NotNull(panel);
- }
-
- [Fact]
- public void GetDetailedPanel_WithNoGpus_HandlesGracefully()
- {
- // Arrange
- var snapshot = CreateValidSystemSnapshot() with { Gpus = [], PrimaryGpu = null };
-
- // Act
- var panel = SystemInfoService.GetDetailedPanel(snapshot, Log);
-
- // Assert
- Assert.NotNull(panel);
- }
-
- [Fact]
- public void GetDetailedPanel_WithUnknownGpu_HandlesGracefully()
- {
- // Arrange
- var snapshot = CreateValidSystemSnapshot() with { Gpus = [GpuInfo.Unknown], PrimaryGpu = null };
-
- // Act
- var panel = SystemInfoService.GetDetailedPanel(snapshot, Log);
-
- // Assert
- Assert.NotNull(panel);
- }
-
- [Fact]
- public void GetDetailedPanel_WithHighMemoryUsage_ReturnsPanel()
- {
- // Arrange
- var ram = new RamInfo(32, 32768, 33554432, 5.5, 85.0, 16384, []);
- var snapshot = CreateValidSystemSnapshot() with { Ram = ram };
-
- // Act
- var panel = SystemInfoService.GetDetailedPanel(snapshot, Log);
-
- // Assert
- Assert.NotNull(panel);
- }
-
- [Fact]
- public void GetDetailedPanel_WithRamModules_RendersModuleDetails()
- {
- // Arrange
- var module1 = new RamModule(16.0, "3200", "Corsair", "CMK16GX4M2B3200C16", "DIMM 1");
- var module2 = new RamModule(16.0, "3200", "Kingston", "KF432C16BB2K2/32", "DIMM 2");
- var ram = new RamInfo(32, 32768, 33554432, 16.0, 50.0, 16384, [module1, module2]);
- var snapshot = CreateValidSystemSnapshot() with { Ram = ram };
-
- // Act
- var panel = SystemInfoService.GetDetailedPanel(snapshot, Log);
-
- // Assert
- Assert.NotNull(panel);
- }
-
- private static SystemSnapshot CreateValidSystemSnapshot()
- {
- var cpu = new CpuInfo(
- "Intel(R) Core(TM) i9-12900K",
- "GenuineIntel",
- "Intel",
- "64-bit",
- 16,
- 24,
- 5200,
- 3200,
- 8192,
- 30720
- );
-
- var ram = new RamInfo(32, 32768, 33554432, 20.0, 50.0, 16384, []);
-
- var os = new OsInfo(
- "Windows 11",
- "11",
- "22621",
- "Pro",
- "64-bit",
- "Desktop",
- "2022-01-15",
- "2025-11-03 10:30"
- );
-
- var bios = new BiosInfo(
- "American Megatrends Inc.",
- "F14",
- "2022-01-10",
- "3.4",
- "ABCDEF123456"
- );
-
- var gpu = new GpuInfo(
- "NVIDIA GeForce RTX 3080",
- "537.13",
- GpuVendor.NVIDIA,
- 10240,
- "PCI\\VEN_10DE",
- "PCI_VEN_10DE"
- );
-
- var disk = new DiskInfo([
- new DiskVolume("C:", false, "NTFS", "Fixed", "New Volume", 250.0, 250.0, 50.0, 25.0, "SSD")
- ]);
-
- return new SystemSnapshot(cpu, ram, os, bios, [gpu], gpu, disk);
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck.Test/optimizerDuck.Test.csproj b/optimizerDuck.Test/optimizerDuck.Test.csproj
index ae371f0..919e26b 100644
--- a/optimizerDuck.Test/optimizerDuck.Test.csproj
+++ b/optimizerDuck.Test/optimizerDuck.Test.csproj
@@ -1,24 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>net10.0</TargetFramework>
+ <TargetFramework>net10.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
- <Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="coverlet.collector" Version="6.0.4">
- <PrivateAssets>all</PrivateAssets>
- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
- </PackageReference>
- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0"/>
+ <PackageReference Include="coverlet.collector" Version="6.0.4"/>
+ <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.2"/>
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1"/>
+ <PackageReference Include="Newtonsoft.Json" Version="13.0.4"/>
<PackageReference Include="xunit" Version="2.9.3"/>
- <PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
- <PrivateAssets>all</PrivateAssets>
- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
- </PackageReference>
+ <PackageReference Include="xunit.runner.visualstudio" Version="3.1.4"/>
</ItemGroup>
<ItemGroup>
diff --git a/optimizerDuck.sln b/optimizerDuck.sln
deleted file mode 100644
index ad85d2e..0000000
--- a/optimizerDuck.sln
+++ /dev/null
@@ -1,46 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 18
-VisualStudioVersion = 18.0.11111.16
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "optimizerDuck", "optimizerDuck\optimizerDuck.csproj", "{B4F29678-908B-4259-BB38-CC786052AA65}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "optimizerDuck.Test", "optimizerDuck.Test\optimizerDuck.Test.csproj", "{CF555C17-30D3-4BF0-BA11-D849EF792AA6}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C3459623-250A-48CB-95E1-8EDFC95BB129}"
- ProjectSection(SolutionItems) = preProject
- .editorconfig = .editorconfig
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|x64 = Debug|x64
- Release|Any CPU = Release|Any CPU
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {B4F29678-908B-4259-BB38-CC786052AA65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B4F29678-908B-4259-BB38-CC786052AA65}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B4F29678-908B-4259-BB38-CC786052AA65}.Debug|x64.ActiveCfg = Debug|x64
- {B4F29678-908B-4259-BB38-CC786052AA65}.Debug|x64.Build.0 = Debug|x64
- {B4F29678-908B-4259-BB38-CC786052AA65}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B4F29678-908B-4259-BB38-CC786052AA65}.Release|Any CPU.Build.0 = Release|Any CPU
- {B4F29678-908B-4259-BB38-CC786052AA65}.Release|x64.ActiveCfg = Release|x64
- {B4F29678-908B-4259-BB38-CC786052AA65}.Release|x64.Build.0 = Release|x64
- {CF555C17-30D3-4BF0-BA11-D849EF792AA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {CF555C17-30D3-4BF0-BA11-D849EF792AA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {CF555C17-30D3-4BF0-BA11-D849EF792AA6}.Debug|x64.ActiveCfg = Debug|x64
- {CF555C17-30D3-4BF0-BA11-D849EF792AA6}.Debug|x64.Build.0 = Debug|x64
- {CF555C17-30D3-4BF0-BA11-D849EF792AA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {CF555C17-30D3-4BF0-BA11-D849EF792AA6}.Release|Any CPU.Build.0 = Release|Any CPU
- {CF555C17-30D3-4BF0-BA11-D849EF792AA6}.Release|x64.ActiveCfg = Release|x64
- {CF555C17-30D3-4BF0-BA11-D849EF792AA6}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {1ACFDC10-C1F2-45B2-BF2B-D546CB3CD7E9}
- EndGlobalSection
-EndGlobal
diff --git a/optimizerDuck/App.xaml b/optimizerDuck/App.xaml
new file mode 100644
index 0000000..998bb36
--- /dev/null
+++ b/optimizerDuck/App.xaml
@@ -0,0 +1,20 @@
+<Application
+ x:Class="optimizerDuck.App"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ <Application.Resources>
+ <ResourceDictionary>
+ <ResourceDictionary.MergedDictionaries>
+ <ui:ThemesDictionary Theme="Dark" />
+ <ui:ControlsDictionary />
+ </ResourceDictionary.MergedDictionaries>
+
+ <Style TargetType="Image">
+ <Setter Property="RenderOptions.BitmapScalingMode" Value="HighQuality" />
+ <Setter Property="SnapsToDevicePixels" Value="True" />
+ <Setter Property="UseLayoutRounding" Value="True" />
+ </Style>
+ </ResourceDictionary>
+ </Application.Resources>
+</Application>
\ No newline at end of file
diff --git a/optimizerDuck/App.xaml.cs b/optimizerDuck/App.xaml.cs
new file mode 100644
index 0000000..eda3ab3
--- /dev/null
+++ b/optimizerDuck/App.xaml.cs
@@ -0,0 +1,231 @@
+using System.Globalization;
+using System.IO;
+using System.Windows;
+using System.Windows.Media;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using optimizerDuck.Common.Helpers;
+using optimizerDuck.Core.Models.Config;
+using optimizerDuck.Services;
+using optimizerDuck.Services.Managers;
+using optimizerDuck.Services.OptimizationServices;
+using optimizerDuck.UI.ViewModels.Pages;
+using Serilog;
+using Serilog.Events;
+using Serilog.Formatting;
+using Serilog.Parsing;
+using Wpf.Ui;
+using Wpf.Ui.Appearance;
+using Wpf.Ui.DependencyInjection;
+using DashboardPage = optimizerDuck.UI.Views.Pages.DashboardPage;
+using DashboardViewModel = optimizerDuck.UI.ViewModels.Pages.DashboardViewModel;
+using MainWindow = optimizerDuck.UI.Views.Windows.MainWindow;
+using OptimizePage = optimizerDuck.UI.Views.Pages.OptimizePage;
+using SettingsPage = optimizerDuck.UI.Views.Pages.SettingsPage;
+using SettingsViewModel = optimizerDuck.UI.ViewModels.Pages.SettingsViewModel;
+
+namespace optimizerDuck;
+
+public class ScopeBlockTextFormatter : ITextFormatter
+{
+ public void Format(LogEvent logEvent, TextWriter output)
+ {
+ // build prefix
+ var timestamp = $"{logEvent.Timestamp:yyyy-MM-dd HH:mm:ss}";
+ var ctx = logEvent.Properties.TryGetValue("SourceContext", out var sourceContext)
+ ? sourceContext is ScalarValue { Value: string s }
+ ? s.Split(".", 2)[1]
+ : sourceContext.ToString().Split(".", 2)[1]
+ : "";
+ var levelText = logEvent.Level switch
+ {
+ LogEventLevel.Verbose => "VERBOSE",
+ LogEventLevel.Debug => "DEBUG",
+ LogEventLevel.Information => "INFO",
+ LogEventLevel.Warning => "WARNING",
+ LogEventLevel.Error => "ERROR",
+ LogEventLevel.Fatal => "FATAL",
+ _ => "UNKNOWN"
+ };
+
+ var prefix = $"{timestamp} | {ctx,-67} | {levelText,-7} | ";
+
+ // print message
+ output.WriteLine(prefix + RenderWithoutQuotes(logEvent));
+
+ // print property
+ foreach (var kvp in logEvent.Properties)
+ {
+ if (kvp.Key == "SourceContext") continue;
+
+ var usedInMessage = logEvent.MessageTemplate.Tokens
+ .OfType<PropertyToken>()
+ .Any(t => t.PropertyName == kvp.Key);
+ if (usedInMessage) continue;
+
+ var valueText = kvp.Value is ScalarValue sv
+ ? sv.Value?.ToString() ?? ""
+ : kvp.Value.ToString();
+
+ output.WriteLine(new string(' ', prefix.Length) + $"{kvp.Key} = {valueText}");
+ }
+
+ if (logEvent.Exception != null)
+ {
+ output.WriteLine("Exception : ");
+ output.WriteLine($" {logEvent.Exception}");
+ }
+ }
+
+ private static string RenderWithoutQuotes(LogEvent logEvent)
+ {
+ var output = new StringWriter();
+ foreach (var token in logEvent.MessageTemplate.Tokens)
+ if (token is PropertyToken pt && logEvent.Properties.TryGetValue(pt.PropertyName, out var value))
+ {
+ if (value is ScalarValue { Value: string s })
+ // write string without quotes
+ output.Write(s);
+ else
+ // use default rendering for other types
+ pt.Render(logEvent.Properties, output);
+ }
+ else
+ {
+ token.Render(logEvent.Properties, output);
+ }
+
+ return output.ToString();
+ }
+}
+
+public partial class App : Application
+{
+ private IHost? _host;
+ private ILogger<App> _logger = null!;
+
+ protected override async void OnStartup(StartupEventArgs e)
+ {
+ base.OnStartup(e);
+
+ // Create the required directories if they don't exist
+ Directory.CreateDirectory(Shared.ResourcesDirectory);
+ Directory.CreateDirectory(Shared.RootDirectory);
+ Directory.CreateDirectory(Shared.RevertDirectory);
+
+ var logPath = Path.Combine(Shared.RootDirectory, "optimizerDuck.log");
+ Log.Logger = new LoggerConfiguration()
+ .MinimumLevel.Verbose()
+ .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
+ .Enrich.FromLogContext()
+ .WriteTo.File(
+ new ScopeBlockTextFormatter(),
+ logPath,
+ rollingInterval: RollingInterval.Infinite
+ )
+ .CreateLogger();
+
+ _host = Host.CreateDefaultBuilder()
+ .UseSerilog()
+ .ConfigureAppConfiguration((c) =>
+ {
+ ConfigManager.ValidateConfig();
+ c.AddJsonFile(Path.Combine(Shared.RootDirectory, "appsettings.json"), false, true);
+ })
+ .ConfigureServices((context, services) =>
+ {
+ services.Configure<AppSettings>(context.Configuration);
+
+ // WPF UI shi
+ services.AddNavigationViewPageProvider();
+ services.AddSingleton<INavigationService, NavigationService>();
+ services.AddSingleton<IContentDialogService, ContentDialogService>();
+ services.AddSingleton<ISnackbarService, SnackbarService>();
+
+ // Windows
+ services.AddSingleton<MainWindow>();
+
+ // Pages
+ services.AddSingleton<DashboardViewModel>();
+ services.AddSingleton<DashboardPage>();
+
+ services.AddSingleton<OptimizeViewModel>();
+ services.AddSingleton<OptimizePage>();
+
+ services.AddSingleton<SettingsViewModel>();
+ services.AddSingleton<SettingsPage>();
+
+ // Optimizations
+ services.AddAllOptimizationPages();
+
+ // Managers
+ services.AddSingleton<ConfigManager>();
+ services.AddScoped<RevertManager>();
+
+ // Services
+ services.AddSingleton<OptimizationRegistry>();
+ services.AddScoped<OptimizationService>();
+ services.AddSingleton<SystemInfoService>();
+ services.AddSingleton<StreamService>();
+ })
+ .Build();
+
+ await _host.StartAsync();
+
+ var config = _host.Services.GetRequiredService<ConfigManager>();
+ await config.InitializeAsync();
+
+ var appOptionsMonitor = _host.Services.GetRequiredService<IOptionsMonitor<AppSettings>>();
+ // init shell service with config
+ ShellService.Init(appOptionsMonitor);
+
+ var appSettings = appOptionsMonitor.CurrentValue;
+
+ Loc.Instance.ChangeCulture(new CultureInfo(appSettings.App.Language));
+
+ _logger = _host.Services.GetRequiredService<ILogger<App>>();
+ _logger.LogInformation("\n{Logo}\nVersion: {Version}\n\n", Shared.RawLogo, Shared.FileVersion);
+ _logger.LogInformation("Loaded language: {Language}", appSettings.App.Language);
+
+ var optimizationRegistry = _host.Services.GetRequiredService<OptimizationRegistry>();
+ _logger.LogInformation("Preloading optimizations...");
+ await optimizationRegistry.PreloadOptimizations();
+
+ // Apply custom accent colors
+ ApplicationAccentColorManager.Apply(
+ Color.FromRgb(254, 209, 20),
+ Color.FromRgb(242, 124, 20),
+ Color.FromRgb(254, 209, 20),
+ Color.FromRgb(242, 124, 20)
+ );
+
+ ApplicationThemeManager.Apply(
+ appSettings.App.Theme switch
+ {
+ "Dark" => ApplicationTheme.Dark,
+ "HighContrast" => ApplicationTheme.HighContrast,
+ _ => ApplicationTheme.Light
+ },
+ updateAccent: false
+ );
+
+ var mainWindow = _host.Services.GetRequiredService<MainWindow>();
+ mainWindow.Show();
+ }
+
+ protected override async void OnExit(ExitEventArgs e)
+ {
+ if (_host != null)
+ {
+ await _host.StopAsync();
+ _host.Dispose();
+ }
+
+ await Log.CloseAndFlushAsync();
+
+ base.OnExit(e);
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/AssemblyInfo.cs b/optimizerDuck/AssemblyInfo.cs
new file mode 100644
index 0000000..4a05c7d
--- /dev/null
+++ b/optimizerDuck/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
\ No newline at end of file
diff --git a/optimizerDuck/Common/Extensions/LanguageExtensions.cs b/optimizerDuck/Common/Extensions/LanguageExtensions.cs
new file mode 100644
index 0000000..8b28894
--- /dev/null
+++ b/optimizerDuck/Common/Extensions/LanguageExtensions.cs
@@ -0,0 +1,119 @@
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+using optimizerDuck.Services.Managers;
+
+namespace optimizerDuck.Common.Extensions;
+
+/// <summary>
+/// maybe i will add change language runtime support later
+/// </summary>
+public class LocExtension : MarkupExtension
+{
+ public LocExtension()
+ {
+ }
+
+ public LocExtension(string key)
+ {
+ Key = key;
+ }
+
+ public LocExtension(string key, BindingBase arg1) : this(key)
+ {
+ Args.Add(arg1);
+ }
+
+ public LocExtension(string key, BindingBase arg1, BindingBase arg2) : this(key)
+ {
+ Args.Add(arg1);
+ Args.Add(arg2);
+ }
+
+ public LocExtension(string key, BindingBase arg1, BindingBase arg2, BindingBase arg3) : this(key)
+ {
+ Args.Add(arg1);
+ Args.Add(arg2);
+ Args.Add(arg3);
+ }
+
+ public LocExtension(string key, BindingBase arg1, BindingBase arg2, BindingBase arg3, BindingBase arg4) : this(key)
+ {
+ Args.Add(arg1);
+ Args.Add(arg2);
+ Args.Add(arg3);
+ Args.Add(arg4);
+ }
+
+ public LocExtension(string key, BindingBase arg1, BindingBase arg2, BindingBase arg3, BindingBase arg4,
+ BindingBase arg5) : this(key)
+ {
+ Args.Add(arg1);
+ Args.Add(arg2);
+ Args.Add(arg3);
+ Args.Add(arg4);
+ Args.Add(arg5);
+ }
+
+ public string? Key { get; set; }
+
+ public List<BindingBase> Args { get; } = [];
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ if (Args.Count == 0)
+ return new Binding($"[{Key}]")
+ {
+ Source = Loc.Instance,
+ Mode = BindingMode.OneWay
+ }.ProvideValue(serviceProvider);
+
+ var mb = new MultiBinding
+ {
+ Converter = new LocDynamicConverter(),
+ ConverterParameter = Key
+ };
+
+ // [0] Loc.Instance (required OneWay)
+ mb.Bindings.Add(new Binding
+ {
+ Source = Loc.Instance,
+ Mode = BindingMode.OneWay
+ });
+
+ foreach (var arg in Args)
+ {
+ if (arg is Binding b)
+ b.Mode = BindingMode.OneWay;
+
+ mb.Bindings.Add(arg);
+ }
+
+ return mb.ProvideValue(serviceProvider);
+ }
+}
+
+public class LocDynamicConverter : IMultiValueConverter
+{
+ public object Convert(object[] values, Type targetType, object? parameter, CultureInfo culture)
+ {
+ if (values.Length == 0 || values[0] is not Loc loc)
+ return "";
+
+ if (parameter is not string key)
+ return "";
+
+ var format = loc[key];
+ if (values.Length == 1)
+ return format;
+
+ // skip Loc.Instance, get args
+ var args = values.Skip(1).ToArray();
+ return string.Format(culture, format, args);
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotSupportedException();
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Extensions/TextExtensions.cs b/optimizerDuck/Common/Extensions/StringExtensions.cs
similarity index 67%
rename from optimizerDuck/src/Core/Extensions/TextExtensions.cs
rename to optimizerDuck/Common/Extensions/StringExtensions.cs
index 31599a5..028052f 100644
--- a/optimizerDuck/src/Core/Extensions/TextExtensions.cs
+++ b/optimizerDuck/Common/Extensions/StringExtensions.cs
@@ -1,44 +1,11 @@
-using System.Management.Automation;
+using System.Management.Automation;
using System.Text;
using System.Xml.Linq;
-namespace optimizerDuck.Core.Extensions;
+namespace optimizerDuck.Common.Extensions;
public static class TextExtensions
{
- public static string LimitWidth(this string text, int maxWidth, bool wrap = true)
- {
- if (string.IsNullOrEmpty(text))
- return text;
-
- if (!wrap)
- return text.Length <= maxWidth ? text : text[..(maxWidth - 1)] + "…";
-
- var words = text.Split(' ', StringSplitOptions.RemoveEmptyEntries);
- var sb = new StringBuilder();
- var line = new StringBuilder();
-
- foreach (var word in words)
- {
- // Check if adding the next word (plus a space if needed) would exceed the max width.
- // If yes, finalize the current line and start a new one.
- if (line.Length + word.Length + 1 > maxWidth)
- if (line.Length > 0)
- {
- sb.AppendLine(line.ToString().TrimEnd());
- line.Clear();
- }
-
- line.Append(word).Append(' ');
- }
-
- // Trim the trailing space from the last word before appending the line.
- if (line.Length > 0)
- sb.Append(line.ToString().TrimEnd());
-
- return sb.ToString();
- }
-
public static string ParseCliXml(this string? cliXml)
{
if (string.IsNullOrWhiteSpace(cliXml))
@@ -125,4 +92,11 @@ public static class TextExtensions
return value;
}
}
+
+ public static string FormatTime(this TimeSpan time)
+ {
+ if (time.TotalSeconds >= 1) return $"{time.TotalSeconds:F1}s";
+ if (time.TotalMilliseconds >= 1) return $"{time.TotalMilliseconds:F0}ms";
+ return time.Ticks > 0 ? $"{time.Ticks} ticks" : "0";
+ }
}
\ No newline at end of file
diff --git a/optimizerDuck/Common/Helpers/Converters/BooleanConverter.cs b/optimizerDuck/Common/Helpers/Converters/BooleanConverter.cs
new file mode 100644
index 0000000..2aa21d6
--- /dev/null
+++ b/optimizerDuck/Common/Helpers/Converters/BooleanConverter.cs
@@ -0,0 +1,24 @@
+using System.Globalization;
+using System.Windows.Data;
+
+namespace optimizerDuck.Common.Helpers.Converters;
+
+// Source - https://stackoverflow.com/a/5182660
+// Posted by Atif Aziz, modified by community. See post 'Timeline' for change history
+// Retrieved 2026-01-21, License - CC BY-SA 2.5
+
+public class BooleanConverter<T>(T trueValue, T falseValue) : IValueConverter
+{
+ public T True { get; set; } = trueValue;
+ public T False { get; set; } = falseValue;
+
+ public virtual object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ return value is true ? True : False;
+ }
+
+ public virtual object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ return value is T value1 && EqualityComparer<T>.Default.Equals(value1, True);
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Common/Helpers/Converters/BooleanToVisibilityConverter.cs b/optimizerDuck/Common/Helpers/Converters/BooleanToVisibilityConverter.cs
new file mode 100644
index 0000000..09b0a43
--- /dev/null
+++ b/optimizerDuck/Common/Helpers/Converters/BooleanToVisibilityConverter.cs
@@ -0,0 +1,6 @@
+using System.Windows;
+
+namespace optimizerDuck.Common.Helpers.Converters;
+
+public sealed class BooleanToVisibilityConverter()
+ : BooleanConverter<Visibility>(Visibility.Visible, Visibility.Collapsed);
\ No newline at end of file
diff --git a/optimizerDuck/Common/Helpers/Converters/GreaterThanNumberToVisibilityConverter.cs b/optimizerDuck/Common/Helpers/Converters/GreaterThanNumberToVisibilityConverter.cs
new file mode 100644
index 0000000..e3db0d0
--- /dev/null
+++ b/optimizerDuck/Common/Helpers/Converters/GreaterThanNumberToVisibilityConverter.cs
@@ -0,0 +1,23 @@
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace optimizerDuck.Common.Helpers.Converters;
+
+public class GreaterThanNumberToVisibilityConverter : IValueConverter
+{
+ public int Threshold { get; set; } = 1;
+
+ public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ if (value is not int intValue)
+ return Visibility.Collapsed;
+
+ return intValue > Threshold ? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotSupportedException();
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Common/Helpers/Converters/GreaterThanZeroToVisibilityConverter.cs b/optimizerDuck/Common/Helpers/Converters/GreaterThanZeroToVisibilityConverter.cs
new file mode 100644
index 0000000..be85b93
--- /dev/null
+++ b/optimizerDuck/Common/Helpers/Converters/GreaterThanZeroToVisibilityConverter.cs
@@ -0,0 +1,21 @@
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace optimizerDuck.Common.Helpers.Converters;
+
+public class GreaterThanZeroToVisibilityConverter : IValueConverter
+{
+ public Visibility True { get; set; } = Visibility.Visible;
+ public Visibility False { get; set; } = Visibility.Collapsed;
+
+ public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ return value is > 0 ? True : False;
+ }
+
+ public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotSupportedException();
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Common/Helpers/Converters/MBToGBConverter.cs b/optimizerDuck/Common/Helpers/Converters/MBToGBConverter.cs
new file mode 100644
index 0000000..968951c
--- /dev/null
+++ b/optimizerDuck/Common/Helpers/Converters/MBToGBConverter.cs
@@ -0,0 +1,18 @@
+using System.Globalization;
+using System.Windows.Data;
+
+namespace optimizerDuck.Common.Helpers.Converters;
+
+public class MBToGBConverter : IValueConverter
+{
+ public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ if (value is int mb and > 0) return (mb / 1024.0).ToString("F1");
+ return "N/A";
+ }
+
+ public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotSupportedException();
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Common/Helpers/Converters/MinusNumberConverter.cs b/optimizerDuck/Common/Helpers/Converters/MinusNumberConverter.cs
new file mode 100644
index 0000000..ac2ca1a
--- /dev/null
+++ b/optimizerDuck/Common/Helpers/Converters/MinusNumberConverter.cs
@@ -0,0 +1,21 @@
+using System.Globalization;
+using System.Windows.Data;
+
+namespace optimizerDuck.Common.Helpers.Converters;
+
+public class MinusNumberConverter : IValueConverter
+{
+ public int NumberToMinus { get; set; } = 1;
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is int intValue)
+ return intValue - NumberToMinus;
+ return value;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Common/Helpers/Converters/NullToVisibilityConverter.cs b/optimizerDuck/Common/Helpers/Converters/NullToVisibilityConverter.cs
new file mode 100644
index 0000000..0063e24
--- /dev/null
+++ b/optimizerDuck/Common/Helpers/Converters/NullToVisibilityConverter.cs
@@ -0,0 +1,21 @@
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace optimizerDuck.Common.Helpers.Converters;
+
+public class NullToVisibilityConverter : IValueConverter
+{
+ public Visibility True { get; set; } = Visibility.Visible;
+ public Visibility False { get; set; } = Visibility.Collapsed;
+
+ public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ return value is null ? True : False;
+ }
+
+ public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Common/Helpers/Converters/ThemeToGitHubIconConverter.cs b/optimizerDuck/Common/Helpers/Converters/ThemeToGitHubIconConverter.cs
new file mode 100644
index 0000000..7be3a21
--- /dev/null
+++ b/optimizerDuck/Common/Helpers/Converters/ThemeToGitHubIconConverter.cs
@@ -0,0 +1,24 @@
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Media.Imaging;
+using Wpf.Ui.Appearance;
+
+namespace optimizerDuck.Common.Helpers.Converters;
+
+public sealed class ThemeToGitHubIconConverter : IValueConverter
+{
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is ApplicationTheme theme && theme == ApplicationTheme.Dark)
+ return new BitmapImage(
+ new Uri("pack://application:,,,/Resources/Images/GitHubLogoWhite.png"));
+
+ return new BitmapImage(
+ new Uri("pack://application:,,,/Resources/Images/GitHubLogoBlack.png"));
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotSupportedException();
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Common/Helpers/Converters/ThemeToIndexConverter.cs b/optimizerDuck/Common/Helpers/Converters/ThemeToIndexConverter.cs
new file mode 100644
index 0000000..d79e325
--- /dev/null
+++ b/optimizerDuck/Common/Helpers/Converters/ThemeToIndexConverter.cs
@@ -0,0 +1,28 @@
+using System.Globalization;
+using System.Windows.Data;
+using Wpf.Ui.Appearance;
+
+namespace optimizerDuck.Common.Helpers.Converters;
+
+public sealed class ThemeToIndexConverter : IValueConverter
+{
+ public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ return value switch
+ {
+ ApplicationTheme.Dark => 1,
+ ApplicationTheme.HighContrast => 2,
+ _ => 0
+ };
+ }
+
+ public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ return value switch
+ {
+ 1 => ApplicationTheme.Dark,
+ 2 => ApplicationTheme.HighContrast,
+ _ => ApplicationTheme.Light
+ };
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Common/Helpers/Converters/WidthToColumnConverter.cs b/optimizerDuck/Common/Helpers/Converters/WidthToColumnConverter.cs
new file mode 100644
index 0000000..5752007
--- /dev/null
+++ b/optimizerDuck/Common/Helpers/Converters/WidthToColumnConverter.cs
@@ -0,0 +1,24 @@
+using System.Globalization;
+using System.Windows.Data;
+
+namespace optimizerDuck.Common.Helpers.Converters;
+
+public class WidthToColumnConverter : IValueConverter
+{
+ public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ if (value is not double width) return 2;
+ return width switch
+ {
+ < 770 => 1,
+ < 1100 => 2,
+ < 1480 => 3,
+ _ => 4
+ };
+ }
+
+ public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotSupportedException();
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Common/Helpers/Converters/ZeroToVisibilityConverter.cs b/optimizerDuck/Common/Helpers/Converters/ZeroToVisibilityConverter.cs
new file mode 100644
index 0000000..a93c8db
--- /dev/null
+++ b/optimizerDuck/Common/Helpers/Converters/ZeroToVisibilityConverter.cs
@@ -0,0 +1,21 @@
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace optimizerDuck.Common.Helpers.Converters;
+
+public class ZeroToVisibilityConverter : IValueConverter
+{
+ public Visibility True { get; set; } = Visibility.Visible;
+ public Visibility False { get; set; } = Visibility.Collapsed;
+
+ public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ return value is 0 ? True : False;
+ }
+
+ public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotSupportedException();
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Helpers/ReflectionHelper.cs b/optimizerDuck/Common/Helpers/ReflectionHelper.cs
similarity index 50%
rename from optimizerDuck/src/Core/Helpers/ReflectionHelper.cs
rename to optimizerDuck/Common/Helpers/ReflectionHelper.cs
index 264dad0..dc94277 100644
--- a/optimizerDuck/src/Core/Helpers/ReflectionHelper.cs
+++ b/optimizerDuck/Common/Helpers/ReflectionHelper.cs
@@ -1,7 +1,6 @@
-using System.Reflection;
-using optimizerDuck.Core.Managers;
+using System.Reflection;
-namespace optimizerDuck.Core.Helpers;
+namespace optimizerDuck.Common.Helpers;
public static class ReflectionHelper
{
@@ -24,18 +23,11 @@ public static class ReflectionHelper
public static IEnumerable<Type> FindImplementationsInLoadedAssemblies(Type interfaceType)
{
- if (!interfaceType.IsInterface)
- throw new ArgumentException("interfaceType must be an interface", nameof(interfaceType));
-
- return CacheManager.GetOrCreate(interfaceType.FullName!, entry =>
- {
- entry.SlidingExpiration = TimeSpan.FromMinutes(5);
- return AppDomain.CurrentDomain.GetAssemblies()
- .SelectMany(SafeGetTypes)
- .Where(t => t != interfaceType && t is { IsClass: true, IsAbstract: false } &&
- interfaceType.IsAssignableFrom(t))
- .ToList();
- });
+ return AppDomain.CurrentDomain.GetAssemblies()
+ .SelectMany(SafeGetTypes)
+ .Where(t => t != interfaceType && t is { IsClass: true, IsAbstract: false } &&
+ interfaceType.IsAssignableFrom(t))
+ .ToList();
}
public static IEnumerable<Type> FindImplementationsInLoadedAssemblies<TInterface>()
diff --git a/optimizerDuck/Common/Helpers/Shared.cs b/optimizerDuck/Common/Helpers/Shared.cs
new file mode 100644
index 0000000..33ec27c
--- /dev/null
+++ b/optimizerDuck/Common/Helpers/Shared.cs
@@ -0,0 +1,44 @@
+using System.Diagnostics;
+using System.IO;
+
+namespace optimizerDuck.Common.Helpers;
+
+public static class Shared
+{
+ public const string RawLogo = """
+ _ _ _ _____ _
+ | | (_) (_) | __ \ | |
+ ___ _ __ | |_ _ _ __ ___ _ _______ _ __| | | |_ _ ___| | __
+ / _ \| '_ \| __| | '_ ` _ \| |_ / _ \ '__| | | | | | |/ __| |/ /
+ | (_) | |_) | |_| | | | | | | |/ / __/ | | |__| | |_| | (__| <
+ \___/| .__/ \__|_|_| |_| |_|_/___\___|_| |_____/ \__,_|\___|_|\_\
+ | |
+ |_|
+ """;
+
+
+ public const string DiscordInviteURL = "https://discord.gg/GqvJYQsgSm";
+ public const string GitHubRepoURL = "https://github.com/itsfatduck/optimizerDuck";
+ public const string SupportMeURL = "https://github.com/itsfatduck/optimizerDuck/SUPPORT.md";
+
+ public const string AcknowledgementsURL = "https://github.com/itsfatduck/optimizerDuck/blob/master/THIRD-PARTY-NOTICES.md";
+
+ public const string PowerPlanUrl =
+ "https://github.com/itsfatduck/optimizerDuck/raw/refs/heads/master/optimizerDuck.Resources/optimizerDuck.pow";
+
+ public const string PowerPlanGUID = "8ae61178-2c55-43f2-afb2-f83725823657";
+
+ public static readonly string ExePath = Environment.ProcessPath!;
+ public static readonly string ExeDir = Path.GetDirectoryName(ExePath)!;
+ public static readonly string ExeName = Path.GetFileName(ExePath);
+ public static readonly string FileVersion = FileVersionInfo.GetVersionInfo(ExePath).FileVersion!;
+
+ public static string RootDirectory =>
+ Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "optimizerDuck");
+
+ public static string ResourcesDirectory =>
+ Path.Combine(RootDirectory, "Resources");
+
+ public static string RevertDirectory =>
+ Path.Combine(RootDirectory, "Revert");
+}
\ No newline at end of file
diff --git a/optimizerDuck/Common/Helpers/ThemeResource.cs b/optimizerDuck/Common/Helpers/ThemeResource.cs
new file mode 100644
index 0000000..6f2086d
--- /dev/null
+++ b/optimizerDuck/Common/Helpers/ThemeResource.cs
@@ -0,0 +1,12 @@
+using System.Windows;
+
+namespace optimizerDuck.Common.Helpers;
+
+public static class ThemeResource
+{
+ public static T Get<T>(string key) where T : class
+ {
+ return Application.Current.Resources[key] as T
+ ?? throw new KeyNotFoundException(key);
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Interfaces/IOptimization.cs b/optimizerDuck/Core/Interfaces/IOptimization.cs
new file mode 100644
index 0000000..8e1559c
--- /dev/null
+++ b/optimizerDuck/Core/Interfaces/IOptimization.cs
@@ -0,0 +1,19 @@
+using optimizerDuck.Core.Models.Optimization;
+using optimizerDuck.Core.Models.UI;
+using OptimizationState = optimizerDuck.Core.Models.UI.OptimizationState;
+
+namespace optimizerDuck.Core.Interfaces;
+
+public interface IOptimization
+{
+ Guid Id { get; }
+ OptimizationRisk Risk { get; }
+
+ string OptimizationKey { get; }
+
+ string Name { get; }
+ string ShortDescription { get; }
+ OptimizationState State { get; set; }
+
+ Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context);
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Interfaces/IOptimizationCategory.cs b/optimizerDuck/Core/Interfaces/IOptimizationCategory.cs
new file mode 100644
index 0000000..fd6e210
--- /dev/null
+++ b/optimizerDuck/Core/Interfaces/IOptimizationCategory.cs
@@ -0,0 +1,12 @@
+using System.Collections.ObjectModel;
+using optimizerDuck.Core.Models.Optimization;
+using optimizerDuck.Core.Models.UI;
+
+namespace optimizerDuck.Core.Interfaces;
+
+public interface IOptimizationCategory
+{
+ public string Name { get; init; }
+ public OptimizationCategoryOrder Order { get; init; }
+ public ObservableCollection<IOptimization> Optimizations { get; init; }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Interfaces/IRevertStep.cs b/optimizerDuck/Core/Interfaces/IRevertStep.cs
new file mode 100644
index 0000000..639f012
--- /dev/null
+++ b/optimizerDuck/Core/Interfaces/IRevertStep.cs
@@ -0,0 +1,12 @@
+using Newtonsoft.Json.Linq;
+
+namespace optimizerDuck.Core.Interfaces;
+
+public interface IRevertStep
+{
+ public string Type { get; }
+
+ Task<bool> ExecuteAsync();
+
+ JObject ToData();
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Interfaces/IWindow.cs b/optimizerDuck/Core/Interfaces/IWindow.cs
new file mode 100644
index 0000000..80b9047
--- /dev/null
+++ b/optimizerDuck/Core/Interfaces/IWindow.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+namespace optimizerDuck.Core.Interfaces;
+
+public interface IWindow
+{
+ event RoutedEventHandler Loaded;
+
+ void Show();
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/Attributes/OptimizationAttribute.cs b/optimizerDuck/Core/Models/Attributes/OptimizationAttribute.cs
new file mode 100644
index 0000000..e205dc2
--- /dev/null
+++ b/optimizerDuck/Core/Models/Attributes/OptimizationAttribute.cs
@@ -0,0 +1,11 @@
+using optimizerDuck.Core.Models.UI;
+
+namespace optimizerDuck.Core.Models.Attributes;
+
+[AttributeUsage(AttributeTargets.Class, Inherited = false)]
+public sealed class OptimizationAttribute : Attribute
+{
+ public required string Id { get; init; }
+ public required OptimizationRisk Risk { get; init; }
+ public required OptimizationTags Tags { get; init; }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/Attributes/OptimizationCategoryAttribute.cs b/optimizerDuck/Core/Models/Attributes/OptimizationCategoryAttribute.cs
new file mode 100644
index 0000000..4142514
--- /dev/null
+++ b/optimizerDuck/Core/Models/Attributes/OptimizationCategoryAttribute.cs
@@ -0,0 +1,7 @@
+namespace optimizerDuck.Core.Models.Attributes;
+
+[AttributeUsage(AttributeTargets.Class, Inherited = false)]
+public class OptimizationCategoryAttribute(Type pageType) : Attribute
+{
+ public Type PageType { get; init; } = pageType;
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/Config/AppSettings.cs b/optimizerDuck/Core/Models/Config/AppSettings.cs
new file mode 100644
index 0000000..a08d87b
--- /dev/null
+++ b/optimizerDuck/Core/Models/Config/AppSettings.cs
@@ -0,0 +1,18 @@
+namespace optimizerDuck.Core.Models.Config;
+
+public sealed class AppSettings
+{
+ public AppOptions App { get; set; } = new();
+ public OptimizeOptions Optimize { get; set; } = new();
+
+ public sealed class AppOptions
+ {
+ public string Language { get; set; } = "en-US";
+ public string Theme { get; set; } = "Dark";
+ }
+
+ public sealed class OptimizeOptions
+ {
+ public int ShellTimeoutMs { get; set; } = 120000;
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/Optimization/ApplyResult.cs b/optimizerDuck/Core/Models/Optimization/ApplyResult.cs
new file mode 100644
index 0000000..dbfee98
--- /dev/null
+++ b/optimizerDuck/Core/Models/Optimization/ApplyResult.cs
@@ -0,0 +1,14 @@
+namespace optimizerDuck.Core.Models.Optimization;
+
+public readonly record struct ApplyResult(string? Message)
+{
+ public static ApplyResult True()
+ {
+ return new ApplyResult(null);
+ }
+
+ public static ApplyResult False(string message)
+ {
+ return new ApplyResult(message);
+ }
+}
diff --git a/optimizerDuck/Core/Models/Optimization/OperationStepResult.cs b/optimizerDuck/Core/Models/Optimization/OperationStepResult.cs
new file mode 100644
index 0000000..83e1d63
--- /dev/null
+++ b/optimizerDuck/Core/Models/Optimization/OperationStepResult.cs
@@ -0,0 +1,11 @@
+namespace optimizerDuck.Core.Models.Optimization;
+
+public record OperationStepResult
+{
+ public int Index { get; init; }
+ public string Name { get; init; } = string.Empty;
+ public string Description { get; init; } = string.Empty;
+ public bool Success { get; init; }
+ public string? Error { get; init; }
+ public Func<Task<bool>>? RetryAction { get; init; }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/Optimization/OptimizationContext.cs b/optimizerDuck/Core/Models/Optimization/OptimizationContext.cs
new file mode 100644
index 0000000..cc803c8
--- /dev/null
+++ b/optimizerDuck/Core/Models/Optimization/OptimizationContext.cs
@@ -0,0 +1,10 @@
+using Microsoft.Extensions.Logging;
+using optimizerDuck.Common.Helpers;
+using optimizerDuck.Services;
+
+namespace optimizerDuck.Core.Models.Optimization;
+
+public record OptimizationContext(
+ ILogger Logger,
+ SystemSnapshot Snapshot,
+ StreamService StreamService);
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/Optimization/OptimizationResult.cs b/optimizerDuck/Core/Models/Optimization/OptimizationResult.cs
new file mode 100644
index 0000000..26e2248
--- /dev/null
+++ b/optimizerDuck/Core/Models/Optimization/OptimizationResult.cs
@@ -0,0 +1,11 @@
+using optimizerDuck.Core.Models.UI;
+
+namespace optimizerDuck.Core.Models.Optimization;
+
+public record OptimizationResult
+{
+ public OptimizationSuccessResult Status { get; init; }
+ public string Message { get; init; } = string.Empty;
+ public Exception? Exception { get; init; }
+ public List<OperationStepResult> FailedSteps { get; init; } = [];
+}
\ No newline at end of file
diff --git a/optimizerDuck/src/Models/RegistryItem.cs b/optimizerDuck/Core/Models/Optimization/Services/RegistryItem.cs
similarity index 94%
rename from optimizerDuck/src/Models/RegistryItem.cs
rename to optimizerDuck/Core/Models/Optimization/Services/RegistryItem.cs
index 1f29797..be9c554 100644
--- a/optimizerDuck/src/Models/RegistryItem.cs
+++ b/optimizerDuck/Core/Models/Optimization/Services/RegistryItem.cs
@@ -1,6 +1,6 @@
-using Microsoft.Win32;
+using Microsoft.Win32;
-namespace optimizerDuck.Models;
+namespace optimizerDuck.Core.Models.Optimization.Services;
public record struct RegistryItem
{
diff --git a/optimizerDuck/Core/Models/Optimization/Services/ServiceItem.cs b/optimizerDuck/Core/Models/Optimization/Services/ServiceItem.cs
new file mode 100644
index 0000000..d59310d
--- /dev/null
+++ b/optimizerDuck/Core/Models/Optimization/Services/ServiceItem.cs
@@ -0,0 +1,3 @@
+namespace optimizerDuck.Core.Models.Optimization.Services;
+
+public readonly record struct ServiceItem(string Name, ServiceStartupType StartupType);
\ No newline at end of file
diff --git a/optimizerDuck/src/Models/ServiceStartupType.cs b/optimizerDuck/Core/Models/Optimization/Services/ServiceStartupType.cs
similarity index 62%
rename from optimizerDuck/src/Models/ServiceStartupType.cs
rename to optimizerDuck/Core/Models/Optimization/Services/ServiceStartupType.cs
index a7efbe1..7b1c2e1 100644
--- a/optimizerDuck/src/Models/ServiceStartupType.cs
+++ b/optimizerDuck/Core/Models/Optimization/Services/ServiceStartupType.cs
@@ -1,4 +1,4 @@
-namespace optimizerDuck.Models;
+namespace optimizerDuck.Core.Models.Optimization.Services;
public enum ServiceStartupType
{
diff --git a/optimizerDuck/Core/Models/Optimization/Services/ShellResult.cs b/optimizerDuck/Core/Models/Optimization/Services/ShellResult.cs
new file mode 100644
index 0000000..ba15b57
--- /dev/null
+++ b/optimizerDuck/Core/Models/Optimization/Services/ShellResult.cs
@@ -0,0 +1,8 @@
+namespace optimizerDuck.Core.Models.Optimization.Services;
+
+public record ShellResult(
+ string Command,
+ string Stdout,
+ string Stderr,
+ int ExitCode,
+ TimeSpan Duration);
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/Revert/RevertContext.cs b/optimizerDuck/Core/Models/Revert/RevertContext.cs
new file mode 100644
index 0000000..adb1364
--- /dev/null
+++ b/optimizerDuck/Core/Models/Revert/RevertContext.cs
@@ -0,0 +1,43 @@
+using Microsoft.Extensions.Logging;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Services.Managers;
+
+namespace optimizerDuck.Core.Models.Revert;
+
+public sealed class RevertContext : IAsyncDisposable
+{
+ private readonly ILogger _logger;
+ private readonly RevertManager _manager;
+ private readonly IOptimization _optimization;
+ private readonly Stack<IRevertStep> _steps = new();
+
+ internal RevertContext(IOptimization optimization, ILogger logger, RevertManager manager)
+ {
+ _optimization = optimization;
+ _logger = logger;
+ _manager = manager;
+ }
+
+ public async ValueTask DisposeAsync()
+ {
+ try
+ {
+ if (_steps.Count > 0)
+ await _manager.SaveAsync(
+ _optimization.Id,
+ _optimization.OptimizationKey,
+ _steps);
+ else
+ _logger.LogWarning("No revert steps recorded for {Name}", _optimization.OptimizationKey);
+ }
+ finally
+ {
+ if (RevertManager.Current == this) RevertManager.ClearCurrent();
+ }
+ }
+
+ internal void AddStep(IRevertStep step)
+ {
+ _steps.Push(step);
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/Revert/RevertData.cs b/optimizerDuck/Core/Models/Revert/RevertData.cs
new file mode 100644
index 0000000..10bb763
--- /dev/null
+++ b/optimizerDuck/Core/Models/Revert/RevertData.cs
@@ -0,0 +1,17 @@
+using Newtonsoft.Json.Linq;
+
+namespace optimizerDuck.Core.Models.Revert;
+
+public class RevertStepData
+{
+ public string Type { get; set; } = string.Empty;
+ public JObject Data { get; set; } = new();
+}
+
+public class RevertData
+{
+ public Guid OptimizationId { get; set; }
+ public string OptimizationName { get; set; } = string.Empty;
+ public DateTime AppliedAt { get; set; }
+ public List<RevertStepData> Steps { get; set; } = new();
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/Revert/RevertResult.cs b/optimizerDuck/Core/Models/Revert/RevertResult.cs
new file mode 100644
index 0000000..6a49b74
--- /dev/null
+++ b/optimizerDuck/Core/Models/Revert/RevertResult.cs
@@ -0,0 +1,12 @@
+using optimizerDuck.Core.Models.Optimization;
+
+namespace optimizerDuck.Core.Models.Revert;
+
+public class RevertResult
+{
+ public bool Success { get; set; }
+ public string Message { get; set; } = string.Empty;
+ public Exception? Exception { get; set; }
+
+ public List<OperationStepResult> FailedStepDetails { get; set; } = [];
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/Revert/RevertValidationResult.cs b/optimizerDuck/Core/Models/Revert/RevertValidationResult.cs
new file mode 100644
index 0000000..8f17a2e
--- /dev/null
+++ b/optimizerDuck/Core/Models/Revert/RevertValidationResult.cs
@@ -0,0 +1,28 @@
+using optimizerDuck.Resources.Languages;
+using optimizerDuck.Services.Managers;
+
+namespace optimizerDuck.Core.Models.Revert;
+
+public class RevertValidationResult
+{
+ private RevertValidationResult(bool valid, string message, string localizedMessage)
+ {
+ IsValid = valid;
+ Message = message;
+ LocalizedMessage = localizedMessage;
+ }
+
+ public bool IsValid { get; private set; }
+ public string Message { get; private set; }
+ public string LocalizedMessage { get; private set; }
+
+ public static RevertValidationResult Success()
+ {
+ return new RevertValidationResult(true, "Revert data is valid.", Translations.Revert_Error_InvalidData);
+ }
+
+ public static RevertValidationResult Fail(string localizedMessage, string message)
+ {
+ return new RevertValidationResult(false, message, localizedMessage);
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/Revert/Steps/RegistryRevertStep.cs b/optimizerDuck/Core/Models/Revert/Steps/RegistryRevertStep.cs
new file mode 100644
index 0000000..6fc11a9
--- /dev/null
+++ b/optimizerDuck/Core/Models/Revert/Steps/RegistryRevertStep.cs
@@ -0,0 +1,157 @@
+using Microsoft.Win32;
+using Newtonsoft.Json.Linq;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Optimization.Services;
+using optimizerDuck.Services.OptimizationServices;
+
+namespace optimizerDuck.Core.Models.Revert.Steps;
+
+public class RegistryRevertStep : IRevertStep
+{
+ public RevertAction Action { get; init; }
+ public string Path { get; init; } = string.Empty;
+ public string? Name { get; init; }
+
+ /// <summary>
+ /// List of subkeys that were created during the apply operation (in order of creation, deepest first for cleanup)
+ /// </summary>
+ public IReadOnlyList<string>? CreatedSubKeys { get; init; }
+
+ public object? Value { get; init; }
+ public RegistryValueKind Kind { get; init; }
+ public string Type => "Registry";
+
+ public async Task<bool> ExecuteAsync()
+ {
+ return await Task.Run(() =>
+ {
+ var valueName = Name ?? string.Empty;
+
+ var result = Action switch
+ {
+ RevertAction.NoPreviousValue =>
+ RegistryService.DeleteValue(new RegistryItem(Path, valueName)),
+
+ RevertAction.RestorePrevious =>
+ Value == null
+ ? false
+ : RegistryService.Write(new RegistryItem(Path, valueName, Value!, Kind)),
+
+ _ => false
+ };
+
+ // Cleanup empty subkeys if they were created during apply
+ if (result && CreatedSubKeys?.Count > 0) RegistryService.CleanupEmptyKeys(CreatedSubKeys);
+
+ return result;
+ });
+ }
+
+
+ public JObject ToData()
+ {
+ var obj = new JObject
+ {
+ [nameof(Action)] = Action.ToString(),
+ [nameof(Path)] = Path,
+ [nameof(Name)] = Name,
+ [nameof(Kind)] = Kind.ToString()
+ };
+
+ // Save created subkeys list
+ if (CreatedSubKeys?.Count > 0) obj[nameof(CreatedSubKeys)] = new JArray(CreatedSubKeys);
+
+ // Serialize Value based on Kind to ensure deterministic JSON and avoid JValue rendering issues
+ if (Value == null)
+ {
+ obj[nameof(Value)] = null;
+ return obj;
+ }
+
+ switch (Kind)
+ {
+ case RegistryValueKind.DWord:
+ obj[nameof(Value)] = new JValue(Convert.ToInt32(Value));
+ break;
+ case RegistryValueKind.QWord:
+ obj[nameof(Value)] = new JValue(Convert.ToInt64(Value));
+ break;
+ case RegistryValueKind.String:
+ case RegistryValueKind.ExpandString:
+ obj[nameof(Value)] = new JValue(Value.ToString());
+ break;
+ case RegistryValueKind.MultiString:
+ if (Value is string[] sa)
+ obj[nameof(Value)] = new JArray(sa);
+ else
+ obj[nameof(Value)] = JToken.FromObject(Value);
+ break;
+ case RegistryValueKind.Binary:
+ if (Value is byte[] bytes)
+ obj[nameof(Value)] = Convert.ToBase64String(bytes);
+ else
+ obj[nameof(Value)] = Value.ToString();
+ break;
+ default:
+ // Fallback: serialize as token (strings/numbers/arrays)
+ obj[nameof(Value)] = JToken.FromObject(Value);
+ break;
+ }
+
+ return obj;
+ }
+
+ public static RegistryRevertStep FromData(JObject data)
+ {
+ var kind = Enum.Parse<RegistryValueKind>(data[nameof(Kind)]!.ToString());
+ var token = data[nameof(Value)];
+
+ object? value = null;
+ if (token != null && token.Type != JTokenType.Null)
+ switch (kind)
+ {
+ case RegistryValueKind.DWord:
+ value = token.ToObject<int>();
+ break;
+ case RegistryValueKind.QWord:
+ value = token.ToObject<long>();
+ break;
+ case RegistryValueKind.String:
+ case RegistryValueKind.ExpandString:
+ value = token.ToObject<string>();
+ break;
+ case RegistryValueKind.MultiString:
+ value = token.Type == JTokenType.Array ? token.ToObject<string[]>() : token.ToObject<string[]>();
+ break;
+ case RegistryValueKind.Binary:
+ // stored as base64 string
+ var base64 = token.ToObject<string>();
+ value = base64 != null ? Convert.FromBase64String(base64) : null;
+ break;
+ default:
+ // best-effort
+ value = token.ToObject<object>();
+ break;
+ }
+
+ // Load created subkeys list
+ List<string>? createdSubKeys = null;
+ if (data[nameof(CreatedSubKeys)] is JArray subKeysArray) createdSubKeys = subKeysArray.ToObject<List<string>>();
+
+ return new RegistryRevertStep
+ {
+ Action = Enum.Parse<RevertAction>(data[nameof(Action)]!.ToString()),
+ Path = data[nameof(Path)]!.ToString(),
+ Name = data[nameof(Name)]?.ToObject<string>(),
+ Value = value,
+ Kind = kind,
+ CreatedSubKeys = createdSubKeys
+ };
+ }
+}
+
+public enum RevertAction
+{
+ NoPreviousValue,
+ RestorePrevious
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/Revert/Steps/ServiceRevertStep.cs b/optimizerDuck/Core/Models/Revert/Steps/ServiceRevertStep.cs
new file mode 100644
index 0000000..808f18e
--- /dev/null
+++ b/optimizerDuck/Core/Models/Revert/Steps/ServiceRevertStep.cs
@@ -0,0 +1,41 @@
+using Newtonsoft.Json.Linq;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Optimization.Services;
+using optimizerDuck.Services.OptimizationServices;
+
+namespace optimizerDuck.Core.Models.Revert.Steps;
+
+public class ServiceRevertStep : IRevertStep
+{
+ public string ServiceName { get; set; } = string.Empty;
+ public ServiceStartupType OriginalStartupType { get; set; }
+ public string Type => "Service";
+
+ public async Task<bool> ExecuteAsync()
+ {
+ return await Task.Run(() => ServiceProcessService.ChangeServiceStartupType(new ServiceItem
+ {
+ Name = ServiceName,
+ StartupType = OriginalStartupType
+ }));
+ }
+
+ public JObject ToData()
+ {
+ return new JObject
+ {
+ [nameof(ServiceName)] = ServiceName,
+ [nameof(OriginalStartupType)] = OriginalStartupType.ToString()
+ };
+ }
+
+ public static ServiceRevertStep FromData(JObject data)
+ {
+ return new ServiceRevertStep
+ {
+ ServiceName = data[nameof(ServiceName)]?.ToString() ?? string.Empty,
+ OriginalStartupType = Enum.Parse<ServiceStartupType>(
+ data[nameof(OriginalStartupType)]?.ToString() ?? "Manual")
+ };
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/Revert/Steps/ShellRevertStep.cs b/optimizerDuck/Core/Models/Revert/Steps/ShellRevertStep.cs
new file mode 100644
index 0000000..329d1cc
--- /dev/null
+++ b/optimizerDuck/Core/Models/Revert/Steps/ShellRevertStep.cs
@@ -0,0 +1,52 @@
+using Newtonsoft.Json.Linq;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Optimization.Services;
+using optimizerDuck.Services.OptimizationServices;
+
+namespace optimizerDuck.Core.Models.Revert.Steps;
+
+public class ShellRevertStep : IRevertStep
+{
+ public ShellType ShellType { get; set; }
+ public string Command { get; set; } = string.Empty;
+ public string Type => "Shell";
+
+ public async Task<bool> ExecuteAsync()
+ {
+ return await Task.Run(() =>
+ {
+ var result = ShellType switch
+ {
+ ShellType.PowerShell => ShellService.PowerShell(Command),
+ ShellType.CMD => ShellService.CMD(Command),
+ _ => new ShellResult(Command, "", "Unknown shell type", 1, TimeSpan.Zero)
+ };
+ return result.ExitCode == 0;
+ });
+ }
+
+ public JObject ToData()
+ {
+ return new JObject
+ {
+ [nameof(ShellType)] = ShellType.ToString(),
+ [nameof(Command)] = Command
+ };
+ }
+
+ public static ShellRevertStep FromData(JToken data)
+ {
+ return new ShellRevertStep
+ {
+ ShellType = Enum.Parse<ShellType>(
+ data[nameof(ShellType)]?.ToString() ?? "PowerShell"),
+ Command = data[nameof(Command)]?.ToString() ?? string.Empty
+ };
+ }
+}
+
+public enum ShellType
+{
+ PowerShell,
+ CMD
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/UI/LanguageOption.cs b/optimizerDuck/Core/Models/UI/LanguageOption.cs
new file mode 100644
index 0000000..436c585
--- /dev/null
+++ b/optimizerDuck/Core/Models/UI/LanguageOption.cs
@@ -0,0 +1,8 @@
+using System.Globalization;
+
+namespace optimizerDuck.Core.Models.UI;
+
+public record LanguageOption(
+ string DisplayName,
+ CultureInfo Culture
+);
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/UI/OptimizationCategoryOrder.cs b/optimizerDuck/Core/Models/UI/OptimizationCategoryOrder.cs
new file mode 100644
index 0000000..76e2c93
--- /dev/null
+++ b/optimizerDuck/Core/Models/UI/OptimizationCategoryOrder.cs
@@ -0,0 +1,11 @@
+namespace optimizerDuck.Core.Models.UI;
+
+public enum OptimizationCategoryOrder
+{
+ Performance,
+ SecurityAndPrivacy,
+ Gpu,
+ Power,
+ BloatwareAndServices,
+ UserExperience
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/UI/OptimizationRisk.cs b/optimizerDuck/Core/Models/UI/OptimizationRisk.cs
new file mode 100644
index 0000000..be4b68e
--- /dev/null
+++ b/optimizerDuck/Core/Models/UI/OptimizationRisk.cs
@@ -0,0 +1,8 @@
+namespace optimizerDuck.Core.Models.UI;
+
+public enum OptimizationRisk
+{
+ Safe,
+ Moderate,
+ Risky
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/UI/OptimizationRiskVisual.cs b/optimizerDuck/Core/Models/UI/OptimizationRiskVisual.cs
new file mode 100644
index 0000000..f390aed
--- /dev/null
+++ b/optimizerDuck/Core/Models/UI/OptimizationRiskVisual.cs
@@ -0,0 +1,9 @@
+using Wpf.Ui.Controls;
+
+namespace optimizerDuck.Core.Models.UI;
+
+public class OptimizationRiskVisual
+{
+ public string Display { get; init; } = string.Empty;
+ public SymbolRegular Icon { get; init; }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/UI/OptimizationState.cs b/optimizerDuck/Core/Models/UI/OptimizationState.cs
new file mode 100644
index 0000000..26b4d19
--- /dev/null
+++ b/optimizerDuck/Core/Models/UI/OptimizationState.cs
@@ -0,0 +1,68 @@
+using System.Windows;
+using System.Windows.Threading;
+using CommunityToolkit.Mvvm.ComponentModel;
+using optimizerDuck.Resources.Languages;
+
+namespace optimizerDuck.Core.Models.UI;
+
+public partial class OptimizationState : ObservableObject
+{
+ private readonly DispatcherTimer _timer;
+ private int _lastDisplayedSeconds = -1;
+
+ [ObservableProperty] private DateTime? appliedAt;
+ [ObservableProperty] private bool isApplied;
+ [ObservableProperty] private string? relativeTime = string.Empty;
+
+ [ObservableProperty] private OptimizationRisk risk;
+
+ public OptimizationState()
+ {
+ _timer = new DispatcherTimer(
+ TimeSpan.FromMilliseconds(250),
+ DispatcherPriority.Render,
+ (s, e) => UpdateRelativeTime(),
+ Application.Current?.Dispatcher
+ ?? Dispatcher.CurrentDispatcher
+ );
+ _timer.Start();
+ }
+
+ private void UpdateRelativeTime()
+ {
+ if (AppliedAt == null)
+ {
+ RelativeTime = string.Empty;
+ _lastDisplayedSeconds = -1;
+ return;
+ }
+
+ var ts = DateTime.UtcNow - AppliedAt.Value.ToUniversalTime();
+ var totalSeconds = (int)Math.Floor(ts.TotalSeconds);
+ if (totalSeconds == _lastDisplayedSeconds) return;
+
+ _lastDisplayedSeconds = totalSeconds;
+
+ RelativeTime = ts switch
+ {
+ _ when totalSeconds < 15 => Translations.Common_AppliedJustNow,
+ _ when totalSeconds < 60 =>
+ string.Format(Translations.Common_AppliedSecondsAgo, totalSeconds),
+ _ when ts.TotalMinutes < 60 =>
+ string.Format(Translations.Common_AppliedMinutesAgo, (int)Math.Floor(ts.TotalMinutes)),
+ _ when ts.TotalHours < 24 =>
+ string.Format(Translations.Common_AppliedHoursAgo, (int)Math.Floor(ts.TotalHours)),
+ _ when ts.TotalDays < 30 =>
+ string.Format(Translations.Common_AppliedDaysAgo, (int)Math.Floor(ts.TotalDays)),
+ _ when ts.TotalDays < 365 =>
+ string.Format(Translations.Common_AppliedMonthsAgo, (int)(ts.TotalDays / 30)),
+ _ => string.Format(Translations.Common_AppliedYearsAgo, (int)(ts.TotalDays / 365))
+ };
+ }
+
+ partial void OnAppliedAtChanged(DateTime? value)
+ {
+ _lastDisplayedSeconds = -1;
+ UpdateRelativeTime();
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/UI/OptimizationSuccessResult.cs b/optimizerDuck/Core/Models/UI/OptimizationSuccessResult.cs
new file mode 100644
index 0000000..3524055
--- /dev/null
+++ b/optimizerDuck/Core/Models/UI/OptimizationSuccessResult.cs
@@ -0,0 +1,8 @@
+namespace optimizerDuck.Core.Models.UI;
+
+public enum OptimizationSuccessResult
+{
+ Success,
+ PartialSuccess,
+ Failed
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/UI/OptimizationTags.cs b/optimizerDuck/Core/Models/UI/OptimizationTags.cs
new file mode 100644
index 0000000..8210755
--- /dev/null
+++ b/optimizerDuck/Core/Models/UI/OptimizationTags.cs
@@ -0,0 +1,133 @@
+using optimizerDuck.Resources.Languages;
+using Wpf.Ui.Controls;
+
+namespace optimizerDuck.Core.Models.UI;
+
+[Flags]
+public enum OptimizationTags
+{
+ None = 0,
+
+ // Hardware
+ Ram = 1 << 0,
+ Display = 1 << 1,
+ Disk = 1 << 2,
+
+ // Network
+ Network = 1 << 3,
+ NetworkRequired = 1 << 4,
+
+ // System & Security
+ Privacy = 1 << 5,
+ Security = 1 << 6,
+ System = 1 << 7,
+
+ // User Experience
+ Audio = 1 << 8,
+ Visual = 1 << 9,
+
+ // GPU Vendors
+ Nvidia = 1 << 10,
+ Amd = 1 << 11,
+ Intel = 1 << 12,
+
+ // Power
+ Power = 1 << 13,
+
+ // Performance
+ Performance = 1 << 14,
+ Latency = 1 << 15
+}
+
+
+public static class OptimizationTagsToDisplay
+{
+ extension(OptimizationTags tags)
+ {
+ public IEnumerable<OptimizationTagDisplay> ToDisplays()
+ {
+ foreach (var flag in Enum.GetValues<OptimizationTags>())
+ {
+ if (flag == OptimizationTags.None)
+ continue;
+
+ if (tags.HasFlag(flag))
+ yield return flag.ToDisplay();
+ }
+ }
+
+ private OptimizationTagDisplay ToDisplay()
+ {
+ return tags switch
+ {
+ OptimizationTags.Ram => new OptimizationTagDisplay(
+ SymbolRegular.Memory16,
+ Translations.Optimizer_UI_Tags_Ram),
+
+ OptimizationTags.Disk => new OptimizationTagDisplay(
+ SymbolRegular.HardDrive20,
+ Translations.Optimizer_UI_Tags_Disk),
+
+ OptimizationTags.Latency => new OptimizationTagDisplay(
+ SymbolRegular.Clock24,
+ Translations.Optimizer_UI_Tags_Latency),
+
+ OptimizationTags.Visual => new OptimizationTagDisplay(
+ SymbolRegular.VideoClip24,
+ Translations.Optimizer_UI_Tags_Visual),
+
+ OptimizationTags.Display => new OptimizationTagDisplay(
+ SymbolRegular.VideoClip24,
+ Translations.Optimizer_UI_Tags_Display),
+
+ OptimizationTags.Network => new OptimizationTagDisplay(
+ SymbolRegular.NetworkAdapter16,
+ Translations.Optimizer_UI_Tags_Network),
+
+ OptimizationTags.Performance => new OptimizationTagDisplay(
+ SymbolRegular.Gauge24,
+ Translations.Optimizer_UI_Tags_Performance),
+
+ OptimizationTags.Privacy => new OptimizationTagDisplay(
+ SymbolRegular.LockOpen24,
+ Translations.Optimizer_UI_Tags_Privacy),
+
+ OptimizationTags.Audio => new OptimizationTagDisplay(
+ SymbolRegular.Headphones24,
+ Translations.Optimizer_UI_Tags_Audio),
+
+ OptimizationTags.System => new OptimizationTagDisplay(
+ SymbolRegular.Desktop24,
+ Translations.Optimizer_UI_Tags_System),
+
+ OptimizationTags.Security => new OptimizationTagDisplay(
+ SymbolRegular.LockClosed24,
+ Translations.Optimizer_UI_Tags_Security),
+
+ OptimizationTags.NetworkRequired => new OptimizationTagDisplay(
+ SymbolRegular.NetworkAdapter16,
+ Translations.Optimizer_UI_Tags_NetworkRequired),
+
+ OptimizationTags.Nvidia => new OptimizationTagDisplay(
+ SymbolRegular.VideoClip24,
+ Translations.Optimizer_UI_Tags_Nvidia),
+
+ OptimizationTags.Amd => new OptimizationTagDisplay(
+ SymbolRegular.VideoClip24,
+ Translations.Optimizer_UI_Tags_Amd),
+
+ OptimizationTags.Intel => new OptimizationTagDisplay(
+ SymbolRegular.VideoClip24,
+ Translations.Optimizer_UI_Tags_Intel),
+
+ OptimizationTags.Power => new OptimizationTagDisplay(
+ SymbolRegular.BatteryCharge24,
+ Translations.Optimizer_UI_Tags_Power),
+
+ _ => throw new ArgumentOutOfRangeException(nameof(tags))
+ };
+ }
+ }
+}
+
+public readonly record struct OptimizationTagDisplay(SymbolRegular Icon, string Display);
\ No newline at end of file
diff --git a/optimizerDuck/Core/Models/UI/ProcessingProgress.cs b/optimizerDuck/Core/Models/UI/ProcessingProgress.cs
new file mode 100644
index 0000000..4a4cb42
--- /dev/null
+++ b/optimizerDuck/Core/Models/UI/ProcessingProgress.cs
@@ -0,0 +1,9 @@
+namespace optimizerDuck.Core.Models.UI;
+
+public record ProcessingProgress
+{
+ public string Message { get; init; } = string.Empty;
+ public bool IsIndeterminate { get; init; } = true;
+ public int Value { get; init; }
+ public int Total { get; init; }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Optimizers/BaseOptimization.cs b/optimizerDuck/Core/Optimizers/BaseOptimization.cs
new file mode 100644
index 0000000..f7ac933
--- /dev/null
+++ b/optimizerDuck/Core/Optimizers/BaseOptimization.cs
@@ -0,0 +1,103 @@
+using System.Reflection;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Attributes;
+using optimizerDuck.Core.Models.Optimization;
+using optimizerDuck.Core.Models.UI;
+using optimizerDuck.Resources.Languages;
+using optimizerDuck.Services.Managers;
+using Wpf.Ui.Controls;
+using OptimizationState = optimizerDuck.Core.Models.UI.OptimizationState;
+
+namespace optimizerDuck.Core.Optimizers;
+
+public abstract class BaseOptimization : IOptimization
+{
+ private OptimizationAttribute? _meta;
+
+ private OptimizationAttribute Meta =>
+ _meta ??= GetType().GetCustomAttribute<OptimizationAttribute>()
+ ?? throw new InvalidOperationException(
+ $"{GetType().Name} is missing [Optimization] attribute");
+
+ public Guid Id => Guid.Parse(Meta.Id);
+ public OptimizationRisk Risk => Meta.Risk;
+
+ public Type? OwnerType { get; set; }
+
+ public string OwnerKey =>
+ OwnerType?.Name
+ ?? throw new InvalidOperationException(
+ $"{GetType().Name} has no owner assigned");
+
+ public string OptimizationKey => GetType().Name;
+
+ public OptimizationRiskVisual RiskVisual => Risk switch
+ {
+ OptimizationRisk.Safe => new OptimizationRiskVisual
+ {
+ Display = Translations.Optimizer_UI_Risk_Safe,
+ Icon = SymbolRegular.ShieldCheckmark24
+ },
+ OptimizationRisk.Moderate => new OptimizationRiskVisual
+ {
+ Display = Translations.Optimizer_UI_Risk_Moderate,
+ Icon = SymbolRegular.Warning24
+ },
+ OptimizationRisk.Risky => new OptimizationRiskVisual
+ {
+ Display = Translations.Optimizer_UI_Risk_Risky,
+ Icon = SymbolRegular.ShieldError24
+ },
+ _ => new OptimizationRiskVisual
+ {
+ Display = Translations.Optimizer_UI_Risk_Safe,
+ Icon = SymbolRegular.ShieldCheckmark24
+ }
+ };
+
+ public IEnumerable<OptimizationTagDisplay> TagDisplays =>
+ Meta.Tags.ToDisplays();
+
+ public OptimizationState State { get; set; } = new();
+
+ public string Prefix => Loc.Instance[$"Optimizer.{OwnerKey}.{OptimizationKey}"];
+ public string ProgressPrefix => Loc.Instance[$"{Prefix}.Progress"];
+ public string ErrorPrefix => Loc.Instance[$"{Prefix}.Error"];
+
+ public string Name => Loc.Instance[$"{Prefix}.Name"];
+ public string ShortDescription => Loc.Instance[$"{Prefix}.ShortDescription"];
+
+ public abstract Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context);
+}
+
+/*
+using Microsoft.Extensions.Logging;
+using System.Collections.ObjectModel;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Attributes;
+using optimizerDuck.Core.Models.Optimization;
+using optimizerDuck.Core.Models.UI;
+using optimizerDuck.Services.Managers;
+using optimizerDuck.UI.Views.Pages.Optimizations;
+
+namespace optimizerDuck.Core.Optimizers;
+
+[OptimizationCategory(typeof(PAGE))]
+public class OPTIMIZER : IOptimizationCategory
+{
+ public string Name { get; init; } = Loc.Instance[$"Optimizer.{nameof(OPTIMIZER)}"];
+ public OptimizationCategoryOrder Order { get; init; } = OptimizationCategoryOrder.OPTIMIZER_ORDER;
+ public ObservableCollection<IOptimization> Optimizations { get; init; } = [];
+
+ [Optimization(Id = "OPTIMIZATION_ID", Risk = OptimizationRisk.RISK,
+ Tags = OptimizationTags.TAG)]
+ public class OPTIMIZATION_NAME : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ // ... Optimization logic here ...
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+}
+ */
\ No newline at end of file
diff --git a/optimizerDuck/Core/Optimizers/BloatwareAndServices.cs b/optimizerDuck/Core/Optimizers/BloatwareAndServices.cs
new file mode 100644
index 0000000..71e625f
--- /dev/null
+++ b/optimizerDuck/Core/Optimizers/BloatwareAndServices.cs
@@ -0,0 +1,310 @@
+using System.Collections.ObjectModel;
+using Microsoft.Extensions.Logging;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Attributes;
+using optimizerDuck.Core.Models.Optimization;
+using optimizerDuck.Core.Models.Optimization.Services;
+using optimizerDuck.Core.Models.UI;
+using optimizerDuck.Services.Managers;
+using optimizerDuck.Services.OptimizationServices;
+using optimizerDuck.UI.Views.Pages.Optimizations;
+
+namespace optimizerDuck.Core.Optimizers;
+
+[OptimizationCategory(typeof(BloatwareAndServicesOptimizerPage))]
+public class BloatwareAndServices : IOptimizationCategory
+{
+ public string Name { get; init; } = Loc.Instance[$"Optimizer.{nameof(BloatwareAndServices)}"];
+ public OptimizationCategoryOrder Order { get; init; } = OptimizationCategoryOrder.BloatwareAndServices;
+ public ObservableCollection<IOptimization> Optimizations { get; init; } = [];
+
+ [Optimization(Id = "E3C970B0-129D-4354-BAE4-2732E5BACCF7", Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Disk)]
+ public class DisablePreinstalledApps : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "PreInstalledAppsEnabled", 0),
+ new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "PreInstalledAppsEverEnabled", 0),
+ new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "OemPreInstalledAppsEnabled", 0),
+ new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "SilentInstalledAppsEnabled", 0)
+ );
+ context.Logger.LogInformation("Blocked preinstalled apps");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(Id = "66126FAC-E79B-4CDA-9F53-F85DD88730A9", Risk = OptimizationRisk.Risky,
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Latency)]
+ public class ConfigureServices : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ var servicesToChange = new List<ServiceItem>
+ {
+ new("AJRouter", ServiceStartupType.Disabled),
+ new("ALG", ServiceStartupType.Manual),
+ new("AppIDSvc", ServiceStartupType.Manual),
+ new("AppMgmt", ServiceStartupType.Manual),
+ new("AppReadiness", ServiceStartupType.Manual),
+ new("AppVClient", ServiceStartupType.Disabled),
+ new("AppXSvc", ServiceStartupType.Manual),
+ new("Appinfo", ServiceStartupType.Manual),
+ new("AssignedAccessManagerSvc", ServiceStartupType.Disabled),
+ new("AudioEndpointBuilder", ServiceStartupType.Automatic),
+ new("Audiosrv", ServiceStartupType.Automatic),
+ new("AxInstSV", ServiceStartupType.Manual),
+ new("BDESVC", ServiceStartupType.Manual),
+ new("BFE", ServiceStartupType.Automatic),
+ new("BITS", ServiceStartupType.AutomaticDelayedStart),
+ new("BTAGService", ServiceStartupType.Manual),
+ new("BrokerInfrastructure", ServiceStartupType.Automatic),
+ new("Browser", ServiceStartupType.Manual),
+ new("BthAvctpSvc", ServiceStartupType.Automatic),
+ new("BthHFSrv", ServiceStartupType.Automatic),
+ new("CDPSvc", ServiceStartupType.Manual),
+ new("COMSysApp", ServiceStartupType.Manual),
+ new("CertPropSvc", ServiceStartupType.Manual),
+ new("ClipSVC", ServiceStartupType.Manual),
+ new("CoreMessagingRegistrar", ServiceStartupType.Automatic),
+ new("CryptSvc", ServiceStartupType.Automatic),
+ new("CscService", ServiceStartupType.Manual),
+ new("DPS", ServiceStartupType.Automatic),
+ new("DcomLaunch", ServiceStartupType.Automatic),
+ new("DcpSvc", ServiceStartupType.Manual),
+ new("DevQueryBroker", ServiceStartupType.Manual),
+ new("DeviceAssociationService", ServiceStartupType.Manual),
+ new("DeviceInstall", ServiceStartupType.Manual),
+ new("Dhcp", ServiceStartupType.Automatic),
+ new("DiagTrack", ServiceStartupType.Disabled),
+ new("DialogBlockingService", ServiceStartupType.Disabled),
+ new("DispBrokerDesktopSvc", ServiceStartupType.Automatic),
+ new("DisplayEnhancementService", ServiceStartupType.Manual),
+ new("DmEnrollmentSvc", ServiceStartupType.Manual),
+ new("Dnscache", ServiceStartupType.Automatic),
+ new("EFS", ServiceStartupType.Manual),
+ new("EapHost", ServiceStartupType.Manual),
+ new("EntAppSvc", ServiceStartupType.Manual),
+ new("EventLog", ServiceStartupType.Automatic),
+ new("EventSystem", ServiceStartupType.Automatic),
+ new("FDResPub", ServiceStartupType.Manual),
+ new("Fax", ServiceStartupType.Disabled),
+ new("FontCache", ServiceStartupType.Automatic),
+ new("FrameServer", ServiceStartupType.Manual),
+ new("FrameServerMonitor", ServiceStartupType.Manual),
+ new("GraphicsPerfSvc", ServiceStartupType.Manual),
+ new("HomeGroupListener", ServiceStartupType.Disabled),
+ new("HomeGroupProvider", ServiceStartupType.Disabled),
+ new("HvHost", ServiceStartupType.Manual),
+ new("IEEtwCollectorService", ServiceStartupType.Manual),
+ new("IKEEXT", ServiceStartupType.Manual),
+ new("InstallService", ServiceStartupType.Manual),
+ new("InventorySvc", ServiceStartupType.Manual),
+ new("IpxlatCfgSvc", ServiceStartupType.Manual),
+ new("KeyIso", ServiceStartupType.Automatic),
+ new("KtmRm", ServiceStartupType.Manual),
+ new("LSM", ServiceStartupType.Automatic),
+ new("LanmanServer", ServiceStartupType.Automatic),
+ new("LanmanWorkstation", ServiceStartupType.Automatic),
+ new("LicenseManager", ServiceStartupType.Manual),
+ new("LxpSvc", ServiceStartupType.Manual),
+ new("MSDTC", ServiceStartupType.Manual),
+ new("MSiSCSI", ServiceStartupType.Manual),
+ new("MapsBroker", ServiceStartupType.AutomaticDelayedStart),
+ new("McpManagementService", ServiceStartupType.Manual),
+ new("MicrosoftEdgeElevationService", ServiceStartupType.Manual),
+ new("MixedRealityOpenXRSvc", ServiceStartupType.Manual),
+ new("MpsSvc", ServiceStartupType.Automatic),
+ new("MsKeyboardFilter", ServiceStartupType.Manual),
+ new("NaturalAuthentication", ServiceStartupType.Manual),
+ new("NcaSvc", ServiceStartupType.Manual),
+ new("NcbService", ServiceStartupType.Manual),
+ new("NcdAutoSetup", ServiceStartupType.Manual),
+ new("NetSetupSvc", ServiceStartupType.Manual),
+ new("NetTcpPortSharing", ServiceStartupType.Disabled),
+ new("Netman", ServiceStartupType.Manual),
+ new("NgcCtnrSvc", ServiceStartupType.Manual),
+ new("NgcSvc", ServiceStartupType.Manual),
+ new("NlaSvc", ServiceStartupType.Manual),
+ new("PNRPAutoReg", ServiceStartupType.Manual),
+ new("PNRPsvc", ServiceStartupType.Manual),
+ new("PcaSvc", ServiceStartupType.Manual),
+ new("PeerDistSvc", ServiceStartupType.Manual),
+ new("PerfHost", ServiceStartupType.Manual),
+ new("PhoneSvc", ServiceStartupType.Manual),
+ new("PlugPlay", ServiceStartupType.Automatic),
+ new("PolicyAgent", ServiceStartupType.Manual),
+ new("Power", ServiceStartupType.Automatic),
+ new("PrintNotify", ServiceStartupType.Manual),
+ new("ProfSvc", ServiceStartupType.Automatic),
+ new("PushToInstall", ServiceStartupType.Manual),
+ new("QWAVE", ServiceStartupType.Manual),
+ new("RasAuto", ServiceStartupType.Manual),
+ new("RasMan", ServiceStartupType.Manual),
+ new("RemoteAccess", ServiceStartupType.Disabled),
+ new("RemoteRegistry", ServiceStartupType.Disabled),
+ new("RetailDemo", ServiceStartupType.Manual),
+ new("RmSvc", ServiceStartupType.Manual),
+ new("RpcEptMapper", ServiceStartupType.Automatic),
+ new("RpcLocator", ServiceStartupType.Manual),
+ new("RpcSs", ServiceStartupType.Automatic),
+ new("SCPolicySvc", ServiceStartupType.Manual),
+ new("SCardSvr", ServiceStartupType.Manual),
+ new("SDRSVC", ServiceStartupType.Manual),
+ new("SEMgrSvc", ServiceStartupType.Manual),
+ new("SENS", ServiceStartupType.Automatic),
+ new("SNMPTRAP", ServiceStartupType.Manual),
+ new("SSDPSRV", ServiceStartupType.Manual),
+ new("SamSs", ServiceStartupType.Automatic),
+ new("ScDeviceEnum", ServiceStartupType.Manual),
+ new("Schedule", ServiceStartupType.Automatic),
+ new("SensorDataService", ServiceStartupType.Manual),
+ new("SensorService", ServiceStartupType.Manual),
+ new("SensrSvc", ServiceStartupType.Manual),
+ new("SessionEnv", ServiceStartupType.Manual),
+ new("SharedAccess", ServiceStartupType.Manual),
+ new("SharedRealitySvc", ServiceStartupType.Manual),
+ new("ShellHWDetection", ServiceStartupType.Automatic),
+ new("SmsRouter", ServiceStartupType.Manual),
+ new("Spooler", ServiceStartupType.Automatic),
+ new("SstpSvc", ServiceStartupType.Manual),
+ new("StiSvc", ServiceStartupType.Manual),
+ new("StorSvc", ServiceStartupType.Manual),
+ new("SystemEventsBroker", ServiceStartupType.Automatic),
+ new("TabletInputService", ServiceStartupType.Manual),
+ new("TapiSrv", ServiceStartupType.Manual),
+ new("TermService", ServiceStartupType.Automatic),
+ new("Themes", ServiceStartupType.Automatic),
+ new("TieringEngineService", ServiceStartupType.Manual),
+ new("TimeBroker", ServiceStartupType.Manual),
+ new("TimeBrokerSvc", ServiceStartupType.Manual),
+ new("TokenBroker", ServiceStartupType.Manual),
+ new("TrkWks", ServiceStartupType.Automatic),
+ new("TroubleshootingSvc", ServiceStartupType.Manual),
+ new("UI0Detect", ServiceStartupType.Manual),
+ new("UevAgentService", ServiceStartupType.Disabled),
+ new("UmRdpService", ServiceStartupType.Manual),
+ new("UserManager", ServiceStartupType.Automatic),
+ new("UsoSvc", ServiceStartupType.Manual),
+ new("VGAuthService", ServiceStartupType.Automatic),
+ new("VMTools", ServiceStartupType.Automatic),
+ new("VSS", ServiceStartupType.Manual),
+ new("VacSvc", ServiceStartupType.Manual),
+ new("VaultSvc", ServiceStartupType.Automatic),
+ new("W32Time", ServiceStartupType.Manual),
+ new("WEPHOSTSVC", ServiceStartupType.Manual),
+ new("WFDSConMgrSvc", ServiceStartupType.Manual),
+ new("WMPNetworkSvc", ServiceStartupType.Manual),
+ new("WManSvc", ServiceStartupType.Manual),
+ new("WPDBusEnum", ServiceStartupType.Manual),
+ new("WSearch", ServiceStartupType.AutomaticDelayedStart),
+ new("WaaSMedicSvc", ServiceStartupType.Manual),
+ new("WalletService", ServiceStartupType.Manual),
+ new("WarpJITSvc", ServiceStartupType.Manual),
+ new("WbioSrvc", ServiceStartupType.Manual),
+ new("Wcmsvc", ServiceStartupType.Automatic),
+ new("WcsPlugInService", ServiceStartupType.Manual),
+ new("WdiServiceHost", ServiceStartupType.Manual),
+ new("WdiSystemHost", ServiceStartupType.Manual),
+ new("WebClient", ServiceStartupType.Manual),
+ new("Wecsvc", ServiceStartupType.Manual),
+ new("WerSvc", ServiceStartupType.Manual),
+ new("WiaRpc", ServiceStartupType.Manual),
+ new("WinHttpAutoProxySvc", ServiceStartupType.Manual),
+ new("WinRM", ServiceStartupType.Manual),
+ new("Winmgmt", ServiceStartupType.Automatic),
+ new("WlanSvc", ServiceStartupType.Automatic),
+ new("WpcMonSvc", ServiceStartupType.Manual),
+ new("WpnService", ServiceStartupType.Manual),
+ new("XblAuthManager", ServiceStartupType.Manual),
+ new("XblGameSave", ServiceStartupType.Manual),
+ new("XboxGipSvc", ServiceStartupType.Manual),
+ new("XboxNetApiSvc", ServiceStartupType.Manual),
+ new("autotimesvc", ServiceStartupType.Manual),
+ new("bthserv", ServiceStartupType.Manual),
+ new("camsvc", ServiceStartupType.Manual),
+ new("cloudidsvc", ServiceStartupType.Manual),
+ new("dcsvc", ServiceStartupType.Manual),
+ new("defragsvc", ServiceStartupType.Manual),
+ new("diagnosticshub.standardcollector.service", ServiceStartupType.Manual),
+ new("diagsvc", ServiceStartupType.Manual),
+ new("dmwappushservice", ServiceStartupType.Manual),
+ new("dot3svc", ServiceStartupType.Manual),
+ new("edgeupdate", ServiceStartupType.Manual),
+ new("edgeupdatem", ServiceStartupType.Manual),
+ new("embeddedmode", ServiceStartupType.Manual),
+ new("fdPHost", ServiceStartupType.Manual),
+ new("fhsvc", ServiceStartupType.Manual),
+ new("gpsvc", ServiceStartupType.Automatic),
+ new("hidserv", ServiceStartupType.Manual),
+ new("icssvc", ServiceStartupType.Manual),
+ new("iphlpsvc", ServiceStartupType.Automatic),
+ new("lfsvc", ServiceStartupType.Manual),
+ new("lltdsvc", ServiceStartupType.Manual),
+ new("lmhosts", ServiceStartupType.Manual),
+ new("msiserver", ServiceStartupType.Manual),
+ new("netprofm", ServiceStartupType.Manual),
+ new("nsi", ServiceStartupType.Automatic),
+ new("p2pimsvc", ServiceStartupType.Manual),
+ new("p2psvc", ServiceStartupType.Manual),
+ new("perceptionsimulation", ServiceStartupType.Manual),
+ new("pla", ServiceStartupType.Manual),
+ new("seclogon", ServiceStartupType.Manual),
+ new("shpamsvc", ServiceStartupType.Disabled),
+ new("smphost", ServiceStartupType.Manual),
+ new("spectrum", ServiceStartupType.Manual),
+ new("sppsvc", ServiceStartupType.AutomaticDelayedStart),
+ new("ssh-agent", ServiceStartupType.Disabled),
+ new("svsvc", ServiceStartupType.Manual),
+ new("swprv", ServiceStartupType.Manual),
+ new("tiledatamodelsvc", ServiceStartupType.Automatic),
+ new("tzautoupdate", ServiceStartupType.Disabled),
+ new("upnphost", ServiceStartupType.Manual),
+ new("vds", ServiceStartupType.Manual),
+ new("vm3dservice", ServiceStartupType.Manual),
+ new("vmicguestinterface", ServiceStartupType.Manual),
+ new("vmicheartbeat", ServiceStartupType.Manual),
+ new("vmickvpexchange", ServiceStartupType.Manual),
+ new("vmicrdv", ServiceStartupType.Manual),
+ new("vmicshutdown", ServiceStartupType.Manual),
+ new("vmictimesync", ServiceStartupType.Manual),
+ new("vmicvmsession", ServiceStartupType.Manual),
+ new("vmicvss", ServiceStartupType.Manual),
+ new("vmvss", ServiceStartupType.Manual),
+ new("wbengine", ServiceStartupType.Manual),
+ new("wcncsvc", ServiceStartupType.Manual),
+ new("webthreatdefsvc", ServiceStartupType.Manual),
+ new("wercplsupport", ServiceStartupType.Manual),
+ new("wisvc", ServiceStartupType.Manual),
+ new("wlidsvc", ServiceStartupType.Manual),
+ new("wlpasvc", ServiceStartupType.Manual),
+ new("wmiApSrv", ServiceStartupType.Manual),
+ new("workfolderssvc", ServiceStartupType.Manual),
+ new("wscsvc", ServiceStartupType.AutomaticDelayedStart),
+ new("wuauserv", ServiceStartupType.Manual)
+ };
+
+ for (var i = 0; i < servicesToChange.Count; i++)
+ {
+ var service = servicesToChange[i];
+ progress?.Report(new ProcessingProgress
+ {
+ Message = string.Format(Loc.Instance[$"{ProgressPrefix}.ChangeServiceStartupType"], service.Name,
+ service.StartupType),
+ IsIndeterminate = false,
+ Value = i + 1,
+ Total = servicesToChange.Count
+ });
+ ServiceProcessService.ChangeServiceStartupType(service);
+ }
+
+ context.Logger.LogInformation("Optimized service startup for {Count} services", servicesToChange.Count);
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Optimizers/Gpu.cs b/optimizerDuck/Core/Optimizers/Gpu.cs
new file mode 100644
index 0000000..83369fe
--- /dev/null
+++ b/optimizerDuck/Core/Optimizers/Gpu.cs
@@ -0,0 +1,246 @@
+using System.Collections.ObjectModel;
+using Microsoft.Extensions.Logging;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Attributes;
+using optimizerDuck.Core.Models.Optimization;
+using optimizerDuck.Core.Models.Optimization.Services;
+using optimizerDuck.Core.Models.UI;
+using optimizerDuck.Services;
+using optimizerDuck.Services.Managers;
+using optimizerDuck.Services.OptimizationServices;
+using optimizerDuck.UI.Views.Pages.Optimizations;
+
+namespace optimizerDuck.Core.Optimizers;
+
+public abstract class GpuRegistryOptimization : BaseOptimization
+{
+ protected abstract GpuVendor Vendor { get; }
+ protected abstract IReadOnlyList<RegistryItem> CreateItems(string registryPath);
+
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ foreach (var gpu in context.Snapshot.Gpus
+ .Where(g => g.Vendor == Vendor && !string.IsNullOrEmpty(g.DeviceId)))
+ {
+ if (!Gpu.TryParseDeviceIdToIndex(gpu.DeviceId, out var index))
+ {
+ context.Logger.LogWarning("Invalid DeviceId for GPU {GpuName} ({DeviceId})", gpu.Name, gpu.DeviceId);
+ continue;
+ }
+
+ var path =
+ $@"HKLM\SYSTEM\CurrentControlSet\Control\Class\{{4d36e968-e325-11ce-bfc1-08002be10318}}\{index:D4}";
+
+ RegistryService.Write(CreateItems(path).ToArray());
+ context.Logger.LogInformation("Applied {Optimization} for GPU {DeviceId}", GetType().Name, gpu.DeviceId);
+ }
+
+ return Task.FromResult(ApplyResult.True());
+ }
+}
+
+[OptimizationCategory(typeof(GpuOptimizerPage))]
+public class Gpu : IOptimizationCategory
+{
+ public string Name { get; init; } = Loc.Instance[$"Optimizer.{nameof(Gpu)}"];
+ public OptimizationCategoryOrder Order { get; init; } = OptimizationCategoryOrder.Gpu;
+ public ObservableCollection<IOptimization> Optimizations { get; init; } = [];
+
+ [Optimization(
+ Id = "4433CE93-B632-4D67-AE71-0241C31099C0",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Amd | OptimizationTags.Power)]
+ public class AmdDisableUlps : GpuRegistryOptimization
+ {
+ protected override GpuVendor Vendor => GpuVendor.AMD;
+
+ protected override IReadOnlyList<RegistryItem> CreateItems(string path) =>
+ [
+ new(path, "EnableULPS", 0)
+ ];
+ }
+
+ [Optimization(
+ Id = "A3836587-C461-4BEB-9C4C-88493B36C138",
+ Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.Amd | OptimizationTags.Performance)]
+ public class AmdDisablePowerGating : GpuRegistryOptimization
+ {
+ protected override GpuVendor Vendor => GpuVendor.AMD;
+
+ protected override IReadOnlyList<RegistryItem> CreateItems(string path) =>
+ [
+ new(path, "DisablePowerGating", 1),
+ new(path, "PP_GPUPowerDownEnabled", 0),
+ new(path, "DisableDynamicPstate", 1),
+ ];
+ }
+
+ [Optimization(
+ Id = "DB379BB5-FC8C-4AD3-BE32-11BE09E76FBA",
+ Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.Amd | OptimizationTags.Performance)]
+ public class AmdDisableVideoClockGating : GpuRegistryOptimization
+ {
+ protected override GpuVendor Vendor => GpuVendor.AMD;
+
+ protected override IReadOnlyList<RegistryItem> CreateItems(string path) =>
+ [
+ new(path, "DisableVCEPowerGating", 1),
+ new(path, "DisableVceClockGating", 1),
+ new(path, "EnableUvdClockGating", 0),
+ new(path, "EnableVceSwClockGating", 0),
+ ];
+ }
+
+
+ [Optimization(
+ Id = "8A4B4C4D-000E-42DB-8BD7-293067F8FAE7",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Amd | OptimizationTags.Latency)]
+ public class AmdDisableAspm : GpuRegistryOptimization
+ {
+ protected override GpuVendor Vendor => GpuVendor.AMD;
+
+ protected override IReadOnlyList<RegistryItem> CreateItems(string path) =>
+ [
+ new(path, "EnableAspmL0s", 0),
+ new(path, "EnableAspmL1", 0),
+ ];
+ }
+
+
+ [Optimization(
+ Id = "FA58802F-B98C-4E98-AA67-067C5A394296",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Nvidia | OptimizationTags.Power)]
+ public class NvidiaDisableDynamicPstate : GpuRegistryOptimization
+ {
+ protected override GpuVendor Vendor => GpuVendor.NVIDIA;
+
+ protected override IReadOnlyList<RegistryItem> CreateItems(string path) =>
+ [
+ new(path, "DisableDynamicPstate", 1)
+ ];
+ }
+
+
+ [Optimization(
+ Id = "9E7702BE-9E03-4C96-A316-C4E435CB993E",
+ Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.Nvidia | OptimizationTags.Performance)]
+ public class NvidiaDisableAsyncPstates : GpuRegistryOptimization
+ {
+ protected override GpuVendor Vendor => GpuVendor.NVIDIA;
+
+ protected override IReadOnlyList<RegistryItem> CreateItems(string path) =>
+ [
+ new(path, "DisableASyncPstates", 1)
+ ];
+ }
+
+ [Optimization(
+ Id = "DF8739FF-E322-4958-B369-DF584BB9B0C1",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Intel | OptimizationTags.Latency)]
+ public class IntelDisableAsyncFlips : GpuRegistryOptimization
+ {
+ protected override GpuVendor Vendor => GpuVendor.Intel;
+
+ protected override IReadOnlyList<RegistryItem> CreateItems(string path) =>
+ [
+ new(path, "Display1_DisableAsyncFlips", 1)
+ ];
+ }
+
+
+ [Optimization(
+ Id = "EBFB0DED-5D1A-4CD1-B5C0-4F7018DD6054",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Intel | OptimizationTags.Display)]
+ public class IntelDisableAdaptiveVsync : GpuRegistryOptimization
+ {
+ protected override GpuVendor Vendor => GpuVendor.Intel;
+
+ protected override IReadOnlyList<RegistryItem> CreateItems(string path) =>
+ [
+ new(path, "AdaptiveVsyncEnable", 0)
+ ];
+ }
+
+
+ /// <summary>
+ /// Attempts to parse a WMI <c>DeviceID</c> (e.g., "VideoController1") into a zero-based registry index
+ /// used in the Display Class registry path (e.g., "0000", "0001").
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Windows stores display adapter settings under:
+ /// <c>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\XXXX</c>
+ /// where <c>XXXX</c> is a 4-digit zero-padded index (e.g., <c>0000</c>).
+ /// </para>
+ /// <para>
+ /// The <see cref="Win32_VideoController" /> WMI class provides a <c>DeviceID</c> property in the format:
+ /// <c>"VideoController1"</c>, <c>"VideoController2"</c>, etc. This method converts:
+ /// <list type="bullet">
+ /// <item>
+ /// <description><c>"VideoController1"</c> → index <c>0</c> → registry subkey <c>"0000"</c></description>
+ /// </item>
+ /// <item>
+ /// <description><c>"VideoController2"</c> → index <c>1</c> → registry subkey <c>"0001"</c></description>
+ /// </item>
+ /// </list>
+ /// </para>
+ /// <para>
+ /// This mapping is <strong>required</strong> because the order of GPUs in <see cref="SystemSnapshot.Gpus" />
+ /// does <strong>not</strong> guarantee alignment with registry index order. Using array index (0, 1, 2...)
+ /// leads to applying tweaks to the wrong GPU (e.g., iGPU instead of dGPU).
+ /// </para>
+ /// </remarks>
+ /// <param name="deviceId">
+ /// The <c>DeviceID</c> string from <c>Win32_VideoController</c>, typically in the form
+ /// <c>"VideoControllerN"</c> where <c>N</c> is a positive integer starting from 1.
+ /// </param>
+ /// <param name="index">
+ /// When the method returns <c>true</c>, contains the zero-based index suitable for formatting with
+ /// <c>:D4</c> (e.g., <c>0</c> → <c>"0000"</c>). When <c>false</c>, the value is <c>-1</c>.
+ /// </param>
+ /// <returns>
+ /// <c>true</c> if <paramref name="deviceId" /> is valid and successfully parsed; otherwise, <c>false</c>.
+ /// </returns>
+ /// <example>
+ /// <code>
+ /// string deviceId = "VideoController1";
+ /// if (TryParseDeviceIdToIndex(deviceId, out int index))
+ /// {
+ /// string regPath = $@"HKLM\...\{{4d36e968-...\}}\{index:D4}"; // → "0000"
+ /// Console.WriteLine($"Apply tweak to GPU at registry index: {index:D4}");
+ /// }
+ /// </code>
+ /// </example>
+ /// <exception cref="ArgumentNullException">
+ /// Thrown if <paramref name="deviceId" /> is <c>null</c> — but this method uses <c>string.IsNullOrWhiteSpace</c>
+ /// and returns <c>false</c> instead for consistency with TryParse pattern.
+ /// </exception>
+ /// <seealso cref="GpuInfo.DeviceId" />
+ /// <seealso href="https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-videocontroller">
+ /// Win32_VideoController WMI class
+ /// </seealso>
+ public static bool TryParseDeviceIdToIndex(string? deviceId, out int index)
+ {
+ index = -1;
+ if (string.IsNullOrWhiteSpace(deviceId))
+ return false;
+
+ const string prefix = "VideoController";
+ if (!deviceId.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ var numberPart = deviceId[prefix.Length..];
+ if (!int.TryParse(numberPart, out var deviceNumber) || deviceNumber <= 0)
+ return false;
+
+ index = deviceNumber - 1; // convert to zero-based index
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Optimizers/Performance.cs b/optimizerDuck/Core/Optimizers/Performance.cs
new file mode 100644
index 0000000..4d884e5
--- /dev/null
+++ b/optimizerDuck/Core/Optimizers/Performance.cs
@@ -0,0 +1,253 @@
+using System.Collections.ObjectModel;
+using Microsoft.Extensions.Logging;
+using Microsoft.Win32;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Attributes;
+using optimizerDuck.Core.Models.Optimization;
+using optimizerDuck.Core.Models.Optimization.Services;
+using optimizerDuck.Core.Models.UI;
+using optimizerDuck.Services;
+using optimizerDuck.Services.Managers;
+using optimizerDuck.Services.OptimizationServices;
+using optimizerDuck.UI.Views.Pages.Optimizations;
+
+namespace optimizerDuck.Core.Optimizers;
+
+[OptimizationCategory(typeof(PerformanceOptimizerPage))]
+public class Performance : IOptimizationCategory
+{
+ public string Name { get; init; } = Loc.Instance[$"Optimizer.{nameof(Performance)}"];
+ public OptimizationCategoryOrder Order { get; init; } = OptimizationCategoryOrder.Performance;
+ public ObservableCollection<IOptimization> Optimizations { get; init; } = [];
+
+ [Optimization(Id = "648EC19A-FDA5-4607-8A7C-148B8B05FB4C", Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Ram)]
+ public class DisableBackgroundApps : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications",
+ "GlobalUserDisabled", 1),
+ new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search", "BackgroundAppGlobalToggle",
+ 0)
+ );
+ context.Logger.LogInformation("Disabled background apps");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(Id = "CD436A05-51F1-46E9-B4DE-5262EE7F812A", Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.System | OptimizationTags.Performance)]
+ public class SvcHostSplit : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ if (context.Snapshot.Ram.TotalKB <= 0)
+ {
+ context.Logger.LogInformation("Invalid RAM value: {RamTotalKB}. Skipping...", context.Snapshot.Ram.TotalKB);
+ return Task.FromResult(ApplyResult.False(string.Format(Loc.Instance[$"{ErrorPrefix}.InvalidRAM"], context.Snapshot.Ram.TotalKB)));
+ }
+
+ RegistryService.Write(
+ new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control", "SvcHostSplitThresholdInKB", context.Snapshot.Ram.TotalKB,
+ RegistryValueKind.DWord)
+ );
+ context.Logger.LogInformation("Enabled service host splitting with threshold: {ThresholdKB} KB", context.Snapshot.Ram.TotalKB);
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(Id = "C51E4187-BE49-4376-A97D-46C967A033B5", Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Power)]
+ public class ProcessPriority : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ /*
+ ref: https://forums.blurbusters.com/viewtopic.php?t=8535
+ 42 Dec, 2A Hex = Short, Fixed , High foreground boost.
+ 41 Dec, 29 Hex = Short, Fixed , Medium foreground boost.
+ 40 Dec, 28 Hex = Short, Fixed , No foreground boost.
+
+ 38 Dec, 26 Hex = Short, Variable , High foreground boost.
+ 37 Dec, 25 Hex = Short, Variable , Medium foreground boost.
+ 36 Dec, 24 Hex = Short, Variable , No foreground boost.
+
+ 26 Dec, 1A Hex = Long, Fixed, High foreground boost.
+ 25 Dec, 19 Hex = Long, Fixed, Medium foreground boost.
+ 24 Dec, 18 Hex = Long, Fixed, No foreground boost.
+
+ 22 Dec, 16 Hex = Long, Variable, High foreground boost.
+ 21 Dec, 15 Hex = Long, Variable, Medium foreground boost.
+ 20 Dec, 14 Hex = Long, Variable, No foreground boost.
+ */
+
+ const int win32Priority = 38; // Short, Variable, High foreground boost
+
+
+ RegistryService.Write(
+ new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\PriorityControl", "Win32PrioritySeparation",
+ win32Priority)
+ );
+ context.Logger.LogInformation("Enabled foreground boost with priority: {Priority}", win32Priority);
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(Id = "D3E93D47-FC7E-44E2-8B58-D8626A75DB93", Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Power)]
+ public class GameTaskScheduling : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games",
+ "Priority", 2),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games",
+ "Scheduling Category", "High"),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games",
+ "SFIO Priority", "High"),
+ new RegistryItem(
+ @"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games",
+ "GPU Priority", 8)
+ );
+
+ context.Logger.LogInformation("Enabled game task scheduling with high priority");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(
+ Id = "FFB49D94-CCA9-4591-B329-6FDA3A2758F9",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Latency)]
+ public class MultimediaResponsiveness : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ const string systemProfileKey =
+ @"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile";
+
+ RegistryService.Write(
+ new RegistryItem(
+ systemProfileKey,
+ "NetworkThrottlingIndex",
+ unchecked((int)0xFFFFFFFF),
+ RegistryValueKind.DWord),
+ new RegistryItem(systemProfileKey, "SystemResponsiveness",
+ 10) // minimum possible value (Values below 10 and above 100 are clamped to 20.)
+ );
+
+ context.Logger.LogInformation("Optimized multimedia responsiveness for low latency");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+
+ [Optimization(
+ Id = "70D84D83-01DB-455A-8004-D80BC372094C",
+ Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Latency)]
+ public class DisableGameBar : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(@"HKCU\System\GameConfigStore", "GameBarEnabled", 0),
+
+ new RegistryItem(@"HKCU\Software\Microsoft\GameBar", "ShowStartupPanel", 0),
+ new RegistryItem(@"HKCU\Software\Microsoft\GameBar", "UseNexusForGameBarEnabled", 0),
+ new RegistryItem(@"HKCU\Software\Microsoft\GameBar", "GamePanelStartupTipIndex", 0)
+ );
+ context.Logger.LogInformation("Disabled Xbox Game Bar");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(
+ Id = "B453F151-7408-49FD-8898-F810E7E45902",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Latency |
+ OptimizationTags.Power)]
+ public class EnableGameMode : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(@"HKCU\Software\Microsoft\GameBar", "AllowAutoGameMode", 1),
+
+ new RegistryItem(@"HKCU\Software\Microsoft\GameBar", "AutoGameModeEnabled", 1)
+ );
+ context.Logger.LogInformation("Enabled Windows Game Mode");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(
+ Id = "E6DBF550-0191-49D2-AEED-3F80A11592EE",
+ Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Latency |
+ OptimizationTags.Power)]
+ public class DisableGameDVR : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR", "AppCaptureEnabled", 0),
+
+ new RegistryItem(@"HKCU\System\GameConfigStore", "GameDVR_Enabled", 0),
+ new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\GameDVR", "AllowGameDVR", 0),
+ new RegistryItem(@"HKLM\SOFTWARE\Microsoft\PolicyManager\default\ApplicationManagement\AllowGameDVR",
+ "value", 0)
+ );
+ context.Logger.LogInformation("Disabled Game DVR recording");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(
+ Id = "7D386B99-CDAD-42C9-924E-84307AA683AD",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Latency)]
+ public class DisableMouseAcceleration : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(@"HKCU\Control Panel\Mouse", "MouseSpeed", "0"),
+
+ new RegistryItem(@"HKCU\Control Panel\Mouse", "MouseThreshold1", "0"),
+ new RegistryItem(@"HKCU\Control Panel\Mouse", "MouseThreshold2", "0"),
+ new RegistryItem(@"HKCU\Control Panel\Mouse", "MouseSensitivity", "10")
+ );
+ context.Logger.LogInformation("Disabled mouse acceleration");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(
+ Id = "613FE85C-770D-441C-B97A-147B89B99028",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Latency)]
+ public class KeyboardLatencyOptimization : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(@"HKEY_CURRENT_USER\Control Panel\Keyboard", "KeyboardDelay", "0"),
+
+ new RegistryItem(@"HKEY_CURRENT_USER\Control Panel\Keyboard", "KeyboardSpeed", "31"),
+ new RegistryItem(@"HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys", "Flags", "506"),
+ new RegistryItem(@"HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response", "Flags", "122"),
+ new RegistryItem(@"HKEY_CURRENT_USER\Control Panel\Accessibility\ToggleKeys", "Flags", "58")
+ );
+
+ context.Logger.LogInformation("Optimized keyboard responsiveness");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Optimizers/PowerManagement.cs b/optimizerDuck/Core/Optimizers/PowerManagement.cs
new file mode 100644
index 0000000..4a7705e
--- /dev/null
+++ b/optimizerDuck/Core/Optimizers/PowerManagement.cs
@@ -0,0 +1,173 @@
+using System.Collections.ObjectModel;
+using System.Text.RegularExpressions;
+using Microsoft.Extensions.Logging;
+using optimizerDuck.Common.Helpers;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Attributes;
+using optimizerDuck.Core.Models.Optimization;
+using optimizerDuck.Core.Models.Optimization.Services;
+using optimizerDuck.Core.Models.UI;
+using optimizerDuck.Services.Managers;
+using optimizerDuck.Services.OptimizationServices;
+using optimizerDuck.UI.Views.Pages.Optimizations;
+
+namespace optimizerDuck.Core.Optimizers;
+
+[OptimizationCategory(typeof(PowerManagementOptimizerPage))]
+public class PowerManagement : IOptimizationCategory
+{
+ public string Name { get; init; } = Loc.Instance[$"Optimizer.{nameof(PowerManagement)}"];
+ public OptimizationCategoryOrder Order { get; init; } = OptimizationCategoryOrder.Power;
+ public ObservableCollection<IOptimization> Optimizations { get; init; } = [];
+
+ [Optimization(Id = "C7A97DDE-6631-48BF-A0A8-590D447A81AB", Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.System | OptimizationTags.Power | OptimizationTags.Performance)]
+ public class DisableHibernate : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\Power", "HibernateEnabled", 0),
+ new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\Power\PowerThrottling",
+ "HibernateEnabledDefault", 0),
+ new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings",
+ "ShowHibernateOption", 0),
+ new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power", "HiberbootEnabled", 0)
+ );
+ context.Logger.LogInformation("Disabled hibernate and fast startup");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(Id = "805F993F-67F9-4F5A-8606-998EA9087CF0", Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Latency | OptimizationTags.Performance)]
+ public class DisableUSBPowerSaving : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress,
+ OptimizationContext context)
+ {
+ context.Logger.LogInformation("Saving current USB power state");
+ var usbStates = ShellService.PowerShell("""
+ $states = Get-CimInstance -Namespace root\wmi -ClassName MSPower_DeviceEnable |
+ Where-Object { $_.InstanceName -match 'USB\\ROOT' } |
+ Select-Object InstanceName, Enable
+
+ $states | ConvertTo-Json -Compress
+ """);
+
+ if (string.IsNullOrWhiteSpace(usbStates.Stdout))
+ {
+ context.Logger.LogInformation("No USB devices found, skipping");
+ return Task.FromResult(ApplyResult.True());
+ }
+
+ context.Logger.LogInformation("Disabling USB power saving");
+ ShellService.PowerShell("""
+ $devices = Get-CimInstance -Namespace root\wmi -ClassName MSPower_DeviceEnable |
+ Where-Object { $_.InstanceName -match 'USB\\ROOT' }
+
+ foreach ($d in $devices) {
+ if ($d.Enable -ne $false) {
+ Set-CimInstance -CimInstance $d -Property @{ Enable = $false } | Out-Null
+ }
+ }
+ """,
+ $$"""
+ $states = '{{usbStates.Stdout}}' | ConvertFrom-Json
+
+ foreach ($s in $states) {
+ $obj = Get-CimInstance -Namespace root\wmi -ClassName MSPower_DeviceEnable |
+ Where-Object { $_.InstanceName -eq $s.InstanceName }
+
+ if ($obj -and $obj.Enable -ne [bool]$s.Enable) {
+ Set-CimInstance -CimInstance $obj -Property @{ Enable = [bool]$s.Enable } | Out-Null
+ }
+ }
+ """
+ );
+
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(Id = "EE71E993-EE41-4449-8856-84B09B2B0C46", Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Latency | OptimizationTags.Performance | OptimizationTags.NetworkRequired |
+ OptimizationTags.Power)]
+ public class InstallOptimizerDuckPowerPlan : BaseOptimization
+ {
+ public override async Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ var activeQuery = ShellService.CMD("powercfg /getactivescheme");
+ var match = Regex.Match(
+ activeQuery.Stdout,
+ @"Power Scheme GUID:\s*([a-fA-F0-9\-]{36})",
+ RegexOptions.IgnoreCase
+ );
+
+ if (!match.Success)
+ {
+ context.Logger.LogError("Failed to detect current active power plan");
+ return ApplyResult.False("Failed to detect current active power plan");
+ }
+
+ var previousPlanGuid = match.Groups[1].Value;
+ context.Logger.LogInformation("Current active power plan: {Guid}", previousPlanGuid);
+
+ progress?.Report(new ProcessingProgress
+ {
+ Message = Loc.Instance[$"{ProgressPrefix}.Downloading"],
+ IsIndeterminate = true
+ });
+
+ var (success, powerPlanPath) = await context.StreamService.TryDownloadAsync(
+ Shared.PowerPlanUrl,
+ "optimizerDuck.pow");
+ if (!success)
+ {
+ context.Logger.LogInformation("Downloaded optimizerDuck power plan successfully");
+ }
+ else
+ {
+ context.Logger.LogError("Failed to download optimizerDuck power plan");
+ return ApplyResult.False(Loc.Instance[$"{ErrorPrefix}.DownloadFailed"]);
+ }
+
+ progress?.Report(new ProcessingProgress
+ {
+ Message = Loc.Instance[$"{ProgressPrefix}.Importing"],
+ IsIndeterminate = true
+ });
+
+ ShellService.CMD("powercfg /setactive 381b4222-f694-41f0-9685-ff5bb260df2e", policy: ShellPolicy.SuccessExitCodes(0, 1)); // set Balanced
+ var result = ShellService.CMD($"powercfg /delete {Shared.PowerPlanGUID}", $"powercfg /setactive {previousPlanGuid}", policy: ShellPolicy.SuccessExitCodes(0, 1));
+ if (result.ExitCode == 0)
+ context.Logger.LogInformation("Deleted old power plan");
+
+ ShellService.CMD($"powercfg /import \"{powerPlanPath}\" {Shared.PowerPlanGUID}");
+ ShellService.CMD($"powercfg /setactive {Shared.PowerPlanGUID}");
+ context.Logger.LogInformation("Installed optimizerDuck power plan successfully!");
+ return ApplyResult.True();
+ }
+ }
+
+ [Optimization(Id = "D2392F86-2B35-4BA2-939B-6FF38EE18EE6", Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.Power | OptimizationTags.Performance | OptimizationTags.System)]
+ public class DisablePowerSaving : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\USB\AutomaticSurpriseRemoval",
+ "AttemptRecoveryFromUsbPowerDrain", 0),
+ new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile",
+ "NoLazyMode", 1),
+ new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile",
+ "AlwaysOn", 1),
+ new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\Power\PowerThrottling", "PowerThrottlingOff",
+ 1)
+ );
+ context.Logger.LogInformation("Disabled power saving features");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Optimizers/SecurityAndPrivacy.cs b/optimizerDuck/Core/Optimizers/SecurityAndPrivacy.cs
similarity index 62%
rename from optimizerDuck/src/Core/Optimizers/SecurityAndPrivacy.cs
rename to optimizerDuck/Core/Optimizers/SecurityAndPrivacy.cs
index 006f7d7..5459b9c 100644
--- a/optimizerDuck/src/Core/Optimizers/SecurityAndPrivacy.cs
+++ b/optimizerDuck/Core/Optimizers/SecurityAndPrivacy.cs
@@ -1,57 +1,52 @@
-using Microsoft.Extensions.Logging;
-using optimizerDuck.Core.Services;
-using optimizerDuck.Interfaces;
-using optimizerDuck.Models;
-using optimizerDuck.UI.Logger;
+using System.Collections.ObjectModel;
+using System.Text.RegularExpressions;
+using System.Xml.Linq;
+using Microsoft.Extensions.Logging;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Attributes;
+using optimizerDuck.Core.Models.Optimization;
+using optimizerDuck.Core.Models.Optimization.Services;
+using optimizerDuck.Core.Models.UI;
+using optimizerDuck.Services.Managers;
+using optimizerDuck.Services.OptimizationServices;
+using optimizerDuck.UI.Views.Pages.Optimizations;
namespace optimizerDuck.Core.Optimizers;
+[OptimizationCategory(typeof(SecurityAndPrivacyOptimizerPage))]
public class SecurityAndPrivacy : IOptimizationCategory
{
- public string Name { get; } = "Security & Privacy";
- public OptimizationCategoryOrder Order { get; } = OptimizationCategoryOrder.SecurityAndPrivacy;
- public static ILogger Log { get; } = Logger.CreateLogger<SecurityAndPrivacy>();
+ public string Name { get; init; } = Loc.Instance[$"Optimizer.{nameof(SecurityAndPrivacy)}"];
+ public OptimizationCategoryOrder Order { get; init; } = OptimizationCategoryOrder.SecurityAndPrivacy;
+ public ObservableCollection<IOptimization> Optimizations { get; init; } = [];
- public class DisableUAC : IOptimization
+ [Optimization(Id = "09F7CE38-93B2-4E1A-AB09-130268165B42", Risk = OptimizationRisk.Risky,
+ Tags = OptimizationTags.System | OptimizationTags.Security)]
+ public class DisableUAC : BaseOptimization
{
- public string Name { get; } = "Disable User Account Control (UAC)";
-
- public string Description { get; } =
- "Disables UAC prompts to reduce interruptions (reduces security - use with caution)";
-
- public bool EnabledByDefault { get; } = false;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Aggressive;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
{
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
RegistryService.Write(new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System",
"EnableLUA", 0));
- Log.LogInformation("Disabled UAC");
- return Task.CompletedTask;
+ context.Logger.LogInformation("Disabled UAC prompts");
+ return Task.FromResult(ApplyResult.True());
}
}
- public class DisableTelemetry : IOptimization
+ [Optimization(Id = "74DC8DAC-1F90-4BBD-ACF7-7E626749D71C",
+ Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.Security | OptimizationTags.Privacy)]
+ public class DisableTelemetry : BaseOptimization
{
- public string Name { get; } = "Disable Telemetry Services & Tasks";
-
- public string Description { get; } =
- "Disables telemetry services, scheduled tasks, and Windows data collection";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Significant;
-
- /// <summary>
- /// thank you https://github.com/ChrisTitusTech/winutil
- /// </summary>
- public Task Apply(SystemSnapshot _, CancellationToken t)
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
{
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
+ progress?.Report(new ProcessingProgress
+ {
+ Message = Loc.Instance[$"{ProgressPrefix}.EditRegistry"],
+ IsIndeterminate = false,
+ Value = 0,
+ Total = 3
+ });
// @formatter:off
RegistryService.Write(
new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection", "AllowTelemetry", 0),
@@ -102,7 +97,14 @@ public class SecurityAndPrivacy : IOptimizationCategory
RegistryService.DeleteValue([
new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Siuf\Rules", "PeriodInNanoSeconds")
]);
-
+ context.Logger.LogInformation("Reduced telemetry and feedback");
+ progress?.Report(new ProcessingProgress
+ {
+ Message = Loc.Instance[$"{ProgressPrefix}.DisableServices"],
+ IsIndeterminate = false,
+ Value = 1,
+ Total = 3
+ });
ServiceProcessService.ChangeServiceStartupType(
new ServiceItem("DiagTrack", ServiceStartupType.Disabled), // Connected User Experiences and Telemetry (The main telemetry service)
new ServiceItem("dmwappushservice", ServiceStartupType.Disabled), // WAP Push Message Routing Service (Used for telemetry)
@@ -113,6 +115,13 @@ public class SecurityAndPrivacy : IOptimizationCategory
new ServiceItem("PcaSvc", ServiceStartupType.Disabled) // Program Compatibility Assistant Service (Monitors apps and sends data)
);
+ progress?.Report(new ProcessingProgress
+ {
+ Message = Loc.Instance[$"{ProgressPrefix}.DisableTasks"],
+ IsIndeterminate = false,
+ Value = 2,
+ Total = 3
+ });
var tasksToDelete = new HashSet<string>([
@"\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser",
@"\Microsoft\Windows\Application Experience\ProgramDataUpdater",
@@ -129,33 +138,80 @@ public class SecurityAndPrivacy : IOptimizationCategory
@"\Microsoft\Windows\Maps\MapsUpdateTask",
@"\Microsoft\Windows\Diagnosis\Scheduled",
@"\Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticResolver"
- ]);
+ ]);
foreach (var task in tasksToDelete)
- if (ShellService.CMD($"schtasks /Change /TN \"{task}\" /Disable").ExitCode != 0)
- Log.LogError("Failed to disable task {Task}.", task);
+ {
+ var query = ShellService.CMD(
+ $"schtasks /Query /TN \"{task}\" /XML"
+ );
+
+ if (query.ExitCode != 0 || string.IsNullOrWhiteSpace(query.Stdout))
+ {
+ context.Logger.LogDebug("Task {Task} not found, skipping", task);
+ continue;
+ }
+
+ var wasEnabled = GetTaskEnabledFromXml(query.Stdout);
+
+ if (wasEnabled == null)
+ {
+ context.Logger.LogWarning(
+ "Cannot determine Enabled state from XML for task {Task}, skipping",
+ task
+ );
+ continue;
+ }
+
+ var result = ShellService.CMD(
+ $"schtasks /Change /TN \"{task}\" /Disable",
+ () => wasEnabled.Value
+ ? $"schtasks /Change /TN \"{task}\" /Enable"
+ : $"schtasks /Change /TN \"{task}\" /Disable"
+ );
+
+ if (result.ExitCode != 0)
+ {
+ context.Logger.LogWarning(
+ "Failed to disable task {Task}",
+ task
+ );
+ }
+ }
+
+ return Task.FromResult(ApplyResult.True());
+ }
- Log.LogInformation("Disabled telemetry.");
- // @formatter:on
- return Task.CompletedTask;
+ private static bool? GetTaskEnabledFromXml(string xml)
+ {
+ try
+ {
+ var doc = XDocument.Parse(xml);
+
+ // Task Scheduler XML has a namespace
+ var ns = doc.Root!.Name.Namespace;
+
+ var enabledElement = doc
+ .Element(ns + "Task")?
+ .Element(ns + "Settings")?
+ .Element(ns + "Enabled");
+
+ // if element is not found, it means the task is enabled
+ return enabledElement == null || bool.Parse(enabledElement.Value);
+ }
+ catch
+ {
+ return null;
+ }
}
}
- public class DisableAutologger : IOptimization
+ [Optimization(Id = "4107430C-0074-4380-90E7-3662572E4720", Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.Privacy)]
+ public class DisableAutoLogger : BaseOptimization
{
- public string Name { get; } = "Disable WMI AutoLogger";
-
- public string Description { get; } =
- "Disables WMI AutoLogger services used for diagnostic event tracing";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Moderate;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
{
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
RegistryService.Write(
new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\AppModel", "Start", 0),
new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\Cellcore", "Start", 0),
@@ -173,102 +229,43 @@ public class SecurityAndPrivacy : IOptimizationCategory
new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\WdiContextLog", "Start", 0),
new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\WiFiSession", "Start", 0)
);
- Log.LogInformation("Disabled Autologger services.");
- return Task.CompletedTask;
+ context.Logger.LogInformation("Disabled WMI AutoLogger sessions");
+ return Task.FromResult(ApplyResult.True());
}
}
- public class DisableContentDeliveryManager : IOptimization
+ [Optimization(Id = "6856782A-B530-4623-BD89-942D73FB82FD", Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.Privacy | OptimizationTags.System)]
+ public class DisableCortana : BaseOptimization
{
- public string Name { get; } = "Disable Content Delivery Manager";
-
- public string Description { get; } =
- "Disables suggested apps, consumer features, and content recommendations";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Moderate;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
{
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
RegistryService.Write(
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "ContentDeliveryAllowed", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "OemPreInstalledAppsEnabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "PreInstalledAppsEnabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "PreInstalledAppsEverEnabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "SilentInstalledAppsEnabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "SubscribedContent-338387Enabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "SubscribedContent-338388Enabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "SubscribedContent-338389Enabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "SubscribedContent-353698Enabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "SystemPaneSuggestionsEnabled", 0)
- );
- Log.LogInformation("Disabled Content Delivery Manager.");
- return Task.CompletedTask;
+ new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowCortana", 0),
+ new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowCloudSearch", 0),
+ new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowCortanaAboveLock",
+ 0),
+ new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowSearchToUseLocation",
+ 0),
+ new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "ConnectedSearchUseWeb",
+ 0),
+ new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "DisableWebSearch", 1),
+ new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Search",
+ "CortanaConsent", 0),
+ new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Search",
+ "CortanaConsent2", 0)
+ );
+ context.Logger.LogInformation("Disabled Cortana and web search");
+ return Task.FromResult(ApplyResult.True());
}
}
- public class DisableCortana : IOptimization
+ [Optimization(Id = "64C6BEC3-B58C-4E57-830A-1DE1F4650542", Risk = OptimizationRisk.Moderate,
+ Tags = OptimizationTags.Privacy | OptimizationTags.System)]
+ public class DisableCopilot : BaseOptimization
{
- public string Name { get; } = "Disable Cortana & Search AI";
-
- public string Description { get; } =
- "Disables Cortana, cloud search, web search integration, and related AI-powered search features";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Moderate;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
{
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowCortana", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowCloudSearch", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowCortanaAboveLock",
- 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "AllowSearchToUseLocation",
- 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "ConnectedSearchUseWeb",
- 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search",
- "ConnectedSearchUseWebOverMeteredConnections", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search", "DisableWebSearch", 1)
- );
-
- Log.LogInformation("Cortana and AI-powered search features disabled.");
- return Task.CompletedTask;
- }
- }
-
- public class DisableCopilot : IOptimization
- {
- public string Name { get; } = "Disable Windows Copilot";
-
- public string Description { get; } =
- "Disables AI Copilot integration from Explorer and system taskbar";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Moderate;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
RegistryService.Write(
new RegistryItem(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot",
"TurnOffWindowsCopilot", 1),
@@ -289,8 +286,33 @@ public class SecurityAndPrivacy : IOptimizationCategory
"IsUserEligible", 0)
);
- Log.LogInformation("Windows Copilot disabled.");
- return Task.CompletedTask;
+ context.Logger.LogInformation("Disabled Windows Copilot");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(Id = "00C997FE-1CB7-41BD-B473-65A81333AEE9", Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Latency | OptimizationTags.Privacy)]
+ public class DisableContentDeliveryManager : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "ContentDeliveryAllowed", 0),
+ new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "SubscribedContent-338387Enabled", 0),
+ new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "SubscribedContent-338388Enabled", 0),
+ new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "SubscribedContent-338389Enabled", 0),
+ new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "SubscribedContent-353698Enabled", 0),
+ new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "SystemPaneSuggestionsEnabled", 0)
+ );
+ context.Logger.LogInformation("Disabled content delivery manager");
+ return Task.FromResult(ApplyResult.True());
}
}
}
\ No newline at end of file
diff --git a/optimizerDuck/Core/Optimizers/UserExperience.cs b/optimizerDuck/Core/Optimizers/UserExperience.cs
new file mode 100644
index 0000000..332c39e
--- /dev/null
+++ b/optimizerDuck/Core/Optimizers/UserExperience.cs
@@ -0,0 +1,263 @@
+using Microsoft.Extensions.Logging;
+using System.Collections.ObjectModel;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Attributes;
+using optimizerDuck.Core.Models.Optimization;
+using optimizerDuck.Core.Models.Optimization.Services;
+using optimizerDuck.Core.Models.UI;
+using optimizerDuck.Services.Managers;
+using optimizerDuck.Services.OptimizationServices;
+using optimizerDuck.UI.Views.Pages.Optimizations;
+
+namespace optimizerDuck.Core.Optimizers;
+
+[OptimizationCategory(typeof(UserExperienceOptimizerPage))]
+public class UserExperience : IOptimizationCategory
+{
+ public string Name { get; init; } = Loc.Instance[$"Optimizer.{nameof(UserExperience)}"];
+ public OptimizationCategoryOrder Order { get; init; } = OptimizationCategoryOrder.UserExperience;
+ public ObservableCollection<IOptimization> Optimizations { get; init; } = [];
+
+ [Optimization(
+ Id = "B4E0B6C1-7A1C-4A92-8D38-9B8E5F2D8D11",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Visual | OptimizationTags.Privacy)]
+ public sealed class DisableTaskbarNewsAndInterests : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Dsh", "AllowNewsAndInterests", 0),
+ new RegistryItem(@"HKCU\SOFTWARE\Policies\Microsoft\Windows\Windows Feeds", "EnableFeeds", 0),
+ new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Feeds",
+ "ShellFeedsTaskbarViewMode", 2)
+ );
+ context.Logger.LogInformation("Disabled taskbar news and interests");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(
+ Id = "2F8E9B9A-31D5-4B4D-BE47-6F3E9C90A7C3",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Visual)]
+ public sealed class DisableTaskbarExtraButtons : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ "TaskbarDa", 0), // Widgets
+ new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ "TaskbarMn", 0), // Chat
+ new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ "ShowTaskViewButton", 0)
+ );
+ context.Logger.LogInformation("Disabled extra taskbar buttons");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(
+ Id = "8C9F43B4-5C5D-4F71-9E4E-1C7E9B4E6D90",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Visual | OptimizationTags.Privacy)]
+ public sealed class DisableTaskbarSearchAndBing : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Search",
+ "SearchboxTaskbarMode", 0),
+ new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Search",
+ "BingSearchEnabled", 0)
+ );
+ context.Logger.LogInformation("Disabled taskbar search and Bing");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(
+ Id = "4A1F6B78-4E5E-4A77-A5C9-7C6F3D2E1B90",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System)]
+ public sealed class RemoveMeetNowAndPeople : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer",
+ "HideSCAMeetNow", 1),
+ new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People",
+ "PeopleBand", 0)
+ );
+ context.Logger.LogInformation("Removed Meet Now and People icons");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+
+
+ [Optimization(
+ Id = "E1C2D3A4-B5F6-47A8-9C0D-1F2E3A4B5C6D",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System)]
+ public sealed class EnableTaskbarEndTask : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings",
+ "TaskbarEndTask", 1)
+ );
+ context.Logger.LogInformation("Enabled taskbar end task feature");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(
+ Id = "C08A5C23-6977-4C14-8CB2-F398CD85B3EE",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Visual | OptimizationTags.Power)]
+ public sealed class EnableDarkMode : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
+ "AppsUseLightTheme", 0),
+ new RegistryItem(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
+ "SystemUsesLightTheme", 0)
+ );
+ context.Logger.LogInformation("Enabled dark mode");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(
+ Id = "5A6E2C9D-3F7E-4B92-A9D1-7F3C2A6E8813",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Privacy)]
+ public sealed class DisableExplorerAndSystemNotifications : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ "ShowSyncProviderNotifications", 0),
+ new(@"HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
+ "SystemPaneSuggestionsEnabled", 0),
+ new(@"HKCU\Software\Microsoft\Windows\CurrentVersion\PushNotifications",
+ "ToastEnabled", 0),
+ new(@"HKCU\Software\Microsoft\Windows\CurrentVersion\PushNotifications",
+ "LockScreenToastEnabled", 0)
+ );
+ context.Logger.LogInformation("Disabled Explorer and system notifications");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+
+ [Optimization(
+ Id = "B9D2F8A7-1A52-4E73-8E19-92C3A6E7D0C2",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Visual)]
+ public sealed class ShowFileExtensionsAndHiddenFiles : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ "HideFileExt", 0)
+ );
+ RegistryService.Write(
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ "Hidden", 1)
+ );
+ context.Logger.LogInformation("Showed file extensions and hidden files");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(
+ Id = "1A4D9E7F-9B73-4A0E-B5C2-7D9F1E6C4A55",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Visual)]
+ public sealed class EnableClassicContextMenu : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(
+ @"HKCU\SOFTWARE\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32",
+ "")
+ );
+ context.Logger.LogInformation("Enabled classic context menu");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+
+ [Optimization(
+ Id = "9E2C4F7D-5A6B-4E9D-8C71-6E2F5A9C3314",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Performance | OptimizationTags.Latency)]
+ public sealed class SpeedUpExplorerAndMenus : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize",
+ "StartupDelayInMSec", 0),
+ new(@"HKCU\Control Panel\Desktop",
+ "MenuShowDelay", "0")
+ );
+ context.Logger.LogInformation("Speeded up Explorer and menus");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(
+ Id = "C7A98B41-0F1E-4E0D-8D4F-5A7F2E3D9B66",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.Visual)]
+ public sealed class ShowSecondsInSystemClock : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new RegistryItem(
+ @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ "ShowSecondsInSystemClock", 1)
+ );
+ context.Logger.LogInformation("Showed seconds in system clock");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+
+ [Optimization(
+ Id = "7D9A4C3E-6F1B-4E8C-A9F2-3D7E5C6A8815",
+ Risk = OptimizationRisk.Safe,
+ Tags = OptimizationTags.System | OptimizationTags.Visual | OptimizationTags.Performance)]
+ public sealed class DisableVisualEffects : BaseOptimization
+ {
+ public override Task<ApplyResult> ApplyAsync(IProgress<ProcessingProgress> progress, OptimizationContext context)
+ {
+ RegistryService.Write(
+ new(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ "TaskbarAnimations", 0),
+ new(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
+ "ListviewShadow", 0),
+ new(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
+ "EnableTransparency", 0),
+ new(@"HKCU\Software\Microsoft\Windows\DWM",
+ "EnableAeroPeek", 0)
+ );
+ context.Logger.LogInformation("Disabled visual effects");
+ return Task.FromResult(ApplyResult.True());
+ }
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Program.cs b/optimizerDuck/Program.cs
deleted file mode 100644
index 1030390..0000000
--- a/optimizerDuck/Program.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-using System.Text;
-using Microsoft.Extensions.Logging;
-using optimizerDuck.Core;
-using optimizerDuck.Core.Extensions;
-using optimizerDuck.Core.Helpers;
-using optimizerDuck.Core.Services;
-using optimizerDuck.UI;
-using optimizerDuck.UI.Components;
-using optimizerDuck.UI.Logger;
-using Spectre.Console;
-
-namespace optimizerDuck;
-
-/*
-⠀⠀⠀⠀⠀⢀⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
-⠀⠀⠀⠀⠀⣸⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
-⠀⠀⠀⠀⢠⡟⠘⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
-⠀⠀⠀⢰⡟⠀⠀⠈⠻⣷⣤⣤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
-⠀⠀⣠⡟⠀⠀⠀⠀⠀⠈⢻⡿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
-⠀⣰⡟⠀⠀⠀⠀⠀⠀⠀⠀⠻⠸⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
-⢰⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣇⠀⣠⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⠀⠀⠀⠀⠀⠀⠀
-⣾⡁⢀⣠⠴⠒⠲⣤⣠⠶⠋⠳⣤⣸⣿⣰⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀
-⣿⠟⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⣽⠏⣿⡿⢿⣿⣿⣿⣷⣄⠀⠀⠀⠀⢠⣾⣿⣿⣿⠋⢹⡇⠀⠀⠀⠀⠀⠀
-⢹⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⡟⠀⣿⠁⠀⠙⣿⡛⠛⢿⡶⠶⠶⠶⣿⣄⣀⣰⠃⠀⢸⡇⠀⠀⠀⠀⠀⠀
-⠈⢷⡀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡿⠁⠀⣿⠀⠀⠀⠈⢷⡀⠘⠛⠀⠀⠀⠀⠈⠉⠳⣄⠀⢸⡇⠀⠀⠀⠀⠀⠀
-⠀⠈⢿⣦⡀⠀⠀⠀⠀⠀⢀⣿⣇⣀⠀⢻⠀⠀⠀⠀⢰⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠳⣾⠃⠀⣤⣤⣄⠀⠀
-⠀⠀⠀⠉⠻⢶⣄⣠⣴⠞⠛⠉⠉⠙⠻⢾⣇⠀⢀⣰⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡄⠀⣿⢩⡿⣿⡆
-⠀⠀⠀⠀⣠⣴⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⢹⡷⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⣿⣟⣵⡿⠁
-⠀⢀⣠⡾⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣇⠀⠀⠀⣴⣿⠀⠀⠀⠀⠀⠀⢠⣶⠀⠀⣸⡇⠀⠙⠋⠁⠀⠀
-⢸⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣄⣈⣀⣙⣁⠀⠀⣶⣾⡶⠀⠻⠿⠀⢠⣿⣁⡀⠀⠀⠀⠀⠀
-⠈⠛⠻⠿⠶⠶⠶⡤⣤⣤⣤⣄⣀⣤⣀⣠⣤⣀⣀⣹⣿⣿⣿⣿⣤⣽⣿⣴⣶⣶⡦⢼⣿⣿⣿⣿⠇⠀⠀⠀⠀
-*/
-/// <summary>
-/// I started this project on Oct 16, 2025 btw
-/// </summary>
-internal class Program
-{
- private static readonly ILogger Log = Logger.CreateLogger<Program>();
- private SystemSnapshot _systemSnapshot = null!;
-
- private async Task Init()
- {
- RequirementChecker.Restart();
-
- SystemHelper.Title("Initializing");
- if (!RequirementChecker.IsAdmin())
- {
- Log.LogWarning("Application is not running with administrator privileges.");
- PromptDialog.Warning(
- "Administrator Privileges Required",
- $"""
- The first initialization to run as admin and maximized seems to have [{Theme.Error}]failed[/].
- Please restart to grant administrator privileges and ensure the application is maximized.
- [{Theme.Muted}]You can continue if you have already confirmed your administrator status.[/]
- """,
- new PromptOption("Restart", Theme.Warning, () => RequirementChecker.Restart(true)),
- new PromptOption("Continue anyway", Theme.Success)
- );
- }
-
-
- await AnsiConsole.Status()
- .Spinner(Spinner.Known.BouncingBar)
- .SpinnerStyle($"bold {Theme.Primary}")
- .StartAsyncGlobal("Checking for exclusions...", async ctx =>
- {
- Log.LogInformation("Checking for exclusions...");
- var exclusions = SystemHelper.CheckForExclusions();
- if (exclusions.Count != 0)
- PromptDialog.Warning("Missing Anti-Malware Exclusions",
- $"""
- Do you want to add [{Theme.Primary}]{string.Join($"[/], [{Theme.Primary}]", exclusions)}[/] to the exclusion list?
- This will help reduce the chances of errors caused by [{Theme.Error}]antivirus blocking[/].
- """,
- new PromptOption("Add", Theme.Success, () =>
- {
- ctx.Status("Adding exclusions...");
- SystemHelper.AddToExclusions(exclusions);
- }),
- new PromptOption("Skip", Theme.Error));
-
- ctx.Status("Fetching system information...");
- Log.LogInformation("Fetching system information...");
- _systemSnapshot = await SystemInfoService.RefreshAsync().ConfigureAwait(false);
-
- Log.LogDebug("=== System Information ===");
- SystemInfoService.GetSummary(Log);
- Log.LogDebug("==========================");
-
- ctx.Status("Checking and creating necessary paths...");
- Log.LogInformation("Checking and creating necessary paths...");
- RequirementChecker.EnsureDirectoriesExists();
-
- ctx.Status("Checking system requirements...");
- Log.LogInformation("Checking system requirements...");
- RequirementChecker.ValidateSystemRequirements(_systemSnapshot);
-
- ctx.Status("Initialization completed successfully.");
- Log.LogInformation($"[{Theme.Success}]Initialization completed successfully.[/]");
- });
- }
-
- private async Task Start()
- {
- var menuHandler = new MenuHandler(_systemSnapshot);
-
- while (true)
- {
- MainMenu.Display(_systemSnapshot);
-
- Console.CursorVisible = false;
- var option = Console.ReadKey(true).KeyChar;
- Console.CursorVisible = true;
-
- _systemSnapshot = await menuHandler.HandleInputAsync(option).ConfigureAwait(false);
- }
- }
-
- private static async Task Main(string[] _)
- {
- try
- {
- Console.OutputEncoding =
- Encoding.UTF8; // idk why, but it will fix some ansi issues of spectre console
-
- AnsiConsole.Clear();
- AnsiConsole.Write(Defaults.Logo);
-
- await UpdateService.CheckForUpdatesAsync();
-
- var app = new Program();
- await app.Init().ConfigureAwait(false);
- await app.Start().ConfigureAwait(false);
- }
- catch (Exception ex)
- {
- Log.LogCritical(ex, $"[{Theme.Error}]Fatal error![/]");
- PromptDialog.Exception(ex, "Fatal Error",
- "An unexpected error occurred while running the application.");
- }
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/Properties/PublishProfiles/Portable.pubxml b/optimizerDuck/Properties/PublishProfiles/Portable.pubxml
new file mode 100644
index 0000000..b1e6d2a
--- /dev/null
+++ b/optimizerDuck/Properties/PublishProfiles/Portable.pubxml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
+<Project>
+ <PropertyGroup>
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+
+ <TargetFramework>net10.0-windows</TargetFramework>
+ <RuntimeIdentifier>win-x64</RuntimeIdentifier>
+
+ <PublishDir>bin\Release\Portable\net10.0\publish\win-x64\</PublishDir>
+
+ <SelfContained>true</SelfContained>
+ <PublishSingleFile>false</PublishSingleFile>
+
+ <PublishReadyToRun>true</PublishReadyToRun>
+ <PublishTrimmed>false</PublishTrimmed>
+
+ <DebugSymbols>false</DebugSymbols>
+ <DebugType>none</DebugType>
+ </PropertyGroup>
+</Project>
diff --git a/optimizerDuck/Properties/PublishProfiles/FolderProfile.pubxml b/optimizerDuck/Properties/PublishProfiles/Single.pubxml
similarity index 66%
rename from optimizerDuck/Properties/PublishProfiles/FolderProfile.pubxml
rename to optimizerDuck/Properties/PublishProfiles/Single.pubxml
index 0955921..858b1a1 100644
--- a/optimizerDuck/Properties/PublishProfiles/FolderProfile.pubxml
+++ b/optimizerDuck/Properties/PublishProfiles/Single.pubxml
@@ -1,22 +1,25 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>x64</Platform>
- <PublishDir>bin\Release\net10.0\publish\win-x64\</PublishDir>
- <PublishProtocol>FileSystem</PublishProtocol>
- <_TargetId>Folder</_TargetId>
- <TargetFramework>net10.0</TargetFramework>
+
+ <TargetFramework>net10.0-windows</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
- <DebugSymbols>false</DebugSymbols>
- <DebugType>none</DebugType>
+
+ <PublishDir>bin\Release\Single\net10.0\publish\win-x64\</PublishDir>
+
<SelfContained>true</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
+ <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
+
<PublishReadyToRun>true</PublishReadyToRun>
- <EnableReadyToRunCompilation>true</EnableReadyToRunCompilation>
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
+
<PublishTrimmed>false</PublishTrimmed>
- <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
+
+ <DebugSymbols>false</DebugSymbols>
+ <DebugType>none</DebugType>
</PropertyGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/optimizerDuck/Properties/launchSettings.json b/optimizerDuck/Properties/launchSettings.json
deleted file mode 100644
index b4e2f19..0000000
--- a/optimizerDuck/Properties/launchSettings.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "profiles": {
- "optimizerDuck": {
- "commandName": "Project"
- },
- "WithRestartArgument": {
- "commandName": "Project",
- "commandLineArgs": "--restart"
- },
- "RestartAndDebug": {
- "commandName": "Project",
- "commandLineArgs": "--restart --debug"
- }
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/Resources/Images/DiscordLogo.png b/optimizerDuck/Resources/Images/DiscordLogo.png
new file mode 100644
index 0000000..c49cc20
Binary files /dev/null and b/optimizerDuck/Resources/Images/DiscordLogo.png differ
diff --git a/optimizerDuck/Resources/Images/Duck.png b/optimizerDuck/Resources/Images/Duck.png
new file mode 100644
index 0000000..9adb598
Binary files /dev/null and b/optimizerDuck/Resources/Images/Duck.png differ
diff --git a/optimizerDuck/Resources/Images/GitHubLogoBlack.png b/optimizerDuck/Resources/Images/GitHubLogoBlack.png
new file mode 100644
index 0000000..7cc5b84
Binary files /dev/null and b/optimizerDuck/Resources/Images/GitHubLogoBlack.png differ
diff --git a/optimizerDuck/Resources/Images/GitHubLogoWhite.png b/optimizerDuck/Resources/Images/GitHubLogoWhite.png
new file mode 100644
index 0000000..4bf59dd
Binary files /dev/null and b/optimizerDuck/Resources/Images/GitHubLogoWhite.png differ
diff --git a/optimizerDuck/Resources/Images/optimizerDuck.png b/optimizerDuck/Resources/Images/optimizerDuck.png
new file mode 100644
index 0000000..2ed180a
Binary files /dev/null and b/optimizerDuck/Resources/Images/optimizerDuck.png differ
diff --git a/optimizerDuck/Resources/Languages/Translations.Designer.cs b/optimizerDuck/Resources/Languages/Translations.Designer.cs
new file mode 100644
index 0000000..d1d022f
--- /dev/null
+++ b/optimizerDuck/Resources/Languages/Translations.Designer.cs
@@ -0,0 +1,2241 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace optimizerDuck.Resources.Languages {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ public class Translations {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Translations() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("optimizerDuck.Resources.Languages.Translations", typeof(Translations).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cancel.
+ /// </summary>
+ public static string Button_Cancel {
+ get {
+ return ResourceManager.GetString("Button.Cancel", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Clear.
+ /// </summary>
+ public static string Button_Clear {
+ get {
+ return ResourceManager.GetString("Button.Clear", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Close.
+ /// </summary>
+ public static string Button_Close {
+ get {
+ return ResourceManager.GetString("Button.Close", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Copy GUID.
+ /// </summary>
+ public static string Button_CopyGuid {
+ get {
+ return ResourceManager.GetString("Button.CopyGuid", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to OK.
+ /// </summary>
+ public static string Button_Ok {
+ get {
+ return ResourceManager.GetString("Button.Ok", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Open.
+ /// </summary>
+ public static string Button_Open {
+ get {
+ return ResourceManager.GetString("Button.Open", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Retry.
+ /// </summary>
+ public static string Button_Retry {
+ get {
+ return ResourceManager.GetString("Button.Retry", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Applied on {0} days ago.
+ /// </summary>
+ public static string Common_AppliedDaysAgo {
+ get {
+ return ResourceManager.GetString("Common.AppliedDaysAgo", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Applied on {0} hours ago.
+ /// </summary>
+ public static string Common_AppliedHoursAgo {
+ get {
+ return ResourceManager.GetString("Common.AppliedHoursAgo", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Just applied.
+ /// </summary>
+ public static string Common_AppliedJustNow {
+ get {
+ return ResourceManager.GetString("Common.AppliedJustNow", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Applied on {0} minutes ago.
+ /// </summary>
+ public static string Common_AppliedMinutesAgo {
+ get {
+ return ResourceManager.GetString("Common.AppliedMinutesAgo", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Applied on {0} months ago.
+ /// </summary>
+ public static string Common_AppliedMonthsAgo {
+ get {
+ return ResourceManager.GetString("Common.AppliedMonthsAgo", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Applied on {0} seconds ago.
+ /// </summary>
+ public static string Common_AppliedSecondsAgo {
+ get {
+ return ResourceManager.GetString("Common.AppliedSecondsAgo", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Applied on {0} years ago.
+ /// </summary>
+ public static string Common_AppliedYearsAgo {
+ get {
+ return ResourceManager.GetString("Common.AppliedYearsAgo", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unknown.
+ /// </summary>
+ public static string Common_Unknown {
+ get {
+ return ResourceManager.GetString("Common.Unknown", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Join our Discord community to... get support or play games with me.
+ /// </summary>
+ public static string Dashboard_Actions_Discord_Description {
+ get {
+ return ResourceManager.GetString("Dashboard.Actions.Discord.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Discord Community.
+ /// </summary>
+ public static string Dashboard_Actions_Discord_Title {
+ get {
+ return ResourceManager.GetString("Dashboard.Actions.Discord.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Explore, review, and contribute to my project through GitHub.
+ /// </summary>
+ public static string Dashboard_Actions_GitHub_Description {
+ get {
+ return ResourceManager.GetString("Dashboard.Actions.GitHub.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to GitHub Repository.
+ /// </summary>
+ public static string Dashboard_Actions_GitHub_Title {
+ get {
+ return ResourceManager.GetString("Dashboard.Actions.GitHub.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Support me and keep this project growing!.
+ /// </summary>
+ public static string Dashboard_Actions_SupportMe_Description {
+ get {
+ return ResourceManager.GetString("Dashboard.Actions.SupportMe.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Support Me.
+ /// </summary>
+ public static string Dashboard_Actions_SupportMe_Title {
+ get {
+ return ResourceManager.GetString("Dashboard.Actions.SupportMe.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Options.
+ /// </summary>
+ public static string Dashboard_Header_Menu_Header_Options {
+ get {
+ return ResourceManager.GetString("Dashboard.Header.Menu.Header.Options", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Run.
+ /// </summary>
+ public static string Dashboard_Header_Menu_Header_Run {
+ get {
+ return ResourceManager.GetString("Dashboard.Header.Menu.Header.Run", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Refresh.
+ /// </summary>
+ public static string Dashboard_Header_Menu_Refresh {
+ get {
+ return ResourceManager.GetString("Dashboard.Header.Menu.Refresh", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Control Panel.
+ /// </summary>
+ public static string Dashboard_Header_Menu_RunControlPanel {
+ get {
+ return ResourceManager.GetString("Dashboard.Header.Menu.RunControlPanel", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Settings.
+ /// </summary>
+ public static string Dashboard_Header_Menu_RunSettings {
+ get {
+ return ResourceManager.GetString("Dashboard.Header.Menu.RunSettings", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Task Manager.
+ /// </summary>
+ public static string Dashboard_Header_Menu_RunTaskManager {
+ get {
+ return ResourceManager.GetString("Dashboard.Header.Menu.RunTaskManager", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Dashboard.
+ /// </summary>
+ public static string Dashboard_Header_Title {
+ get {
+ return ResourceManager.GetString("Dashboard.Header.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to {0} Cores.
+ /// </summary>
+ public static string Dashboard_SystemInfo_Cpu_Cores {
+ get {
+ return ResourceManager.GetString("Dashboard.SystemInfo.Cpu.Cores", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to {0} Threads.
+ /// </summary>
+ public static string Dashboard_SystemInfo_Cpu_Threads {
+ get {
+ return ResourceManager.GetString("Dashboard.SystemInfo.Cpu.Threads", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to + {0} more GPU.
+ /// </summary>
+ public static string Dashboard_SystemInfo_Gpu_More {
+ get {
+ return ResourceManager.GetString("Dashboard.SystemInfo.Gpu.More", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Fetching System Information....
+ /// </summary>
+ public static string Dashboard_SystemInfo_Loading {
+ get {
+ return ResourceManager.GetString("Dashboard.SystemInfo.Loading", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to {0} GB Available.
+ /// </summary>
+ public static string Dashboard_SystemInfo_Ram_Available {
+ get {
+ return ResourceManager.GetString("Dashboard.SystemInfo.Ram.Available", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to {0} Module(s).
+ /// </summary>
+ public static string Dashboard_SystemInfo_Ram_Modules {
+ get {
+ return ResourceManager.GetString("Dashboard.SystemInfo.Ram.Modules", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to {0} GB Used.
+ /// </summary>
+ public static string Dashboard_SystemInfo_Ram_Used {
+ get {
+ return ResourceManager.GetString("Dashboard.SystemInfo.Ram.Used", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to {0} GB used of {1} GB ({2} GB free).
+ /// </summary>
+ public static string Dashboard_SystemInfo_Storage_DiskInfo {
+ get {
+ return ResourceManager.GetString("Dashboard.SystemInfo.Storage.DiskInfo", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Storage.
+ /// </summary>
+ public static string Dashboard_SystemInfo_Storage_Header {
+ get {
+ return ResourceManager.GetString("Dashboard.SystemInfo.Storage.Header", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to SYSTEM.
+ /// </summary>
+ public static string Dashboard_SystemInfo_Storage_System {
+ get {
+ return ResourceManager.GetString("Dashboard.SystemInfo.Storage.System", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Do you really want to proceed?.
+ /// </summary>
+ public static string Dialog_AreYouSure_Title {
+ get {
+ return ResourceManager.GetString("Dialog.AreYouSure.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Completed.
+ /// </summary>
+ public static string Optimization_Apply_Completed {
+ get {
+ return ResourceManager.GetString("Optimization.Apply.Completed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Failed to apply {0}..
+ /// </summary>
+ public static string Optimization_Apply_Error_Failed {
+ get {
+ return ResourceManager.GetString("Optimization.Apply.Error.Failed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Applied {0} with {1} failed step(s)..
+ /// </summary>
+ public static string Optimization_Apply_Error_FailedWithSteps {
+ get {
+ return ResourceManager.GetString("Optimization.Apply.Error.FailedWithSteps", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Applying changes....
+ /// </summary>
+ public static string Optimization_Apply_Processing {
+ get {
+ return ResourceManager.GetString("Optimization.Apply.Processing", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Couldn&apos;t apply optimization..
+ /// </summary>
+ public static string Optimization_Apply_Snackbar_Error_Title {
+ get {
+ return ResourceManager.GetString("Optimization.Apply.Snackbar.Error.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Successfully applied {0}..
+ /// </summary>
+ public static string Optimization_Apply_Success {
+ get {
+ return ResourceManager.GetString("Optimization.Apply.Success", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Retrying failed steps....
+ /// </summary>
+ public static string Optimization_Retry_Processing {
+ get {
+ return ResourceManager.GetString("Optimization.Retry.Processing", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Retrying {0} step ({1}/{2} steps).
+ /// </summary>
+ public static string Optimization_RetryStep_Processing {
+ get {
+ return ResourceManager.GetString("Optimization.RetryStep.Processing", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Failed to revert {0}..
+ /// </summary>
+ public static string Optimization_Revert_Error_Failed {
+ get {
+ return ResourceManager.GetString("Optimization.Revert.Error.Failed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Reverted {0} with {1} failed step(s)..
+ /// </summary>
+ public static string Optimization_Revert_Error_FailedWithSteps {
+ get {
+ return ResourceManager.GetString("Optimization.Revert.Error.FailedWithSteps", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Executing revert step: {0}/{1} ({2}).
+ /// </summary>
+ public static string Optimization_Revert_ExecutingStep {
+ get {
+ return ResourceManager.GetString("Optimization.Revert.ExecutingStep", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Reverting....
+ /// </summary>
+ public static string Optimization_Revert_Reverting {
+ get {
+ return ResourceManager.GetString("Optimization.Revert.Reverting", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Couldn&apos;t revert optimization.
+ /// </summary>
+ public static string Optimization_Revert_Snackbar_Error_Title {
+ get {
+ return ResourceManager.GetString("Optimization.Revert.Snackbar.Error.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Successfully reverted {0}!.
+ /// </summary>
+ public static string Optimization_Revert_Success {
+ get {
+ return ResourceManager.GetString("Optimization.Revert.Success", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to An error occurred: {0}.
+ /// </summary>
+ public static string Optimization_Toggle_Snackbar_Error_Message {
+ get {
+ return ResourceManager.GetString("Optimization.Toggle.Snackbar.Error.Message", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Couldn&apos;t toggle optimization.
+ /// </summary>
+ public static string Optimization_Toggle_Snackbar_Error_Title {
+ get {
+ return ResourceManager.GetString("Optimization.Toggle.Snackbar.Error.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Detailed description.
+ /// </summary>
+ public static string OptimizationDetailsDialog_DetailedDescription {
+ get {
+ return ResourceManager.GetString("OptimizationDetailsDialog.DetailedDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Other.
+ /// </summary>
+ public static string OptimizationDetailsDialog_Other {
+ get {
+ return ResourceManager.GetString("OptimizationDetailsDialog.Other", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Open the folder and select the rollback data file for this optimization..
+ /// </summary>
+ public static string OptimizationDetailsDialog_Other_OpenRevertFile_Description {
+ get {
+ return ResourceManager.GetString("OptimizationDetailsDialog.Other.OpenRevertFile.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Revert file.
+ /// </summary>
+ public static string OptimizationDetailsDialog_Other_OpenRevertFile_Title {
+ get {
+ return ResourceManager.GetString("OptimizationDetailsDialog.Other.OpenRevertFile.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Risk.
+ /// </summary>
+ public static string OptimizationDetailsDialog_Risk {
+ get {
+ return ResourceManager.GetString("OptimizationDetailsDialog.Risk", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Tags.
+ /// </summary>
+ public static string OptimizationDetailsDialog_Tags {
+ get {
+ return ResourceManager.GetString("OptimizationDetailsDialog.Tags", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Some steps didn&apos;t complete successfully. You can retry only the failed steps..
+ /// </summary>
+ public static string OptimizationResultDialog_Description {
+ get {
+ return ResourceManager.GetString("OptimizationResultDialog.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to {0} Failed steps.
+ /// </summary>
+ public static string OptimizationResultDialog_Header {
+ get {
+ return ResourceManager.GetString("OptimizationResultDialog.Header", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Bloatware &amp; Services.
+ /// </summary>
+ public static string Optimizer_BloatwareAndServices {
+ get {
+ return ResourceManager.GetString("Optimizer.BloatwareAndServices", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Optimize Service Startup.
+ /// </summary>
+ public static string Optimizer_BloatwareAndServices_ConfigureServices_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.BloatwareAndServices.ConfigureServices.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Setting startup type for {0} to {1}....
+ /// </summary>
+ public static string Optimizer_BloatwareAndServices_ConfigureServices_Progress_ChangeServiceStartupType {
+ get {
+ return ResourceManager.GetString(("Optimizer.BloatwareAndServices.ConfigureServices.Progress.ChangeServiceStartupTyp" +
+ "e"), resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Switches non-critical system services to manual start, reducing background usage without breaking functionality. Required services will start automatically when needed..
+ /// </summary>
+ public static string Optimizer_BloatwareAndServices_ConfigureServices_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.BloatwareAndServices.ConfigureServices.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Block Preinstalled Apps.
+ /// </summary>
+ public static string Optimizer_BloatwareAndServices_DisablePreinstalledApps_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.BloatwareAndServices.DisablePreinstalledApps.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Blocks Windows from automatically installing OEM/bundled apps and suggested apps, helping keep the system cleaner from bloatware (especially after a fresh install or reset)..
+ /// </summary>
+ public static string Optimizer_BloatwareAndServices_DisablePreinstalledApps_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.BloatwareAndServices.DisablePreinstalledApps.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to GPU.
+ /// </summary>
+ public static string Optimizer_Gpu {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable AMD ASPM.
+ /// </summary>
+ public static string Optimizer_Gpu_AmdDisableAspm_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.AmdDisableAspm.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables AMD Active State Power Management to reduce latency and improve responsiveness. May increase PCIe power draw..
+ /// </summary>
+ public static string Optimizer_Gpu_AmdDisableAspm_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.AmdDisableAspm.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable AMD Power Gating.
+ /// </summary>
+ public static string Optimizer_Gpu_AmdDisablePowerGating_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.AmdDisablePowerGating.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables AMD power gating features to maintain consistent GPU performance under load. May increase power draw and temperatures..
+ /// </summary>
+ public static string Optimizer_Gpu_AmdDisablePowerGating_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.AmdDisablePowerGating.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable AMD ULPS.
+ /// </summary>
+ public static string Optimizer_Gpu_AmdDisableUlps_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.AmdDisableUlps.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables AMD Ultra Low Power State to prevent GPU power-down issues and improve wake-up latency..
+ /// </summary>
+ public static string Optimizer_Gpu_AmdDisableUlps_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.AmdDisableUlps.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable AMD Video Clock Gating.
+ /// </summary>
+ public static string Optimizer_Gpu_AmdDisableVideoClockGating_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.AmdDisableVideoClockGating.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables AMD video engine clock gating to improve video processing performance and stability. May increase power usage..
+ /// </summary>
+ public static string Optimizer_Gpu_AmdDisableVideoClockGating_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.AmdDisableVideoClockGating.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Intel Adaptive V-Sync.
+ /// </summary>
+ public static string Optimizer_Gpu_IntelDisableAdaptiveVsync_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.IntelDisableAdaptiveVsync.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables Intel adaptive vertical sync to provide more consistent frame timing..
+ /// </summary>
+ public static string Optimizer_Gpu_IntelDisableAdaptiveVsync_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.IntelDisableAdaptiveVsync.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Intel Async Flips.
+ /// </summary>
+ public static string Optimizer_Gpu_IntelDisableAsyncFlips_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.IntelDisableAsyncFlips.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables Intel asynchronous flip operations to reduce display latency and improve tearing resistance..
+ /// </summary>
+ public static string Optimizer_Gpu_IntelDisableAsyncFlips_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.IntelDisableAsyncFlips.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable NVIDIA Async P-States.
+ /// </summary>
+ public static string Optimizer_Gpu_NvidiaDisableAsyncPstates_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.NvidiaDisableAsyncPstates.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables NVIDIA asynchronous power state management for more predictable performance. May increase power usage..
+ /// </summary>
+ public static string Optimizer_Gpu_NvidiaDisableAsyncPstates_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.NvidiaDisableAsyncPstates.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable NVIDIA Dynamic P-State.
+ /// </summary>
+ public static string Optimizer_Gpu_NvidiaDisableDynamicPstate_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.NvidiaDisableDynamicPstate.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables NVIDIA dynamic power state transitions to maintain consistent performance. May increase idle power usage..
+ /// </summary>
+ public static string Optimizer_Gpu_NvidiaDisableDynamicPstate_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Gpu.NvidiaDisableDynamicPstate.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Performance.
+ /// </summary>
+ public static string Optimizer_Performance {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Background App Activity.
+ /// </summary>
+ public static string Optimizer_Performance_DisableBackgroundApps_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.DisableBackgroundApps.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Blocks supported apps from running in the background, reducing idle RAM/CPU usage and improving responsiveness..
+ /// </summary>
+ public static string Optimizer_Performance_DisableBackgroundApps_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.DisableBackgroundApps.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Xbox Game Bar.
+ /// </summary>
+ public static string Optimizer_Performance_DisableGameBar_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.DisableGameBar.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables Game Bar UI overlays and tips to reduce background overhead and interruptions..
+ /// </summary>
+ public static string Optimizer_Performance_DisableGameBar_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.DisableGameBar.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Game DVR Recording.
+ /// </summary>
+ public static string Optimizer_Performance_DisableGameDVR_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.DisableGameDVR.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Turns off background game capture/recording features to free resources and reduce latency..
+ /// </summary>
+ public static string Optimizer_Performance_DisableGameDVR_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.DisableGameDVR.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Mouse Acceleration.
+ /// </summary>
+ public static string Optimizer_Performance_DisableMouseAcceleration_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.DisableMouseAcceleration.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables mouse acceleration for consistent, predictable cursor movement..
+ /// </summary>
+ public static string Optimizer_Performance_DisableMouseAcceleration_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.DisableMouseAcceleration.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Enable Game Mode.
+ /// </summary>
+ public static string Optimizer_Performance_EnableGameMode_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.EnableGameMode.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Enables Game Mode to prioritize gaming performance and limit background activity. (Recommended on Windows 11).
+ /// </summary>
+ public static string Optimizer_Performance_EnableGameMode_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.EnableGameMode.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Enable Game Task Priority.
+ /// </summary>
+ public static string Optimizer_Performance_GameTaskScheduling_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.GameTaskScheduling.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Adjusts MMCSS “Games” task settings to prioritize game workloads for more consistent frame pacing..
+ /// </summary>
+ public static string Optimizer_Performance_GameTaskScheduling_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.GameTaskScheduling.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Optimize Keyboard Responsiveness.
+ /// </summary>
+ public static string Optimizer_Performance_KeyboardLatencyOptimization_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.KeyboardLatencyOptimization.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Tunes keyboard delay/repeat rate and related accessibility flags to improve typing responsiveness..
+ /// </summary>
+ public static string Optimizer_Performance_KeyboardLatencyOptimization_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.KeyboardLatencyOptimization.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Optimize MMCSS Responsiveness.
+ /// </summary>
+ public static string Optimizer_Performance_MultimediaResponsiveness_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.MultimediaResponsiveness.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Reduces latency by tuning SystemProfile responsiveness and disabling network throttling for gaming and AV workloads..
+ /// </summary>
+ public static string Optimizer_Performance_MultimediaResponsiveness_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.MultimediaResponsiveness.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Enable Foreground Boost.
+ /// </summary>
+ public static string Optimizer_Performance_ProcessPriority_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.ProcessPriority.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Tunes Windows scheduler foreground boost so active apps feel snappier and input latency is reduced..
+ /// </summary>
+ public static string Optimizer_Performance_ProcessPriority_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.ProcessPriority.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Invalid RAM: {0}.
+ /// </summary>
+ public static string Optimizer_Performance_SvcHostSplit_Error_InvalidRAM {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.SvcHostSplit.Error.InvalidRAM", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Enable Service Host Splitting.
+ /// </summary>
+ public static string Optimizer_Performance_SvcHostSplit_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.Performance.SvcHostSplit.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Power Management.
+ /// </summary>
+ public static string Optimizer_PowerManagement {
+ get {
+ return ResourceManager.GetString("Optimizer.PowerManagement", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Hibernate &amp; Fast Startup.
+ /// </summary>
+ public static string Optimizer_PowerManagement_DisableHibernate_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.PowerManagement.DisableHibernate.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables Hibernate and Fast Startup to free disk space and avoid using the hiberfile..
+ /// </summary>
+ public static string Optimizer_PowerManagement_DisableHibernate_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.PowerManagement.DisableHibernate.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Power Throttling.
+ /// </summary>
+ public static string Optimizer_PowerManagement_DisablePowerSaving_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.PowerManagement.DisablePowerSaving.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables power throttling and related power-saving behaviors to keep performance stable under load. May increase power use and temperatures..
+ /// </summary>
+ public static string Optimizer_PowerManagement_DisablePowerSaving_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.PowerManagement.DisablePowerSaving.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable USB Power Saving.
+ /// </summary>
+ public static string Optimizer_PowerManagement_DisableUSBPowerSaving_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.PowerManagement.DisableUSBPowerSaving.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Prevents USB root hubs from entering power-saving mode to reduce latency. May increase power usage on laptops..
+ /// </summary>
+ public static string Optimizer_PowerManagement_DisableUSBPowerSaving_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.PowerManagement.DisableUSBPowerSaving.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Failed to download optimizerDuck&apos;s power plan..
+ /// </summary>
+ public static string Optimizer_PowerManagement_InstallOptimizerDuckPowerPlan_Error_DownloadFailed {
+ get {
+ return ResourceManager.GetString("Optimizer.PowerManagement.InstallOptimizerDuckPowerPlan.Error.DownloadFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Install optimizerDuck&apos;s Power Plan.
+ /// </summary>
+ public static string Optimizer_PowerManagement_InstallOptimizerDuckPowerPlan_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.PowerManagement.InstallOptimizerDuckPowerPlan.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Downloading power plan....
+ /// </summary>
+ public static string Optimizer_PowerManagement_InstallOptimizerDuckPowerPlan_Progress_Downloading {
+ get {
+ return ResourceManager.GetString("Optimizer.PowerManagement.InstallOptimizerDuckPowerPlan.Progress.Downloading", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Importing and activating power plan....
+ /// </summary>
+ public static string Optimizer_PowerManagement_InstallOptimizerDuckPowerPlan_Progress_Importing {
+ get {
+ return ResourceManager.GetString("Optimizer.PowerManagement.InstallOptimizerDuckPowerPlan.Progress.Importing", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Downloads, imports, and activates the optimizerDuck power plan to prioritize maximum performance. May increase power use, heat, and fan noise..
+ /// </summary>
+ public static string Optimizer_PowerManagement_InstallOptimizerDuckPowerPlan_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.PowerManagement.InstallOptimizerDuckPowerPlan.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Security &amp; Privacy.
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable WMI AutoLogger.
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy_DisableAutoLogger_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy.DisableAutoLogger.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables multiple WMI AutoLogger sessions to reduce background event logging; can make troubleshooting harder..
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy_DisableAutoLogger_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy.DisableAutoLogger.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Content Delivery.
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy_DisableContentDeliveryManager_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy.DisableContentDeliveryManager.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Stops suggested apps, tips, and Windows content delivery recommendations..
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy_DisableContentDeliveryManager_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy.DisableContentDeliveryManager.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Windows Copilot.
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy_DisableCopilot_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy.DisableCopilot.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables Windows Copilot and hides its UI integration in the taskbar and system shell..
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy_DisableCopilot_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy.DisableCopilot.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Cortana &amp; Web Search.
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy_DisableCortana_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy.DisableCortana.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Removes Cortana and web search integration from Windows Search..
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy_DisableCortana_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy.DisableCortana.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Reduce Telemetry &amp; Feedback.
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy_DisableTelemetry_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy.DisableTelemetry.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disabling telemetry services....
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy_DisableTelemetry_Progress_DisableServices {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy.DisableTelemetry.Progress.DisableServices", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disabling scheduled telemetry tasks....
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy_DisableTelemetry_Progress_DisableTasks {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy.DisableTelemetry.Progress.DisableTasks", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Applying policy and registry changes....
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy_DisableTelemetry_Progress_EditRegistry {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy.DisableTelemetry.Progress.EditRegistry", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Reduces Windows diagnostics/telemetry and feedback by applying policies, registry settings, services, and scheduled tasks. May affect error reporting and some compatibility features..
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy_DisableTelemetry_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy.DisableTelemetry.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable UAC Prompts.
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy_DisableUAC_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy.DisableUAC.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables UAC (User Account Control) – the mechanism that asks for confirmation when running applications requiring Admin rights. Turning it off may reduce annoyance, but it also weakens important security protections..
+ /// </summary>
+ public static string Optimizer_SecurityAndPrivacy_DisableUAC_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.SecurityAndPrivacy.DisableUAC.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to This value reflects the level of intervention and the safety of the optimization process. Please exercise caution and consider carefully before applying any optimization..
+ /// </summary>
+ public static string Optimizer_UI_Risk_Help {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Risk.Help", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Moderate.
+ /// </summary>
+ public static string Optimizer_UI_Risk_Moderate {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Risk.Moderate", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Risky.
+ /// </summary>
+ public static string Optimizer_UI_Risk_Risky {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Risk.Risky", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Safe.
+ /// </summary>
+ public static string Optimizer_UI_Risk_Safe {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Risk.Safe", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to AMD.
+ /// </summary>
+ public static string Optimizer_UI_Tags_Amd {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Amd", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Audio.
+ /// </summary>
+ public static string Optimizer_UI_Tags_Audio {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Audio", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disk.
+ /// </summary>
+ public static string Optimizer_UI_Tags_Disk {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Disk", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Display.
+ /// </summary>
+ public static string Optimizer_UI_Tags_Display {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Display", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to These tags indicate which parts of the system the optimization will affect..
+ /// </summary>
+ public static string Optimizer_UI_Tags_Help {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Help", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Intel.
+ /// </summary>
+ public static string Optimizer_UI_Tags_Intel {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Intel", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Latency.
+ /// </summary>
+ public static string Optimizer_UI_Tags_Latency {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Latency", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Network.
+ /// </summary>
+ public static string Optimizer_UI_Tags_Network {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Network", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Network connection required.
+ /// </summary>
+ public static string Optimizer_UI_Tags_NetworkRequired {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.NetworkRequired", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to NVIDIA.
+ /// </summary>
+ public static string Optimizer_UI_Tags_Nvidia {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Nvidia", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Performance.
+ /// </summary>
+ public static string Optimizer_UI_Tags_Performance {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Performance", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Power.
+ /// </summary>
+ public static string Optimizer_UI_Tags_Power {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Power", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Privacy.
+ /// </summary>
+ public static string Optimizer_UI_Tags_Privacy {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Privacy", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Ram.
+ /// </summary>
+ public static string Optimizer_UI_Tags_Ram {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Ram", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Security.
+ /// </summary>
+ public static string Optimizer_UI_Tags_Security {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Security", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to System.
+ /// </summary>
+ public static string Optimizer_UI_Tags_System {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.System", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Visual.
+ /// </summary>
+ public static string Optimizer_UI_Tags_Visual {
+ get {
+ return ResourceManager.GetString("Optimizer.UI.Tags.Visual", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to User Experience.
+ /// </summary>
+ public static string Optimizer_UserExperience {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Explorer &amp; System Notifications.
+ /// </summary>
+ public static string Optimizer_UserExperience_DisableExplorerAndSystemNotifications_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.DisableExplorerAndSystemNotifications.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables various system notifications and sync provider notifications to reduce interruptions..
+ /// </summary>
+ public static string Optimizer_UserExperience_DisableExplorerAndSystemNotifications_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.DisableExplorerAndSystemNotifications.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Extra Taskbar Buttons.
+ /// </summary>
+ public static string Optimizer_UserExperience_DisableTaskbarExtraButtons_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.DisableTaskbarExtraButtons.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Hides Widgets, Chat, and Task View buttons from the taskbar for a cleaner interface..
+ /// </summary>
+ public static string Optimizer_UserExperience_DisableTaskbarExtraButtons_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.DisableTaskbarExtraButtons.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Taskbar News &amp; Interests.
+ /// </summary>
+ public static string Optimizer_UserExperience_DisableTaskbarNewsAndInterests_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.DisableTaskbarNewsAndInterests.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Removes the news and interests widget from the taskbar to reduce distractions and resource usage..
+ /// </summary>
+ public static string Optimizer_UserExperience_DisableTaskbarNewsAndInterests_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.DisableTaskbarNewsAndInterests.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Taskbar Search &amp; Bing.
+ /// </summary>
+ public static string Optimizer_UserExperience_DisableTaskbarSearchAndBing_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.DisableTaskbarSearchAndBing.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Removes the search box from taskbar and disables Bing web search integration..
+ /// </summary>
+ public static string Optimizer_UserExperience_DisableTaskbarSearchAndBing_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.DisableTaskbarSearchAndBing.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disable Visual Effects.
+ /// </summary>
+ public static string Optimizer_UserExperience_DisableVisualEffects_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.DisableVisualEffects.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Disables taskbar animations, shadows, transparency, and Aero Peek for better performance..
+ /// </summary>
+ public static string Optimizer_UserExperience_DisableVisualEffects_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.DisableVisualEffects.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Enable Classic Context Menu (for Windows 11).
+ /// </summary>
+ public static string Optimizer_UserExperience_EnableClassicContextMenu_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.EnableClassicContextMenu.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Restores the classic Windows context menu instead of the modern simplified version..
+ /// </summary>
+ public static string Optimizer_UserExperience_EnableClassicContextMenu_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.EnableClassicContextMenu.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Enable Dark Mode.
+ /// </summary>
+ public static string Optimizer_UserExperience_EnableDarkMode_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.EnableDarkMode.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Enables dark mode for system apps and interface elements to reduce eye strain..
+ /// </summary>
+ public static string Optimizer_UserExperience_EnableDarkMode_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.EnableDarkMode.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Enable Taskbar End Task.
+ /// </summary>
+ public static string Optimizer_UserExperience_EnableTaskbarEndTask_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.EnableTaskbarEndTask.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Adds the ability to right-click taskbar applications and select &quot;End task&quot; for quick process termination..
+ /// </summary>
+ public static string Optimizer_UserExperience_EnableTaskbarEndTask_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.EnableTaskbarEndTask.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Remove Meet Now &amp; People.
+ /// </summary>
+ public static string Optimizer_UserExperience_RemoveMeetNowAndPeople_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.RemoveMeetNowAndPeople.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Removes Meet Now and People icons from the taskbar to reduce clutter..
+ /// </summary>
+ public static string Optimizer_UserExperience_RemoveMeetNowAndPeople_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.RemoveMeetNowAndPeople.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Show File Extensions &amp; Hidden Files.
+ /// </summary>
+ public static string Optimizer_UserExperience_ShowFileExtensionsAndHiddenFiles_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.ShowFileExtensionsAndHiddenFiles.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Makes file extensions visible and shows hidden system files for better file management..
+ /// </summary>
+ public static string Optimizer_UserExperience_ShowFileExtensionsAndHiddenFiles_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.ShowFileExtensionsAndHiddenFiles.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Show Seconds in System Clock.
+ /// </summary>
+ public static string Optimizer_UserExperience_ShowSecondsInSystemClock_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.ShowSecondsInSystemClock.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Adds seconds display to the system clock in the taskbar for more precise time tracking..
+ /// </summary>
+ public static string Optimizer_UserExperience_ShowSecondsInSystemClock_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.ShowSecondsInSystemClock.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Speed Up Explorer &amp; Menus.
+ /// </summary>
+ public static string Optimizer_UserExperience_SpeedUpExplorerAndMenus_Name {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.SpeedUpExplorerAndMenus.Name", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Reduces Explorer startup delay and menu popup delay for faster interface response..
+ /// </summary>
+ public static string Optimizer_UserExperience_SpeedUpExplorerAndMenus_ShortDescription {
+ get {
+ return ResourceManager.GetString("Optimizer.UserExperience.SpeedUpExplorerAndMenus.ShortDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Please don&apos;t close the app or restart while changes are being applied or reverted..
+ /// </summary>
+ public static string ProcessingOptimizationDialog_Warning_DontCloseAppOrRestart {
+ get {
+ return ResourceManager.GetString("ProcessingOptimizationDialog.Warning.DontCloseAppOrRestart", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to System Restore.
+ /// </summary>
+ public static string RestorePoint_Title {
+ get {
+ return ResourceManager.GetString("RestorePoint.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The Windows operating system includes a feature called Restore Point, which allows you to revert the system to its previous state before applying any changes or optimizations..
+ /// </summary>
+ public static string RestorePointDialog_Description {
+ get {
+ return ResourceManager.GetString("RestorePointDialog.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to When you proceed, the application will automatically activate System Restore (if it is disabled) and create a new restore point with a name starting with &quot;optimizerDuck...&quot;, helping safeguard the system before any changes..
+ /// </summary>
+ public static string RestorePointDialog_Help {
+ get {
+ return ResourceManager.GetString("RestorePointDialog.Help", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Revert file is empty.
+ /// </summary>
+ public static string Revert_Error_FileEmpty {
+ get {
+ return ResourceManager.GetString("Revert.Error.FileEmpty", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Revert file not found.
+ /// </summary>
+ public static string Revert_Error_FileNotFound {
+ get {
+ return ResourceManager.GetString("Revert.Error.FileNotFound", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Invalid revert data for {0}: {1}.
+ /// </summary>
+ public static string Revert_Error_InvalidData {
+ get {
+ return ResourceManager.GetString("Revert.Error.InvalidData", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Invalid revert data.
+ /// </summary>
+ public static string Revert_Error_InvalidJson {
+ get {
+ return ResourceManager.GetString("Revert.Error.InvalidJson", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Invalid JSON format: {0}.
+ /// </summary>
+ public static string Revert_Error_InvalidJsonFormat {
+ get {
+ return ResourceManager.GetString("Revert.Error.InvalidJsonFormat", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Invalid revert steps: {0}.
+ /// </summary>
+ public static string Revert_Error_InvalidSteps {
+ get {
+ return ResourceManager.GetString("Revert.Error.InvalidSteps", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to No revert data found for {0}..
+ /// </summary>
+ public static string Revert_Error_NoDataFound {
+ get {
+ return ResourceManager.GetString("Revert.Error.NoDataFound", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to No revert steps found..
+ /// </summary>
+ public static string Revert_Error_NoSteps {
+ get {
+ return ResourceManager.GetString("Revert.Error.NoSteps", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to OptimizationId mismatch..
+ /// </summary>
+ public static string Revert_Error_OptimizationIdMismatch {
+ get {
+ return ResourceManager.GetString("Revert.Error.OptimizationIdMismatch", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Failed to read revert data: {0}.
+ /// </summary>
+ public static string Revert_Error_ReadFailed {
+ get {
+ return ResourceManager.GetString("Revert.Error.ReadFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Failed to revert {0}: {1}.
+ /// </summary>
+ public static string Revert_Error_RevertFailed {
+ get {
+ return ResourceManager.GetString("Revert.Error.RevertFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Access denied.
+ /// </summary>
+ public static string Service_Common_Error_AccessDenied {
+ get {
+ return ResourceManager.GetString("Service.Common.Error.AccessDenied", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Access denied (protected hive).
+ /// </summary>
+ public static string Service_Registry_Error_AccessDeniedProtectedHive {
+ get {
+ return ResourceManager.GetString("Service.Registry.Error.AccessDeniedProtectedHive", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Failed to create/open subkey.
+ /// </summary>
+ public static string Service_Registry_Error_CreateOrOpenSubkeyFailed {
+ get {
+ return ResourceManager.GetString("Service.Registry.Error.CreateOrOpenSubkeyFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unauthorized access.
+ /// </summary>
+ public static string Service_Registry_Error_UnauthorizedAccess {
+ get {
+ return ResourceManager.GetString("Service.Registry.Error.UnauthorizedAccess", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ChangeStartMode failed (code: {0}).
+ /// </summary>
+ public static string Service_Service_Error_ChangeStartModeFailedWithCode {
+ get {
+ return ResourceManager.GetString("Service.Service.Error.ChangeStartModeFailedWithCode", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Service not found.
+ /// </summary>
+ public static string Service_Service_Error_NotFound {
+ get {
+ return ResourceManager.GetString("Service.Service.Error.NotFound", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Failed to update registry for startup type.
+ /// </summary>
+ public static string Service_Service_Error_UpdateRegistryForStartupTypeFailed {
+ get {
+ return ResourceManager.GetString("Service.Service.Error.UpdateRegistryForStartupTypeFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Exit code {0}.
+ /// </summary>
+ public static string Service_Shell_Error_ExitCode {
+ get {
+ return ResourceManager.GetString("Service.Shell.Error.ExitCode", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Timed out.
+ /// </summary>
+ public static string Service_Shell_Error_TimedOut {
+ get {
+ return ResourceManager.GetString("Service.Shell.Error.TimedOut", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to optimizerDuck is made possible by the following open-source software and resources..
+ /// </summary>
+ public static string Settings_About_Acknowledgements_Description {
+ get {
+ return ResourceManager.GetString("Settings.About.Acknowledgements.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Acknowledgments.
+ /// </summary>
+ public static string Settings_About_Acknowledgements_Title {
+ get {
+ return ResourceManager.GetString("Settings.About.Acknowledgements.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Thank you for your trust and support &lt;3! Current version: {0}.
+ /// </summary>
+ public static string Settings_About_Duck_Description {
+ get {
+ return ResourceManager.GetString("Settings.About.Duck.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to About.
+ /// </summary>
+ public static string Settings_About_Header {
+ get {
+ return ResourceManager.GetString("Settings.About.Header", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Learn more.
+ /// </summary>
+ public static string Settings_About_LearnMore {
+ get {
+ return ResourceManager.GetString("Settings.About.LearnMore", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Acknowledgments.
+ /// </summary>
+ public static string Settings_About_LearnMore_Acknowledgements {
+ get {
+ return ResourceManager.GetString("Settings.About.LearnMore.Acknowledgements", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Discord community.
+ /// </summary>
+ public static string Settings_About_LearnMore_Discord {
+ get {
+ return ResourceManager.GetString("Settings.About.LearnMore.Discord", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Documentation.
+ /// </summary>
+ public static string Settings_About_LearnMore_Documentation {
+ get {
+ return ResourceManager.GetString("Settings.About.LearnMore.Documentation", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to GitHub repository.
+ /// </summary>
+ public static string Settings_About_LearnMore_GitHub {
+ get {
+ return ResourceManager.GetString("Settings.About.LearnMore.GitHub", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Support me.
+ /// </summary>
+ public static string Settings_About_LearnMore_Support {
+ get {
+ return ResourceManager.GetString("Settings.About.LearnMore.Support", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Delete all files downloaded during the optimization process..
+ /// </summary>
+ public static string Settings_Advanced_ClearResources_Description {
+ get {
+ return ResourceManager.GetString("Settings.Advanced.ClearResources.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Clear resources.
+ /// </summary>
+ public static string Settings_Advanced_ClearResources_Title {
+ get {
+ return ResourceManager.GetString("Settings.Advanced.ClearResources.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Clear all rollback data from optimizations..
+ /// </summary>
+ public static string Settings_Advanced_ClearRevertDatas_Description {
+ get {
+ return ResourceManager.GetString("Settings.Advanced.ClearRevertDatas.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Clear all revert data.
+ /// </summary>
+ public static string Settings_Advanced_ClearRevertDatas_Title {
+ get {
+ return ResourceManager.GetString("Settings.Advanced.ClearRevertDatas.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Advanced.
+ /// </summary>
+ public static string Settings_Advanced_Header {
+ get {
+ return ResourceManager.GetString("Settings.Advanced.Header", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Open the application&apos;s root directory, where all necessary files are stored..
+ /// </summary>
+ public static string Settings_Advanced_OpenRootDir_Description {
+ get {
+ return ResourceManager.GetString("Settings.Advanced.OpenRootDir.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Open root directory.
+ /// </summary>
+ public static string Settings_Advanced_OpenRootDir_Title {
+ get {
+ return ResourceManager.GetString("Settings.Advanced.OpenRootDir.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Appearance.
+ /// </summary>
+ public static string Settings_Appearance_Header {
+ get {
+ return ResourceManager.GetString("Settings.Appearance.Header", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Choose your preferred language..
+ /// </summary>
+ public static string Settings_Appearance_LanguageSelector_Description {
+ get {
+ return ResourceManager.GetString("Settings.Appearance.LanguageSelector.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Language.
+ /// </summary>
+ public static string Settings_Appearance_LanguageSelector_Title {
+ get {
+ return ResourceManager.GetString("Settings.Appearance.LanguageSelector.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Dark.
+ /// </summary>
+ public static string Settings_Appearance_ThemeSelector_Dark {
+ get {
+ return ResourceManager.GetString("Settings.Appearance.ThemeSelector.Dark", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Select your preferred theme for the app..
+ /// </summary>
+ public static string Settings_Appearance_ThemeSelector_Description {
+ get {
+ return ResourceManager.GetString("Settings.Appearance.ThemeSelector.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to High Contrast.
+ /// </summary>
+ public static string Settings_Appearance_ThemeSelector_HighContrast {
+ get {
+ return ResourceManager.GetString("Settings.Appearance.ThemeSelector.HighContrast", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Light.
+ /// </summary>
+ public static string Settings_Appearance_ThemeSelector_Light {
+ get {
+ return ResourceManager.GetString("Settings.Appearance.ThemeSelector.Light", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Theme.
+ /// </summary>
+ public static string Settings_Appearance_ThemeSelector_Title {
+ get {
+ return ResourceManager.GetString("Settings.Appearance.ThemeSelector.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to You are about to delete all resources downloaded or generated during the optimization process. Please note that this action is permanent and cannot be undone, so make sure you are certain before proceeding..
+ /// </summary>
+ public static string Settings_ClearResources_Description {
+ get {
+ return ResourceManager.GetString("Settings.ClearResources.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to You are about to delete all rollback data generated after the optimization process. This means you will no longer be able to restore the pre-optimization state, so please think carefully before confirming..
+ /// </summary>
+ public static string Settings_ClearRevertData_Description {
+ get {
+ return ResourceManager.GetString("Settings.ClearRevertData.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Settings.
+ /// </summary>
+ public static string Settings_Header_Title {
+ get {
+ return ResourceManager.GetString("Settings.Header.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to You need to restart the application to apply the new language..
+ /// </summary>
+ public static string Settings_LanguageChanged_Description {
+ get {
+ return ResourceManager.GetString("Settings.LanguageChanged.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Language change.
+ /// </summary>
+ public static string Settings_LanguageChanged_Title {
+ get {
+ return ResourceManager.GetString("Settings.LanguageChanged.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Optimize.
+ /// </summary>
+ public static string Settings_Optimize_Header {
+ get {
+ return ResourceManager.GetString("Settings.Optimize.Header", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Timeout for each shell command execution (milliseconds)..
+ /// </summary>
+ public static string Settings_Optimize_ShellTimeout_Description {
+ get {
+ return ResourceManager.GetString("Settings.Optimize.ShellTimeout.Description", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Shell service timeout.
+ /// </summary>
+ public static string Settings_Optimize_ShellTimeout_Title {
+ get {
+ return ResourceManager.GetString("Settings.Optimize.ShellTimeout.Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Do NOT change unless you know exactly what you are doing.
+ /// </summary>
+ public static string Settings_Optimize_ShellTimeout_Warning {
+ get {
+ return ResourceManager.GetString("Settings.Optimize.ShellTimeout.Warning", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Dashboard.
+ /// </summary>
+ public static string Sidebar_Dashboard {
+ get {
+ return ResourceManager.GetString("Sidebar.Dashboard", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Optimize.
+ /// </summary>
+ public static string Sidebar_Optimize {
+ get {
+ return ResourceManager.GetString("Sidebar.Optimize", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Settings.
+ /// </summary>
+ public static string Sidebar_Settings {
+ get {
+ return ResourceManager.GetString("Sidebar.Settings", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/optimizerDuck/Resources/Languages/Translations.resx b/optimizerDuck/Resources/Languages/Translations.resx
new file mode 100644
index 0000000..1be42d2
--- /dev/null
+++ b/optimizerDuck/Resources/Languages/Translations.resx
@@ -0,0 +1,748 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root" xmlns="">
+ <xsd:element name="root" msdata:IsDataSet="true"></xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>1.3</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
+ PublicKeyToken=b77a5c561934e089
+ </value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
+ PublicKeyToken=b77a5c561934e089
+ </value>
+ </resheader>
+ <data name="Dashboard.Header.Title" xml:space="preserve">
+ <value>Dashboard</value>
+ </data>
+ <data name="Sidebar.Dashboard" xml:space="preserve">
+ <value>Dashboard</value>
+ </data>
+ <data name="Sidebar.Settings" xml:space="preserve">
+ <value>Settings</value>
+ </data>
+ <data name="Button.Close" xml:space="preserve">
+ <value>Close</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Cpu.Cores" xml:space="preserve">
+ <value>{0} Cores</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Storage.DiskInfo" xml:space="preserve">
+ <value>{0} GB used of {1} GB ({2} GB free)</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Ram.Modules" xml:space="preserve">
+ <value>{0} Module(s)</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Cpu.Threads" xml:space="preserve">
+ <value>{0} Threads</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Storage.System" xml:space="preserve">
+ <value>SYSTEM</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Storage.Header" xml:space="preserve">
+ <value>Storage</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Ram.Used" xml:space="preserve">
+ <value>{0} GB Used</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Ram.Available" xml:space="preserve">
+ <value>{0} GB Available</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Loading" xml:space="preserve">
+ <value>Fetching System Information...</value>
+ </data>
+ <data name="Sidebar.Optimize" xml:space="preserve">
+ <value>Optimize</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Gpu.More" xml:space="preserve">
+ <value>+ {0} more GPU</value>
+ </data>
+ <data name="Dashboard.Actions.Discord.Title" xml:space="preserve">
+ <value>Discord Community</value>
+ </data>
+ <data name="Dashboard.Actions.Discord.Description" xml:space="preserve">
+ <value>Join our Discord community to... get support or play games with me</value>
+ </data>
+ <data name="Dashboard.Actions.GitHub.Title" xml:space="preserve">
+ <value>GitHub Repository</value>
+ </data>
+ <data name="Dashboard.Actions.GitHub.Description" xml:space="preserve">
+ <value>Explore, review, and contribute to my project through GitHub</value>
+ </data>
+ <data name="Dashboard.Actions.SupportMe.Title" xml:space="preserve">
+ <value>Support Me</value>
+ </data>
+ <data name="Dashboard.Actions.SupportMe.Description" xml:space="preserve">
+ <value>Support me and keep this project growing!</value>
+ </data>
+ <data name="Settings.LanguageChanged.Title" xml:space="preserve">
+ <value>Language change</value>
+ </data>
+ <data name="Settings.LanguageChanged.Description" xml:space="preserve">
+ <value>You need to restart the application to apply the new language.</value>
+ </data>
+ <data name="Button.Ok" xml:space="preserve">
+ <value>OK</value>
+ </data>
+ <data name="Settings.Header.Title" xml:space="preserve">
+ <value>Settings</value>
+ </data>
+ <data name="Settings.Appearance.Header" xml:space="preserve">
+ <value>Appearance</value>
+ </data>
+ <data name="Settings.Appearance.LanguageSelector.Title" xml:space="preserve">
+ <value>Language</value>
+ </data>
+ <data name="Settings.Appearance.LanguageSelector.Description" xml:space="preserve">
+ <value>Choose your preferred language.</value>
+ </data>
+ <data name="Settings.Appearance.ThemeSelector.Title" xml:space="preserve">
+ <value>Theme</value>
+ </data>
+ <data name="Settings.Appearance.ThemeSelector.Description" xml:space="preserve">
+ <value>Select your preferred theme for the app.</value>
+ </data>
+ <data name="Settings.Appearance.ThemeSelector.Light" xml:space="preserve">
+ <value>Light</value>
+ </data>
+ <data name="Settings.Appearance.ThemeSelector.Dark" xml:space="preserve">
+ <value>Dark</value>
+ </data>
+ <data name="Settings.Appearance.ThemeSelector.HighContrast" xml:space="preserve">
+ <value>High Contrast</value>
+ </data>
+ <data name="Common.AppliedSecondsAgo" xml:space="preserve">
+ <value>Applied on {0} seconds ago</value>
+ </data>
+ <data name="Common.AppliedMinutesAgo" xml:space="preserve">
+ <value>Applied on {0} minutes ago</value>
+ </data>
+ <data name="Common.AppliedHoursAgo" xml:space="preserve">
+ <value>Applied on {0} hours ago</value>
+ </data>
+ <data name="Common.AppliedDaysAgo" xml:space="preserve">
+ <value>Applied on {0} days ago</value>
+ </data>
+ <data name="Common.AppliedMonthsAgo" xml:space="preserve">
+ <value>Applied on {0} months ago</value>
+ </data>
+ <data name="Common.AppliedYearsAgo" xml:space="preserve">
+ <value>Applied on {0} years ago</value>
+ </data>
+ <data name="Optimizer.UI.Risk.Safe" xml:space="preserve">
+ <value>Safe</value>
+ </data>
+ <data name="Optimizer.UI.Risk.Moderate" xml:space="preserve">
+ <value>Moderate</value>
+ </data>
+ <data name="Optimizer.UI.Risk.Risky" xml:space="preserve">
+ <value>Risky</value>
+ </data>
+ <data name="Button.CopyGuid" xml:space="preserve">
+ <value>Copy GUID</value>
+ </data>
+ <data name="OptimizationDetailsDialog.DetailedDescription" xml:space="preserve">
+ <value>Detailed description</value>
+ </data>
+ <data name="OptimizationDetailsDialog.Tags" xml:space="preserve">
+ <value>Tags</value>
+ </data>
+ <data name="OptimizationDetailsDialog.Risk" xml:space="preserve">
+ <value>Risk</value>
+ </data>
+ <data name="OptimizationDetailsDialog.Other" xml:space="preserve">
+ <value>Other</value>
+ </data>
+ <data name="Optimizer.UI.Risk.Help" xml:space="preserve">
+ <value>This value reflects the level of intervention and the safety of the optimization process. Please exercise caution and consider carefully before applying any optimization.</value>
+ </data>
+ <data name="Optimizer.UI.Tags.System" xml:space="preserve">
+ <value>System</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Ram" xml:space="preserve">
+ <value>Ram</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Disk" xml:space="preserve">
+ <value>Disk</value>
+ </data>
+ <data name="Optimizer.UI.Tags.NetworkRequired" xml:space="preserve">
+ <value>Network connection required</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Network" xml:space="preserve">
+ <value>Network</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Privacy" xml:space="preserve">
+ <value>Privacy</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Audio" xml:space="preserve">
+ <value>Audio</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Help" xml:space="preserve">
+ <value>These tags indicate which parts of the system the optimization will affect.</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Nvidia" xml:space="preserve">
+ <value>NVIDIA</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Amd" xml:space="preserve">
+ <value>AMD</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Intel" xml:space="preserve">
+ <value>Intel</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Power" xml:space="preserve">
+ <value>Power</value>
+ </data>
+ <data name="Revert.Error.InvalidData" xml:space="preserve">
+ <value>Invalid revert data for {0}: {1}</value>
+ </data>
+ <data name="Revert.Error.NoDataFound" xml:space="preserve">
+ <value>No revert data found for {0}.</value>
+ </data>
+ <data name="Optimization.Revert.Reverting" xml:space="preserve">
+ <value>Reverting...</value>
+ </data>
+ <data name="Optimization.Revert.Success" xml:space="preserve">
+ <value>Successfully reverted {0}!</value>
+ </data>
+ <data name="Optimization.Revert.Error.FailedWithSteps" xml:space="preserve">
+ <value>Reverted {0} with {1} failed step(s).</value>
+ </data>
+ <data name="Revert.Error.RevertFailed" xml:space="preserve">
+ <value>Failed to revert {0}: {1}</value>
+ </data>
+ <data name="Optimization.Revert.ExecutingStep" xml:space="preserve">
+ <value>Executing revert step: {0}/{1} ({2})</value>
+ </data>
+ <data name="Revert.Error.FileNotFound" xml:space="preserve">
+ <value>Revert file not found</value>
+ </data>
+ <data name="Revert.Error.FileEmpty" xml:space="preserve">
+ <value>Revert file is empty</value>
+ </data>
+ <data name="Revert.Error.ReadFailed" xml:space="preserve">
+ <value>Failed to read revert data: {0}</value>
+ </data>
+ <data name="Revert.Error.InvalidJson" xml:space="preserve">
+ <value>Invalid revert data</value>
+ </data>
+ <data name="Revert.Error.InvalidJsonFormat" xml:space="preserve">
+ <value>Invalid JSON format: {0}</value>
+ </data>
+ <data name="Revert.Error.NoSteps" xml:space="preserve">
+ <value>No revert steps found.</value>
+ </data>
+ <data name="Revert.Error.InvalidSteps" xml:space="preserve">
+ <value>Invalid revert steps: {0}</value>
+ </data>
+ <data name="Revert.Error.OptimizationIdMismatch" xml:space="preserve">
+ <value>OptimizationId mismatch.</value>
+ </data>
+ <data name="Optimization.Apply.Processing" xml:space="preserve">
+ <value>Applying changes...</value>
+ </data>
+ <data name="Optimization.Apply.Completed" xml:space="preserve">
+ <value>Completed</value>
+ </data>
+ <data name="Optimization.Apply.Success" xml:space="preserve">
+ <value>Successfully applied {0}.</value>
+ </data>
+ <data name="Optimization.Apply.Error.FailedWithSteps" xml:space="preserve">
+ <value>Applied {0} with {1} failed step(s).</value>
+ </data>
+ <data name="Optimization.Apply.Error.Failed" xml:space="preserve">
+ <value>Failed to apply {0}.</value>
+ </data>
+ <data name="Service.Common.Error.AccessDenied" xml:space="preserve">
+ <value>Access denied</value>
+ </data>
+ <data name="Service.Registry.Error.AccessDeniedProtectedHive" xml:space="preserve">
+ <value>Access denied (protected hive)</value>
+ </data>
+ <data name="Service.Registry.Error.UnauthorizedAccess" xml:space="preserve">
+ <value>Unauthorized access</value>
+ </data>
+ <data name="Service.Registry.Error.CreateOrOpenSubkeyFailed" xml:space="preserve">
+ <value>Failed to create/open subkey</value>
+ </data>
+ <data name="Service.Service.Error.NotFound" xml:space="preserve">
+ <value>Service not found</value>
+ </data>
+ <data name="Service.Service.Error.UpdateRegistryForStartupTypeFailed" xml:space="preserve">
+ <value>Failed to update registry for startup type</value>
+ </data>
+ <data name="Service.Service.Error.ChangeStartModeFailedWithCode" xml:space="preserve">
+ <value>ChangeStartMode failed (code: {0})</value>
+ </data>
+ <data name="Service.Shell.Error.ExitCode" xml:space="preserve">
+ <value>Exit code {0}</value>
+ </data>
+ <data name="Service.Shell.Error.TimedOut" xml:space="preserve">
+ <value>Timed out</value>
+ </data>
+ <data name="OptimizationDetailsDialog.Other.OpenRevertFile.Title" xml:space="preserve">
+ <value>Revert file</value>
+ </data>
+ <data name="OptimizationDetailsDialog.Other.OpenRevertFile.Description" xml:space="preserve">
+ <value>Open the folder and select the rollback data file for this optimization.</value>
+ </data>
+ <data name="OptimizationResultDialog.Header" xml:space="preserve">
+ <value>{0} Failed steps</value>
+ </data>
+ <data name="OptimizationResultDialog.Description" xml:space="preserve">
+ <value>Some steps didn't complete successfully. You can retry only the failed steps.</value>
+ </data>
+ <data name="Button.Retry" xml:space="preserve">
+ <value>Retry</value>
+ </data>
+ <data name="Settings.About.Duck.Description" xml:space="preserve">
+ <value>Thank you for your trust and support &lt;3! Current version: {0}</value>
+ </data>
+ <data name="Settings.Advanced.Header" xml:space="preserve">
+ <value>Advanced</value>
+ </data>
+ <data name="Settings.Optimize.Header" xml:space="preserve">
+ <value>Optimize</value>
+ </data>
+ <data name="Settings.Optimize.ShellTimeout.Title" xml:space="preserve">
+ <value>Shell service timeout</value>
+ </data>
+ <data name="Settings.Optimize.ShellTimeout.Description" xml:space="preserve">
+ <value>Timeout for each shell command execution (milliseconds).</value>
+ </data>
+ <data name="Settings.Advanced.ClearResources.Title" xml:space="preserve">
+ <value>Clear resources</value>
+ </data>
+ <data name="Settings.Advanced.ClearResources.Description" xml:space="preserve">
+ <value>Delete all files downloaded during the optimization process.</value>
+ </data>
+ <data name="Settings.Advanced.ClearRevertDatas.Title" xml:space="preserve">
+ <value>Clear all revert data</value>
+ </data>
+ <data name="Settings.Advanced.ClearRevertDatas.Description" xml:space="preserve">
+ <value>Clear all rollback data from optimizations.</value>
+ </data>
+ <data name="Button.Clear" xml:space="preserve">
+ <value>Clear</value>
+ </data>
+ <data name="Settings.Advanced.OpenRootDir.Title" xml:space="preserve">
+ <value>Open root directory</value>
+ </data>
+ <data name="Settings.Advanced.OpenRootDir.Description" xml:space="preserve">
+ <value>Open the application's root directory, where all necessary files are stored.</value>
+ </data>
+ <data name="Button.Open" xml:space="preserve">
+ <value>Open</value>
+ </data>
+ <data name="Settings.About.Header" xml:space="preserve">
+ <value>About</value>
+ </data>
+ <data name="Settings.About.LearnMore" xml:space="preserve">
+ <value>Learn more</value>
+ </data>
+ <data name="Settings.About.LearnMore.Documentation" xml:space="preserve">
+ <value>Documentation</value>
+ </data>
+ <data name="Settings.About.LearnMore.Support" xml:space="preserve">
+ <value>Support me</value>
+ </data>
+ <data name="Settings.About.LearnMore.Discord" xml:space="preserve">
+ <value>Discord community</value>
+ </data>
+ <data name="Settings.About.LearnMore.GitHub" xml:space="preserve">
+ <value>GitHub repository</value>
+ </data>
+ <data name="Dialog.AreYouSure.Title" xml:space="preserve">
+ <value>Do you really want to proceed?</value>
+ </data>
+ <data name="Settings.ClearResources.Description" xml:space="preserve">
+ <value>You are about to delete all resources downloaded or generated during the optimization process. Please note that this action is permanent and cannot be undone, so make sure you are certain before proceeding.</value>
+ </data>
+ <data name="Button.Cancel" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name="Settings.ClearRevertData.Description" xml:space="preserve">
+ <value>You are about to delete all rollback data generated after the optimization process. This means you will no longer be able to restore the pre-optimization state, so please think carefully before confirming.</value>
+ </data>
+ <data name="ProcessingOptimizationDialog.Warning.DontCloseAppOrRestart" xml:space="preserve">
+ <value>Please don't close the app or restart while changes are being applied or reverted.</value>
+ </data>
+ <data name="Common.AppliedJustNow" xml:space="preserve">
+ <value>Just applied</value>
+ </data>
+ <data name="Optimization.Apply.Snackbar.Error.Title" xml:space="preserve">
+ <value>Couldn't apply optimization.</value>
+ </data>
+ <data name="Optimization.Revert.Snackbar.Error.Title" xml:space="preserve">
+ <value>Couldn't revert optimization</value>
+ </data>
+ <data name="Optimization.Toggle.Snackbar.Error.Title" xml:space="preserve">
+ <value>Couldn't toggle optimization</value>
+ </data>
+ <data name="Optimization.Toggle.Snackbar.Error.Message" xml:space="preserve">
+ <value>An error occurred: {0}</value>
+ </data>
+ <data name="Optimization.Retry.Processing" xml:space="preserve">
+ <value>Retrying failed steps...</value>
+ </data>
+ <data name="Optimization.RetryStep.Processing" xml:space="preserve">
+ <value>Retrying {0} step ({1}/{2} steps)</value>
+ </data>
+ <data name="Optimization.Revert.Error.Failed" xml:space="preserve">
+ <value>Failed to revert {0}.</value>
+ </data>
+ <data name="Dashboard.Header.Menu.Refresh" xml:space="preserve">
+ <value>Refresh</value>
+ </data>
+ <data name="Dashboard.Header.Menu.Header.Options" xml:space="preserve">
+ <value>Options</value>
+ </data>
+ <data name="Dashboard.Header.Menu.Header.Run" xml:space="preserve">
+ <value>Run</value>
+ </data>
+ <data name="Dashboard.Header.Menu.RunSettings" xml:space="preserve">
+ <value>Settings</value>
+ </data>
+ <data name="Dashboard.Header.Menu.RunTaskManager" xml:space="preserve">
+ <value>Task Manager</value>
+ </data>
+ <data name="Dashboard.Header.Menu.RunControlPanel" xml:space="preserve">
+ <value>Control Panel</value>
+ </data>
+ <data name="Common.Unknown" xml:space="preserve">
+ <value>Unknown</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Security" xml:space="preserve">
+ <value>Security</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Performance" xml:space="preserve">
+ <value>Performance</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Latency" xml:space="preserve">
+ <value>Latency</value>
+ </data>
+ <data name="Optimizer.Performance" xml:space="preserve">
+ <value>Performance</value>
+ </data>
+ <data name="Optimizer.PowerManagement" xml:space="preserve">
+ <value>Power Management</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy" xml:space="preserve">
+ <value>Security &amp; Privacy</value>
+ </data>
+ <data name="Optimizer.BloatwareAndServices" xml:space="preserve">
+ <value>Bloatware &amp; Services</value>
+ </data>
+ <data name="Optimizer.Performance.DisableBackgroundApps.Name" xml:space="preserve">
+ <value>Disable Background App Activity</value>
+ </data>
+ <data name="Optimizer.Performance.DisableBackgroundApps.ShortDescription" xml:space="preserve">
+ <value>Blocks supported apps from running in the background, reducing idle RAM/CPU usage and improving responsiveness.</value>
+ </data>
+ <data name="Optimizer.Performance.SvcHostSplit.Name" xml:space="preserve">
+ <value>Enable Service Host Splitting</value>
+ </data>
+ <data name="Optimizer.Performance.SvcHostSplit.Error.InvalidRAM" xml:space="preserve">
+ <value>Invalid RAM: {0}</value>
+ </data>
+ <data name="Optimizer.Performance.ProcessPriority.Name" xml:space="preserve">
+ <value>Enable Foreground Boost</value>
+ </data>
+ <data name="Optimizer.Performance.ProcessPriority.ShortDescription" xml:space="preserve">
+ <value>Tunes Windows scheduler foreground boost so active apps feel snappier and input latency is reduced.</value>
+ </data>
+ <data name="Optimizer.Performance.GameTaskScheduling.Name" xml:space="preserve">
+ <value>Enable Game Task Priority</value>
+ </data>
+ <data name="Optimizer.Performance.GameTaskScheduling.ShortDescription" xml:space="preserve">
+ <value>Adjusts MMCSS “Games” task settings to prioritize game workloads for more consistent frame pacing.</value>
+ </data>
+ <data name="Optimizer.Performance.MultimediaResponsiveness.Name" xml:space="preserve">
+ <value>Optimize MMCSS Responsiveness</value>
+ </data>
+ <data name="Optimizer.Performance.MultimediaResponsiveness.ShortDescription" xml:space="preserve">
+ <value>Reduces latency by tuning SystemProfile responsiveness and disabling network throttling for gaming and AV workloads.</value>
+ </data>
+ <data name="Optimizer.Performance.DisableGameBar.Name" xml:space="preserve">
+ <value>Disable Xbox Game Bar</value>
+ </data>
+ <data name="Optimizer.Performance.DisableGameBar.ShortDescription" xml:space="preserve">
+ <value>Disables Game Bar UI overlays and tips to reduce background overhead and interruptions.</value>
+ </data>
+ <data name="Optimizer.Performance.EnableGameMode.Name" xml:space="preserve">
+ <value>Enable Game Mode</value>
+ </data>
+ <data name="Optimizer.Performance.EnableGameMode.ShortDescription" xml:space="preserve">
+ <value>Enables Game Mode to prioritize gaming performance and limit background activity. (Recommended on Windows 11)</value>
+ </data>
+ <data name="Optimizer.Performance.DisableGameDVR.Name" xml:space="preserve">
+ <value>Disable Game DVR Recording</value>
+ </data>
+ <data name="Optimizer.Performance.DisableGameDVR.ShortDescription" xml:space="preserve">
+ <value>Turns off background game capture/recording features to free resources and reduce latency.</value>
+ </data>
+ <data name="Optimizer.Performance.DisableMouseAcceleration.Name" xml:space="preserve">
+ <value>Disable Mouse Acceleration</value>
+ </data>
+ <data name="Optimizer.Performance.DisableMouseAcceleration.ShortDescription" xml:space="preserve">
+ <value>Disables mouse acceleration for consistent, predictable cursor movement.</value>
+ </data>
+ <data name="Optimizer.Performance.KeyboardLatencyOptimization.Name" xml:space="preserve">
+ <value>Optimize Keyboard Responsiveness</value>
+ </data>
+ <data name="Optimizer.Performance.KeyboardLatencyOptimization.ShortDescription" xml:space="preserve">
+ <value>Tunes keyboard delay/repeat rate and related accessibility flags to improve typing responsiveness.</value>
+ </data>
+ <data name="Optimizer.PowerManagement.DisableHibernate.Name" xml:space="preserve">
+ <value>Disable Hibernate &amp; Fast Startup</value>
+ </data>
+ <data name="Optimizer.PowerManagement.DisableHibernate.ShortDescription" xml:space="preserve">
+ <value>Disables Hibernate and Fast Startup to free disk space and avoid using the hiberfile.</value>
+ </data>
+ <data name="Optimizer.PowerManagement.DisableUSBPowerSaving.Name" xml:space="preserve">
+ <value>Disable USB Power Saving</value>
+ </data>
+ <data name="Optimizer.PowerManagement.DisableUSBPowerSaving.ShortDescription" xml:space="preserve">
+ <value>Prevents USB root hubs from entering power-saving mode to reduce latency. May increase power usage on laptops.</value>
+ </data>
+ <data name="Optimizer.PowerManagement.InstallOptimizerDuckPowerPlan.Name" xml:space="preserve">
+ <value>Install optimizerDuck's Power Plan</value>
+ </data>
+ <data name="Optimizer.PowerManagement.InstallOptimizerDuckPowerPlan.ShortDescription" xml:space="preserve">
+ <value>Downloads, imports, and activates the optimizerDuck power plan to prioritize maximum performance. May increase power use, heat, and fan noise.</value>
+ </data>
+ <data name="Optimizer.PowerManagement.InstallOptimizerDuckPowerPlan.Progress.Downloading" xml:space="preserve">
+ <value>Downloading power plan...</value>
+ </data>
+ <data name="Optimizer.PowerManagement.InstallOptimizerDuckPowerPlan.Progress.Importing" xml:space="preserve">
+ <value>Importing and activating power plan...</value>
+ </data>
+ <data name="Optimizer.PowerManagement.DisablePowerSaving.Name" xml:space="preserve">
+ <value>Disable Power Throttling</value>
+ </data>
+ <data name="Optimizer.PowerManagement.DisablePowerSaving.ShortDescription" xml:space="preserve">
+ <value>Disables power throttling and related power-saving behaviors to keep performance stable under load. May increase power use and temperatures.</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableUAC.Name" xml:space="preserve">
+ <value>Disable UAC Prompts</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableUAC.ShortDescription" xml:space="preserve">
+ <value>Disables UAC (User Account Control) – the mechanism that asks for confirmation when running applications requiring Admin rights. Turning it off may reduce annoyance, but it also weakens important security protections.</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableTelemetry.Name" xml:space="preserve">
+ <value>Reduce Telemetry &amp; Feedback</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableTelemetry.ShortDescription" xml:space="preserve">
+ <value>Reduces Windows diagnostics/telemetry and feedback by applying policies, registry settings, services, and scheduled tasks. May affect error reporting and some compatibility features.</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableTelemetry.Progress.EditRegistry" xml:space="preserve">
+ <value>Applying policy and registry changes...</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableTelemetry.Progress.DisableServices" xml:space="preserve">
+ <value>Disabling telemetry services...</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableTelemetry.Progress.DisableTasks" xml:space="preserve">
+ <value>Disabling scheduled telemetry tasks...</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableAutoLogger.Name" xml:space="preserve">
+ <value>Disable WMI AutoLogger</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableAutoLogger.ShortDescription" xml:space="preserve">
+ <value>Disables multiple WMI AutoLogger sessions to reduce background event logging; can make troubleshooting harder.</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableCortana.Name" xml:space="preserve">
+ <value>Disable Cortana &amp; Web Search</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableCortana.ShortDescription" xml:space="preserve">
+ <value>Removes Cortana and web search integration from Windows Search.</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableCopilot.Name" xml:space="preserve">
+ <value>Disable Windows Copilot</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableCopilot.ShortDescription" xml:space="preserve">
+ <value>Disables Windows Copilot and hides its UI integration in the taskbar and system shell.</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableContentDeliveryManager.Name" xml:space="preserve">
+ <value>Disable Content Delivery</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableContentDeliveryManager.ShortDescription" xml:space="preserve">
+ <value>Stops suggested apps, tips, and Windows content delivery recommendations.</value>
+ </data>
+ <data name="Optimizer.BloatwareAndServices.DisablePreinstalledApps.Name" xml:space="preserve">
+ <value>Block Preinstalled Apps</value>
+ </data>
+ <data name="Optimizer.BloatwareAndServices.DisablePreinstalledApps.ShortDescription" xml:space="preserve">
+ <value>Blocks Windows from automatically installing OEM/bundled apps and suggested apps, helping keep the system cleaner from bloatware (especially after a fresh install or reset).</value>
+ </data>
+ <data name="Optimizer.BloatwareAndServices.ConfigureServices.Name" xml:space="preserve">
+ <value>Optimize Service Startup</value>
+ </data>
+ <data name="Optimizer.BloatwareAndServices.ConfigureServices.ShortDescription" xml:space="preserve">
+ <value>Switches non-critical system services to manual start, reducing background usage without breaking functionality. Required services will start automatically when needed.</value>
+ </data>
+ <data name="Optimizer.BloatwareAndServices.ConfigureServices.Progress.ChangeServiceStartupType" xml:space="preserve">
+ <value>Setting startup type for {0} to {1}...</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Display" xml:space="preserve">
+ <value>Display</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Visual" xml:space="preserve">
+ <value>Visual</value>
+ </data>
+ <data name="Optimizer.Gpu" xml:space="preserve">
+ <value>GPU</value>
+ </data>
+ <data name="Optimizer.UserExperience" xml:space="preserve">
+ <value>User Experience</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisableUlps.Name" xml:space="preserve">
+ <value>Disable AMD ULPS</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisableUlps.ShortDescription" xml:space="preserve">
+ <value>Disables AMD Ultra Low Power State to prevent GPU power-down issues and improve wake-up latency.</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisablePowerGating.Name" xml:space="preserve">
+ <value>Disable AMD Power Gating</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisablePowerGating.ShortDescription" xml:space="preserve">
+ <value>Disables AMD power gating features to maintain consistent GPU performance under load. May increase power draw and temperatures.</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisableVideoClockGating.Name" xml:space="preserve">
+ <value>Disable AMD Video Clock Gating</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisableVideoClockGating.ShortDescription" xml:space="preserve">
+ <value>Disables AMD video engine clock gating to improve video processing performance and stability. May increase power usage.</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisableAspm.Name" xml:space="preserve">
+ <value>Disable AMD ASPM</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisableAspm.ShortDescription" xml:space="preserve">
+ <value>Disables AMD Active State Power Management to reduce latency and improve responsiveness. May increase PCIe power draw.</value>
+ </data>
+ <data name="Optimizer.Gpu.NvidiaDisableDynamicPstate.Name" xml:space="preserve">
+ <value>Disable NVIDIA Dynamic P-State</value>
+ </data>
+ <data name="Optimizer.Gpu.NvidiaDisableDynamicPstate.ShortDescription" xml:space="preserve">
+ <value>Disables NVIDIA dynamic power state transitions to maintain consistent performance. May increase idle power usage.</value>
+ </data>
+ <data name="Optimizer.Gpu.NvidiaDisableAsyncPstates.Name" xml:space="preserve">
+ <value>Disable NVIDIA Async P-States</value>
+ </data>
+ <data name="Optimizer.Gpu.NvidiaDisableAsyncPstates.ShortDescription" xml:space="preserve">
+ <value>Disables NVIDIA asynchronous power state management for more predictable performance. May increase power usage.</value>
+ </data>
+ <data name="Optimizer.Gpu.IntelDisableAsyncFlips.Name" xml:space="preserve">
+ <value>Disable Intel Async Flips</value>
+ </data>
+ <data name="Optimizer.Gpu.IntelDisableAsyncFlips.ShortDescription" xml:space="preserve">
+ <value>Disables Intel asynchronous flip operations to reduce display latency and improve tearing resistance.</value>
+ </data>
+ <data name="Optimizer.Gpu.IntelDisableAdaptiveVsync.Name" xml:space="preserve">
+ <value>Disable Intel Adaptive V-Sync</value>
+ </data>
+ <data name="Optimizer.Gpu.IntelDisableAdaptiveVsync.ShortDescription" xml:space="preserve">
+ <value>Disables Intel adaptive vertical sync to provide more consistent frame timing.</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableTaskbarNewsAndInterests.Name" xml:space="preserve">
+ <value>Disable Taskbar News &amp; Interests</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableTaskbarNewsAndInterests.ShortDescription" xml:space="preserve">
+ <value>Removes the news and interests widget from the taskbar to reduce distractions and resource usage.</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableTaskbarExtraButtons.Name" xml:space="preserve">
+ <value>Disable Extra Taskbar Buttons</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableTaskbarExtraButtons.ShortDescription" xml:space="preserve">
+ <value>Hides Widgets, Chat, and Task View buttons from the taskbar for a cleaner interface.</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableTaskbarSearchAndBing.Name" xml:space="preserve">
+ <value>Disable Taskbar Search &amp; Bing</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableTaskbarSearchAndBing.ShortDescription" xml:space="preserve">
+ <value>Removes the search box from taskbar and disables Bing web search integration.</value>
+ </data>
+ <data name="Optimizer.UserExperience.RemoveMeetNowAndPeople.Name" xml:space="preserve">
+ <value>Remove Meet Now &amp; People</value>
+ </data>
+ <data name="Optimizer.UserExperience.RemoveMeetNowAndPeople.ShortDescription" xml:space="preserve">
+ <value>Removes Meet Now and People icons from the taskbar to reduce clutter.</value>
+ </data>
+ <data name="Optimizer.UserExperience.EnableTaskbarEndTask.Name" xml:space="preserve">
+ <value>Enable Taskbar End Task</value>
+ </data>
+ <data name="Optimizer.UserExperience.EnableTaskbarEndTask.ShortDescription" xml:space="preserve">
+ <value>Adds the ability to right-click taskbar applications and select "End task" for quick process termination.</value>
+ </data>
+ <data name="Optimizer.UserExperience.EnableDarkMode.Name" xml:space="preserve">
+ <value>Enable Dark Mode</value>
+ </data>
+ <data name="Optimizer.UserExperience.EnableDarkMode.ShortDescription" xml:space="preserve">
+ <value>Enables dark mode for system apps and interface elements to reduce eye strain.</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableExplorerAndSystemNotifications.Name" xml:space="preserve">
+ <value>Disable Explorer &amp; System Notifications</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableExplorerAndSystemNotifications.ShortDescription" xml:space="preserve">
+ <value>Disables various system notifications and sync provider notifications to reduce interruptions.</value>
+ </data>
+ <data name="Optimizer.UserExperience.ShowFileExtensionsAndHiddenFiles.Name" xml:space="preserve">
+ <value>Show File Extensions &amp; Hidden Files</value>
+ </data>
+ <data name="Optimizer.UserExperience.ShowFileExtensionsAndHiddenFiles.ShortDescription" xml:space="preserve">
+ <value>Makes file extensions visible and shows hidden system files for better file management.</value>
+ </data>
+ <data name="Optimizer.UserExperience.EnableClassicContextMenu.Name" xml:space="preserve">
+ <value>Enable Classic Context Menu (for Windows 11)</value>
+ </data>
+ <data name="Optimizer.UserExperience.EnableClassicContextMenu.ShortDescription" xml:space="preserve">
+ <value>Restores the classic Windows context menu instead of the modern simplified version.</value>
+ </data>
+ <data name="Optimizer.UserExperience.SpeedUpExplorerAndMenus.Name" xml:space="preserve">
+ <value>Speed Up Explorer &amp; Menus</value>
+ </data>
+ <data name="Optimizer.UserExperience.SpeedUpExplorerAndMenus.ShortDescription" xml:space="preserve">
+ <value>Reduces Explorer startup delay and menu popup delay for faster interface response.</value>
+ </data>
+ <data name="Optimizer.UserExperience.ShowSecondsInSystemClock.Name" xml:space="preserve">
+ <value>Show Seconds in System Clock</value>
+ </data>
+ <data name="Optimizer.UserExperience.ShowSecondsInSystemClock.ShortDescription" xml:space="preserve">
+ <value>Adds seconds display to the system clock in the taskbar for more precise time tracking.</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableVisualEffects.Name" xml:space="preserve">
+ <value>Disable Visual Effects</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableVisualEffects.ShortDescription" xml:space="preserve">
+ <value>Disables taskbar animations, shadows, transparency, and Aero Peek for better performance.</value>
+ </data>
+ <data name="Settings.Optimize.ShellTimeout.Warning" xml:space="preserve">
+ <value>Do NOT change unless you know exactly what you are doing</value>
+ </data>
+ <data name="Optimizer.PowerManagement.InstallOptimizerDuckPowerPlan.Error.DownloadFailed" xml:space="preserve">
+ <value>Failed to download optimizerDuck's power plan.</value>
+ </data>
+ <data name="Settings.About.Acknowledgements.Title" xml:space="preserve">
+ <value>Acknowledgments</value>
+ </data>
+ <data name="Settings.About.Acknowledgements.Description" xml:space="preserve">
+ <value>optimizerDuck is made possible by the following open-source software and resources.</value>
+ </data>
+ <data name="Settings.About.LearnMore.Acknowledgements" xml:space="preserve">
+ <value>Acknowledgments</value>
+ </data>
+ <data name="RestorePoint.Title" xml:space="preserve">
+ <value>System Restore</value>
+ </data>
+ <data name="RestorePointDialog.Description" xml:space="preserve">
+ <value>The Windows operating system includes a feature called Restore Point, which allows you to revert the system to its previous state before applying any changes or optimizations.</value>
+ </data>
+ <data name="RestorePointDialog.Help" xml:space="preserve">
+ <value>When you proceed, the application will automatically activate System Restore (if it is disabled) and create a new restore point with a name starting with "optimizerDuck...", helping safeguard the system before any changes.</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/optimizerDuck/Resources/Languages/Translations.vi-vn.resx b/optimizerDuck/Resources/Languages/Translations.vi-vn.resx
new file mode 100644
index 0000000..26d63d3
--- /dev/null
+++ b/optimizerDuck/Resources/Languages/Translations.vi-vn.resx
@@ -0,0 +1,745 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>1.3</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
+ PublicKeyToken=b77a5c561934e089
+ </value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
+ PublicKeyToken=b77a5c561934e089
+ </value>
+ </resheader>
+ <data name="Dashboard.Header.Title" xml:space="preserve">
+ <value>Dashboard</value>
+ </data>
+ <data name="Sidebar.Dashboard" xml:space="preserve">
+ <value>Dashboard</value>
+ </data>
+ <data name="Sidebar.Settings" xml:space="preserve">
+ <value>Cài đặt</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Cpu.Cores" xml:space="preserve">
+ <value>{0} Nhân</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Storage.DiskInfo" xml:space="preserve">
+ <value>Đã dùng {0} GB trên tổng {1} GB (còn {2} GB trống)</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Ram.Modules" xml:space="preserve">
+ <value>{0} thanh RAM</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Cpu.Threads" xml:space="preserve">
+ <value>{0} Luồng</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Storage.System" xml:space="preserve">
+ <value>HỆ THỐNG</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Storage.Header" xml:space="preserve">
+ <value>Ổ cứng</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Ram.Used" xml:space="preserve">
+ <value>{0} GB đã dùng</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Ram.Available" xml:space="preserve">
+ <value>{0} GB khả dụng</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Loading" xml:space="preserve">
+ <value>Đang lấy thông tin hệ thống...</value>
+ </data>
+ <data name="Sidebar.Optimize" xml:space="preserve">
+ <value>Tối ưu</value>
+ </data>
+ <data name="Dashboard.SystemInfo.Gpu.More" xml:space="preserve">
+ <value>Còn {0} GPU khác</value>
+ </data>
+ <data name="Dashboard.Actions.Discord.Title" xml:space="preserve">
+ <value>Cộng Đồng Discord</value>
+ </data>
+ <data name="Dashboard.Actions.Discord.Description" xml:space="preserve">
+ <value>Tham gia cộng đồng Discord của chúng tôi để... được hỗ trợ hoặc chơi game với tôi</value>
+ </data>
+ <data name="Dashboard.Actions.GitHub.Title" xml:space="preserve">
+ <value>Mã nguồn trên GitHub</value>
+ </data>
+ <data name="Dashboard.Actions.GitHub.Description" xml:space="preserve">
+ <value>Khám phá, theo dõi và đóng góp mã nguồn trực tiếp tại GitHub</value>
+ </data>
+ <data name="Dashboard.Actions.SupportMe.Title" xml:space="preserve">
+ <value>Hỗ Trợ Tôi</value>
+ </data>
+ <data name="Dashboard.Actions.SupportMe.Description" xml:space="preserve">
+ <value>Hỗ trợ tôi để dự án tiếp tục phát triển!</value>
+ </data>
+ <data name="Settings.LanguageChanged.Title" xml:space="preserve">
+ <value>Thay đổi ngôn ngữ</value>
+ </data>
+ <data name="Settings.LanguageChanged.Description" xml:space="preserve">
+ <value>Bạn cần phải khởi động lại ứng dụng để áp dụng ngôn ngữ mới.</value>
+ </data>
+ <data name="Button.Ok" xml:space="preserve">
+ <value>OK</value>
+ </data>
+ <data name="Button.Close" xml:space="preserve">
+ <value>Hủy</value>
+ </data>
+ <data name="Settings.Header.Title" xml:space="preserve">
+ <value>Cài đặt</value>
+ </data>
+ <data name="Settings.Appearance.Header" xml:space="preserve">
+ <value>Giao diện</value>
+ </data>
+ <data name="Settings.Appearance.LanguageSelector.Title" xml:space="preserve">
+ <value>Ngôn ngữ</value>
+ </data>
+ <data name="Settings.Appearance.LanguageSelector.Description" xml:space="preserve">
+ <value>Chọn ngôn ngữ bạn muốn.</value>
+ </data>
+ <data name="Settings.Appearance.ThemeSelector.Title" xml:space="preserve">
+ <value>Chủ đề</value>
+ </data>
+ <data name="Settings.Appearance.ThemeSelector.Description" xml:space="preserve">
+ <value>Chọn giao diện bạn muốn sử dụng.</value>
+ </data>
+ <data name="Settings.Appearance.ThemeSelector.Light" xml:space="preserve">
+ <value>Sáng</value>
+ </data>
+ <data name="Settings.Appearance.ThemeSelector.Dark" xml:space="preserve">
+ <value>Tối</value>
+ </data>
+ <data name="Settings.Appearance.ThemeSelector.HighContrast" xml:space="preserve">
+ <value>Tương phản cao</value>
+ </data>
+ <data name="Common.AppliedYearsAgo" xml:space="preserve">
+ <value>Đã áp dụng {0} năm trước</value>
+ </data>
+ <data name="Common.AppliedSecondsAgo" xml:space="preserve">
+ <value>Đã áp dụng {0} giây trước</value>
+ </data>
+ <data name="Common.AppliedMonthsAgo" xml:space="preserve">
+ <value>Đã áp dụng {0} tháng trước</value>
+ </data>
+ <data name="Common.AppliedMinutesAgo" xml:space="preserve">
+ <value>Đã áp dụng {0} phút trước</value>
+ </data>
+ <data name="Common.AppliedHoursAgo" xml:space="preserve">
+ <value>Đã áp dụng {0} giờ trước</value>
+ </data>
+ <data name="Common.AppliedDaysAgo" xml:space="preserve">
+ <value>Đã áp dụng {0} ngày trước</value>
+ </data>
+ <data name="Optimizer.UI.Risk.Safe" xml:space="preserve">
+ <value>An toàn</value>
+ </data>
+ <data name="Optimizer.UI.Risk.Moderate" xml:space="preserve">
+ <value>Trung bình</value>
+ </data>
+ <data name="Optimizer.UI.Risk.Risky" xml:space="preserve">
+ <value>Nguy hiểm</value>
+ </data>
+ <data name="Button.CopyGuid" xml:space="preserve">
+ <value>Sao Chép GUID</value>
+ </data>
+ <data name="OptimizationDetailsDialog.DetailedDescription" xml:space="preserve">
+ <value>Mô tả chi tiết</value>
+ </data>
+ <data name="OptimizationDetailsDialog.Tags" xml:space="preserve">
+ <value>Thẻ</value>
+ </data>
+ <data name="OptimizationDetailsDialog.Risk" xml:space="preserve">
+ <value>Độ an toàn</value>
+ </data>
+ <data name="OptimizationDetailsDialog.Other" xml:space="preserve">
+ <value>Khác</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Audio" xml:space="preserve">
+ <value>Âm thanh</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Disk" xml:space="preserve">
+ <value>Ổ cứng</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Intel" xml:space="preserve">
+ <value>Intel</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Network" xml:space="preserve">
+ <value>Mạng</value>
+ </data>
+ <data name="Optimizer.UI.Tags.NetworkRequired" xml:space="preserve">
+ <value>Cần kết nối mạng</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Nvidia" xml:space="preserve">
+ <value>NVIDIA</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Power" xml:space="preserve">
+ <value>Công suất/Điện năng</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Privacy" xml:space="preserve">
+ <value>Quyền riêng tư</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Ram" xml:space="preserve">
+ <value>Ram</value>
+ </data>
+ <data name="Optimizer.UI.Tags.System" xml:space="preserve">
+ <value>Hệ thống</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Amd" xml:space="preserve">
+ <value>AMD</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Help" xml:space="preserve">
+ <value>Các thẻ này cho biết tối ưu sẽ ảnh hưởng đến phần nào trong hệ thống.</value>
+ </data>
+ <data name="Optimizer.UI.Risk.Help" xml:space="preserve">
+ <value>Giá trị này thể hiện mức độ can thiệp và mức độ an toàn của quá trình tối ưu hóa. Vui lòng thận trọng và xem xét kỹ lưỡng trước khi áp dụng bất kỳ tối ưu nào.</value>
+ </data>
+ <data name="Revert.Error.InvalidData" xml:space="preserve">
+ <value>Dữ liệu hoàn tác không hợp lệ cho {0}: {1}</value>
+ </data>
+ <data name="Revert.Error.NoDataFound" xml:space="preserve">
+ <value>Không tìm thấy dữ liệu hoàn tác cho {0}.</value>
+ </data>
+ <data name="Optimization.Revert.Reverting" xml:space="preserve">
+ <value>Đang hoàn tác...</value>
+ </data>
+ <data name="Optimization.Revert.Success" xml:space="preserve">
+ <value>Hoàn tác {0} thành công!</value>
+ </data>
+ <data name="Optimization.Revert.Error.FailedWithSteps" xml:space="preserve">
+ <value>Hoàn tác {0} nhưng có {1} bước thất bại.</value>
+ </data>
+ <data name="Revert.Error.RevertFailed" xml:space="preserve">
+ <value>Không thể hoàn tác {0}: {1}</value>
+ </data>
+ <data name="Optimization.Revert.ExecutingStep" xml:space="preserve">
+ <value>Đang thực hiện bước hoàn tác: {0}/{1} ({2})</value>
+ </data>
+ <data name="Revert.Error.FileNotFound" xml:space="preserve">
+ <value>Không tìm thấy tệp hoàn tác</value>
+ </data>
+ <data name="Revert.Error.FileEmpty" xml:space="preserve">
+ <value>Tệp hoàn tác trống</value>
+ </data>
+ <data name="Revert.Error.ReadFailed" xml:space="preserve">
+ <value>Không thể đọc dữ liệu hoàn tác: {0}</value>
+ </data>
+ <data name="Revert.Error.InvalidJson" xml:space="preserve">
+ <value>Dữ liệu hoàn tác không hợp lệ</value>
+ </data>
+ <data name="Revert.Error.InvalidJsonFormat" xml:space="preserve">
+ <value>Định dạng JSON không hợp lệ: {0}</value>
+ </data>
+ <data name="Revert.Error.NoSteps" xml:space="preserve">
+ <value>Không có bước hoàn tác.</value>
+ </data>
+ <data name="Revert.Error.InvalidSteps" xml:space="preserve">
+ <value>Các bước hoàn tác không hợp lệ: {0}</value>
+ </data>
+ <data name="Revert.Error.OptimizationIdMismatch" xml:space="preserve">
+ <value>OptimizationId không khớp.</value>
+ </data>
+ <data name="Optimization.Apply.Processing" xml:space="preserve">
+ <value>Đang áp dụng...</value>
+ </data>
+ <data name="Optimization.Apply.Completed" xml:space="preserve">
+ <value>Hoàn tất</value>
+ </data>
+ <data name="Optimization.Apply.Success" xml:space="preserve">
+ <value>Áp dụng {0} thành công.</value>
+ </data>
+ <data name="Optimization.Apply.Error.FailedWithSteps" xml:space="preserve">
+ <value>Đã áp dụng {0} nhưng có {1} bước bị lỗi.</value>
+ </data>
+ <data name="Optimization.Apply.Error.Failed" xml:space="preserve">
+ <value>Không thể áp dụng {0}.</value>
+ </data>
+ <data name="Service.Common.Error.AccessDenied" xml:space="preserve">
+ <value>Không có quyền truy cập</value>
+ </data>
+ <data name="Service.Registry.Error.AccessDeniedProtectedHive" xml:space="preserve">
+ <value>Bị từ chối truy cập (registry được bảo vệ)</value>
+ </data>
+ <data name="Service.Registry.Error.UnauthorizedAccess" xml:space="preserve">
+ <value>Không có quyền truy cập</value>
+ </data>
+ <data name="Service.Registry.Error.CreateOrOpenSubkeyFailed" xml:space="preserve">
+ <value>Không thể tạo/mở khóa con (subkey)</value>
+ </data>
+ <data name="Service.Service.Error.NotFound" xml:space="preserve">
+ <value>Không tìm thấy dịch vụ</value>
+ </data>
+ <data name="Service.Service.Error.UpdateRegistryForStartupTypeFailed" xml:space="preserve">
+ <value>Không thể cập nhật registry cho kiểu khởi động</value>
+ </data>
+ <data name="Service.Service.Error.ChangeStartModeFailedWithCode" xml:space="preserve">
+ <value>ChangeStartMode thất bại (mã: {0})</value>
+ </data>
+ <data name="Service.Shell.Error.ExitCode" xml:space="preserve">
+ <value>Mã thoát {0}</value>
+ </data>
+ <data name="Service.Shell.Error.TimedOut" xml:space="preserve">
+ <value>Hết thời gian chờ</value>
+ </data>
+ <data name="OptimizationDetailsDialog.Other.OpenRevertFile.Title" xml:space="preserve">
+ <value>Tệp hoàn tác</value>
+ </data>
+ <data name="OptimizationDetailsDialog.Other.OpenRevertFile.Description" xml:space="preserve">
+ <value>Mở thư mục và chọn tệp dữ liệu hoàn tác của tối ưu này.</value>
+ </data>
+ <data name="OptimizationResultDialog.Header" xml:space="preserve">
+ <value>{0} Bước bị lỗi</value>
+ </data>
+ <data name="OptimizationResultDialog.Description" xml:space="preserve">
+ <value>Một số bước chưa hoàn tất thành công. Bạn có thể thử lại chỉ những bước bị lỗi.</value>
+ </data>
+ <data name="Button.Retry" xml:space="preserve">
+ <value>Thử lại</value>
+ </data>
+ <data name="Settings.About.Duck.Description" xml:space="preserve">
+ <value>Cảm ơn bạn đã tin tưởng và ủng hộ &lt;3! Phiên bản hiện tại: {0}</value>
+ </data>
+ <data name="Settings.Advanced.Header" xml:space="preserve">
+ <value>Nâng cao</value>
+ </data>
+ <data name="Settings.Optimize.Header" xml:space="preserve">
+ <value>Tối ưu</value>
+ </data>
+ <data name="Settings.Optimize.ShellTimeout.Title" xml:space="preserve">
+ <value>Thời gian chờ dịch vụ shell</value>
+ </data>
+ <data name="Settings.Optimize.ShellTimeout.Description" xml:space="preserve">
+ <value>Thời gian chờ cho mỗi lệnh shell (tính bằng mili‑giây).</value>
+ </data>
+ <data name="Settings.Advanced.ClearResources.Title" xml:space="preserve">
+ <value>Dọn dẹp tài nguyên</value>
+ </data>
+ <data name="Settings.Advanced.ClearResources.Description" xml:space="preserve">
+ <value>Xóa tất cả tệp đã tải về trong quá trình tối ưu.</value>
+ </data>
+ <data name="Settings.Advanced.ClearRevertDatas.Title" xml:space="preserve">
+ <value>Xóa toàn bộ dữ liệu hoàn tác</value>
+ </data>
+ <data name="Settings.Advanced.ClearRevertDatas.Description" xml:space="preserve">
+ <value>Xóa toàn bộ các dữ liệu hoàn tác của các tối ưu.</value>
+ </data>
+ <data name="Button.Clear" xml:space="preserve">
+ <value>Xóa</value>
+ </data>
+ <data name="Settings.Advanced.OpenRootDir.Title" xml:space="preserve">
+ <value>Mở thư mục root</value>
+ </data>
+ <data name="Settings.Advanced.OpenRootDir.Description" xml:space="preserve">
+ <value>Mở thư mục gốc của ứng dụng, nơi chứa tất cả các tệp cần thiết.</value>
+ </data>
+ <data name="Button.Open" xml:space="preserve">
+ <value>Mở</value>
+ </data>
+ <data name="Settings.About.Header" xml:space="preserve">
+ <value>Giới thiệu</value>
+ </data>
+ <data name="Settings.About.LearnMore" xml:space="preserve">
+ <value>Tìm hiểu thêm</value>
+ </data>
+ <data name="Settings.About.LearnMore.Documentation" xml:space="preserve">
+ <value>Tài liệu hướng dẫn</value>
+ </data>
+ <data name="Settings.About.LearnMore.Support" xml:space="preserve">
+ <value>Hỗ trợ tôi</value>
+ </data>
+ <data name="Settings.About.LearnMore.Discord" xml:space="preserve">
+ <value>Cộng đồng Discord</value>
+ </data>
+ <data name="Settings.About.LearnMore.GitHub" xml:space="preserve">
+ <value>Mã nguồn trên GitHub</value>
+ </data>
+ <data name="Dialog.AreYouSure.Title" xml:space="preserve">
+ <value>Bạn có chắc chắn muốn tiếp tục không?</value>
+ </data>
+ <data name="Settings.ClearResources.Description" xml:space="preserve">
+ <value>Bạn sắp xóa tất cả các tài nguyên đã được tải xuống hoặc tạo ra trong quá trình tối ưu. Xin lưu ý rằng hành động này là vĩnh viễn và không thể hoàn tác, vì vậy hãy chắc chắn trước khi tiếp tục.</value>
+ </data>
+ <data name="Button.Cancel" xml:space="preserve">
+ <value>Hủy</value>
+ </data>
+ <data name="Settings.ClearRevertData.Description" xml:space="preserve">
+ <value>Bạn chuẩn bị xóa tất cả dữ liệu hoàn tác được tạo sau quá trình tối ưu. Việc này đồng nghĩa với việc bạn sẽ không thể khôi phục lại trạng thái trước tối ưu, vì vậy hãy cân nhắc thật kỹ trước khi xác nhận.</value>
+ </data>
+ <data name="ProcessingOptimizationDialog.Warning.DontCloseAppOrRestart" xml:space="preserve">
+ <value>Vui lòng không tắt ứng dụng hoặc tắt máy trong khi đang áp dụng hoặc hoàn tác các thay đổi hệ thống.</value>
+ </data>
+ <data name="Optimization.Apply.Snackbar.Error.Title" xml:space="preserve">
+ <value>Đã xảy ra lỗi sau khi áp dụng.</value>
+ </data>
+ <data name="Common.AppliedJustNow" xml:space="preserve">
+ <value>Vừa áp dụng</value>
+ </data>
+ <data name="Optimization.Revert.Snackbar.Error.Title" xml:space="preserve">
+ <value>Đã xảy ra lỗi sau khi hoàn tác</value>
+ </data>
+ <data name="Optimization.Toggle.Snackbar.Error.Title" xml:space="preserve">
+ <value>Không thể áp dụng/hoàn tác tối ưu</value>
+ </data>
+ <data name="Optimization.Retry.Processing" xml:space="preserve">
+ <value>Đang thử lại các bước thất bại...</value>
+ </data>
+ <data name="Optimization.RetryStep.Processing" xml:space="preserve">
+ <value>Đang thử lại bước {0} ({1}/ {2} bước)</value>
+ </data>
+ <data name="Optimization.Toggle.Snackbar.Error.Message" xml:space="preserve">
+ <value>Đã xảy ra lỗi: {0}</value>
+ </data>
+ <data name="Optimization.Revert.Error.Failed" xml:space="preserve">
+ <value>Không thể hoàn tác {0}.</value>
+ </data>
+ <data name="Dashboard.Header.Menu.Refresh" xml:space="preserve">
+ <value>Làm mới</value>
+ </data>
+ <data name="Dashboard.Header.Menu.Header.Options" xml:space="preserve">
+ <value>Tùy chọn</value>
+ </data>
+ <data name="Dashboard.Header.Menu.Header.Run" xml:space="preserve">
+ <value>Mở</value>
+ </data>
+ <data name="Dashboard.Header.Menu.RunSettings" xml:space="preserve">
+ <value>Cài đặt</value>
+ </data>
+ <data name="Dashboard.Header.Menu.RunTaskManager" xml:space="preserve">
+ <value>Task Manager</value>
+ </data>
+ <data name="Dashboard.Header.Menu.RunControlPanel" xml:space="preserve">
+ <value>Control Panel</value>
+ </data>
+ <data name="Common.Unknown" xml:space="preserve">
+ <value>Không rõ</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Security" xml:space="preserve">
+ <value>Bảo mật</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Performance" xml:space="preserve">
+ <value>Hiệu suất</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Latency" xml:space="preserve">
+ <value>Độ trễ</value>
+ </data>
+ <data name="Optimizer.Performance" xml:space="preserve">
+ <value>Hiệu suất</value>
+ </data>
+ <data name="Optimizer.PowerManagement" xml:space="preserve">
+ <value>Quản lý điện năng</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy" xml:space="preserve">
+ <value>Bảo mật &amp; Quyền riêng tư</value>
+ </data>
+ <data name="Optimizer.BloatwareAndServices" xml:space="preserve">
+ <value>Bloatware &amp; Dịch vụ</value>
+ </data>
+ <data name="Optimizer.Performance.DisableBackgroundApps.Name" xml:space="preserve">
+ <value>Tắt Background Apps</value>
+ </data>
+ <data name="Optimizer.Performance.DisableBackgroundApps.ShortDescription" xml:space="preserve">
+ <value>Chặn các ứng dụng được hỗ trợ chạy nền, giúp giảm mức sử dụng RAM/CPU và cải thiện độ phản hồi.</value>
+ </data>
+ <data name="Optimizer.Performance.SvcHostSplit.Name" xml:space="preserve">
+ <value>Bật Chia Service Host</value>
+ </data>
+ <data name="Optimizer.Performance.SvcHostSplit.Error.InvalidRAM" xml:space="preserve">
+ <value>RAM không hợp lệ: {0}</value>
+ </data>
+ <data name="Optimizer.Performance.ProcessPriority.Name" xml:space="preserve">
+ <value>Bật Foreground Boost</value>
+ </data>
+ <data name="Optimizer.Performance.ProcessPriority.ShortDescription" xml:space="preserve">
+ <value>Tinh chỉnh scheduler để app ở foreground được ưu tiên hơn, giúp phản hồi mượt và giảm input lag khi chơi game/làm việc nặng.</value>
+ </data>
+ <data name="Optimizer.Performance.GameTaskScheduling.Name" xml:space="preserve">
+ <value>Bật Ưu Tiên Game</value>
+ </data>
+ <data name="Optimizer.Performance.GameTaskScheduling.ShortDescription" xml:space="preserve">
+ <value>Tinh chỉnh MMCSS “Games” để ưu tiên workload game, hướng tới frame pacing ổn định và giảm stutter.</value>
+ </data>
+ <data name="Optimizer.Performance.MultimediaResponsiveness.Name" xml:space="preserve">
+ <value>Tối Ưu MMCSS Responsiveness</value>
+ </data>
+ <data name="Optimizer.Performance.MultimediaResponsiveness.ShortDescription" xml:space="preserve">
+ <value>Tinh chỉnh SystemProfile responsiveness và tắt Network Throttling để ưu tiên độ trễ thấp cho game và audio/video realtime.</value>
+ </data>
+ <data name="Optimizer.Performance.DisableGameBar.Name" xml:space="preserve">
+ <value>Tắt Xbox Game Bar</value>
+ </data>
+ <data name="Optimizer.Performance.DisableGameBar.ShortDescription" xml:space="preserve">
+ <value>Tắt lớp phủ/mẹo của Xbox Game Bar để giảm gánh nặng xử lý nền và tránh cửa sổ bật lên. Bạn sẽ không dùng được lớp phủ/phím tắt của Game Bar.</value>
+ </data>
+ <data name="Optimizer.Performance.EnableGameMode.Name" xml:space="preserve">
+ <value>Bật Chế Độ Trò Chơi</value>
+ </data>
+ <data name="Optimizer.Performance.EnableGameMode.ShortDescription" xml:space="preserve">
+ <value>Bật Chế độ Trò chơi (Game Mode) để ưu tiên hiệu năng chơi game và hạn chế hoạt động nền. (Khuyến nghị trên Windows 11)</value>
+ </data>
+ <data name="Optimizer.Performance.DisableGameDVR.Name" xml:space="preserve">
+ <value>Tắt Game DVR Recording</value>
+ </data>
+ <data name="Optimizer.Performance.DisableGameDVR.ShortDescription" xml:space="preserve">
+ <value>Tắt Game DVR/Background Capture để giảm tài nguyên và giảm latency. Bạn sẽ không dùng được tính năng ghi hình/ghi clip chạy nền.</value>
+ </data>
+ <data name="Optimizer.Performance.DisableMouseAcceleration.Name" xml:space="preserve">
+ <value>Tắt Gia Tốc Chuột</value>
+ </data>
+ <data name="Optimizer.Performance.DisableMouseAcceleration.ShortDescription" xml:space="preserve">
+ <value>Tắt tăng tốc chuột để con trỏ di chuyển ổn định và dễ dự đoán.</value>
+ </data>
+ <data name="Optimizer.Performance.KeyboardLatencyOptimization.Name" xml:space="preserve">
+ <value>Tối Ưu Phản Hồi Bàn Phím</value>
+ </data>
+ <data name="Optimizer.Performance.KeyboardLatencyOptimization.ShortDescription" xml:space="preserve">
+ <value>Tinh chỉnh Keyboard Delay/Repeat Rate và một số tuỳ chọn Accessibility để cảm giác gõ/phím phản hồi nhanh hơn.</value>
+ </data>
+ <data name="Optimizer.PowerManagement.DisableHibernate.Name" xml:space="preserve">
+ <value>Tắt Hibernate &amp; Fast Startup</value>
+ </data>
+ <data name="Optimizer.PowerManagement.DisableHibernate.ShortDescription" xml:space="preserve">
+ <value>Tắt Hibernate và Fast Startup để giải phóng dung lượng (hiberfile) và tránh một số lỗi shutdown/boot liên quan Fast Startup.</value>
+ </data>
+ <data name="Optimizer.PowerManagement.DisableUSBPowerSaving.Name" xml:space="preserve">
+ <value>Tắt Tiết Kiệm Điện USB</value>
+ </data>
+ <data name="Optimizer.PowerManagement.DisableUSBPowerSaving.ShortDescription" xml:space="preserve">
+ <value>Ngăn USB Root Hub chuyển sang power saving để giảm độ trễ. Có thể tăng tiêu thụ điện (đặc biệt trên laptop).</value>
+ </data>
+ <data name="Optimizer.PowerManagement.InstallOptimizerDuckPowerPlan.Name" xml:space="preserve">
+ <value>Cài Đặt Power Plan của optimizerDuck</value>
+ </data>
+ <data name="Optimizer.PowerManagement.InstallOptimizerDuckPowerPlan.ShortDescription" xml:space="preserve">
+ <value>Tải và import power plan của optimizerDuck, sau đó sử dụng để ưu tiên hiệu năng tối đa. Có thể tăng điện năng, nhiệt độ và tiếng quạt.</value>
+ </data>
+ <data name="Optimizer.PowerManagement.InstallOptimizerDuckPowerPlan.Progress.Downloading" xml:space="preserve">
+ <value>Đang tải power plan...</value>
+ </data>
+ <data name="Optimizer.PowerManagement.InstallOptimizerDuckPowerPlan.Progress.Importing" xml:space="preserve">
+ <value>Đang import và set active power plan...</value>
+ </data>
+ <data name="Optimizer.PowerManagement.DisablePowerSaving.Name" xml:space="preserve">
+ <value>Tắt Power Throttling</value>
+ </data>
+ <data name="Optimizer.PowerManagement.DisablePowerSaving.ShortDescription" xml:space="preserve">
+ <value>Tắt Power Throttling và một số thiết lập power saving để giữ hiệu năng ổn định khi tải nặng. Có thể tăng điện năng và nhiệt độ.</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableUAC.Name" xml:space="preserve">
+ <value>Tắt Prompt UAC</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableUAC.ShortDescription" xml:space="preserve">
+ <value>Tắt UAC (User Account Control) – cơ chế yêu cầu bạn xác nhận khi chạy ứng dụng cần quyền Admin. Việc tắt có thể giảm sự phiền phức, nhưng đồng thời làm suy yếu các cơ chế bảo vệ bảo mật quan trọng.</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableTelemetry.Name" xml:space="preserve">
+ <value>Giảm Telemetry &amp; Feedback</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableTelemetry.ShortDescription" xml:space="preserve">
+ <value>Giảm Diagnostics/Telemetry và Feedback bằng cách áp dụng các chính sách, thiết lập registry, dịch vụ và tác vụ theo lịch. Có thể ảnh hưởng báo cáo lỗi và một số tính năng tương thích.</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableTelemetry.Progress.EditRegistry" xml:space="preserve">
+ <value>Đang áp dụng các chính sách và registry...</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableTelemetry.Progress.DisableServices" xml:space="preserve">
+ <value>Đang tắt các dịch vụ telemetry...</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableTelemetry.Progress.DisableTasks" xml:space="preserve">
+ <value>Đang tắt các tác vụ telemetry theo lịch trình…</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableAutoLogger.Name" xml:space="preserve">
+ <value>Tắt WMI AutoLogger</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableAutoLogger.ShortDescription" xml:space="preserve">
+ <value>Tắt một số WMI AutoLogger session để giảm background logging; có thể làm khó chẩn đoán lỗi.</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableCortana.Name" xml:space="preserve">
+ <value>Tắt Cortana &amp; Web Search</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableCortana.ShortDescription" xml:space="preserve">
+ <value>Gỡ bỏ Cortana và tích hợp tìm kiếm web khỏi Windows Search.</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableCopilot.Name" xml:space="preserve">
+ <value>Tắt Windows Copilot</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableCopilot.ShortDescription" xml:space="preserve">
+ <value>Vô hiệu hóa Windows Copilot và ẩn tích hợp giao diện của nó trong thanh taskbar và hệ thống shell.</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableContentDeliveryManager.Name" xml:space="preserve">
+ <value>Tắt Content Delivery</value>
+ </data>
+ <data name="Optimizer.SecurityAndPrivacy.DisableContentDeliveryManager.ShortDescription" xml:space="preserve">
+ <value>Tắt Content Delivery để hạn chế Suggested apps, tips và nội dung đề xuất trong Windows.</value>
+ </data>
+ <data name="Optimizer.BloatwareAndServices.DisablePreinstalledApps.Name" xml:space="preserve">
+ <value>Chặn Ứng Dụng Cài Sẵn</value>
+ </data>
+ <data name="Optimizer.BloatwareAndServices.DisablePreinstalledApps.ShortDescription" xml:space="preserve">
+ <value>Chặn Windows tự động cài app OEM/bundled và “suggested apps”, giúp máy sạch bloatware hơn (đặc biệt sau cài mới/reset).</value>
+ </data>
+ <data name="Optimizer.BloatwareAndServices.ConfigureServices.Name" xml:space="preserve">
+ <value>Tối Ưu Khởi Động Dịch Vụ</value>
+ </data>
+ <data name="Optimizer.BloatwareAndServices.ConfigureServices.ShortDescription" xml:space="preserve">
+ <value>Chuyển các dịch vụ hệ thống không quan trọng sang chế độ khởi động thủ công, giúp giảm tài nguyên chạy nền mà không ảnh hưởng đến chức năng. Các dịch vụ cần thiết sẽ tự động khởi động khi được yêu cầu.</value>
+ </data>
+ <data name="Optimizer.BloatwareAndServices.ConfigureServices.Progress.ChangeServiceStartupType" xml:space="preserve">
+ <value>Đang đặt kiểu khởi động cho dịch vụ {0} thành {1}...</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Display" xml:space="preserve">
+ <value>Màn hình</value>
+ </data>
+ <data name="Optimizer.UI.Tags.Visual" xml:space="preserve">
+ <value>Giao diện</value>
+ </data>
+ <data name="Optimizer.Gpu" xml:space="preserve">
+ <value>GPU</value>
+ </data>
+ <data name="Optimizer.UserExperience" xml:space="preserve">
+ <value>Trải nghiệm người dùng</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisableUlps.Name" xml:space="preserve">
+ <value>Tắt AMD ULPS</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisableUlps.ShortDescription" xml:space="preserve">
+ <value>Tắt Chế độ Siêu Tiết kiệm Điện của AMD để tránh các vấn đề về giảm hiệu năng GPU và cải thiện độ trễ khi thức dậy.</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisablePowerGating.Name" xml:space="preserve">
+ <value>Tắt Power Gating của AMD</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisablePowerGating.ShortDescription" xml:space="preserve">
+ <value>Tắt các tính năng power gating của AMD để duy trì hiệu suất GPU ổn định dưới tải nặng. Có thể tăng điện năng và nhiệt độ.</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisableVideoClockGating.Name" xml:space="preserve">
+ <value>Tắt Video Clock Gating của AMD</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisableVideoClockGating.ShortDescription" xml:space="preserve">
+ <value>Tắt clock gating của engine video AMD để cải thiện hiệu suất xử lý video và độ ổn định. Có thể tăng điện năng.</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisableAspm.Name" xml:space="preserve">
+ <value>Tắt ASPM của AMD</value>
+ </data>
+ <data name="Optimizer.Gpu.AmdDisableAspm.ShortDescription" xml:space="preserve">
+ <value>Tắt Quản lý Năng lượng Trạng thái Chủ động của AMD để giảm độ trễ và cải thiện độ phản hồi. Có thể tăng điện năng PCIe.</value>
+ </data>
+ <data name="Optimizer.Gpu.NvidiaDisableDynamicPstate.Name" xml:space="preserve">
+ <value>Tắt Dynamic P-State của NVIDIA</value>
+ </data>
+ <data name="Optimizer.Gpu.NvidiaDisableDynamicPstate.ShortDescription" xml:space="preserve">
+ <value>Tắt các chuyển đổi trạng thái năng lượng động của NVIDIA để duy trì hiệu suất nhất quán. Có thể tăng điện năng khi nhàn rỗi.</value>
+ </data>
+ <data name="Optimizer.Gpu.NvidiaDisableAsyncPstates.Name" xml:space="preserve">
+ <value>Tắt Async P-States của NVIDIA</value>
+ </data>
+ <data name="Optimizer.Gpu.NvidiaDisableAsyncPstates.ShortDescription" xml:space="preserve">
+ <value>Tắt quản lý trạng thái năng lượng không đồng bộ của NVIDIA để có hiệu suất dễ dự đoán hơn. Có thể tăng điện năng.</value>
+ </data>
+ <data name="Optimizer.Gpu.IntelDisableAsyncFlips.Name" xml:space="preserve">
+ <value>Tắt Async Flips của Intel</value>
+ </data>
+ <data name="Optimizer.Gpu.IntelDisableAsyncFlips.ShortDescription" xml:space="preserve">
+ <value>Tắt các thao tác lật không đồng bộ của Intel để giảm độ trễ hiển thị và cải thiện khả năng chống xé hình.</value>
+ </data>
+ <data name="Optimizer.Gpu.IntelDisableAdaptiveVsync.Name" xml:space="preserve">
+ <value>Tắt Adaptive V-Sync của Intel</value>
+ </data>
+ <data name="Optimizer.Gpu.IntelDisableAdaptiveVsync.ShortDescription" xml:space="preserve">
+ <value>Tắt vertical sync thích ứng của Intel để cung cấp thời gian khung hình nhất quán hơn.</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableTaskbarNewsAndInterests.Name" xml:space="preserve">
+ <value>Tắt Tin tức &amp; Sở thích trên Taskbar</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableTaskbarNewsAndInterests.ShortDescription" xml:space="preserve">
+ <value>Xóa widget tin tức và sở thích khỏi taskbar để giảm sự xao nhãng và sử dụng tài nguyên.</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableTaskbarExtraButtons.Name" xml:space="preserve">
+ <value>Tắt các nút bổ sung trên Taskbar</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableTaskbarExtraButtons.ShortDescription" xml:space="preserve">
+ <value>Ẩn các nút Widgets, Chat và Task View khỏi taskbar để có giao diện sạch sẽ hơn.</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableTaskbarSearchAndBing.Name" xml:space="preserve">
+ <value>Tắt Tìm kiếm &amp; Bing trên Taskbar</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableTaskbarSearchAndBing.ShortDescription" xml:space="preserve">
+ <value>Xóa hộp tìm kiếm khỏi taskbar và tắt tích hợp tìm kiếm web Bing.</value>
+ </data>
+ <data name="Optimizer.UserExperience.RemoveMeetNowAndPeople.Name" xml:space="preserve">
+ <value>Xóa Meet Now &amp; People</value>
+ </data>
+ <data name="Optimizer.UserExperience.RemoveMeetNowAndPeople.ShortDescription" xml:space="preserve">
+ <value>Xóa các biểu tượng Meet Now và People khỏi taskbar để giảm sự lộn xộn.</value>
+ </data>
+ <data name="Optimizer.UserExperience.EnableTaskbarEndTask.Name" xml:space="preserve">
+ <value>Bật End Task trên Taskbar</value>
+ </data>
+ <data name="Optimizer.UserExperience.EnableTaskbarEndTask.ShortDescription" xml:space="preserve">
+ <value>Thêm khả năng chuột phải vào ứng dụng taskbar và chọn "End task" để kết thúc tiến trình nhanh chóng.</value>
+ </data>
+ <data name="Optimizer.UserExperience.EnableDarkMode.Name" xml:space="preserve">
+ <value>Bật Chế độ Tối</value>
+ </data>
+ <data name="Optimizer.UserExperience.EnableDarkMode.ShortDescription" xml:space="preserve">
+ <value>Bật chế độ tối cho các ứng dụng hệ thống và thành phần giao diện để giảm mỏi mắt.</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableExplorerAndSystemNotifications.Name" xml:space="preserve">
+ <value>Tắt Thông báo Explorer &amp; Hệ thống</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableExplorerAndSystemNotifications.ShortDescription" xml:space="preserve">
+ <value>Tắt nhiều thông báo hệ thống và thông báo nhà cung cấp đồng bộ hóa để giảm sự gián đoạn.</value>
+ </data>
+ <data name="Optimizer.UserExperience.ShowFileExtensionsAndHiddenFiles.Name" xml:space="preserve">
+ <value>Hiển thị Phần mở rộng &amp; Tệp ẩn</value>
+ </data>
+ <data name="Optimizer.UserExperience.ShowFileExtensionsAndHiddenFiles.ShortDescription" xml:space="preserve">
+ <value>Hiển thị phần mở rộng tệp và các tệp hệ thống ẩn để quản lý tệp tốt hơn.</value>
+ </data>
+ <data name="Optimizer.UserExperience.EnableClassicContextMenu.Name" xml:space="preserve">
+ <value>Bật Menu chuột phải Cổ điển (cho Windows 11)</value>
+ </data>
+ <data name="Optimizer.UserExperience.EnableClassicContextMenu.ShortDescription" xml:space="preserve">
+ <value>Khôi phục menu chuột phải cổ điển của Windows thay vì phiên bản hiện đại đơn giản hóa.</value>
+ </data>
+ <data name="Optimizer.UserExperience.SpeedUpExplorerAndMenus.Name" xml:space="preserve">
+ <value>Tăng tốc Explorer &amp; Menu</value>
+ </data>
+ <data name="Optimizer.UserExperience.SpeedUpExplorerAndMenus.ShortDescription" xml:space="preserve">
+ <value>Giảm độ trễ khởi động Explorer và độ trễ hiển thị menu để phản hồi giao diện nhanh hơn.</value>
+ </data>
+ <data name="Optimizer.UserExperience.ShowSecondsInSystemClock.Name" xml:space="preserve">
+ <value>Hiển thị Giây trên Đồng hồ Hệ thống</value>
+ </data>
+ <data name="Optimizer.UserExperience.ShowSecondsInSystemClock.ShortDescription" xml:space="preserve">
+ <value>Thêm hiển thị giây vào đồng hồ hệ thống trên taskbar để theo dõi thời gian chính xác hơn.</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableVisualEffects.Name" xml:space="preserve">
+ <value>Tắt Hiệu ứng Trực quan</value>
+ </data>
+ <data name="Optimizer.UserExperience.DisableVisualEffects.ShortDescription" xml:space="preserve">
+ <value>Tắt hoạt ảnh taskbar, bóng đổ, độ trong suốt và Aero Peek để có hiệu suất tốt hơn.</value>
+ </data>
+ <data name="Settings.Optimize.ShellTimeout.Warning" xml:space="preserve">
+ <value>Đừng thay đổi nếu bạn không thực sự biết mình đang làm gì</value>
+ </data>
+ <data name="Optimizer.PowerManagement.InstallOptimizerDuckPowerPlan.Error.DownloadFailed" xml:space="preserve">
+ <value>Không thể tải power plan của optimizerDuck.</value>
+ </data>
+ <data name="Settings.About.Acknowledgements.Title" xml:space="preserve">
+ <value>Ghi nhận (Acknowledgments)</value>
+ </data>
+ <data name="Settings.About.Acknowledgements.Description" xml:space="preserve">
+ <value>optimizerDuck được xây dựng nhờ các phần mềm và tài nguyên nguồn mở.</value>
+ </data>
+ <data name="Settings.About.LearnMore.Acknowledgements" xml:space="preserve">
+ <value>Ghi nhận (Acknowledgments)</value>
+ </data>
+ <data name="RestorePoint.Title" xml:space="preserve">
+ <value>Phục hồi hệ thống</value>
+ </data>
+ <data name="RestorePointDialog.Description" xml:space="preserve">
+ <value>Hệ điều hành Windows tích hợp một tính năng gọi là Restore Point. Nhờ đó, bạn có thể dễ dàng đưa hệ thống trở về trạng thái trước khi thực hiện bất kỳ thay đổi hay tối ưu nào, giúp hạn chế rủi ro và đảm bảo an toàn cho máy tính.</value>
+ </data>
+ <data name="RestorePointDialog.Help" xml:space="preserve">
+ <value>Khi bạn tiếp tục, ứng dụng sẽ tự động kích hoạt System Restore (nếu đang tắt) và tạo một điểm khôi phục mới với tên bắt đầu bằng "optimizerDuck...", giúp bảo vệ hệ thống trước mọi thay đổi.</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/optimizerDuck/Services/Managers/ConfigManager.cs b/optimizerDuck/Services/Managers/ConfigManager.cs
new file mode 100644
index 0000000..6388da7
--- /dev/null
+++ b/optimizerDuck/Services/Managers/ConfigManager.cs
@@ -0,0 +1,168 @@
+using System.IO;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using optimizerDuck.Common.Helpers;
+
+namespace optimizerDuck.Services.Managers;
+
+public class ConfigManager(IConfiguration configuration, ILogger<ConfigManager> logger)
+{
+ private readonly string _configPath = Path.Combine(Shared.RootDirectory, "appsettings.json");
+ private readonly SemaphoreSlim _lock = new(1, 1);
+ private JObject _cache = new();
+
+ public async Task InitializeAsync()
+ {
+ _cache = await LoadConfigAsync();
+ }
+
+
+ public async Task SetAsync(string key, string value)
+ {
+ await _lock.WaitAsync();
+ try
+ {
+ var parts = key.Split(':');
+ var current = _cache;
+
+ for (var i = 0; i < parts.Length - 1; i++)
+ current = GetOrCreateObjectIgnoreCase(current, parts[i]);
+
+ SetValueIgnoreCase(current, parts[^1], value);
+ await SaveConfigAsync();
+ }
+ finally
+ {
+ _lock.Release();
+ }
+ }
+
+ public void Remove(string key)
+ {
+ var parts = key.Split(':');
+ var current = _cache;
+
+ for (var i = 0; i < parts.Length - 1; i++)
+ {
+ var next = GetTokenIgnoreCase(current, parts[i]);
+ if (next is not JObject nextObj) return;
+ current = nextObj;
+ }
+
+ RemoveIgnoreCase(current, parts[^1]);
+ _ = SaveConfigAsync();
+ }
+
+ private async Task<JObject> LoadConfigAsync()
+ {
+ try
+ {
+ Directory.CreateDirectory(Path.GetDirectoryName(_configPath)!);
+
+ if (!File.Exists(_configPath))
+ return new JObject();
+
+ var content = await File.ReadAllTextAsync(_configPath);
+
+ return string.IsNullOrWhiteSpace(content)
+ ? new JObject()
+ : JsonConvert.DeserializeObject<JObject>(content) ?? new JObject();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Invalid config file, resetting");
+ return new JObject();
+ }
+ }
+
+ private async Task SaveConfigAsync()
+ {
+ await File.WriteAllTextAsync(
+ _configPath,
+ _cache.ToString(Formatting.Indented));
+
+ (configuration as IConfigurationRoot)?.Reload();
+ }
+
+ private static JToken? GetTokenIgnoreCase(JObject obj, string key)
+ {
+ var prop = obj.Properties()
+ .FirstOrDefault(p => string.Equals(p.Name, key, StringComparison.OrdinalIgnoreCase));
+ return prop?.Value;
+ }
+
+ private static JObject GetOrCreateObjectIgnoreCase(JObject current, string key)
+ {
+ JProperty? first = null;
+ var extraNames = new List<string>();
+
+ foreach (var p in current.Properties())
+ if (string.Equals(p.Name, key, StringComparison.OrdinalIgnoreCase))
+ {
+ if (first == null) first = p;
+ else extraNames.Add(p.Name);
+ }
+
+ foreach (var name in extraNames) current.Remove(name);
+
+ if (first?.Value is JObject existing)
+ return existing;
+
+ var created = new JObject();
+
+ if (first != null)
+ {
+ first.Value = created;
+ return created;
+ }
+
+ current[key] = created;
+ return created;
+ }
+
+ private static void SetValueIgnoreCase(JObject current, string key, string value)
+ {
+ // Remove all case-insensitive matches
+ var toRemove = current.Properties()
+ .Where(p => string.Equals(p.Name, key, StringComparison.OrdinalIgnoreCase))
+ .Select(p => p.Name)
+ .ToList();
+
+ foreach (var name in toRemove)
+ current.Remove(name);
+
+ // Add with correct casing
+ current[key] = value;
+ }
+
+ private static void RemoveIgnoreCase(JObject current, string key)
+ {
+ var toRemove = new List<string>();
+ foreach (var p in current.Properties())
+ if (string.Equals(p.Name, key, StringComparison.OrdinalIgnoreCase))
+ toRemove.Add(p.Name);
+
+ foreach (var name in toRemove) current.Remove(name);
+ }
+
+ public static void ValidateConfig()
+ {
+ var configPath = Path.Combine(Shared.RootDirectory, "appsettings.json");
+
+ // Rewrite config file if it's empty
+ if (!File.Exists(configPath) || string.IsNullOrWhiteSpace(File.ReadAllText(configPath)))
+ File.WriteAllText(configPath, "{}");
+
+ // Rewrite config file if it's invalid JSON
+ try
+ {
+ JsonConvert.DeserializeObject<JObject>(File.ReadAllText(configPath));
+ }
+ catch
+ {
+ File.WriteAllText(configPath, "{}");
+ }
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Services/Managers/LanguageManager.cs b/optimizerDuck/Services/Managers/LanguageManager.cs
new file mode 100644
index 0000000..488389d
--- /dev/null
+++ b/optimizerDuck/Services/Managers/LanguageManager.cs
@@ -0,0 +1,19 @@
+using System.Globalization;
+using optimizerDuck.Resources.Languages;
+
+namespace optimizerDuck.Services.Managers;
+
+public class Loc
+{
+ public static Loc Instance { get; } = new();
+
+ public static CultureInfo CurrentCulture => Translations.Culture;
+
+ public string this[string key] =>
+ Translations.ResourceManager.GetString(key, Translations.Culture) ?? key;
+
+ public void ChangeCulture(CultureInfo culture)
+ {
+ Translations.Culture = culture;
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Services/Managers/RevertManager.cs b/optimizerDuck/Services/Managers/RevertManager.cs
new file mode 100644
index 0000000..1e89cfa
--- /dev/null
+++ b/optimizerDuck/Services/Managers/RevertManager.cs
@@ -0,0 +1,350 @@
+using System.IO;
+using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using optimizerDuck.Common.Helpers;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Revert;
+using optimizerDuck.Core.Models.Revert.Steps;
+using optimizerDuck.Core.Models.UI;
+using optimizerDuck.Resources.Languages;
+
+namespace optimizerDuck.Services.Managers;
+
+public class RevertManager(ILogger<RevertManager> logger)
+{
+ private static readonly AsyncLocal<RevertContext?> _current = new();
+
+ public static RevertContext? Current => _current.Value;
+
+ public RevertContext BeginRecording(IOptimization optimization)
+ {
+ var context = new RevertContext(optimization, logger, this);
+ _current.Value = context;
+ return context;
+ }
+
+ public static void Record(IRevertStep step)
+ {
+ Current?.AddStep(step);
+ }
+
+ internal async Task SaveAsync(Guid optimizationId, string optimizationName, Stack<IRevertStep> steps)
+ {
+ var filePath = Path.Combine(Shared.RevertDirectory, optimizationId + ".json");
+ var tempPath = filePath + ".tmp";
+
+ try
+ {
+ // Persist revert steps atomically to avoid partial writes.
+ var stepData = steps.Reverse()
+ .Select(s => new RevertStepData
+ {
+ Type = s.Type,
+ Data = s.ToData()
+ })
+ .ToList();
+
+ var payload = new RevertData
+ {
+ OptimizationId = optimizationId,
+ OptimizationName = optimizationName,
+ AppliedAt = DateTime.Now,
+ Steps = stepData
+ };
+
+ Directory.CreateDirectory(Shared.RevertDirectory);
+ var json = JsonConvert.SerializeObject(payload, Formatting.Indented);
+ await File.WriteAllTextAsync(tempPath, json);
+ File.Move(tempPath, filePath, true);
+ logger.LogInformation("Saved {Count} revert steps for {Name} to {File}", steps.Count, optimizationName,
+ filePath);
+ }
+ catch (Exception ex)
+ {
+ try
+ {
+ if (File.Exists(tempPath))
+ File.Delete(tempPath);
+ }
+ catch
+ {
+ // Best-effort cleanup only.
+ }
+
+ logger.LogError(ex, "Failed to save revert data for {Name}", optimizationName);
+ throw;
+ }
+ }
+
+ public async Task<RevertResult> RevertAsync(Guid optimizationId, string optimizationKey,
+ IProgress<ProcessingProgress>? progress = null)
+ {
+ // Load revert data, validate, then execute steps in reverse order.
+ try
+ {
+ var validation = await ValidateAsync(optimizationId);
+ if (!validation.IsValid)
+ {
+ logger.LogWarning("Invalid revert data for {Name}: {Message}", optimizationKey, validation.Message);
+ return new RevertResult
+ {
+ Success = false,
+ Message = string.Format(Translations.Revert_Error_InvalidData, optimizationKey, validation.LocalizedMessage)
+ };
+ }
+
+ var steps = await LoadStepsAsync(optimizationId);
+ if (steps.Count == 0)
+ {
+ logger.LogWarning("No revert steps found for {Name}", optimizationKey);
+ return new RevertResult
+ {
+ Success = false,
+ Message = string.Format(Translations.Revert_Error_NoDataFound, optimizationKey)
+ };
+ }
+
+ logger.LogInformation("Reverting {Name} with {Count} steps", optimizationKey, steps.Count);
+
+ var failedSteps = 0;
+ var stack = new Stack<RevertStepEntry>(steps);
+
+ while (stack.Count > 0)
+ {
+ var (currentIndex, step) = stack.Pop();
+
+ progress?.Report(new ProcessingProgress
+ {
+ Message = string.Format(Translations.Optimization_Revert_ExecutingStep, currentIndex, steps.Count,
+ step.Type),
+ IsIndeterminate = false,
+ Value = currentIndex,
+ Total = steps.Count
+ });
+
+ var success = await step.ExecuteAsync();
+ if (!success) failedSteps++;
+ }
+
+ var failed = failedSteps == steps.Count;
+
+ if (!failed)
+ await RemoveAsync(optimizationId, optimizationKey);
+
+ return new RevertResult
+ {
+ Success = !failed,
+ Message = failed
+ ? string.Format(Translations.Optimization_Revert_Error_Failed, optimizationKey)
+ : failedSteps > 0
+ ? string.Format(Translations.Optimization_Revert_Error_FailedWithSteps, optimizationKey,
+ failedSteps)
+ : string.Format(Translations.Optimization_Revert_Success, optimizationKey)
+ };
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Failed to revert {Name}", optimizationKey);
+ return new RevertResult
+ {
+ Success = false,
+ Message = string.Format(Translations.Revert_Error_RevertFailed, optimizationKey, ex.Message),
+ Exception = ex
+ };
+ }
+ }
+
+ private async Task<List<RevertStepEntry>> LoadStepsAsync(Guid optimizationId)
+ {
+ var filePath = Path.Combine(Shared.RevertDirectory, optimizationId + ".json");
+ if (!File.Exists(filePath))
+ return new List<RevertStepEntry>();
+
+ try
+ {
+ var content = await File.ReadAllTextAsync(filePath);
+ if (string.IsNullOrWhiteSpace(content))
+ return new List<RevertStepEntry>();
+
+ var revertData = JsonConvert.DeserializeObject<RevertData>(content);
+ if (revertData == null || revertData.Steps.Count == 0)
+ return new List<RevertStepEntry>();
+
+ var stepsList = new List<RevertStepEntry>();
+ var index = 0;
+ foreach (var stepData in revertData.Steps)
+ {
+ var step = DeserializeStep(stepData.Type, stepData.Data);
+ if (step == null)
+ throw new InvalidDataException($"Invalid revert step type '{stepData.Type}'.");
+ index++;
+ stepsList.Add(new RevertStepEntry(index, step));
+ }
+
+ return stepsList;
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Failed to load revert steps for {Id}", optimizationId);
+ return new List<RevertStepEntry>();
+ }
+ }
+
+ public static Task<bool> IsAppliedAsync(Guid optimizationId)
+ {
+ // Revert data file existence is the source of truth.
+ var filePath = Path.Combine(Shared.RevertDirectory, optimizationId + ".json");
+ return Task.FromResult(File.Exists(filePath));
+ }
+
+ public static async Task<RevertData?> GetRevertDataAsync(Guid optimizationId)
+ {
+ var filePath = Path.Combine(Shared.RevertDirectory, optimizationId + ".json");
+ if (!File.Exists(filePath))
+ return null;
+
+ try
+ {
+ var content = await File.ReadAllTextAsync(filePath);
+ if (string.IsNullOrWhiteSpace(content))
+ return null;
+
+ var revertData = JsonConvert.DeserializeObject<RevertData>(content);
+ return revertData;
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+ private Task RemoveAsync(Guid optimizationId, string optimizationName)
+ {
+ try
+ {
+ var filePath = Path.Combine(Shared.RevertDirectory, optimizationId + ".json");
+ if (File.Exists(filePath))
+ {
+ File.Delete(filePath);
+ logger.LogInformation("Removed revert data for {Name} ({File})", optimizationName, filePath);
+ }
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Failed to remove revert data for {Id}", optimizationId);
+ }
+
+ return Task.CompletedTask;
+ }
+
+ private IRevertStep? DeserializeStep(string serviceType, JToken data)
+ {
+ try
+ {
+ if (data is not JObject obj)
+ {
+ logger.LogError(
+ "Invalid revert step payload for type {Type}. Expected JObject, got {TokenType}",
+ serviceType,
+ data.Type
+ );
+ return null;
+ }
+
+ return serviceType switch
+ {
+ "Registry" => RegistryRevertStep.FromData(obj),
+ "Service" => ServiceRevertStep.FromData(obj),
+ "Shell" => ShellRevertStep.FromData(obj),
+ _ => null
+ };
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Failed to deserialize step of type {Type}", serviceType);
+ return null;
+ }
+ }
+
+ private async Task<RevertValidationResult> ValidateAsync(Guid optimizationId)
+ {
+ var filePath = Path.Combine(Shared.RevertDirectory, optimizationId + ".json");
+ if (!File.Exists(filePath))
+ return RevertValidationResult.Fail(Translations.Revert_Error_FileNotFound, "Invalid revert data file not found.");
+
+ string content;
+ try
+ {
+ content = await File.ReadAllTextAsync(filePath);
+ if (string.IsNullOrWhiteSpace(content))
+ return RevertValidationResult.Fail(Translations.Revert_Error_FileEmpty, "Invalid revert data file is empty.");
+ }
+ catch (Exception ex)
+ {
+ return RevertValidationResult.Fail(string.Format(Translations.Revert_Error_ReadFailed, ex.Message), ex.Message);
+ }
+
+ RevertData? data;
+ try
+ {
+ data = JsonConvert.DeserializeObject<RevertData>(content);
+ if (data == null)
+ return RevertValidationResult.Fail(Translations.Revert_Error_InvalidJson, "Invalid revert data JSON.");
+ }
+ catch (Exception ex)
+ {
+ return RevertValidationResult.Fail(
+ string.Format(Translations.Revert_Error_InvalidJsonFormat, ex.Message), ex.Message);
+ }
+
+ if (data.OptimizationId != optimizationId)
+ return RevertValidationResult.Fail(Translations.Revert_Error_OptimizationIdMismatch, "Invalid optimization ID.");
+
+ if (data.Steps.Count == 0)
+ return RevertValidationResult.Fail(Translations.Revert_Error_NoSteps, "No revert steps found.");
+
+ var invalidSteps = new List<string>();
+ foreach (var stepData in data.Steps)
+ {
+ if (string.IsNullOrWhiteSpace(stepData.Type))
+ {
+ invalidSteps.Add(stepData.Type);
+ continue;
+ }
+
+ var step = DeserializeStep(stepData.Type, stepData.Data);
+ if (step == null)
+ invalidSteps.Add(stepData.Type);
+ }
+
+ if (invalidSteps.Count > 0)
+ return RevertValidationResult.Fail(string.Format(Translations.Revert_Error_InvalidSteps,
+ string.Join(", ", invalidSteps)), "Invalid revert steps.");
+
+ return RevertValidationResult.Success();
+ }
+
+ internal static void ClearCurrent()
+ {
+ _current.Value = null;
+ }
+
+ public static void ClearAllRevertDataAsync()
+ {
+ if (!Directory.Exists(Shared.RevertDirectory))
+ return;
+
+ foreach (var filePath in Directory.GetFiles(Shared.RevertDirectory))
+ try
+ {
+ File.Delete(filePath);
+ }
+ catch
+ {
+ // Best-effort cleanup only.
+ }
+ }
+
+ private sealed record RevertStepEntry(int Index, IRevertStep Step);
+}
\ No newline at end of file
diff --git a/optimizerDuck/Services/OptimizationPageRegistryExtensions.cs b/optimizerDuck/Services/OptimizationPageRegistryExtensions.cs
new file mode 100644
index 0000000..dad92af
--- /dev/null
+++ b/optimizerDuck/Services/OptimizationPageRegistryExtensions.cs
@@ -0,0 +1,52 @@
+using System.Reflection;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using optimizerDuck.Common.Helpers;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Attributes;
+using Wpf.Ui;
+using OptimizationCategoryViewModel = optimizerDuck.UI.ViewModels.Optimizer.OptimizationCategoryViewModel;
+
+namespace optimizerDuck.Services;
+
+public static class OptimizationPageRegistryExtensions
+{
+ public static void AddAllOptimizationPages(this IServiceCollection services)
+ {
+ var categoryTypes = ReflectionHelper
+ .FindImplementationsInLoadedAssemblies<IOptimizationCategory>()
+ .ToList();
+
+ foreach (var categoryType in categoryTypes)
+ {
+ var attr = categoryType.GetCustomAttribute<OptimizationCategoryAttribute>()!;
+ var pageType = attr.PageType!;
+
+ services.AddSingleton(pageType, sp => CreateOptimizationPage(sp, categoryType, pageType));
+ }
+ }
+
+ private static object CreateOptimizationPage(
+ IServiceProvider serviceProvider,
+ Type categoryType,
+ Type pageType)
+ {
+ var optimizationRegistry = serviceProvider.GetRequiredService<OptimizationRegistry>();
+ var optimizationService = serviceProvider.GetRequiredService<OptimizationService>();
+ var snackbarService = serviceProvider.GetRequiredService<ISnackbarService>();
+ var contentDialogService = serviceProvider.GetRequiredService<IContentDialogService>();
+ var logger = serviceProvider.GetRequiredService<ILogger<OptimizationCategoryViewModel>>();
+
+ var optimizationCategoryType = optimizationRegistry.GetCategory(categoryType);
+
+ var viewModel = new OptimizationCategoryViewModel(
+ optimizationCategoryType,
+ optimizationService,
+ snackbarService,
+ contentDialogService,
+ logger
+ );
+
+ return Activator.CreateInstance(pageType, viewModel)!;
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Services/OptimizationRegistry.cs b/optimizerDuck/Services/OptimizationRegistry.cs
new file mode 100644
index 0000000..a5b3926
--- /dev/null
+++ b/optimizerDuck/Services/OptimizationRegistry.cs
@@ -0,0 +1,79 @@
+using System.Collections.ObjectModel;
+using System.Reflection;
+using Microsoft.Extensions.Logging;
+using optimizerDuck.Common.Helpers;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Optimizers;
+
+namespace optimizerDuck.Services;
+
+public class OptimizationRegistry(ILoggerFactory loggerFactory)
+{
+ private readonly ILogger _logger = loggerFactory.CreateLogger<OptimizationRegistry>();
+ public IOptimizationCategory[] OptimizationCategories { get; set; } = [];
+
+ public async Task PreloadOptimizations()
+ {
+ // Clear state cache before preloading to ensure fresh data
+ OptimizationService.ClearStateCache();
+
+ var optimizationCategories = ReflectionHelper
+ .FindImplementationsInLoadedAssemblies<IOptimizationCategory>()
+ .Select(t =>
+ {
+ var optimizations = new ObservableCollection<IOptimization>(
+ t.GetNestedTypes(BindingFlags.Public)
+ .Where(nt => typeof(IOptimization).IsAssignableFrom(nt))
+ .Select(nt =>
+ {
+ var opt = (IOptimization)Activator.CreateInstance(nt)!;
+
+ if (opt is BaseOptimization bo)
+ bo.OwnerType = t;
+
+ return opt;
+ })
+ .ToList()
+ );
+
+ if (optimizations.Count == 0)
+ return null;
+
+ var instance = (IOptimizationCategory)Activator.CreateInstance(t)!;
+
+ var optProp = t.GetProperty(nameof(IOptimizationCategory.Optimizations),
+ BindingFlags.Public | BindingFlags.Instance);
+ if (optProp != null && optProp.CanWrite)
+ optProp.SetValue(instance, optimizations);
+
+ return instance;
+ })
+ .Where(c => c != null) // skip nulls
+ .OrderBy(c => c!.Order)
+ .ToArray();
+
+ _logger.LogInformation("Total {CategoryCount} categories and {OptimizationCount} optimizations found",
+ optimizationCategories.Length, optimizationCategories.Sum(c => c!.Optimizations.Count));
+
+ await OptimizationService.UpdateOptimizationStateAsync(optimizationCategories.SelectMany(c => c.Optimizations));
+
+ foreach (var category in optimizationCategories)
+ {
+ var sorted = category!.Optimizations
+ .OrderBy(o => o.Risk)
+ .ThenByDescending(o => o.State.IsApplied ? 1 : 0)
+ .ToList();
+
+ category.Optimizations.Clear();
+ foreach (var opt in sorted)
+ category.Optimizations.Add(opt);
+ }
+
+ OptimizationCategories = optimizationCategories!;
+ }
+
+ public IOptimizationCategory GetCategory(Type type)
+ {
+ return OptimizationCategories.First(c => c.GetType() == type);
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Services/OptimizationService.cs b/optimizerDuck/Services/OptimizationService.cs
new file mode 100644
index 0000000..fe50635
--- /dev/null
+++ b/optimizerDuck/Services/OptimizationService.cs
@@ -0,0 +1,355 @@
+using System.IO;
+using Microsoft.Extensions.Logging;
+using optimizerDuck.Common.Helpers;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Optimization;
+using optimizerDuck.Core.Models.Revert;
+using optimizerDuck.Core.Models.UI;
+using optimizerDuck.Resources.Languages;
+using optimizerDuck.Services.Managers;
+
+namespace optimizerDuck.Services;
+
+public class OptimizationService(
+ RevertManager revertManager,
+ ILoggerFactory loggerFactory,
+ SystemInfoService systemInfoService,
+ StreamService streamService)
+{
+ private static readonly Dictionary<Guid, (bool IsApplied, DateTime? AppliedAt)> _stateCache = new();
+ private static readonly object _cacheLock = new();
+
+ #region Main Methods
+
+ public async Task<OptimizationResult> ApplyAsync(IOptimization optimization,
+ IProgress<ProcessingProgress> progress)
+ {
+ var optimizationLogger = loggerFactory.CreateLogger(optimization.GetType());
+
+ OptimizationResult result;
+ List<OperationStepResult> stepResults = [];
+ var tracker = ServiceTracker.Begin(optimizationLogger);
+
+ RevertContext? revertContext = null;
+ var revertContextDisposed = false;
+
+ try
+ {
+ revertContext = revertManager.BeginRecording(optimization);
+
+ progress.Report(new ProcessingProgress
+ {
+ Message = Translations.Optimization_Apply_Processing,
+ IsIndeterminate = true
+ });
+
+ var applyResult = await Task.Run(async () =>
+ await optimization.ApplyAsync(progress,
+ new OptimizationContext(optimizationLogger, systemInfoService.Snapshot, streamService)));
+
+ if (!string.IsNullOrWhiteSpace(applyResult.Message)) // Optimization failed
+ {
+ // Retry to recover from failed steps
+ stepResults = tracker.GetSteps().ToList();
+ var failedApplySteps = stepResults.Where(s => !s.Success).ToList();
+
+ // Persist revert steps first, then attempt an immediate revert.
+ await revertContext.DisposeAsync();
+ revertContextDisposed = true;
+
+ var revertResult = await revertManager.RevertAsync(
+ optimization.Id,
+ optimization.OptimizationKey,
+ progress);
+
+ // If revert succeeds, remove any cached applied state.
+ if (revertResult.Success)
+ {
+ lock (_cacheLock)
+ {
+ _stateCache.Remove(optimization.Id);
+ }
+ }
+
+ return new OptimizationResult
+ {
+ Status = OptimizationSuccessResult.Failed,
+ Message = applyResult.Message,
+ FailedSteps = failedApplySteps
+ };
+ }
+
+ progress.Report(new ProcessingProgress
+ {
+ Message = Translations.Optimization_Apply_Completed,
+ IsIndeterminate = false,
+ Value = 1,
+ Total = 1
+ });
+
+ // Collect steps after apply completes.
+ stepResults = tracker.GetSteps().ToList();
+ var failedSteps = stepResults.Where(s => !s.Success).ToList();
+
+ var status = ResolveStatus(stepResults, failedSteps);
+ result = new OptimizationResult
+ {
+ Status = status,
+ Message = status == OptimizationSuccessResult.Success
+ ? string.Format(Translations.Optimization_Apply_Success, optimization.OptimizationKey)
+ : stepResults.Count == failedSteps.Count // if all steps failed
+ ? string.Format(Translations.Optimization_Apply_Error_Failed, optimization.OptimizationKey)
+ : string.Format(Translations.Optimization_Apply_Error_FailedWithSteps, optimization.OptimizationKey,
+ failedSteps.Count),
+ FailedSteps = failedSteps
+ };
+
+ // Update cache after successful apply
+ if (status == OptimizationSuccessResult.Success)
+ {
+ lock (_cacheLock)
+ {
+ _stateCache[optimization.Id] = (true, DateTime.Now);
+ }
+ }
+
+ if (!revertContextDisposed)
+ await revertContext.DisposeAsync();
+ }
+ catch (Exception ex)
+ {
+ stepResults = tracker?.GetSteps().ToList() ?? [];
+ var failedSteps = stepResults.Where(s => !s.Success).ToList();
+
+ var status = ResolveStatus(stepResults, failedSteps);
+ result = new OptimizationResult
+ {
+ Status = status,
+ Message = string.Format(Translations.Optimization_Apply_Error_Failed,
+ optimization.OptimizationKey, ex.Message),
+ Exception = ex,
+ FailedSteps = failedSteps
+ };
+
+ // Best-effort: persist any revert steps that were recorded before the exception.
+ if (revertContext is not null && !revertContextDisposed)
+ {
+ try
+ {
+ await revertContext.DisposeAsync();
+ revertContextDisposed = true;
+ }
+ catch
+ {
+ // Best-effort cleanup only.
+ }
+ }
+ }
+ finally
+ {
+ tracker?.Dispose();
+ }
+
+ return result;
+
+ OptimizationSuccessResult ResolveStatus(
+ IReadOnlyCollection<OperationStepResult> steps,
+ IReadOnlyCollection<OperationStepResult> failedSteps)
+ {
+ if (steps.Count == 0)
+ return OptimizationSuccessResult.Failed;
+
+ if (failedSteps.Count == 0)
+ return OptimizationSuccessResult.Success;
+
+ return failedSteps.Count < steps.Count
+ ? OptimizationSuccessResult.PartialSuccess
+ : OptimizationSuccessResult.Failed;
+ }
+ }
+
+ public async Task<RevertResult> RevertAsync(IOptimization optimization,
+ IProgress<ProcessingProgress>? progress = null)
+ {
+ var optimizationLogger = loggerFactory.CreateLogger(optimization.GetType());
+ using var tracker = ServiceTracker.Begin(optimizationLogger);
+
+ progress?.Report(new ProcessingProgress
+ {
+ Message = Translations.Optimization_Revert_Reverting,
+ IsIndeterminate = true
+ });
+
+ var result = await revertManager.RevertAsync(
+ optimization.Id,
+ optimization.OptimizationKey,
+ progress);
+
+ var steps = tracker.GetSteps().ToList();
+ result.FailedStepDetails = steps
+ .Where(s => s.Error != null)
+ .ToList();
+
+ progress?.Report(new ProcessingProgress
+ {
+ Message = result.Message,
+ IsIndeterminate = false,
+ Value = 1,
+ Total = 1
+ });
+
+ // Update cache after revert
+ if (result.Success)
+ {
+ lock (_cacheLock)
+ {
+ _stateCache.Remove(optimization.Id);
+ }
+ }
+
+ return result;
+ }
+
+ #endregion Main Methods
+
+ #region Helpers
+
+ public static Task<bool> IsAppliedAsync(Guid optimizationId)
+ {
+ return RevertManager.IsAppliedAsync(optimizationId);
+ }
+
+ public static async Task UpdateOptimizationStateAsync(params IOptimization[] optimizations)
+ {
+ var optimizationIds = optimizations.Select(o => o.Id).ToArray();
+ var uncachedIds = new List<Guid>();
+
+ lock (_cacheLock)
+ {
+ foreach (var optimization in optimizations)
+ {
+ if (_stateCache.TryGetValue(optimization.Id, out var cachedState))
+ {
+ // Use cached state
+ optimization.State.IsApplied = cachedState.IsApplied;
+ optimization.State.AppliedAt = cachedState.AppliedAt;
+ }
+ else
+ {
+ uncachedIds.Add(optimization.Id);
+ }
+ }
+ }
+
+ // Only fetch from disk for uncached optimizations
+ if (uncachedIds.Count > 0)
+ {
+ var tasks = uncachedIds.Select(async id =>
+ {
+ var revertData = await RevertManager.GetRevertDataAsync(id);
+ var state = (IsApplied: revertData != null, AppliedAt: revertData?.AppliedAt);
+
+ lock (_cacheLock)
+ {
+ _stateCache[id] = state;
+ }
+
+ return (Id: id, State: state);
+ });
+
+ var results = await Task.WhenAll(tasks);
+
+ // Update optimizations with fetched data
+ foreach (var optimization in optimizations)
+ {
+ var result = results.FirstOrDefault(r => r.Id == optimization.Id);
+ if (result.Id != Guid.Empty)
+ {
+ optimization.State.IsApplied = result.State.IsApplied;
+ optimization.State.AppliedAt = result.State.AppliedAt;
+ }
+ }
+ }
+ }
+
+ public static async Task UpdateOptimizationStateAsync(IEnumerable<IOptimization> optimizations)
+ {
+ await UpdateOptimizationStateAsync(optimizations.ToArray());
+ }
+
+ public static async Task<List<OperationStepResult>> RetryFailedStepsAsync(
+ IReadOnlyList<OperationStepResult> failedSteps,
+ bool reverseOrder,
+ IProgress<ProcessingProgress>? progress = null)
+ {
+ if (failedSteps.Count == 0)
+ return [];
+
+ var stillFailed = new List<OperationStepResult>();
+
+ var orderedSteps = reverseOrder
+ ? failedSteps.OrderByDescending(s => s.Index)
+ : failedSteps.OrderBy(s => s.Index);
+ var totalSteps = failedSteps.Count;
+ var stepIndex = 0;
+
+ progress?.Report(new ProcessingProgress
+ {
+ Message = Translations.Optimization_Retry_Processing,
+ IsIndeterminate = true,
+ Value = 0,
+ Total = 0
+ });
+
+ foreach (var step in orderedSteps)
+ {
+ stepIndex++;
+
+ progress?.Report(new ProcessingProgress
+ {
+ Message = string.Format(Translations.Optimization_RetryStep_Processing, step.Name, stepIndex,
+ totalSteps),
+ IsIndeterminate = false,
+ Value = stepIndex,
+ Total = totalSteps
+ });
+
+ var success = await step.RetryAction();
+ if (!success)
+ stillFailed.Add(step);
+ }
+
+ return stillFailed;
+ }
+
+ public static void ClearResourcesAsync()
+ {
+ lock (_cacheLock)
+ {
+ _stateCache.Clear();
+ }
+
+ if (!Directory.Exists(Shared.ResourcesDirectory))
+ return;
+
+ foreach (var filePath in Directory.GetFiles(Shared.ResourcesDirectory))
+ try
+ {
+ File.Delete(filePath);
+ }
+ catch
+ {
+ // Best-effort cleanup only.
+ }
+ }
+
+ public static void ClearStateCache()
+ {
+ lock (_cacheLock)
+ {
+ _stateCache.Clear();
+ }
+ }
+
+ #endregion Helpers
+}
\ No newline at end of file
diff --git a/optimizerDuck/Services/OptimizationServices/RegistryService.cs b/optimizerDuck/Services/OptimizationServices/RegistryService.cs
new file mode 100644
index 0000000..ecb72db
--- /dev/null
+++ b/optimizerDuck/Services/OptimizationServices/RegistryService.cs
@@ -0,0 +1,609 @@
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.IO;
+using System.Security;
+using Microsoft.Win32;
+using optimizerDuck.Core.Models.Optimization.Services;
+using optimizerDuck.Core.Models.Revert.Steps;
+using optimizerDuck.Resources.Languages;
+using optimizerDuck.Services.Managers;
+
+namespace optimizerDuck.Services.OptimizationServices;
+
+public static class RegistryService
+{
+ private static readonly Dictionary<string, RegistryKey> RootKeysMap =
+ new(StringComparer.OrdinalIgnoreCase)
+ {
+ ["HKLM"] = Registry.LocalMachine,
+ ["HKLM:"] = Registry.LocalMachine,
+ ["HKEY_LOCAL_MACHINE"] = Registry.LocalMachine,
+ ["HKCU"] = Registry.CurrentUser,
+ ["HKCU:"] = Registry.CurrentUser,
+ ["HKEY_CURRENT_USER"] = Registry.CurrentUser,
+ ["HKCR"] = Registry.ClassesRoot,
+ ["HKCR:"] = Registry.ClassesRoot,
+ ["HKEY_CLASSES_ROOT"] = Registry.ClassesRoot,
+ ["HKU"] = Registry.Users,
+ ["HKU:"] = Registry.Users,
+ ["HKEY_USERS"] = Registry.Users,
+ ["HKCC"] = Registry.CurrentConfig,
+ ["HKCC:"] = Registry.CurrentConfig,
+ ["HKEY_CURRENT_CONFIG"] = Registry.CurrentConfig
+ };
+
+ private static bool TryParsePath(
+ string fullPath,
+ [NotNullWhen(true)] out RegistryKey? rootKey,
+ [NotNullWhen(true)] out string? subPath)
+ {
+ rootKey = null;
+ subPath = null;
+
+ if (string.IsNullOrWhiteSpace(fullPath))
+ {
+ ServiceTracker.LogError(null, "Registry path is null or empty");
+ ServiceTracker.Track(nameof(RegistryService), false);
+ return false;
+ }
+
+ var parts = fullPath.AsSpan();
+ var idx = parts.IndexOf('\\');
+ var rootToken = idx > 0 ? parts[..idx].ToString() : parts.ToString();
+
+ if (!RootKeysMap.TryGetValue(rootToken, out rootKey))
+ {
+ ServiceTracker.LogError(null, "Unknown root key: {RootToken}", rootToken);
+ ServiceTracker.Track(nameof(RegistryService), false);
+ return false;
+ }
+
+ subPath = idx > 0 ? parts[(idx + 1)..].ToString() : string.Empty;
+ return true;
+ }
+
+ private static bool TryOpenSubKey(
+ RegistryKey rootKey,
+ string? subPath,
+ out RegistryKey? key,
+ out bool shouldDispose,
+ bool writable,
+ bool createIfMissing,
+ List<string>? createdSubKeys)
+ {
+ key = null;
+ shouldDispose = false;
+
+ if (string.IsNullOrEmpty(subPath))
+ {
+ key = rootKey;
+ return true;
+ }
+
+ try
+ {
+ var opened = writable
+ ? rootKey.OpenSubKey(subPath, true)
+ : rootKey.OpenSubKey(subPath);
+
+ if (opened == null && writable && createIfMissing)
+ opened = createdSubKeys != null
+ ? CreateSubKeyTrack(rootKey, subPath, createdSubKeys)
+ : rootKey.CreateSubKey(subPath);
+
+ if (opened != null)
+ {
+ key = opened;
+ shouldDispose = true;
+ return true;
+ }
+
+ return false;
+ }
+ catch (SecurityException ex)
+ {
+ TrackRegistryError(
+ Translations.Service_Registry_Error_AccessDeniedProtectedHive,
+ "Access denied (protected hive)",
+ rootKey,
+ subPath,
+ ex);
+ return false;
+ }
+ catch (UnauthorizedAccessException ex)
+ {
+ TrackRegistryError(
+ Translations.Service_Registry_Error_UnauthorizedAccess,
+ "Unauthorized access",
+ rootKey,
+ subPath,
+ ex);
+ return false;
+ }
+ catch (Exception ex)
+ {
+ TrackRegistryError(
+ Translations.Service_Registry_Error_CreateOrOpenSubkeyFailed,
+ "Failed to create/open subkey",
+ rootKey,
+ subPath,
+ ex);
+ return false;
+ }
+ }
+
+ private static T? WithKey<T>(RegistryItem item, Func<RegistryKey, T?> action, bool writable = false,
+ bool createIfMissing = false, List<string>? createdSubKeys = null)
+ {
+ if (!TryParsePath(item.Path, out var rootKey, out var subPath))
+ return default;
+
+ if (!TryOpenSubKey(rootKey, subPath, out var subKey, out var shouldDispose, writable, createIfMissing,
+ createdSubKeys))
+ return default;
+
+ try
+ {
+ return action(subKey);
+ }
+ finally
+ {
+ if (shouldDispose)
+ subKey.Dispose();
+ }
+ }
+
+ public static T? Read<T>(RegistryItem item)
+ {
+ return WithKey(item, key =>
+ {
+ object? value = null;
+ try
+ {
+ value = key.GetValue(item.Name, RegistryValueOptions.DoNotExpandEnvironmentNames);
+ if (value is null) return default;
+
+ var result = ConvertRegistryValue<T>(value);
+
+ ServiceTracker.LogInfo("Read registry {Path}:{Name} = {Value}",
+ item.Path, item.Name!, result);
+
+ return result;
+ }
+ catch (Exception ex)
+ {
+ ServiceTracker.LogError(ex, "Failed to read registry {Path}:{Name}",
+ item.Path, item.Name!);
+
+ ServiceTracker.LogInfo("Read registry {Path}:{Name} = <default> (raw={RawType})",
+ item.Path, item.Name!, value?.GetType().FullName);
+
+ return default;
+ }
+ });
+ }
+
+ public static bool Write(RegistryItem item)
+ {
+ if (item.Value == null)
+ {
+ ServiceTracker.LogError(null, "Value can't be null when writing {Path}:{Name}",
+ item.Path, item.Name!);
+ ServiceTracker.Track(nameof(Write), false);
+ return false;
+ }
+
+ var createdSubKeys = new List<string>();
+
+ return WithKey(item, key =>
+ {
+ var description = $"{item.Path}:{item.Name}";
+ try
+ {
+ object? backupValue = null;
+ RegistryValueKind? backupKind = null;
+ var valueExists = false;
+
+ // Detect value existence correctly:
+ // - backupValue == null does NOT mean value does not exist
+ // - must check value names explicitly
+ try
+ {
+ backupValue = key.GetValue(item.Name, null,
+ RegistryValueOptions.DoNotExpandEnvironmentNames);
+
+ // Value does not exist if backupValue is null and name not found
+ if (backupValue == null &&
+ !key.GetValueNames().Contains(item.Name))
+ {
+ backupKind = null;
+ valueExists = false; // value does not exist
+ }
+ else
+ {
+ backupKind = key.GetValueKind(item.Name);
+ valueExists = true; // value exists
+ }
+ }
+ catch
+ {
+ backupValue = null;
+ backupKind = null;
+ valueExists = false;
+ }
+
+ key.SetValue(item.Name, item.Value, item.Kind);
+
+ if (valueExists)
+ RevertManager.Record(new RegistryRevertStep
+ {
+ Action = RevertAction.RestorePrevious,
+ Path = item.Path,
+ Name = item.Name,
+ Value = backupValue,
+ Kind = backupKind ?? RegistryValueKind.Unknown,
+ CreatedSubKeys = createdSubKeys
+ });
+ else
+ RevertManager.Record(new RegistryRevertStep
+ {
+ Action = RevertAction.NoPreviousValue,
+ Path = item.Path,
+ Name = item.Name,
+ CreatedSubKeys = createdSubKeys
+ });
+
+ ServiceTracker.LogInfo("Wrote {Path}:{Name}[{Kind}] = {Value}",
+ item.Path, item.Name!, item.Kind, item.Value);
+ ServiceTracker.Track(nameof(Write), true);
+ ServiceTracker.TrackStep(
+ "Registry",
+ description,
+ true,
+ null,
+ () => Task.Run(() => Write(item)));
+ return true;
+ }
+ catch (UnauthorizedAccessException)
+ {
+ ServiceTracker.LogError(null, "Access denied writing {Path}:{Name}",
+ item.Path, item.Name!);
+ ServiceTracker.Track(nameof(Write), false);
+ ServiceTracker.TrackStep(
+ "Registry",
+ description,
+ false,
+ Translations.Service_Common_Error_AccessDenied,
+ () => Task.Run(() => Write(item)));
+ return false;
+ }
+ catch (Exception ex)
+ {
+ ServiceTracker.LogError(ex, "Failed to write registry {Path}:{Name}",
+ item.Path, item.Name!);
+ ServiceTracker.Track(nameof(Write), false);
+ ServiceTracker.TrackStep(
+ "Registry",
+ description,
+ false,
+ ex.Message,
+ () => Task.Run(() => Write(item)));
+ return false;
+ }
+ }, true, true, createdSubKeys);
+ }
+
+ public static bool DeleteValue(RegistryItem item)
+ {
+ if (!TryParsePath(item.Path, out var rootKey, out var subPath))
+ return false;
+
+ RegistryKey? key = null;
+ var shouldDispose = false;
+
+ try
+ {
+ var description = $"{item.Path}:{item.Name}";
+ if (string.IsNullOrEmpty(subPath))
+ {
+ key = rootKey;
+ }
+ else
+ {
+ key = rootKey.OpenSubKey(subPath, true);
+ if (key == null)
+ {
+ // Missing subkey means there's nothing to delete; treat as success for revert.
+ ServiceTracker.LogInfo("Skip delete registry {Path}:{Name} (subkey missing)",
+ item.Path, item.Name!);
+ ServiceTracker.Track(nameof(DeleteValue), true);
+ ServiceTracker.TrackStep(
+ "Registry",
+ description,
+ true,
+ null,
+ () => Task.Run(() => DeleteValue(item)));
+ return true;
+ }
+
+ shouldDispose = true;
+ }
+
+ // Key does not exist, treat as success for revert
+ if (key.GetValue(item.Name) == null)
+ {
+ ServiceTracker.Track(nameof(DeleteValue), true);
+ ServiceTracker.TrackStep(
+ "Registry",
+ description,
+ true,
+ null,
+ () => Task.Run(() => DeleteValue(item)));
+ return true;
+ }
+
+ var backupValue = key.GetValue(item.Name);
+ var backupKind = key.GetValueKind(item.Name);
+
+ key.DeleteValue(item.Name!, false);
+
+ // Record revert: key existed before deletion
+ RevertManager.Record(new RegistryRevertStep
+ {
+ Action = RevertAction.RestorePrevious,
+ Path = item.Path,
+ Name = item.Name,
+ Value = backupValue,
+ Kind = backupKind
+ });
+
+ ServiceTracker.LogInfo("Deleted registry {Path}:{Name}", item.Path, item.Name!);
+ ServiceTracker.Track(nameof(DeleteValue), true);
+ ServiceTracker.TrackStep(
+ "Registry",
+ description,
+ true,
+ null,
+ () => Task.Run(() => DeleteValue(item)));
+ return true;
+ }
+ catch (UnauthorizedAccessException)
+ {
+ ServiceTracker.LogError(null, "Access denied deleting {Path}:{Name}",
+ item.Path, item.Name!);
+ ServiceTracker.Track(nameof(DeleteValue), false);
+ ServiceTracker.TrackStep(
+ "Registry",
+ $"{item.Path}:{item.Name}",
+ false,
+ Translations.Service_Common_Error_AccessDenied,
+ () => Task.Run(() => DeleteValue(item)));
+ return false;
+ }
+ catch (Exception ex)
+ {
+ ServiceTracker.LogError(ex, "Failed to delete registry {Path}:{Name}",
+ item.Path, item.Name!);
+ ServiceTracker.Track(nameof(DeleteValue), false);
+ ServiceTracker.TrackStep(
+ "Registry",
+ $"{item.Path}:{item.Name}",
+ false,
+ ex.Message,
+ () => Task.Run(() => DeleteValue(item)));
+ return false;
+ }
+ finally
+ {
+ if (shouldDispose)
+ key?.Dispose();
+ }
+ }
+
+ public static void Write(params RegistryItem[] items)
+ {
+ foreach (var item in items.Distinct()) Write(item);
+ }
+
+ public static void DeleteValue(params RegistryItem[] items)
+ {
+ foreach (var item in items.Distinct()) DeleteValue(item);
+ }
+
+ #region Helpers
+
+ private static T? ConvertRegistryValue<T>(object value)
+ {
+ // Fast path
+ if (value is T t) return t;
+
+ var tType = typeof(T);
+ var targetType = Nullable.GetUnderlyingType(tType) ?? tType;
+
+ // Arrays often from Registry
+ if (targetType == typeof(byte[]) && value is byte[] bytes)
+ return (T)(object)bytes;
+
+ if (targetType == typeof(string[]) && value is string[] arr)
+ return (T)(object)arr;
+
+ // Bool: Registry sometimes saves DWORD 0/1 or string "true/false"
+ if (targetType == typeof(bool))
+ return value switch
+ {
+ int i => (T)(object)(i != 0),
+ long l => (T)(object)(l != 0),
+ string s when bool.TryParse(s, out var b) => (T)(object)b,
+ _ => default
+ };
+
+ // Enum: supports both string and numeric
+ if (targetType.IsEnum)
+ {
+ if (value is string es)
+ return (T)Enum.Parse(targetType, es, true);
+
+ var enumUnderlying = Enum.GetUnderlyingType(targetType);
+ var num = Convert.ChangeType(value, enumUnderlying, CultureInfo.InvariantCulture);
+ return (T)Enum.ToObject(targetType, num!);
+ }
+
+ // Numeric/string common conversions
+ var converted = Convert.ChangeType(value, targetType, CultureInfo.InvariantCulture);
+ return (T)converted!;
+ }
+
+ private static void TrackRegistryError(
+ string uiReason,
+ string logReason,
+ RegistryKey root,
+ string? subPath,
+ Exception ex)
+ {
+ var path = string.IsNullOrEmpty(subPath)
+ ? root.Name
+ : $"{root.Name}\\{subPath}";
+
+ ServiceTracker.LogError(
+ ex,
+ "{Reason}: {Path}",
+ logReason,
+ path);
+
+ ServiceTracker.Track(nameof(RegistryService), false);
+
+ ServiceTracker.TrackStep(
+ "Registry",
+ path,
+ false,
+ uiReason,
+ () => Task.FromResult(false));
+ }
+
+ /// <summary>
+ /// Creates registry subkeys and tracks which ones were created (did not exist before)
+ /// </summary>
+ private static RegistryKey CreateSubKeyTrack(
+ RegistryKey root,
+ string subPath,
+ List<string> createdSubKeys)
+ {
+ var parts = subPath.Split('\\', StringSplitOptions.RemoveEmptyEntries);
+
+ var current = root;
+ var ownsCurrent = false;
+ var currentPath = string.Empty;
+
+ try
+ {
+ foreach (var part in parts)
+ {
+ currentPath = currentPath.Length == 0
+ ? part
+ : $"{currentPath}\\{part}";
+
+ var next = current.OpenSubKey(part, true);
+ if (next == null)
+ {
+ next = current.CreateSubKey(part, true)
+ ?? throw new InvalidOperationException(
+ $"Failed to create registry key: {root.Name}\\{currentPath}");
+
+ createdSubKeys.Add($"{root.Name}\\{currentPath}");
+ ServiceTracker.LogDebug(
+ "Created registry subkey: {Path}",
+ $"{root.Name}\\{currentPath}");
+ }
+
+ // dispose old key if we opened it
+ if (ownsCurrent)
+ current.Dispose();
+
+ current = next;
+ ownsCurrent = true;
+ }
+
+ return current;
+ }
+ catch
+ {
+ if (ownsCurrent)
+ current.Dispose();
+
+ throw;
+ }
+ }
+
+
+ /// <summary>
+ /// Safely cleanup empty registry keys that were created during apply operation
+ /// Only deletes keys that:
+ /// 1. Were created during the apply operation (in createdSubKeys list)
+ /// 2. Are now empty (no values and no subkeys)
+ /// </summary>
+ public static void CleanupEmptyKeys(IEnumerable<string> createdSubKeys)
+ {
+ // Sort by path length descending to delete deepest keys first
+ var sortedKeys = createdSubKeys
+ .Where(k => !string.IsNullOrWhiteSpace(k))
+ .Distinct(StringComparer.OrdinalIgnoreCase)
+ .OrderByDescending(k => k.Count(c => c == '\\'))
+ .ToList();
+
+ foreach (var fullPath in sortedKeys)
+ try
+ {
+ if (!TryParsePath(fullPath, out var root, out var subPath))
+ continue;
+
+ // Check if the key still exists and is empty
+ using var key = root.OpenSubKey(subPath, false);
+
+ if (key == null)
+ // Key already deleted, skip
+ continue;
+
+ // Only delete if the key is completely empty (no values, no subkeys)
+ if (key is { SubKeyCount: 0, ValueCount: 0 })
+ {
+ // Get parent path and key name
+ var idx = subPath.LastIndexOf('\\');
+ var parentPath = idx > 0 ? subPath[..idx] : string.Empty;
+ var keyName = idx > 0 ? subPath[(idx + 1)..] : subPath;
+
+ if (string.IsNullOrEmpty(parentPath))
+ {
+ root.DeleteSubKey(keyName, false);
+ }
+ else
+ {
+ using var parent = root.OpenSubKey(parentPath, true);
+ parent?.DeleteSubKey(keyName, false);
+ }
+
+ ServiceTracker.LogInfo("Cleaned up empty registry key {Path}", fullPath);
+ }
+ else
+ {
+ // Key is not empty, don't delete it
+ ServiceTracker.LogDebug(
+ "Skipped cleanup of registry key {Path} (has {SubKeyCount} subkeys and {ValueCount} values)",
+ fullPath, key.SubKeyCount, key.ValueCount);
+ }
+ }
+ catch (UnauthorizedAccessException)
+ {
+ ServiceTracker.LogWarning("Access denied cleaning up registry key: {Path}", fullPath);
+ }
+ catch (IOException ex)
+ {
+ ServiceTracker.LogError(ex, "I/O error cleaning up registry key: {Path}", fullPath);
+ }
+ catch (Exception ex)
+ {
+ ServiceTracker.LogError(ex, "Failed to cleanup registry key: {Path}", fullPath);
+ }
+ }
+
+ #endregion Helpers
+}
\ No newline at end of file
diff --git a/optimizerDuck/Services/OptimizationServices/ServiceProcessService.cs b/optimizerDuck/Services/OptimizationServices/ServiceProcessService.cs
new file mode 100644
index 0000000..28ae9c9
--- /dev/null
+++ b/optimizerDuck/Services/OptimizationServices/ServiceProcessService.cs
@@ -0,0 +1,174 @@
+using System.Diagnostics;
+using System.Management;
+using optimizerDuck.Common.Extensions;
+using optimizerDuck.Core.Models.Optimization.Services;
+using optimizerDuck.Core.Models.Revert.Steps;
+using optimizerDuck.Resources.Languages;
+using optimizerDuck.Services.Managers;
+
+namespace optimizerDuck.Services.OptimizationServices;
+
+public static class ServiceProcessService
+{
+ private static readonly ManagementScope Scope = new(@"\\.\root\cimv2");
+
+ /// <summary>
+ /// Get current startup type of a service
+ /// </summary>
+ private static ServiceStartupType? GetStartupType(string serviceName, ManagementObject service)
+ {
+ try
+ {
+ var startMode = service["StartMode"]?.ToString();
+
+ if (startMode is "Automatic" or "Auto")
+ {
+ var isDelayed = RegistryService.Read<int>(new RegistryItem(
+ $@"HKLM\SYSTEM\CurrentControlSet\Services\{serviceName}", "DelayedAutoStart"));
+ if (isDelayed == 1)
+ return ServiceStartupType.AutomaticDelayedStart;
+ }
+
+ return startMode switch
+ {
+ "Auto" or "Automatic" => ServiceStartupType.Automatic,
+ "Manual" => ServiceStartupType.Manual,
+ "Disabled" => ServiceStartupType.Disabled,
+ _ => null
+ };
+ }
+ catch (Exception ex)
+ {
+ ServiceTracker.LogError(ex, "Failed to get startup type for {ServiceName}", serviceName);
+ return null;
+ }
+ }
+
+ public static bool ChangeServiceStartupType(ServiceItem item)
+ {
+ var description = $"{item.Name} -> {item.StartupType}";
+ try
+ {
+ if (!Scope.IsConnected)
+ Scope.Connect();
+
+ using var searcher = new ManagementObjectSearcher(Scope,
+ new ObjectQuery($"SELECT * FROM Win32_Service WHERE Name='{item.Name.Replace("'", "''")}'"));
+
+ using var results = searcher.Get();
+ using var service = results.OfType<ManagementObject>().FirstOrDefault();
+
+ if (service == null)
+ {
+ ServiceTracker.LogInfo(
+ "[SERVICE][{Name}][FAIL][NOT_FOUND][D=0ms] startup -> {StartupType}",
+ item.Name,
+ item.StartupType
+ );
+ ServiceTracker.Track(nameof(ChangeServiceStartupType), false);
+ ServiceTracker.TrackStep(
+ "Service",
+ description,
+ false,
+ Translations.Service_Service_Error_NotFound,
+ () => Task.Run(() => ChangeServiceStartupType(item)));
+ return false;
+ }
+
+ // Record revert: backup current startup type
+ var originalStartupType = GetStartupType(item.Name, service);
+
+ var sw = Stopwatch.StartNew();
+
+ using var inParams = service.GetMethodParameters("ChangeStartMode");
+ inParams["StartMode"] = item.StartupType switch
+ {
+ ServiceStartupType.Automatic or ServiceStartupType.AutomaticDelayedStart => "Automatic",
+ ServiceStartupType.Manual => "Manual",
+ ServiceStartupType.Disabled => "Disabled",
+ _ => "Manual"
+ };
+
+ using var outParams = service.InvokeMethod("ChangeStartMode", inParams, null);
+ var resultCode = outParams?["ReturnValue"] is uint val ? val : 1;
+
+ if (resultCode == 0)
+ {
+ // Handle delayed auto start registry key
+ var registrySuccess = item.StartupType == ServiceStartupType.AutomaticDelayedStart
+ ? RegistryService.Write(new RegistryItem(
+ $@"HKLM\SYSTEM\CurrentControlSet\Services\{item.Name}",
+ "DelayedAutoStart", 1))
+ // always delete to ensure consistency
+ : RegistryService.DeleteValue(new RegistryItem(
+ $@"HKLM\SYSTEM\CurrentControlSet\Services\{item.Name}",
+ "DelayedAutoStart"));
+
+ if (registrySuccess && originalStartupType.HasValue)
+ RevertManager.Record(new ServiceRevertStep
+ {
+ ServiceName = item.Name,
+ OriginalStartupType = originalStartupType.Value
+ });
+
+ sw.Stop();
+
+ ServiceTracker.LogInfo(
+ "[SERVICE][{Name}][OK][CODE=0][D={Duration}] startup -> {StartupType}",
+ item.Name,
+ sw.Elapsed.FormatTime(),
+ item.StartupType
+ );
+
+ ServiceTracker.Track(nameof(ChangeServiceStartupType), registrySuccess);
+ ServiceTracker.TrackStep(
+ "Service",
+ description,
+ registrySuccess,
+ registrySuccess ? null : Translations.Service_Service_Error_UpdateRegistryForStartupTypeFailed,
+ () => Task.Run(() => ChangeServiceStartupType(item)));
+ return registrySuccess;
+ }
+
+ ServiceTracker.LogInfo(
+ "[SERVICE][{Name}][FAIL][CODE={Code}][D={Duration}] startup -> {StartupType}",
+ item.Name,
+ resultCode,
+ sw.Elapsed.FormatTime(),
+ item.StartupType
+ );
+
+ ServiceTracker.Track(nameof(ChangeServiceStartupType), false);
+ ServiceTracker.TrackStep(
+ "Service",
+ description,
+ false,
+ string.Format(Translations.Service_Service_Error_ChangeStartModeFailedWithCode, resultCode),
+ () => Task.Run(() => ChangeServiceStartupType(item)));
+ return false;
+ }
+ catch (Exception ex)
+ {
+ ServiceTracker.LogError(
+ ex,
+ "[SERVICE][{Name}][FAIL][EXCEPTION] startup -> {StartupType}",
+ item.Name,
+ item.StartupType
+ );
+ ServiceTracker.Track(nameof(ChangeServiceStartupType), false);
+ ServiceTracker.TrackStep(
+ "Service",
+ description,
+ false,
+ ex.Message,
+ () => Task.Run(() => ChangeServiceStartupType(item)));
+ return false;
+ }
+ }
+
+ public static void ChangeServiceStartupType(params ServiceItem[] items)
+ {
+ foreach (var item in items)
+ ChangeServiceStartupType(item);
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Services/OptimizationServices/ShellService.cs b/optimizerDuck/Services/OptimizationServices/ShellService.cs
new file mode 100644
index 0000000..61dff7d
--- /dev/null
+++ b/optimizerDuck/Services/OptimizationServices/ShellService.cs
@@ -0,0 +1,234 @@
+using System.Diagnostics;
+using System.Text;
+using Microsoft.Extensions.Options;
+using optimizerDuck.Common.Extensions;
+using optimizerDuck.Core.Models.Config;
+using optimizerDuck.Core.Models.Optimization.Services;
+using optimizerDuck.Core.Models.Revert.Steps;
+using optimizerDuck.Resources.Languages;
+using optimizerDuck.Services.Managers;
+
+namespace optimizerDuck.Services.OptimizationServices;
+
+public sealed class ShellPolicy
+{
+ public static readonly ShellPolicy Default = new();
+
+ public Func<ShellResult, bool> IsSuccess { get; init; } = r => r.ExitCode == 0;
+
+ public Func<ShellResult, string?> ErrorFactory { get; init; } =
+ r => r.ExitCode == -1 // if timed out use Error.TimedOut
+ ? Translations.Service_Shell_Error_TimedOut
+ : string.IsNullOrWhiteSpace(r.Stderr) // else check stderr, if empty use exitcode, else use raw stderr
+ ? string.Format(Translations.Service_Shell_Error_ExitCode, r.ExitCode)
+ : r.Stderr;
+
+ public static ShellPolicy From(Func<ShellResult, bool> isSuccess, Func<ShellResult, string?>? errorFactory = null)
+ {
+ return new ShellPolicy
+ {
+ IsSuccess = isSuccess,
+ ErrorFactory = errorFactory ?? Default.ErrorFactory
+ };
+ }
+
+ public static ShellPolicy SuccessExitCodes(params int[] okExitCodes)
+ {
+ return From(r => okExitCodes.Contains(r.ExitCode));
+ }
+
+ public static ShellPolicy SuccessExitCodeRange(int maxOk)
+ {
+ return From(r => r.ExitCode >= 0 && r.ExitCode <= maxOk);
+ }
+}
+
+public static class ShellService
+{
+ private static IOptionsMonitor<AppSettings>? _options;
+
+ public static void Init(IOptionsMonitor<AppSettings> options)
+ {
+ _options = options;
+ }
+
+ private static ShellResult Run(
+ string fileName,
+ string arguments,
+ string command,
+ string serviceName,
+ ShellRevertStep? revertStep,
+ ShellPolicy? policy = null)
+ {
+ policy ??= ShellPolicy.Default;
+
+ var commandForUser = arguments.Contains("-EncodedCommand", StringComparison.OrdinalIgnoreCase)
+ ? command.DecodeBase64().Replace("$ProgressPreference='SilentlyContinue'; ", "")
+ : command;
+
+ var fullCommandForUser =
+ $"{fileName} {arguments.Replace("-EncodedCommand", "-Command", StringComparison.OrdinalIgnoreCase)} {commandForUser}";
+
+ var psi = new ProcessStartInfo
+ {
+ FileName = fileName,
+ Arguments = $"{arguments} {command}",
+ RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ StandardOutputEncoding = Encoding.UTF8,
+ StandardErrorEncoding = Encoding.UTF8,
+ UseShellExecute = false,
+ CreateNoWindow = true
+ };
+
+ using var process = new Process();
+ process.StartInfo = psi;
+
+ var stdoutBuilder = new StringBuilder();
+ var stderrBuilder = new StringBuilder();
+
+ process.OutputDataReceived += (_, e) =>
+ {
+ if (e.Data == null) return;
+ stdoutBuilder.AppendLine(e.Data);
+ };
+
+ process.ErrorDataReceived += (_, e) =>
+ {
+ if (e.Data == null) return;
+ stderrBuilder.AppendLine(e.Data);
+ };
+ var sw = Stopwatch.StartNew();
+
+ process.Start();
+ process.BeginOutputReadLine();
+ process.BeginErrorReadLine();
+
+ var exited =
+ process.WaitForExit(_options?.CurrentValue.Optimize.ShellTimeoutMs ?? 120000); // fallback to 2 minutes
+ var timedOut = !exited;
+
+ if (timedOut)
+ {
+ try
+ {
+ process.Kill(true);
+ }
+ catch
+ {
+ ServiceTracker.LogError(null, "Failed to kill process for timeout");
+ }
+
+ process.WaitForExit(2000); // grace drain
+ }
+
+ sw.Stop();
+ var duration = sw.Elapsed;
+ var stdout = stdoutBuilder.ToString().Trim();
+ var stderr = stderrBuilder.ToString().ParseCliXml().Trim();
+
+ var result = new ShellResult(
+ fullCommandForUser,
+ stdout,
+ stderr,
+ timedOut ? -1 : process.ExitCode, // use -1 error code for timed out
+ duration);
+
+ var success = policy.IsSuccess(result);
+
+ ServiceTracker.Track(serviceName, success);
+
+ ServiceTracker.LogInfo("[{Service}][{Status}][EC={ExitCode}][D={Duration}] {Command}",
+ serviceName,
+ timedOut ? "TIMEOUT" : success ? "OK" : "FAIL",
+ process.ExitCode,
+ duration.FormatTime(),
+ fullCommandForUser);
+
+ ServiceTracker.LogTrace("[{Service}][STDOUT] {Stdout}",
+ serviceName,
+ string.IsNullOrWhiteSpace(stdout) ? "N/A" : stdout
+ );
+ ServiceTracker.LogTrace("[{Service}][STDERR] {Stderr}",
+ serviceName,
+ string.IsNullOrWhiteSpace(stderr) ? "N/A" : stderr
+ );
+
+ var error = success ? null : policy.ErrorFactory(result);
+
+ ServiceTracker.TrackStep(
+ "Shell",
+ fullCommandForUser,
+ success,
+ error,
+ () => Task.Run(() =>
+ policy.IsSuccess(Run(fileName, arguments, command, serviceName, revertStep, policy))
+ )
+ );
+
+ if (success && revertStep is not null)
+ RevertManager.Record(revertStep);
+
+ return result;
+ }
+
+ #region Command Prompt methods
+
+ public static ShellResult CMD(string command, ShellRevertStep? revertStep = null, ShellPolicy? policy = null)
+ {
+ return Run("cmd.exe", "/c", command, nameof(CMD), revertStep, policy);
+ }
+
+ public static ShellResult CMD(string command, string revertCommand, ShellPolicy? policy = null)
+ {
+ return CMD(command, new ShellRevertStep
+ {
+ ShellType = ShellType.CMD,
+ Command = revertCommand
+ }, policy);
+ }
+
+ public static ShellResult CMD(string command, Func<string> revertCommand, ShellPolicy? policy = null)
+ {
+ return CMD(command, new ShellRevertStep
+ {
+ ShellType = ShellType.CMD,
+ Command = revertCommand()
+ }, policy);
+ }
+
+ #endregion Command Prompt methods
+
+ #region PowerShell methods
+
+ public static ShellResult PowerShell(string command, ShellRevertStep? revertStep = null, ShellPolicy? policy = null)
+ {
+ command = "$ProgressPreference='SilentlyContinue'; " + command;
+ return Run("powershell.exe",
+ "-NonInteractive -NoLogo -NoProfile -ExecutionPolicy Bypass -EncodedCommand",
+ command.EncodeBase64(),
+ nameof(PowerShell),
+ revertStep,
+ policy);
+ }
+
+ public static ShellResult PowerShell(string command, string revertCommand, ShellPolicy? policy = null)
+ {
+ return PowerShell(command, new ShellRevertStep
+ {
+ ShellType = ShellType.PowerShell,
+ Command = revertCommand
+ }, policy);
+ }
+
+ public static ShellResult PowerShell(string command, Func<string> revertCommand, ShellPolicy? policy = null)
+ {
+ return PowerShell(command, new ShellRevertStep
+ {
+ ShellType = ShellType.PowerShell,
+ Command = revertCommand()
+ }, policy);
+ }
+
+ #endregion PowerShell methods
+}
\ No newline at end of file
diff --git a/optimizerDuck/Services/ServiceTracker.cs b/optimizerDuck/Services/ServiceTracker.cs
new file mode 100644
index 0000000..0d899d3
--- /dev/null
+++ b/optimizerDuck/Services/ServiceTracker.cs
@@ -0,0 +1,141 @@
+using System.Collections.Concurrent;
+using System.Diagnostics;
+using Microsoft.Extensions.Logging;
+using optimizerDuck.Common.Extensions;
+using optimizerDuck.Core.Models.Optimization;
+
+namespace optimizerDuck.Services;
+
+public sealed class ServiceTracker : IDisposable
+{
+ private static readonly AsyncLocal<ServiceTracker?> _current = new();
+
+ private readonly ILogger _logger;
+ private readonly ConcurrentDictionary<string, Stats> _stats = new();
+ private readonly List<OperationStepResult> _steps = new();
+ private readonly Stopwatch _stopwatch;
+ private int _stepIndex;
+
+ private ServiceTracker(ILogger logger)
+ {
+ _logger = logger;
+ _stopwatch = Stopwatch.StartNew();
+ }
+
+ /// <summary>Current active tracker (null if none)</summary>
+ public static ServiceTracker? Current => _current.Value;
+
+ public void Dispose()
+ {
+ _stopwatch.Stop();
+
+ if (_stats.IsEmpty)
+ {
+ _logger.LogInformation("Completed in {Time} (no operations tracked)",
+ _stopwatch.Elapsed.FormatTime());
+ }
+ else
+ {
+ var summary = string.Join(", ", _stats.Select(kv =>
+ $"{kv.Key}: +({kv.Value.Success}) -({kv.Value.Fail})"));
+
+ _logger.LogInformation("Completed in {Time} | {Summary}",
+ _stopwatch.Elapsed.FormatTime(), summary);
+ }
+
+ _current.Value = null;
+ }
+
+ /// <summary>Begin tracking with a logger</summary>
+ public static ServiceTracker Begin(ILogger logger)
+ {
+ var tracker = new ServiceTracker(logger);
+ _current.Value = tracker;
+ return tracker;
+ }
+
+ /// <summary>Track a service operation result</summary>
+ public static void Track(string serviceName, bool success)
+ {
+ var tracker = Current;
+
+ tracker?._stats.AddOrUpdate(
+ serviceName,
+ _ => success
+ ? new Stats { Success = 1 }
+ : new Stats { Fail = 1 },
+ (_, stats) =>
+ {
+ if (success) stats.Success++;
+ else stats.Fail++;
+ return stats;
+ });
+ }
+
+
+ public static void TrackStep(string name, string description, bool success, string? error = null,
+ Func<Task<bool>>? retryAction = null)
+ {
+ var tracker = Current;
+ if (tracker == null)
+ return;
+
+ var index = ++tracker._stepIndex;
+ tracker._steps.Add(new OperationStepResult
+ {
+ Index = index,
+ Name = name,
+ Description = description,
+ Success = success,
+ Error = error,
+ RetryAction = retryAction
+ });
+ }
+
+ public IReadOnlyList<OperationStepResult> GetSteps()
+ {
+ return _steps.ToList();
+ }
+
+ /// <summary>Log a message using the current tracker's logger</summary>
+ public static void Log(LogLevel level, string message, params object[] args)
+ {
+ Current?._logger.Log(level, message, args);
+ }
+
+ /// <summary>Log debug message</summary>
+ public static void LogDebug(string message, params object[] args)
+ {
+ Log(LogLevel.Debug, message, args);
+ }
+
+ /// <summary>Log trace message</summary>
+ public static void LogTrace(string message, params object[] args)
+ {
+ Log(LogLevel.Trace, message, args);
+ }
+
+ /// <summary>Log info message</summary>
+ public static void LogInfo(string message, params object[] args)
+ {
+ Log(LogLevel.Information, message, args);
+ }
+
+ /// <summary>Log warning message</summary>
+ public static void LogWarning(string message, params object[] args)
+ {
+ Log(LogLevel.Warning, message, args);
+ }
+
+ /// <summary>Log error message</summary>
+ public static void LogError(Exception? ex, string message, params object[] args)
+ {
+ Current?._logger.LogError(ex, message, args);
+ }
+
+ private class Stats
+ {
+ public int Fail;
+ public int Success;
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/Services/StreamService.cs b/optimizerDuck/Services/StreamService.cs
new file mode 100644
index 0000000..36edfc5
--- /dev/null
+++ b/optimizerDuck/Services/StreamService.cs
@@ -0,0 +1,60 @@
+using System.IO;
+using System.Net.Http;
+using Microsoft.Extensions.Logging;
+using optimizerDuck.Common.Helpers;
+
+namespace optimizerDuck.Services;
+
+public class StreamService(ILogger<StreamService> logger)
+{
+ private HttpClient? _client;
+
+ public async Task<(bool Success, string? FilePath)> TryDownloadAsync(
+ string url,
+ string fileName)
+ {
+ var filePath = Path.Combine(Shared.ResourcesDirectory, fileName);
+
+ logger.LogInformation("Starting download from {Url} to {FilePath}", url, filePath);
+
+ try
+ {
+ Directory.CreateDirectory(Shared.ResourcesDirectory);
+ _client ??= new HttpClient();
+ using var response = await _client.GetAsync(url).ConfigureAwait(false);
+
+ logger.LogDebug("Received HTTP {StatusCode} from {Url}", response.StatusCode, url);
+
+ response.EnsureSuccessStatusCode();
+
+ await using var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.None);
+ await response.Content.CopyToAsync(fs).ConfigureAwait(false);
+
+ var length = fs.Length;
+ logger.LogInformation("Successfully downloaded {Length} bytes from {Url} to {FilePath}", length, url,
+ filePath);
+
+ return (true, filePath);
+ }
+ catch (HttpRequestException ex)
+ {
+ logger.LogError(ex, "Network error while downloading {Url}", url);
+ return (false, null);
+ }
+ catch (IOException ex)
+ {
+ logger.LogError(ex, "File I/O error while saving {FilePath}", filePath);
+ return (false, null);
+ }
+ catch (UnauthorizedAccessException ex)
+ {
+ logger.LogError(ex, "Access denied when writing to {FilePath}", filePath);
+ return (false, null);
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Unexpected error downloading {Url} to {FilePath}", url, filePath);
+ return (false, null);
+ }
+ }
+}
diff --git a/optimizerDuck/src/Core/Services/SystemInfoService.cs b/optimizerDuck/Services/SystemInfoService.cs
similarity index 55%
rename from optimizerDuck/src/Core/Services/SystemInfoService.cs
rename to optimizerDuck/Services/SystemInfoService.cs
index 377b146..7878ea3 100644
--- a/optimizerDuck/src/Core/Services/SystemInfoService.cs
+++ b/optimizerDuck/Services/SystemInfoService.cs
@@ -1,13 +1,11 @@
-using System.Management;
+using System.IO;
+using System.Management;
using System.Runtime.InteropServices;
using Microsoft.Extensions.Logging;
using Microsoft.Win32.SafeHandles;
-using optimizerDuck.UI;
-using optimizerDuck.UI.Components;
-using Spectre.Console;
-using Spectre.Console.Rendering;
+using optimizerDuck.Resources.Languages;
-namespace optimizerDuck.Core.Services;
+namespace optimizerDuck.Services;
// ============================================================================
// MODELS (Immutable Records)
@@ -30,7 +28,8 @@ public sealed record GpuInfo(
string? PnpDeviceId
)
{
- public static readonly GpuInfo Unknown = new("Unknown", "Unknown", GpuVendor.Unknown, null, null, null);
+ public static readonly GpuInfo Unknown = new(Translations.Common_Unknown, Translations.Common_Unknown,
+ GpuVendor.Unknown, null, null, null);
public override string ToString()
{
@@ -52,11 +51,12 @@ public sealed record CpuInfo(
int L3CacheKB
)
{
- public static readonly CpuInfo Unknown = new("Unknown", "Unknown", "Unknown", "Unknown", 0, 0, 0, 0, 0, 0);
+ public static readonly CpuInfo Unknown = new(Translations.Common_Unknown, Translations.Common_Unknown,
+ Translations.Common_Unknown, Translations.Common_Unknown, 0, 0, 0, 0, 0, 0);
}
public sealed record DiskVolume(
- string Name,
+ string Letter,
bool SystemDrive,
string FileSystem,
string DriveType,
@@ -65,7 +65,10 @@ public sealed record DiskVolume(
double FreeSpaceGB,
double UsedSpaceGB,
double UsedPercent,
- string DriveTypeDescription
+ string MediaType, // SSD, HDD, or Unknown
+ bool IsRemovable,
+ string? SerialNumber,
+ string? Model
);
public sealed record DiskInfo(
@@ -107,8 +110,10 @@ public sealed record OsInfo(
string LastBoot
)
{
- public static readonly OsInfo Unknown = new("Unknown", "Unknown", "Unknown", "Unknown", "Unknown", "Unknown",
- "Unknown", "Unknown");
+ public static readonly OsInfo Unknown = new(Translations.Common_Unknown, Translations.Common_Unknown,
+ Translations.Common_Unknown, Translations.Common_Unknown, Translations.Common_Unknown,
+ Translations.Common_Unknown,
+ Translations.Common_Unknown, Translations.Common_Unknown);
}
public sealed record BiosInfo(
@@ -119,7 +124,8 @@ public sealed record BiosInfo(
string SerialNumber
)
{
- public static readonly BiosInfo Unknown = new("Unknown", "Unknown", "Unknown", "Unknown", "Unknown");
+ public static readonly BiosInfo Unknown = new(Translations.Common_Unknown, Translations.Common_Unknown,
+ Translations.Common_Unknown, Translations.Common_Unknown, Translations.Common_Unknown);
}
public sealed record SystemSnapshot(
@@ -162,8 +168,9 @@ internal static class WmiHelper
}
}
- public static string GetString(ManagementObject mo, string property, string fallback = "Unknown")
+ public static string GetString(ManagementObject mo, string property, string? fallback = null)
{
+ fallback ??= Translations.Common_Unknown;
try
{
var value = mo[property];
@@ -342,7 +349,12 @@ public static class DiskHelper
private const uint FILE_SHARE_WRITE = 0x00000002;
private const uint OPEN_EXISTING = 3;
private const uint FILE_ATTRIBUTE_NORMAL = 0x80;
- private const uint GENERIC_READ = 0x80000000;
+
+ // Using 0 (FILE_READ_ATTRIBUTES or NULL access) allows us to query
+ // device metadata without requiring Administrator privileges.
+ // i know admin rights is required by default when open app but this just a fallback at least
+ private const uint GENERIC_READ = 0x0; // No access requested; allows querying info without Admin rights
+
private const uint IOCTL_STORAGE_QUERY_PROPERTY = 0x2D1400;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
@@ -358,68 +370,131 @@ public static class DiskHelper
IntPtr lpOutBuffer, uint nOutBufferSize,
out uint lpBytesReturned, IntPtr lpOverlapped);
- public static bool IsSSD(string driveLetter)
+ public static string DetectMediaType(string driveLetter)
{
- var trimmedDrive = driveLetter.TrimEnd('\\');
- if (string.IsNullOrWhiteSpace(trimmedDrive))
- return false;
+ // Try multiple detection methods
+ var seekPenalty = DetectViaSSDSeekPenalty(driveLetter);
+ if (seekPenalty != "Unknown")
+ return seekPenalty;
- using var handle = CreateFile(@"\\.\" + trimmedDrive, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, IntPtr.Zero,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, IntPtr.Zero);
+ var wmiType = DetectViaWMI(driveLetter);
+ if (wmiType != "Unknown")
+ return wmiType;
- if (handle.IsInvalid)
- return false;
+ return "Unknown";
+ }
- var query = new STORAGE_PROPERTY_QUERY
+ private static string DetectViaSSDSeekPenalty(string driveLetter)
+ {
+ try
{
- PropertyId = STORAGE_PROPERTY_ID.StorageDeviceSeekPenaltyProperty,
- QueryType = STORAGE_QUERY_TYPE.PropertyStandardQuery,
- AdditionalParameters = new byte[1]
- };
+ var trimmedDrive = driveLetter.TrimEnd('\\', '/');
+ if (string.IsNullOrWhiteSpace(trimmedDrive))
+ return "Unknown";
- var querySize = Marshal.SizeOf(query);
- var resultSize = Marshal.SizeOf<DEVICE_SEEK_PENALTY_DESCRIPTOR>();
+ using var handle = CreateFile(@"\\.\" + trimmedDrive, GENERIC_READ,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, IntPtr.Zero,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, IntPtr.Zero);
- var queryPtr = IntPtr.Zero;
- var resultPtr = IntPtr.Zero;
+ if (handle.IsInvalid)
+ return "Unknown";
- try
- {
- queryPtr = Marshal.AllocHGlobal(querySize);
- Marshal.StructureToPtr(query, queryPtr, false);
+ var query = new STORAGE_PROPERTY_QUERY
+ {
+ PropertyId = STORAGE_PROPERTY_ID.StorageDeviceSeekPenaltyProperty,
+ QueryType = STORAGE_QUERY_TYPE.PropertyStandardQuery,
+ AdditionalParameters = new byte[1]
+ };
- resultPtr = Marshal.AllocHGlobal(resultSize);
+ var querySize = Marshal.SizeOf(query);
+ var resultSize = Marshal.SizeOf<DEVICE_SEEK_PENALTY_DESCRIPTOR>();
- var success = DeviceIoControl(handle, IOCTL_STORAGE_QUERY_PROPERTY,
- queryPtr, (uint)querySize,
- resultPtr, (uint)resultSize,
- out _, IntPtr.Zero);
+ var queryPtr = IntPtr.Zero;
+ var resultPtr = IntPtr.Zero;
+
+ try
+ {
+ queryPtr = Marshal.AllocHGlobal(querySize);
+ Marshal.StructureToPtr(query, queryPtr, false);
- if (!success)
- return false;
+ resultPtr = Marshal.AllocHGlobal(resultSize);
- var descriptor = Marshal.PtrToStructure<DEVICE_SEEK_PENALTY_DESCRIPTOR>(resultPtr);
- return !descriptor.IncursSeekPenalty;
+ var success = DeviceIoControl(handle, IOCTL_STORAGE_QUERY_PROPERTY,
+ queryPtr, (uint)querySize,
+ resultPtr, (uint)resultSize,
+ out _, IntPtr.Zero);
+
+ if (!success)
+ return "Unknown";
+
+ var descriptor = Marshal.PtrToStructure<DEVICE_SEEK_PENALTY_DESCRIPTOR>(resultPtr);
+ return descriptor.IncursSeekPenalty ? "HDD" : "SSD";
+ }
+ finally
+ {
+ if (queryPtr != IntPtr.Zero)
+ Marshal.FreeHGlobal(queryPtr);
+
+ if (resultPtr != IntPtr.Zero)
+ Marshal.FreeHGlobal(resultPtr);
+ }
}
catch
{
- return false;
+ return "Unknown";
}
- finally
+ }
+
+ private static string DetectViaWMI(string driveLetter)
+ {
+ try
{
- if (queryPtr != IntPtr.Zero)
- Marshal.FreeHGlobal(queryPtr);
+ // Get physical disk number from logical drive
+ var partitions = WmiHelper.Query(
+ $"ASSOCIATORS OF {{Win32_LogicalDisk.DeviceID='{driveLetter.TrimEnd('\\')}' }} WHERE AssocClass=Win32_LogicalDiskToPartition");
- if (resultPtr != IntPtr.Zero)
- Marshal.FreeHGlobal(resultPtr);
+ foreach (var partition in partitions)
+ {
+ var diskDrives = WmiHelper.Query(
+ $"ASSOCIATORS OF {{Win32_DiskPartition.DeviceID='{partition["DeviceID"]}'}} WHERE AssocClass=Win32_DiskDriveToDiskPartition");
+
+ foreach (var disk in diskDrives)
+ {
+ var mediaType = WmiHelper.GetString(disk, "MediaType", "").ToLowerInvariant();
+ var model = WmiHelper.GetString(disk, "Model", "").ToLowerInvariant();
+
+ // Check for SSD indicators
+ if (mediaType.Contains("ssd") || model.Contains("ssd") ||
+ model.Contains("nvme") || mediaType.Contains("fixed hard disk media"))
+ {
+ // Additional check for rotational rate
+ var capabilities = disk["Capabilities"];
+ if (capabilities != null && capabilities is ushort[] caps)
+ // Check if non-rotational (3 = Rotational, 4 = SSD)
+ if (caps.Contains((ushort)4))
+ return "SSD";
+
+ // Fallback to model name check
+ if (model.Contains("ssd") || model.Contains("nvme"))
+ return "SSD";
+ }
+
+ if (mediaType.Contains("removable"))
+ return "Unknown"; // Could be USB drive
+ }
+ }
}
+ catch
+ {
+ // Ignore errors
+ }
+
+ return "Unknown";
}
public static bool IsSystemDrive(string driveLetter)
{
var systemDrive = Path.GetPathRoot(Environment.SystemDirectory)?.TrimEnd('\\') ?? "C:";
-
return string.Equals(systemDrive, driveLetter.TrimEnd('\\'), StringComparison.OrdinalIgnoreCase);
}
@@ -463,6 +538,9 @@ internal static class DiskProvider
return Math.Round(bytes / Math.Pow(1024, 3), 2);
}
+ // Get physical disk information
+ var physicalDisks = GetPhysicalDiskInfo();
+
var volumes = DriveInfo.GetDrives()
.Where(d => d.IsReady)
.Select(drive =>
@@ -472,19 +550,26 @@ internal static class DiskProvider
var usedBytes = totalBytes - freeBytes;
var isSystemDrive = DiskHelper.IsSystemDrive(drive.Name);
- var isSsd = DiskHelper.IsSSD(drive.Name);
+ var mediaType = DiskHelper.DetectMediaType(drive.Name);
+ var isRemovable = drive.DriveType == DriveType.Removable;
+
+ // Try to get disk info for this drive
+ var diskInfo = GetDiskInfoForDrive(drive.Name, physicalDisks);
return new DiskVolume(
drive.Name.TrimEnd('\\'),
isSystemDrive,
drive.DriveFormat,
drive.DriveType.ToString(),
- drive.VolumeLabel,
+ string.IsNullOrWhiteSpace(drive.VolumeLabel) ? "Local Disk" : drive.VolumeLabel,
ToGb(totalBytes),
ToGb(freeBytes),
ToGb(usedBytes),
totalBytes > 0 ? Math.Round(usedBytes * 100.0 / totalBytes, 1) : 0,
- isSsd ? "SSD" : "HDD"
+ mediaType,
+ isRemovable,
+ diskInfo?.SerialNumber,
+ diskInfo?.Model
);
})
.ToList();
@@ -496,6 +581,65 @@ internal static class DiskProvider
return DiskInfo.Unknown;
}
}
+
+ private static List<PhysicalDiskInfo> GetPhysicalDiskInfo()
+ {
+ var disks = new List<PhysicalDiskInfo>();
+ try
+ {
+ var diskDrives = WmiHelper.Query("SELECT * FROM Win32_DiskDrive");
+ foreach (var disk in diskDrives)
+ disks.Add(new PhysicalDiskInfo
+ {
+ DeviceID = WmiHelper.GetString(disk, "DeviceID"),
+ Model = WmiHelper.GetString(disk, "Model"),
+ SerialNumber = WmiHelper.GetString(disk, "SerialNumber").Trim(),
+ MediaType = WmiHelper.GetString(disk, "MediaType")
+ });
+ }
+ catch
+ {
+ // Ignore errors
+ }
+
+ return disks;
+ }
+
+ private static PhysicalDiskInfo? GetDiskInfoForDrive(string driveLetter, List<PhysicalDiskInfo> physicalDisks)
+ {
+ try
+ {
+ var letter = driveLetter.TrimEnd('\\');
+ var partitions = WmiHelper.Query(
+ $"ASSOCIATORS OF {{Win32_LogicalDisk.DeviceID='{letter}'}} WHERE AssocClass=Win32_LogicalDiskToPartition");
+
+ foreach (var partition in partitions)
+ {
+ var diskDrives = WmiHelper.Query(
+ $"ASSOCIATORS OF {{Win32_DiskPartition.DeviceID='{partition["DeviceID"]}'}} WHERE AssocClass=Win32_DiskDriveToDiskPartition");
+
+ foreach (var disk in diskDrives)
+ {
+ var deviceId = WmiHelper.GetString(disk, "DeviceID");
+ return physicalDisks.FirstOrDefault(p => p.DeviceID == deviceId);
+ }
+ }
+ }
+ catch
+ {
+ // Ignore errors
+ }
+
+ return null;
+ }
+
+ private class PhysicalDiskInfo
+ {
+ public string DeviceID { get; set; } = string.Empty;
+ public string Model { get; set; } = string.Empty;
+ public string SerialNumber { get; set; } = string.Empty;
+ public string MediaType { get; set; } = string.Empty;
+ }
}
internal static class GpuProvider
@@ -650,6 +794,7 @@ internal static class OsProvider
{
case 8 or 9 or 10 or 11 or 14 or 30 or 31 or 32:
return "Laptop";
+
case >= 1 and <= 7 or 12 or 13 or >= 15 and <= 29 or >= 33 and <= 36:
return "Desktop";
}
@@ -705,84 +850,98 @@ internal static class BiosProvider
// MAIN SERVICE (Public API)
// ============================================================================
-public static class SystemInfoService
+public sealed class SystemInfoService
{
- private static readonly SemaphoreSlim Semaphore = new(1, 1);
+ private readonly ILogger<SystemInfoService> _logger;
+ private readonly SemaphoreSlim _semaphore = new(1, 1);
+ private BiosInfo? _cachedBios;
- public static SystemSnapshot Snapshot { get; private set; } = SystemSnapshot.Unknown;
+ // Cache CPU, OS, BIOS info (doesn't change at runtime)
+ private CpuInfo? _cachedCpu;
+ private OsInfo? _cachedOs;
- public static async Task<SystemSnapshot> RefreshAsync(CancellationToken ct = default)
+ public SystemInfoService(ILogger<SystemInfoService> logger)
{
- await Semaphore.WaitAsync(ct).ConfigureAwait(false);
+ _logger = logger;
+ }
+
+ public SystemSnapshot Snapshot { get; private set; } = SystemSnapshot.Unknown;
+
+ public async Task<SystemSnapshot> RefreshAsync(CancellationToken ct = default)
+ {
+ await _semaphore.WaitAsync(ct).ConfigureAwait(false);
try
{
- var tasks = new Task[]
+ var (ram, gpus, disk) = await Task.Run(async () =>
{
- Task.Run(CpuProvider.Get, ct),
- Task.Run(RamProvider.Get, ct),
- Task.Run(OsProvider.Get, ct),
- Task.Run(BiosProvider.Get, ct),
- Task.Run(GpuProvider.GetAll, ct)
- };
+ var ramTask = Task.Run(RamProvider.Get, ct);
+ var gpusTask = Task.Run(GpuProvider.GetAll, ct);
+ var diskTask = Task.Run(DiskProvider.Get, ct);
- await Task.WhenAll(tasks).ConfigureAwait(false);
+ await Task.WhenAll(ramTask, gpusTask, diskTask);
+
+ return (await ramTask, await gpusTask, await diskTask);
+ }, ct);
+
+ _cachedCpu ??= await Task.Run(CpuProvider.Get, ct);
+ _cachedOs ??= await Task.Run(OsProvider.Get, ct);
+ _cachedBios ??= await Task.Run(BiosProvider.Get, ct);
- var cpu = ((Task<CpuInfo>)tasks[0]).Result;
- var ram = ((Task<RamInfo>)tasks[1]).Result;
- var os = ((Task<OsInfo>)tasks[2]).Result;
- var bios = ((Task<BiosInfo>)tasks[3]).Result;
- var gpus = ((Task<IReadOnlyList<GpuInfo>>)tasks[4]).Result;
var primaryGpu = GpuProvider.GetPrimary(gpus);
- var disk = DiskProvider.Get();
- var snapshot = new SystemSnapshot(cpu, ram, os, bios, gpus, primaryGpu, disk);
+ var snapshot = new SystemSnapshot(_cachedCpu, ram, _cachedOs, _cachedBios, gpus, primaryGpu, disk);
Snapshot = snapshot;
return snapshot;
}
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Failed to refresh system info");
+ return SystemSnapshot.Unknown;
+ }
finally
{
- Semaphore.Release();
+ _semaphore.Release();
}
}
- public static void GetSummary(ILogger log)
+ public void LogSummary()
{
try
{
- log.LogDebug("OS : {OsName} {OsEdition} [{OsArchitecture}] ({OsDeviceType})",
+ _logger.LogInformation("OS : {OsName} {OsEdition} [{OsArchitecture}] ({OsDeviceType})",
Snapshot.Os.Name, Snapshot.Os.Edition, Snapshot.Os.Architecture, Snapshot.Os.DeviceType);
- LogGpuSummary(log);
+ LogGpuSummary();
- log.LogDebug("CPU: {CpuName} [{CpuVendor}] ({CpuCores} Cores/{CpuThreads} Threads)",
+ _logger.LogInformation("CPU: {CpuName} [{CpuVendor}] ({CpuCores} Cores/{CpuThreads} Threads)",
Snapshot.Cpu.Name, Snapshot.Cpu.Vendor, Snapshot.Cpu.Cores, Snapshot.Cpu.Threads);
- log.LogDebug("RAM: {RamTotalGb:F1} GB [{RamModules} Module(s)] (Used: {RamUsedGB:F1} GB)",
+ _logger.LogInformation("RAM: {RamTotalGb:F1} GB [{RamModules} Module(s)] (Used: {RamUsedGB:F1} GB)",
Snapshot.Ram.TotalGB, Snapshot.Ram.Modules.Count, Snapshot.Ram.UsedGB);
foreach (var volume in Snapshot.Disk.Volumes)
{
var systemDrive = volume.SystemDrive ? " [System Drive]" : "";
- log.LogDebug(
- "Disk {VolumeName}{SystemDrive} [{VolumeDriveType}] {VolumeTotalSizeGb:F1} GB (Free: {VolumeFreeSpaceGb:F1} GB)",
- volume.Name, systemDrive, volume.DriveTypeDescription, volume.TotalSizeGB, volume.FreeSpaceGB);
+ var modelInfo = !string.IsNullOrEmpty(volume.Model) ? $" - {volume.Model}" : "";
+ _logger.LogInformation(
+ "Disk {VolumeLetter}{SystemDrive} [{MediaType}] {VolumeTotalSizeGb:F1} GB (Free: {VolumeFreeSpaceGb:F1} GB){ModelInfo}",
+ volume.Letter, systemDrive, volume.MediaType, volume.TotalSizeGB, volume.FreeSpaceGB, modelInfo);
}
}
catch (Exception ex)
{
- log.LogError(ex, "Failed to log system summary.");
+ _logger.LogError(ex, "Failed to log system summary");
}
}
- private static void LogGpuSummary(ILogger log)
+ private void LogGpuSummary()
{
var gpuCount = Snapshot.Gpus.Count;
-
if (gpuCount == 0 || (gpuCount == 1 && Snapshot.Gpus[0] == GpuInfo.Unknown))
{
- log.LogDebug("GPU: None detected");
+ _logger.LogWarning("GPU: None detected");
return;
}
@@ -790,7 +949,7 @@ public static class SystemInfoService
{
var gpu = Snapshot.Gpus[0];
var memoryInfo = gpu.MemoryMB.HasValue ? $" ({gpu.MemoryMB.Value / 1024.0:F0} GB)" : "";
- log.LogDebug("GPU: {GpuName} [{GpuVendor}]{MemoryInfo}", gpu.Name, gpu.Vendor, memoryInfo);
+ _logger.LogInformation("GPU: {GpuName} [{GpuVendor}]{MemoryInfo}", gpu.Name, gpu.Vendor, memoryInfo);
return;
}
@@ -800,7 +959,7 @@ public static class SystemInfoService
var memoryInfoPrimary = Snapshot.PrimaryGpu.MemoryMB.HasValue
? $" ({Snapshot.PrimaryGpu.MemoryMB.Value / 1024.0:F0} GB)"
: "";
- log.LogDebug("GPU (Primary): {PrimaryGpuName} [{PrimaryGpuVendor}]{MemoryInfo}",
+ _logger.LogInformation("GPU (Primary): {PrimaryGpuName} [{PrimaryGpuVendor}]{MemoryInfo}",
Snapshot.PrimaryGpu.Name, Snapshot.PrimaryGpu.Vendor, memoryInfoPrimary);
for (var index = 0; index < Snapshot.Gpus.Count; index++)
@@ -809,261 +968,15 @@ public static class SystemInfoService
&& Snapshot.Gpus[index].Vendor == Snapshot.PrimaryGpu.Vendor)
continue;
-
var gpu = Snapshot.Gpus[index];
var memoryInfo = gpu.MemoryMB.HasValue
? $" [{gpu.MemoryMB.Value / 1024.0:F0} GB]"
: "";
- log.LogDebug("GPU ({GpuIndex}): {GpuName} ({GpuVendor}){MemoryInfo}",
+ _logger.LogInformation("GPU ({GpuIndex}): {GpuName} ({GpuVendor}){MemoryInfo}",
index + 1, gpu.Name, gpu.Vendor, memoryInfo);
}
- log.LogDebug("Total GPUs : {GpuCount}", gpuCount);
- }
- }
-
- public static Panel? GetDetailedPanel(SystemSnapshot s, ILogger log)
- {
- try
- {
- // Operating System Information
- var osGroup = new List<IRenderable>
- {
- new Rule("Operating System Overview") { Style = Theme.Primary },
- new Markup($"[{Theme.Info}]Name :[/] [bold]{s.Os.Name}[/]"),
- new Markup($"[{Theme.Info}]Version :[/] [{Theme.Success}]{s.Os.Version}[/]"),
- new Markup($"[{Theme.Info}]Build :[/] [{Theme.Success}]{s.Os.BuildNumber}[/]"),
- new Markup($"[{Theme.Info}]Edition :[/] [{Theme.Warning}]{s.Os.Edition}[/]"),
- new Markup($"[{Theme.Info}]Architecture :[/] [bold]{s.Os.Architecture}[/]"),
- new Markup($"[{Theme.Info}]Device Type :[/] [bold]{s.Os.DeviceType}[/]"),
- new Markup($"[{Theme.Info}]Installed On :[/] [{Theme.Success}]{s.Os.InstallDate}[/]"),
- new Markup($"[{Theme.Info}]Last Boot :[/] [{Theme.Success}]{s.Os.LastBoot}[/]")
- };
-
- // BIOS Information
- var biosGroup = new List<IRenderable>
- {
- new Rule("BIOS Details") { Style = Theme.Success },
- new Markup($"[{Theme.Info}]Manufacturer :[/] [bold]{Safe(s.Bios.Manufacturer)}[/]"),
- new Markup($"[{Theme.Info}]Version :[/] [{Theme.Success}]{Safe(s.Bios.Version)}[/]"),
- new Markup($"[{Theme.Info}]Release Date :[/] [{Theme.Success}]{Safe(s.Bios.ReleaseDate)}[/]"),
- new Markup($"[{Theme.Info}]SMBIOS Revision :[/] [{Theme.Success}]{Safe(s.Bios.SmbiosVersion)}[/]")
- };
-
- // CPU Information
- var cpuVendorColor = s.Cpu.Vendor switch
- {
- "AMD" => Theme.Error,
- "Intel" => Theme.Info,
- _ => Theme.Muted
- };
- var cpuGroup = new List<IRenderable>
- {
- new Rule("CPU Details") { Style = Theme.Info },
- new Markup($"[{Theme.Info}]Name :[/] [bold]{Safe(s.Cpu.Name)}[/]"),
- new Markup($"[{Theme.Info}]Vendor :[/] [{cpuVendorColor}]{Safe(s.Cpu.Vendor)}[/]"),
- new Markup($"[{Theme.Info}]Manufacturer :[/] [bold]{Safe(s.Cpu.Manufacturer)}[/]"),
- new Markup($"[{Theme.Info}]Physical Cores :[/] [{Theme.Success}]{s.Cpu.Cores}[/]"),
- new Markup($"[{Theme.Info}]Logical Threads :[/] [{Theme.Success}]{s.Cpu.Threads}[/]"),
- new Markup($"[{Theme.Info}]Architecture :[/] [bold]{s.Cpu.Architecture}[/]"),
- new Markup($"[{Theme.Info}]Max Clock :[/] [{Theme.Warning}]{s.Cpu.MaxClockMHz}[/] [dim]MHz[/]"),
- new Markup(
- $"[{Theme.Info}]Current Clock :[/] [{Theme.Warning}]{s.Cpu.CurrentClockMHz}[/] [dim]MHz[/]"),
- new Markup($"[{Theme.Info}]L2 Cache :[/] [{Theme.Success}]{s.Cpu.L2CacheKB}[/] [dim]KB[/]"),
- new Markup($"[{Theme.Info}]L3 Cache :[/] [{Theme.Success}]{s.Cpu.L3CacheKB}[/] [dim]KB[/]")
- };
-
- // RAM Information
- var usedColor = s.Ram.UsedPercent > 80 ? Theme.Error : Theme.Warning;
- var ramGroup = new List<IRenderable>
- {
- new Rule("Memory Overview") { Style = new Style(Color.Yellow) },
-
- new Markup(
- $"[{Theme.Info}]Total Installed :[/] [{Theme.Success}]{s.Ram.TotalGB:F2}[/] [dim]GB[/] [dim]([/][{Theme.Success}]{s.Ram.TotalMB}[/] [dim]MB)[/]"),
- new Markup($"[{Theme.Info}]Available :[/] [{Theme.Success}]{s.Ram.AvailableGB:F2}[/] [dim]GB[/]"),
- new Markup($"[{Theme.Info}]Current Usage :[/] [{usedColor}]{s.Ram.UsedPercent:F1}%[/]"),
- new BreakdownChart()
- .Width(50)
- .UseValueFormatter(v => $"{v:F2} GB")
- .AddItem(
- "Used",
- s.Ram.UsedGB,
- Color.FromHex(Theme.Warning))
- .AddItem(
- "Available",
- s.Ram.AvailableGB,
- Color.FromHex(Theme.Success))
- };
-
- if (s.Ram.Modules.Count > 0)
- {
- ramGroup.Add(new Markup(
- $"[{Theme.Info}]Detected Modules:[/] [{Theme.Success}]{s.Ram.Modules.Count}[/]"));
- for (var i = 0; i < s.Ram.Modules.Count; i++)
- {
- var module = s.Ram.Modules[i];
- ramGroup.Add(new Markup(
- $" [{Theme.Info}]Module {i + 1} :[/] [{Theme.Success}]{module.CapacityGB:F2}[/] [dim]GB @[/] [{Theme.Warning}]{module.SpeedMHz}[/] [dim]MHz[/]"));
- ramGroup.Add(
- new Markup($" [dim]Manufacturer :[/] [{Theme.Info}]{Safe(module.Manufacturer)}[/]"));
- ramGroup.Add(new Markup($" [dim]Part Number :[/] [bold]{Safe(module.PartNumber)}[/]"));
- ramGroup.Add(new Markup($" [dim]Slot :[/] [bold]{Safe(module.DeviceLocator)}[/]"));
- }
- }
-
- // Disk Information
- var diskGroup = new List<IRenderable>
- {
- new Rule("Storage Overview") { Style = Theme.Info }
- };
-
- foreach (var volume in s.Disk.Volumes)
- {
- var usedDiskColor = volume.UsedPercent > 90 ? Theme.Error : Theme.Warning;
- var systemDrive = volume.SystemDrive ? $" [{Theme.Success}][[System Volume]][/]" : "";
-
- diskGroup.Add(new Markup($"[{Theme.Info}]{volume.Name} [bold white]{volume.Label}[/]{systemDrive}[/]"));
- diskGroup.Add(
- new Markup($" [{Theme.Info}]Media Type :[/] [bold]{volume.DriveTypeDescription}[/]"));
- diskGroup.Add(new Markup(
- $" [{Theme.Info}]Total Capacity :[/] [{Theme.Success}]{volume.TotalSizeGB:F2}[/] [dim]GB[/]"));
- diskGroup.Add(new Markup(
- $" [{Theme.Info}]Used Capacity :[/] [{Theme.Warning}]{volume.UsedSpaceGB:F2}[/] [dim]GB[/]"));
- diskGroup.Add(new Markup(
- $" [{Theme.Info}]Free Capacity :[/] [{usedDiskColor}]{volume.FreeSpaceGB:F2}[/] [dim]GB[/]"));
- diskGroup.Add(new BreakdownChart()
- .Width(50)
- .UseValueFormatter(v => $"{v:F2} GB")
- .AddItem(
- "Used",
- volume.UsedSpaceGB,
- Color.FromHex(usedDiskColor))
- .AddItem(
- "Available",
- volume.FreeSpaceGB,
- Color.FromHex(Theme.Success)));
- }
-
- // GPU Information
- var gpuCount = s.Gpus.Count;
- var gpuGroup = new List<IRenderable>();
-
- switch (gpuCount)
- {
- case 0:
- case 1 when s.Gpus[0] == GpuInfo.Unknown:
- gpuGroup.Add(new Rule("GPU Status") { Style = new Style(Color.Red) });
- gpuGroup.Add(new Markup($"[{Theme.Error}]No discrete GPUs were detected.[/]"));
- break;
- case 1:
- {
- gpuGroup.Add(new Rule("Graphics Adapter") { Style = new Style(Color.Green) });
- var gpu = s.Gpus[0];
-
- var vendorColor = gpu.Vendor switch
- {
- GpuVendor.NVIDIA => Theme.Success,
- GpuVendor.AMD => Theme.Error,
- GpuVendor.Intel => Theme.Accent,
- _ => Theme.Muted
- };
-
- gpuGroup.Add(new Markup($"[{Theme.Info}]Name :[/] [bold]{Safe(gpu.Name)}[/]"));
- gpuGroup.Add(new Markup($"[{Theme.Info}]Vendor :[/] [{vendorColor}]{gpu.Vendor}[/]"));
- gpuGroup.Add(new Markup(
- $"[{Theme.Info}]Driver Version :[/] [{Theme.Warning}]{Safe(gpu.DriverVersion)}[/]"));
-
- if (gpu.MemoryMB.HasValue)
- gpuGroup.Add(new Markup(
- $"[{Theme.Info}]Frame Buffer :[/] [{Theme.Success}]{gpu.MemoryMB.Value / 1024.0:F2}[/] [dim]GB[/] [dim]([/][{Theme.Success}]{gpu.MemoryMB.Value}[/] [dim]MB)[/]")
- );
-
- if (!string.IsNullOrEmpty(gpu.DeviceId))
- gpuGroup.Add(new Markup($"[{Theme.Info}]Device ID :[/] [dim]{Safe(gpu.DeviceId)}[/]"));
-
- if (!string.IsNullOrEmpty(gpu.PnpDeviceId))
- gpuGroup.Add(
- new Markup($"[{Theme.Info}]PCI Identifier :[/] [dim]{Safe(gpu.PnpDeviceId)}[/]"));
- break;
- }
- default:
- {
- gpuGroup.Add(new Rule($"GPU Inventory ({gpuCount} adapters)") { Style = new Style(Color.Green) });
- for (var i = 0; i < s.Gpus.Count; i++)
- {
- var gpu = s.Gpus[i];
- var isPrimary = s.PrimaryGpu != null && gpu.Name == s.PrimaryGpu.Name
- ? $" [{Theme.Primary}][[Primary Adapter]][/]"
- : "";
- var vendorColor = gpu.Vendor switch
- {
- GpuVendor.NVIDIA => Theme.Success,
- GpuVendor.AMD => Theme.Error,
- GpuVendor.Intel => Theme.Accent,
- _ => Theme.Muted
- };
-
- gpuGroup.Add(new Markup($"[{Theme.Info}]GPU {i + 1}{isPrimary}:[/]"));
- gpuGroup.Add(new Markup($" [{Theme.Info}]Name :[/] [bold]{Safe(gpu.Name)}[/]"));
- gpuGroup.Add(
- new Markup($" [{Theme.Info}]Vendor :[/] [{vendorColor}]{gpu.Vendor}[/]"));
- gpuGroup.Add(new Markup(
- $" [{Theme.Info}]Driver :[/] [{Theme.Warning}]{Safe(gpu.DriverVersion)}[/]"));
-
- if (gpu.MemoryMB.HasValue)
- gpuGroup.Add(new Markup(
- $" [{Theme.Info}]Frame Buffer :[/] [{Theme.Success}]{gpu.MemoryMB.Value / 1024.0:F2}[/] [dim]GB[/] [dim]([/][{Theme.Success}]{gpu.MemoryMB.Value}[/] [dim]MB)[/]"));
-
- if (!string.IsNullOrEmpty(gpu.DeviceId))
- gpuGroup.Add(
- new Markup($" [{Theme.Info}]Device ID :[/] [dim]{Safe(gpu.DeviceId)}[/]"));
-
- if (!string.IsNullOrEmpty(gpu.PnpDeviceId))
- gpuGroup.Add(
- new Markup($" [{Theme.Info}]PCI Identifier :[/] [dim]{Safe(gpu.PnpDeviceId)}[/]"));
- }
-
- break;
- }
- }
-
-
- // Combine all groups
- var allGroups = new List<IRenderable>();
- allGroups.AddRange(osGroup);
- allGroups.Add(Text.Empty);
- allGroups.AddRange(biosGroup);
- allGroups.Add(Text.Empty);
- allGroups.AddRange(cpuGroup);
- allGroups.Add(Text.Empty);
- allGroups.AddRange(ramGroup);
- allGroups.Add(Text.Empty);
- allGroups.AddRange(diskGroup);
- allGroups.Add(Text.Empty);
- allGroups.AddRange(gpuGroup);
-
- var panel = new Panel(new Rows(allGroups))
- {
- Border = BoxBorder.Rounded,
- BorderStyle = Theme.PrimaryMuted,
- Width = 90
- };
-
- return panel;
- }
- catch (Exception ex)
- {
- log.LogError(ex, "Failed to generate detailed system info panel.");
- var details =
- $"This is an [{Theme.Error}]unhandled exception[/] that occurred while generating the detailed system information panel.";
- PromptDialog.Exception(ex, "An error occurred while displaying system information.", details);
- return null;
+ _logger.LogInformation("Total GPUs : {GpuCount}", gpuCount);
}
}
-
- private static string Safe(string? s)
- {
- return Markup.Escape(s ?? "");
- }
}
\ No newline at end of file
diff --git a/optimizerDuck/UI/ViewModels/Dialogs/OptimizationDetailsViewModel.cs b/optimizerDuck/UI/ViewModels/Dialogs/OptimizationDetailsViewModel.cs
new file mode 100644
index 0000000..b8139cd
--- /dev/null
+++ b/optimizerDuck/UI/ViewModels/Dialogs/OptimizationDetailsViewModel.cs
@@ -0,0 +1,29 @@
+using System.Diagnostics;
+using System.IO;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+using optimizerDuck.Common.Helpers;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Services.Managers;
+
+namespace optimizerDuck.UI.ViewModels.Dialogs;
+
+public partial class OptimizationDetailsViewModel(IOptimization optimization) : ObservableObject
+{
+ public IOptimization Optimization { get; } = optimization;
+
+ [RelayCommand]
+ private async Task OpenRevertFileAsync()
+ {
+ var revertData = await RevertManager.IsAppliedAsync(Optimization.Id);
+ if (!revertData) return;
+
+ var filePath = Path.Combine(Shared.RevertDirectory, Optimization.Id + ".json");
+ Process.Start(new ProcessStartInfo
+ {
+ FileName = "explorer.exe",
+ Arguments = $"/select,\"{filePath}\"",
+ UseShellExecute = true
+ });
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/ViewModels/Dialogs/OptimizationResultDialogViewModel.cs b/optimizerDuck/UI/ViewModels/Dialogs/OptimizationResultDialogViewModel.cs
new file mode 100644
index 0000000..d4679df
--- /dev/null
+++ b/optimizerDuck/UI/ViewModels/Dialogs/OptimizationResultDialogViewModel.cs
@@ -0,0 +1,17 @@
+using System.Collections.ObjectModel;
+using CommunityToolkit.Mvvm.ComponentModel;
+using optimizerDuck.Core.Models.Optimization;
+
+namespace optimizerDuck.UI.ViewModels.Dialogs;
+
+public class OptimizationResultDialogViewModel : ObservableObject
+{
+ public OptimizationResultDialogViewModel(IEnumerable<OperationStepResult> failedSteps)
+ {
+ FailedSteps = new ObservableCollection<OperationStepResult>(failedSteps);
+ }
+
+ public ObservableCollection<OperationStepResult> FailedSteps { get; }
+
+ public int FailedCount => FailedSteps.Count;
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/ViewModels/Dialogs/ProcessingOptimizationViewModel.cs b/optimizerDuck/UI/ViewModels/Dialogs/ProcessingOptimizationViewModel.cs
new file mode 100644
index 0000000..a5a4699
--- /dev/null
+++ b/optimizerDuck/UI/ViewModels/Dialogs/ProcessingOptimizationViewModel.cs
@@ -0,0 +1,25 @@
+using CommunityToolkit.Mvvm.ComponentModel;
+using optimizerDuck.Core.Models.UI;
+
+namespace optimizerDuck.UI.ViewModels.Dialogs;
+
+public partial class ProcessingOptimizationViewModel : ObservableObject
+{
+ [ObservableProperty] private bool _isIndeterminate;
+ [ObservableProperty] private string? _message;
+ [ObservableProperty] private int _total;
+ [ObservableProperty] private int _value;
+
+ public ProcessingOptimizationViewModel()
+ {
+ ProgressReporter = new Progress<ProcessingProgress>(p =>
+ {
+ IsIndeterminate = p.IsIndeterminate;
+ Message = p.Message;
+ Value = p.Value;
+ Total = p.Total;
+ });
+ }
+
+ public IProgress<ProcessingProgress> ProgressReporter { get; }
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/ViewModels/Optimizer/OptimizationCategoryViewModel.cs b/optimizerDuck/UI/ViewModels/Optimizer/OptimizationCategoryViewModel.cs
new file mode 100644
index 0000000..f093540
--- /dev/null
+++ b/optimizerDuck/UI/ViewModels/Optimizer/OptimizationCategoryViewModel.cs
@@ -0,0 +1,361 @@
+using System.Collections.ObjectModel;
+using System.Windows.Controls;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+using Microsoft.Extensions.Logging;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.Core.Models.Optimization;
+using optimizerDuck.Core.Models.UI;
+using optimizerDuck.Resources.Languages;
+using optimizerDuck.Services;
+using optimizerDuck.UI.ViewModels.Dialogs;
+using optimizerDuck.UI.Views.Dialogs;
+using Wpf.Ui;
+using Wpf.Ui.Controls;
+using TextBlock = Wpf.Ui.Controls.TextBlock;
+
+namespace optimizerDuck.UI.ViewModels.Optimizer;
+
+public partial class OptimizationCategoryViewModel : ViewModel
+{
+ private readonly IContentDialogService _contentDialogService;
+ private readonly ILogger<OptimizationCategoryViewModel> _logger;
+ private readonly OptimizationService _optimizationService;
+ private readonly ISnackbarService _snackbarService;
+ private readonly IOptimizationCategory _category;
+
+ private bool _isApplied;
+
+ [ObservableProperty] private ObservableCollection<IOptimization> _optimizations = [];
+
+ public OptimizationCategoryViewModel(
+ IOptimizationCategory category,
+ OptimizationService optimizationService,
+ ISnackbarService snackbarService,
+ IContentDialogService contentDialogService,
+ ILogger<OptimizationCategoryViewModel> logger)
+ {
+ _category = category;
+ _optimizationService = optimizationService;
+ _snackbarService = snackbarService;
+ _logger = logger;
+ _contentDialogService = contentDialogService;
+ }
+
+ public override async Task OnNavigatedToAsync()
+ {
+ await LoadOptimizationStatesAsync();
+ }
+
+ private async Task LoadOptimizationStatesAsync()
+ {
+ if (Optimizations.Count > 0) return;
+
+ foreach (var optimization in _category.Optimizations)
+ {
+ Optimizations.Add(optimization);
+ await Task.Delay(10);
+ }
+ }
+
+ // Keep the progress dialog visible while long-running work is running.
+ private async Task<T> RunWithProcessingDialogAsync<T>(
+ IOptimization optimization,
+ Func<IProgress<ProcessingProgress>, Task<T>> action)
+ {
+ var viewModel = new ProcessingOptimizationViewModel();
+ var dialog = new ContentDialog
+ {
+ Title = BuildDialogTitle(optimization),
+ Content = new ProcessingOptimizationDialog { DataContext = viewModel },
+ IsFooterVisible = false
+ };
+
+ _ = _contentDialogService.ShowAsync(dialog, CancellationToken.None);
+
+ try
+ {
+ return await action(viewModel.ProgressReporter);
+ }
+ finally
+ {
+ dialog.Hide();
+ }
+ }
+
+ private async Task<RetryOutcome> HandleFailedStepsAsync(IOptimization optimization,
+ List<OperationStepResult> failedSteps, bool isRevert)
+ {
+ if (failedSteps.Count == 0)
+ return RetryOutcome.None;
+
+ // Always keep steps ordered by their original index for a stable UI.
+ var currentFailed = failedSteps.OrderBy(s => s.Index).ToList();
+ while (currentFailed.Count > 0)
+ {
+ var dialogViewModel = new OptimizationResultDialogViewModel(currentFailed);
+ var dialogContent = new OptimizationResultDialog { DataContext = dialogViewModel };
+
+ var dialog = new ContentDialog
+ {
+ Title = BuildDialogTitle(optimization),
+ Content = dialogContent,
+ PrimaryButtonText = Translations.Button_Retry,
+ CloseButtonText = Translations.Button_Cancel
+ };
+
+ var result = await _contentDialogService.ShowAsync(dialog, CancellationToken.None);
+ if (result != ContentDialogResult.Primary)
+ return RetryOutcome.Skipped;
+
+ // Retry only the remaining failed steps. For revert, keep reverse order.
+ if (isRevert)
+ {
+ currentFailed = (await RunWithProcessingDialogAsync(
+ optimization,
+ progress => OptimizationService.RetryFailedStepsAsync(
+ currentFailed,
+ true,
+ progress)))
+ .OrderByDescending(s => s.Index)
+ .ToList();
+
+ if (currentFailed.Count == 0)
+ {
+ await OptimizationService.UpdateOptimizationStateAsync(optimization);
+ return RetryOutcome.Succeeded;
+ }
+ }
+ else
+ {
+ currentFailed = (await RunWithProcessingDialogAsync(
+ optimization,
+ progress => OptimizationService.RetryFailedStepsAsync(
+ currentFailed,
+ false,
+ progress)))
+ .OrderBy(s => s.Index)
+ .ToList();
+
+ if (currentFailed.Count == 0) return RetryOutcome.Succeeded;
+ }
+ }
+
+ return RetryOutcome.Succeeded;
+ }
+
+ private async Task HandleRestorePointAsync()
+ {
+ var dialogContent = new RestorePointDialog();
+ var dialog = new ContentDialog
+ {
+ Title = Translations.RestorePoint_Title,
+ Content = dialogContent,
+
+ PrimaryButtonText = Translations.Button_Ok,
+ CloseButtonText = Translations.Button_Cancel
+ };
+
+ var result = await _contentDialogService.ShowAsync(dialog, CancellationToken.None);
+ }
+
+ private static StackPanel BuildDialogTitle(IOptimization optimization)
+ {
+ return new StackPanel
+ {
+ Children =
+ {
+ new TextBlock
+ {
+ FontTypography = FontTypography.Caption,
+ Appearance = TextColor.Disabled,
+ Text = optimization.Id.ToString()
+ },
+ new TextBlock
+ {
+ FontTypography = FontTypography.Subtitle,
+ Text = optimization.Name
+ }
+ }
+ };
+ }
+
+ private enum RetryOutcome
+ {
+ None,
+ Succeeded,
+ Skipped
+ }
+
+ #region Commands
+
+ [RelayCommand]
+ private async Task ToggleOptimizationAsync(IOptimization optimization)
+ {
+ if (!_isApplied)
+ {
+ await HandleRestorePointAsync();
+ _isApplied = true;
+ }
+
+ // Keep a stable reference to the previous state in case we need to roll back UI changes.
+ var wasApplied = await OptimizationService.IsAppliedAsync(optimization.Id);
+ try
+ {
+ // Apply optimization if not already applied
+ if (!wasApplied)
+ {
+ _logger.LogInformation("===== START applying optimization {OptimizationName} ({OptimizationId}) =====",
+ optimization.OptimizationKey, optimization.Id);
+ var applyResult = await RunWithProcessingDialogAsync(
+ optimization,
+ progress => _optimizationService.ApplyAsync(optimization, progress));
+
+ await OptimizationService.UpdateOptimizationStateAsync(optimization);
+
+ // If result status is Failed, we can't retry it
+ // We just need to show the error message and let the user know
+ // It's "not possible" to retry failed steps and save revert data again
+ if (applyResult.Status == OptimizationSuccessResult.Failed)
+ {
+ _snackbarService.Show(
+ Translations.Optimization_Apply_Snackbar_Error_Title,
+ applyResult.Message,
+ ControlAppearance.Danger,
+ new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
+ TimeSpan.FromSeconds(5));
+ return;
+ }
+
+ // Retry only if there are some successful steps and some failed steps
+ var retryOutcome = await HandleFailedStepsAsync(
+ optimization,
+ applyResult.FailedSteps,
+ false);
+
+ // If applied successfully or retry succeeded, mark as applied
+ var succeeded = applyResult.Status == OptimizationSuccessResult.Success ||
+ retryOutcome == RetryOutcome.Succeeded;
+
+ // If retry skipped, mark as partially applied
+ var partial = retryOutcome == RetryOutcome.Skipped;
+
+ // If retry failed, mark as failed
+ var failed = retryOutcome == RetryOutcome.None &&
+ applyResult.Status != OptimizationSuccessResult.Success;
+
+ // If retry skipped or failed, mark as failed
+ if (failed)
+ {
+ _snackbarService.Show(
+ Translations.Optimization_Apply_Snackbar_Error_Title,
+ applyResult.Message,
+ ControlAppearance.Danger,
+ new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
+ TimeSpan.FromSeconds(5));
+ }
+
+ if (partial)
+ {
+ _snackbarService.Show(
+ Translations.Optimization_Apply_Snackbar_Error_Title,
+ applyResult.Message,
+ ControlAppearance.Caution,
+ new SymbolIcon { Symbol = SymbolRegular.Warning24, Filled = true },
+ TimeSpan.FromSeconds(5));
+ }
+
+ if (applyResult.Exception != null)
+ _logger.LogError(applyResult.Exception, "Failed to apply {Name}", optimization.OptimizationKey);
+ else if (succeeded)
+ _logger.LogInformation("Successfully applied {Name}", optimization.OptimizationKey);
+ else if (partial)
+ _logger.LogWarning("Partially applied {Name}", optimization.OptimizationKey);
+ else
+ _logger.LogWarning("Failed to apply {Name}", optimization.OptimizationKey);
+
+ _logger.LogInformation("===== END applying optimization {OptimizationName} ({OptimizationId}) =====",
+ optimization.OptimizationKey, optimization.Id);
+ }
+ else
+ {
+ // Revert optimization if already applied
+ _logger.LogInformation("===== START reverting optimization {OptimizationName} ({OptimizationId}) =====",
+ optimization.OptimizationKey, optimization.Id);
+
+ var revertResult = await RunWithProcessingDialogAsync(
+ optimization,
+ progress => _optimizationService.RevertAsync(optimization, progress));
+
+ // Revert removes data regardless of failures, so state should be refreshed immediately.
+ await OptimizationService.UpdateOptimizationStateAsync(optimization);
+
+ var retryOutcome = await HandleFailedStepsAsync(
+ optimization,
+ revertResult.FailedStepDetails,
+ true);
+
+ var succeeded = revertResult.Success || retryOutcome == RetryOutcome.Succeeded;
+ var partial = retryOutcome == RetryOutcome.Skipped;
+ var failed = retryOutcome == RetryOutcome.None && !revertResult.Success;
+
+ if (failed)
+ _snackbarService.Show(
+ Translations.Optimization_Revert_Snackbar_Error_Title,
+ revertResult.Message,
+ ControlAppearance.Danger,
+ new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
+ TimeSpan.FromSeconds(5));
+
+ if (partial)
+ {
+ _snackbarService.Show(
+ Translations.Optimization_Apply_Snackbar_Error_Title,
+ revertResult.Message,
+ ControlAppearance.Caution,
+ new SymbolIcon { Symbol = SymbolRegular.Warning24, Filled = true },
+ TimeSpan.FromSeconds(5));
+ }
+
+ if (revertResult.Exception != null)
+ _logger.LogError(revertResult.Exception, "Failed to revert {Name}", optimization.OptimizationKey);
+ else if (succeeded)
+ _logger.LogInformation("Successfully reverted {Name}", optimization.OptimizationKey);
+ else if (partial)
+ _logger.LogWarning("Partially reverted {Name}", optimization.OptimizationKey);
+ else
+ _logger.LogWarning("Failed to revert {Name}", optimization.OptimizationKey);
+ _logger.LogInformation("===== END reverting optimization {OptimizationName} ({OptimizationId}) =====",
+ optimization.OptimizationKey, optimization.Id);
+ }
+ }
+ catch (Exception ex)
+ {
+ optimization.State.IsApplied = wasApplied; // revert UI state on failure
+ _logger.LogError(ex, "Failed to toggle optimization {Name}", optimization.OptimizationKey);
+ _snackbarService.Show(
+ Translations.Optimization_Toggle_Snackbar_Error_Title,
+ string.Format(Translations.Optimization_Toggle_Snackbar_Error_Message, ex.Message),
+ ControlAppearance.Danger,
+ new SymbolIcon { Symbol = SymbolRegular.ErrorCircle24, Filled = true },
+ TimeSpan.FromSeconds(5)
+ );
+ }
+ }
+
+ [RelayCommand]
+ private async Task ShowDetailsAsync(IOptimization optimization)
+ {
+ var dialogViewModel = new OptimizationDetailsViewModel(optimization);
+ var dialogContent = new OptimizationDetailsDialog { DataContext = dialogViewModel };
+ var dialog = new ContentDialog
+ {
+ Title = BuildDialogTitle(optimization),
+ Content = dialogContent,
+ CloseButtonText = Translations.Button_Ok
+ };
+ var result = await _contentDialogService.ShowAsync(dialog, CancellationToken.None);
+ }
+
+ #endregion Commands
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/ViewModels/Pages/DashboardViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/DashboardViewModel.cs
new file mode 100644
index 0000000..e33208c
--- /dev/null
+++ b/optimizerDuck/UI/ViewModels/Pages/DashboardViewModel.cs
@@ -0,0 +1,188 @@
+using System.Diagnostics;
+using System.Windows.Media;
+using System.Windows.Threading;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+using Microsoft.Extensions.Logging;
+using optimizerDuck.Common.Helpers;
+using optimizerDuck.Services;
+using Wpf.Ui.Appearance;
+
+namespace optimizerDuck.UI.ViewModels.Pages;
+
+public partial class DashboardViewModel : ViewModel
+{
+ private readonly ILogger<DashboardViewModel> _logger;
+ private readonly SystemInfoService _systemInfoService;
+ private readonly DispatcherTimer _updateTimer;
+ [ObservableProperty] private ApplicationTheme _currentApplicationTheme = ApplicationTheme.Unknown;
+
+ private bool _isInitialized;
+
+ [ObservableProperty] private bool _isLoading;
+ [ObservableProperty] private RamInfo _runtimeRam = RamInfo.Unknown;
+ [ObservableProperty] private SystemSnapshot _systemInfo = SystemSnapshot.Unknown;
+
+ public DashboardViewModel(SystemInfoService systemInfoService, ILogger<DashboardViewModel> logger)
+ {
+ _systemInfoService = systemInfoService;
+ _logger = logger;
+
+ _updateTimer = new DispatcherTimer
+ {
+ Interval = TimeSpan.FromSeconds(2)
+ };
+ _updateTimer.Tick += async (s, e) => await UpdateRuntimeInfoAsync();
+ CurrentApplicationTheme = ApplicationThemeManager.GetAppTheme();
+ ApplicationThemeManager.Changed += OnThemeChanged;
+ }
+
+ public override async Task OnNavigatedToAsync()
+ {
+ if (IsLoading) return;
+
+ // Load system information when user navigates to the page
+ // This will also update the runtime RAM info
+ await LoadSystemInfoAsync();
+ if (!_isInitialized)
+ {
+ _systemInfoService.LogSummary();
+ _isInitialized = true;
+ }
+
+ // Start the timer to update runtime infos
+ _updateTimer.Start();
+ }
+
+ public override Task OnNavigatedFromAsync()
+ {
+ _updateTimer.Stop();
+ return base.OnNavigatedFromAsync();
+ }
+
+
+ #region Property Changed
+
+ private void OnThemeChanged(ApplicationTheme currentApplicationTheme, Color systemAccent)
+ {
+ if (CurrentApplicationTheme != currentApplicationTheme) CurrentApplicationTheme = currentApplicationTheme;
+ }
+
+ #endregion
+
+ #region Commands
+
+ [RelayCommand]
+ private async Task RefreshAsync()
+ {
+ await LoadSystemInfoAsync();
+ }
+
+ [RelayCommand]
+ private void OpenAction(string action)
+ {
+ try
+ {
+ switch (action)
+ {
+ case "Discord":
+ Process.Start(new ProcessStartInfo
+ {
+ FileName = Shared.DiscordInviteURL,
+ UseShellExecute = true
+ });
+ break;
+
+ case "GitHub":
+ Process.Start(new ProcessStartInfo
+ {
+ FileName = Shared.GitHubRepoURL,
+ UseShellExecute = true
+ });
+ break;
+
+ case "Support":
+ Process.Start(new ProcessStartInfo
+ {
+ FileName = Shared.SupportMeURL,
+ UseShellExecute = true
+ });
+ break;
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Failed to open {Action} link", action);
+ }
+ }
+
+ [RelayCommand]
+ private void Run(string action)
+ {
+ switch (action)
+ {
+ case "Settings":
+ Process.Start(new ProcessStartInfo
+ {
+ FileName = "ms-settings:",
+ UseShellExecute = true
+ });
+ break;
+
+ case "TaskManager":
+ Process.Start(new ProcessStartInfo
+ {
+ FileName = "taskmgr",
+ UseShellExecute = true
+ });
+ break;
+
+ case "ControlPanel":
+ Process.Start(new ProcessStartInfo
+ {
+ FileName = "control",
+ UseShellExecute = true
+ });
+ break;
+ }
+ }
+
+ #endregion
+
+ #region Helpers
+
+ private async Task LoadSystemInfoAsync()
+ {
+ IsLoading = true;
+
+ try
+ {
+ var snapshot = await _systemInfoService.RefreshAsync();
+ SystemInfo = snapshot;
+ RuntimeRam = snapshot.Ram;
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Failed to load system information");
+ }
+ finally
+ {
+ IsLoading = false;
+ }
+ }
+
+ private async Task UpdateRuntimeInfoAsync()
+ {
+ try
+ {
+ var ramInfo = await Task.Run(RamProvider.Get);
+ RuntimeRam = ramInfo;
+ }
+ catch (Exception ex)
+ {
+ _logger.LogWarning(ex, "Failed to update runtime info");
+ }
+ }
+
+ #endregion
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/ViewModels/Pages/OptimizeViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/OptimizeViewModel.cs
new file mode 100644
index 0000000..1dc94c9
--- /dev/null
+++ b/optimizerDuck/UI/ViewModels/Pages/OptimizeViewModel.cs
@@ -0,0 +1,34 @@
+using System.Collections.ObjectModel;
+using System.Reflection;
+using optimizerDuck.Core.Models.Attributes;
+using optimizerDuck.Services;
+using Wpf.Ui.Controls;
+
+namespace optimizerDuck.UI.ViewModels.Pages;
+
+public class OptimizeViewModel(OptimizationRegistry optimizationService) : ViewModel
+{
+ private bool _isInitialized;
+
+ public ObservableCollection<NavigationViewItem> OptimizationCategories { get; } = [];
+
+ public event Action? OptimizationsLoaded;
+
+ public override Task OnNavigatedToAsync()
+ {
+ // Load optimization categories when user navigates to the page
+ if (_isInitialized)
+ return Task.CompletedTask;
+
+ foreach (var category in optimizationService.OptimizationCategories)
+ OptimizationCategories.Add(new NavigationViewItem
+ {
+ Content = category.Name,
+ TargetPageType = category.GetType().GetCustomAttribute<OptimizationCategoryAttribute>()!.PageType
+ });
+
+ OptimizationsLoaded?.Invoke();
+ _isInitialized = true;
+ return Task.CompletedTask;
+ }
+}
diff --git a/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
new file mode 100644
index 0000000..b0ca4ba
--- /dev/null
+++ b/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
@@ -0,0 +1,163 @@
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Globalization;
+using System.Windows.Media;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+using Microsoft.Extensions.Options;
+using optimizerDuck.Common.Helpers;
+using optimizerDuck.Core.Models.Config;
+using optimizerDuck.Core.Models.UI;
+using optimizerDuck.Resources.Languages;
+using optimizerDuck.Services;
+using optimizerDuck.Services.Managers;
+using Wpf.Ui;
+using Wpf.Ui.Appearance;
+using Wpf.Ui.Controls;
+using Wpf.Ui.Extensions;
+
+namespace optimizerDuck.UI.ViewModels.Pages;
+
+public partial class SettingsViewModel(
+ ConfigManager configManager,
+ IOptionsMonitor<AppSettings> appOptionsMonitor,
+ OptimizationRegistry optimizationRegistry,
+ IContentDialogService contentDialogService) : ViewModel
+{
+ [ObservableProperty] private ApplicationTheme _currentApplicationTheme = ApplicationTheme.Unknown;
+ private bool _isInitialized;
+ [ObservableProperty] private string _selectedCultureName = string.Empty;
+ [ObservableProperty] private int _shellTimeoutMs;
+ public string Version { get; } = Shared.FileVersion;
+
+ //Learn more links
+ public string DiscordInvite { get; } = Shared.DiscordInviteURL;
+
+ public string GitHubRepo { get; } = Shared.GitHubRepoURL;
+ public string Documentation { get; } = Shared.GitHubRepoURL + "/wiki";
+ public string SupportMe { get; } = Shared.SupportMeURL;
+ public string Acknowledgements { get; } = Shared.AcknowledgementsURL;
+
+ public ObservableCollection<LanguageOption> Languages { get; } =
+ [
+ new("English", new CultureInfo("en-US")),
+ new("Tiếng Việt", new CultureInfo("vi-VN"))
+ ];
+
+ public override async Task OnNavigatedToAsync()
+ {
+ if (!_isInitialized)
+ await InitializeViewModel();
+ }
+
+ private Task InitializeViewModel()
+ {
+ SelectedCultureName = appOptionsMonitor.CurrentValue.App.Language;
+ ShellTimeoutMs = appOptionsMonitor.CurrentValue.Optimize.ShellTimeoutMs;
+ CurrentApplicationTheme = ApplicationThemeManager.GetAppTheme();
+
+ ApplicationThemeManager.Changed += OnThemeChanged;
+
+ _isInitialized = true;
+ return Task.CompletedTask;
+ }
+
+ private void OnThemeChanged(ApplicationTheme currentApplicationTheme, Color systemAccent)
+ {
+ // Update the theme if it has been changed elsewhere than in the settings.
+ if (CurrentApplicationTheme != currentApplicationTheme) CurrentApplicationTheme = currentApplicationTheme;
+ }
+
+ #region Helpers
+
+ private async Task<ContentDialogResult> ConfirmationDialogAsync(string content)
+ {
+ var dialog = new ContentDialog
+ {
+ Title = Translations.Dialog_AreYouSure_Title,
+ Content = content,
+ PrimaryButtonText = Translations.Button_Clear,
+ PrimaryButtonAppearance = ControlAppearance.Danger,
+
+ CloseButtonText = Translations.Button_Cancel,
+
+ DefaultButton = ContentDialogButton.Close,
+ MaxWidth = 500
+ };
+ return await contentDialogService.ShowAsync(dialog, CancellationToken.None);
+ }
+
+ #endregion Helpers
+
+ #region Commands
+
+ [RelayCommand]
+ private void OpenRootDir()
+ {
+ Process.Start(new ProcessStartInfo
+ {
+ FileName = Shared.RootDirectory,
+ UseShellExecute = true
+ });
+ }
+
+ [RelayCommand]
+ private async Task ClearResources()
+ {
+ var result = await ConfirmationDialogAsync(Translations.Settings_ClearResources_Description);
+ if (result == ContentDialogResult.Primary)
+ OptimizationService.ClearResourcesAsync();
+ }
+
+ [RelayCommand]
+ private async Task ClearAllRevertData()
+ {
+ var result = await ConfirmationDialogAsync(Translations.Settings_ClearRevertData_Description);
+ if (result == ContentDialogResult.Primary)
+ {
+ RevertManager.ClearAllRevertDataAsync();
+ // Refresh optimizations
+ await OptimizationService.UpdateOptimizationStateAsync(
+ optimizationRegistry.OptimizationCategories.SelectMany(c => c.Optimizations));
+ }
+ }
+
+ [RelayCommand]
+ private void OpenAcknowledgements()
+ {
+ Process.Start(new ProcessStartInfo
+ {
+ FileName = Shared.AcknowledgementsURL,
+ UseShellExecute = true
+ });
+ }
+
+ #endregion Commands
+
+ #region Property Changed
+
+ partial void OnSelectedCultureNameChanged(string value)
+ {
+ if (string.IsNullOrEmpty(value)) return;
+ _ = configManager.SetAsync("app:language", value);
+
+ if (value == Loc.CurrentCulture.Name) return;
+ contentDialogService.ShowAlertAsync(Translations.Settings_LanguageChanged_Title,
+ Translations.Settings_LanguageChanged_Description,
+ Translations.Button_Ok, CancellationToken.None);
+ }
+
+ partial void OnCurrentApplicationThemeChanged(ApplicationTheme oldValue, ApplicationTheme newValue)
+ {
+ ApplicationThemeManager.Apply(newValue, updateAccent: false);
+ _ = configManager.SetAsync("app:theme", newValue.ToString());
+ }
+
+ partial void OnShellTimeoutMsChanged(int value)
+ {
+ if (value <= 0) return;
+ _ = configManager.SetAsync("optimize:shellTimeoutMs", value.ToString(CultureInfo.InvariantCulture));
+ }
+
+ #endregion Property Changed
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/ViewModels/ViewModel.cs b/optimizerDuck/UI/ViewModels/ViewModel.cs
new file mode 100644
index 0000000..f2c9763
--- /dev/null
+++ b/optimizerDuck/UI/ViewModels/ViewModel.cs
@@ -0,0 +1,38 @@
+using CommunityToolkit.Mvvm.ComponentModel;
+using Wpf.Ui.Abstractions.Controls;
+
+namespace optimizerDuck.UI.ViewModels;
+
+/// <summary>
+/// Provides a base class for view models that supports navigation event handling and validation.
+/// </summary>
+/// <remarks>
+/// Inherit from this class to implement view models that participate in navigation events within an
+/// application. The ViewModel class implements the INavigationAware interface and provides virtual methods for
+/// responding to navigation events, allowing derived classes to override and customize navigation behavior as needed.
+/// It also inherits from ObservableValidator to support property validation and change notification.
+/// </remarks>
+public abstract class ViewModel : ObservableValidator, INavigationAware
+{
+ public virtual Task OnNavigatedToAsync()
+ {
+ OnNavigatedTo();
+
+ return Task.CompletedTask;
+ }
+
+ public virtual Task OnNavigatedFromAsync()
+ {
+ OnNavigatedFrom();
+
+ return Task.CompletedTask;
+ }
+
+ public virtual void OnNavigatedTo()
+ {
+ }
+
+ public virtual void OnNavigatedFrom()
+ {
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Dialogs/OptimizationDetailsDialog.xaml b/optimizerDuck/UI/Views/Dialogs/OptimizationDetailsDialog.xaml
new file mode 100644
index 0000000..6a96d08
--- /dev/null
+++ b/optimizerDuck/UI/Views/Dialogs/OptimizationDetailsDialog.xaml
@@ -0,0 +1,167 @@
+<UserControl
+ d:DesignHeight="450"
+ d:DesignWidth="800"
+ mc:Ignorable="d"
+ x:Class="optimizerDuck.UI.Views.Dialogs.OptimizationDetailsDialog"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ <ScrollViewer VerticalScrollBarVisibility="Auto">
+ <StackPanel>
+ <ui:TextBlock
+ FontTypography="Body"
+ Text="{Binding Optimization.ShortDescription}"
+ TextTrimming="WordEllipsis"
+ TextWrapping="Wrap" />
+
+ <Separator Margin="0,3,0,3" />
+
+ <StackPanel Margin="0,0,0,4" Orientation="Horizontal">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc OptimizationDetailsDialog.Tags}"
+ TextTrimming="WordEllipsis"
+ TextWrapping="Wrap" />
+ <ui:SymbolIcon
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="5,0,0,0"
+ Symbol="QuestionCircle24"
+ ToolTip="{ext:Loc Optimizer.UI.Tags.Help}"
+ ToolTipService.InitialShowDelay="150"
+ ToolTipService.Placement="Top"
+ VerticalAlignment="Center" />
+ </StackPanel>
+ <ui:VirtualizingItemsControl ItemsSource="{Binding Optimization.TagDisplays}" Margin="0,2,0,2">
+ <ui:VirtualizingItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapPanel HorizontalAlignment="Left" VerticalAlignment="Top" />
+ </ItemsPanelTemplate>
+ </ui:VirtualizingItemsControl.ItemsPanel>
+ <ui:VirtualizingItemsControl.ItemContainerStyle>
+ <Style TargetType="ContentPresenter">
+ <Setter Property="Margin" Value="0,0,2,2" />
+ <Setter Property="HorizontalAlignment" Value="Left" />
+ </Style>
+ </ui:VirtualizingItemsControl.ItemContainerStyle>
+ <ui:VirtualizingItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="5"
+ HorizontalAlignment="Left"
+ Padding="4,2">
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="0,0,5,0"
+ Symbol="{Binding Icon}" />
+
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ HorizontalAlignment="Center"
+ Text="{Binding Display}"
+ TextWrapping="Wrap"
+ VerticalAlignment="Center" />
+ </StackPanel>
+ </Border>
+ </DataTemplate>
+ </ui:VirtualizingItemsControl.ItemTemplate>
+ </ui:VirtualizingItemsControl>
+
+
+ <StackPanel Margin="0,5,0,4" Orientation="Horizontal">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc OptimizationDetailsDialog.Risk}"
+ TextTrimming="WordEllipsis"
+ TextWrapping="Wrap" />
+ <ui:SymbolIcon
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="5,0,0,0"
+ Symbol="QuestionCircle24"
+ ToolTip="{ext:Loc Optimizer.UI.Risk.Help}"
+ ToolTipService.InitialShowDelay="150"
+ ToolTipService.Placement="Top"
+ VerticalAlignment="Center" />
+ </StackPanel>
+ <Border
+ CornerRadius="5"
+ HorizontalAlignment="Left"
+ Padding="4,2">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Optimization.Risk}" Value="Moderate">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Optimization.Risk}" Value="Risky">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Margin="0,0,5,0"
+ Symbol="{Binding Optimization.RiskVisual.Icon}" />
+
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ HorizontalAlignment="Center"
+ Text="{Binding Optimization.RiskVisual.Display}"
+ TextWrapping="Wrap"
+ VerticalAlignment="Center" />
+ </StackPanel>
+ </Border>
+
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Margin="0,5,0,0"
+ Text="{ext:Loc OptimizationDetailsDialog.Other}"
+ TextTrimming="WordEllipsis"
+ TextWrapping="Wrap" />
+ <ui:CardAction
+ Command="{Binding OpenRevertFileCommand}"
+ Icon="{ui:SymbolIcon FolderOpen24}"
+ Visibility="{Binding Optimization.State.AppliedAt, Converter={StaticResource NullToVisibilityConverter}}">
+
+ <StackPanel>
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc OptimizationDetailsDialog.Other.OpenRevertFile.Title}"
+ TextWrapping="Wrap" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Body"
+ Text="{ext:Loc OptimizationDetailsDialog.Other.OpenRevertFile.Description}"
+ TextWrapping="Wrap" />
+ </StackPanel>
+ </ui:CardAction>
+ <Border
+ Background="{DynamicResource CardBackgroundDisabled}"
+ CornerRadius="5"
+ HorizontalAlignment="Left"
+ Margin="0,5,0,0"
+ Padding="4,2"
+ ToolTip="{Binding Optimization.State.AppliedAt}"
+ ToolTipService.InitialShowDelay="150"
+ ToolTipService.Placement="Top"
+ Visibility="{Binding Optimization.State.AppliedAt, Converter={StaticResource NullToVisibilityConverter}}">
+ <ui:TextBlock
+ FontTypography="Caption"
+ HorizontalAlignment="Center"
+ Text="{Binding Optimization.State.RelativeTime}"
+ TextWrapping="Wrap"
+ VerticalAlignment="Center" />
+ </Border>
+ </StackPanel>
+ </ScrollViewer>
+</UserControl>
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Dialogs/OptimizationDetailsDialog.xaml.cs b/optimizerDuck/UI/Views/Dialogs/OptimizationDetailsDialog.xaml.cs
new file mode 100644
index 0000000..174782d
--- /dev/null
+++ b/optimizerDuck/UI/Views/Dialogs/OptimizationDetailsDialog.xaml.cs
@@ -0,0 +1,14 @@
+using System.Windows.Controls;
+
+namespace optimizerDuck.UI.Views.Dialogs;
+
+/// <summary>
+/// Interaction logic for OptimizationMoreInfoDialog.xaml
+/// </summary>
+public partial class OptimizationDetailsDialog : UserControl
+{
+ public OptimizationDetailsDialog()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Dialogs/OptimizationResultDialog.xaml b/optimizerDuck/UI/Views/Dialogs/OptimizationResultDialog.xaml
new file mode 100644
index 0000000..67ddcf0
--- /dev/null
+++ b/optimizerDuck/UI/Views/Dialogs/OptimizationResultDialog.xaml
@@ -0,0 +1,108 @@
+<UserControl
+ d:DesignHeight="450"
+ d:DesignWidth="800"
+ mc:Ignorable="d"
+ x:Class="optimizerDuck.UI.Views.Dialogs.OptimizationResultDialog"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Helpers.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ <UserControl.Resources>
+ <converters:NullToVisibilityConverter
+ False="Visible"
+ True="Collapsed"
+ x:Key="NullToVisibilityConverter" />
+ </UserControl.Resources>
+ <StackPanel>
+ <StackPanel Orientation="Horizontal">
+
+ <ui:TextBlock
+ FontTypography="Subtitle"
+ Text="{ext:Loc OptimizationResultDialog.Header,
+ {Binding FailedCount}}"
+ TextTrimming="WordEllipsis"
+ TextWrapping="Wrap" />
+ </StackPanel>
+
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Body"
+ Margin="0,2,0,8"
+ Text="{ext:Loc OptimizationResultDialog.Description}"
+ TextWrapping="Wrap" />
+
+ <ScrollViewer VerticalScrollBarVisibility="Auto">
+ <ItemsControl ItemsSource="{Binding FailedSteps}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <ui:CardControl Margin="0,0,0,8">
+ <ui:CardControl.Header>
+ <Grid ColumnDefinitions="Auto, Auto, *">
+ <Grid ColumnDefinitions="Auto,Auto">
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ HorizontalAlignment="Left"
+ Margin="0,0,10,0"
+ Padding="6,2"
+ VerticalAlignment="Center">
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Filled="True"
+ Foreground="{DynamicResource SystemFillColorAttentionBrush}"
+ Margin="0,0,5,0"
+ Symbol="Warning24"
+ VerticalAlignment="Center" />
+ <ui:TextBlock
+ Appearance="Disabled"
+ FontTypography="Caption"
+ Text="{Binding Index, StringFormat=# {0}}"
+ VerticalAlignment="Center" />
+ </StackPanel>
+ </Border>
+
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Grid.Column="1"
+ Text="{Binding Name}"
+ TextWrapping="Wrap"
+ VerticalAlignment="Center" />
+ </Grid>
+
+ <Separator Grid.Column="1" Margin="5,0,5,0" />
+
+ <StackPanel Grid.Column="2">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{Binding Description}"
+ TextWrapping="Wrap" />
+
+ <Border
+ BorderBrush="{DynamicResource SystemFillColorCriticalBrush}"
+ BorderThickness="1"
+ CornerRadius="6"
+ HorizontalAlignment="Left"
+ Margin="0,8,0,0"
+ Padding="8,6"
+ Visibility="{Binding Error, Converter={StaticResource NullToVisibilityConverter}}">
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ HorizontalAlignment="Stretch"
+ Text="{Binding Error}"
+ TextWrapping="Wrap" />
+ </Border>
+ </StackPanel>
+ </Grid>
+ </ui:CardControl.Header>
+ </ui:CardControl>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </ScrollViewer>
+ </StackPanel>
+</UserControl>
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Dialogs/OptimizationResultDialog.xaml.cs b/optimizerDuck/UI/Views/Dialogs/OptimizationResultDialog.xaml.cs
new file mode 100644
index 0000000..e08b59d
--- /dev/null
+++ b/optimizerDuck/UI/Views/Dialogs/OptimizationResultDialog.xaml.cs
@@ -0,0 +1,9 @@
+namespace optimizerDuck.UI.Views.Dialogs;
+
+public partial class OptimizationResultDialog
+{
+ public OptimizationResultDialog()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Dialogs/ProcessingOptimizationDialog.xaml b/optimizerDuck/UI/Views/Dialogs/ProcessingOptimizationDialog.xaml
new file mode 100644
index 0000000..c24baff
--- /dev/null
+++ b/optimizerDuck/UI/Views/Dialogs/ProcessingOptimizationDialog.xaml
@@ -0,0 +1,31 @@
+<UserControl
+ d:DesignHeight="450"
+ d:DesignWidth="800"
+ mc:Ignorable="d"
+ x:Class="optimizerDuck.UI.Views.Dialogs.ProcessingOptimizationDialog"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:extensions="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ <StackPanel>
+ <TextBlock
+ HorizontalAlignment="Center"
+ Margin="0,0,0,5"
+ Text="{Binding Message}" />
+
+ <ProgressBar
+ IsIndeterminate="{Binding IsIndeterminate}"
+ Maximum="{Binding Total}"
+ Minimum="0"
+ Value="{Binding Value}" />
+
+ <ui:TextBlock
+ FontTypography="Body"
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ HorizontalAlignment="Center"
+ Margin="0,25,0,0"
+ Text="{extensions:Loc ProcessingOptimizationDialog.Warning.DontCloseAppOrRestart}" />
+ </StackPanel>
+</UserControl>
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Dialogs/ProcessingOptimizationDialog.xaml.cs b/optimizerDuck/UI/Views/Dialogs/ProcessingOptimizationDialog.xaml.cs
new file mode 100644
index 0000000..6ea7425
--- /dev/null
+++ b/optimizerDuck/UI/Views/Dialogs/ProcessingOptimizationDialog.xaml.cs
@@ -0,0 +1,17 @@
+using System.Windows.Controls;
+using optimizerDuck.UI.ViewModels.Dialogs;
+
+namespace optimizerDuck.UI.Views.Dialogs;
+
+/// <summary>
+/// Interaction logic for ProcessingOptimizationDialog.xaml
+/// </summary>
+public partial class ProcessingOptimizationDialog : UserControl
+{
+ public ProcessingOptimizationDialog()
+ {
+ InitializeComponent();
+ }
+
+ public ProcessingOptimizationViewModel? ViewModel => DataContext as ProcessingOptimizationViewModel;
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Dialogs/RestorePointDialog.xaml b/optimizerDuck/UI/Views/Dialogs/RestorePointDialog.xaml
new file mode 100644
index 0000000..a8b123f
--- /dev/null
+++ b/optimizerDuck/UI/Views/Dialogs/RestorePointDialog.xaml
@@ -0,0 +1,39 @@
+<UserControl
+ d:DesignHeight="300"
+ d:DesignWidth="300"
+ mc:Ignorable="d"
+ x:Class="optimizerDuck.UI.Views.Dialogs.RestorePointDialog"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:local="clr-namespace:optimizerDuck.UI.Views.Dialogs"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ <Grid>
+ <StackPanel>
+ <ui:TextBlock
+ FontTypography="Body"
+ HorizontalAlignment="Center"
+ Text="{ext:Loc RestorePointDialog.Description}"
+ TextWrapping="Wrap" />
+
+ <Grid
+ ColumnDefinitions="Auto,*"
+ Margin="0,8,0,3"
+ VerticalAlignment="Center">
+ <ui:SymbolIcon
+ Filled="True"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="0,0,5,0"
+ Symbol="QuestionCircle24" />
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Grid.Column="1"
+ Text="{ext:Loc RestorePointDialog.Help}"
+ TextWrapping="Wrap" />
+ </Grid>
+
+ </StackPanel>
+ </Grid>
+</UserControl>
diff --git a/optimizerDuck/UI/Views/Dialogs/RestorePointDialog.xaml.cs b/optimizerDuck/UI/Views/Dialogs/RestorePointDialog.xaml.cs
new file mode 100644
index 0000000..afe1ab1
--- /dev/null
+++ b/optimizerDuck/UI/Views/Dialogs/RestorePointDialog.xaml.cs
@@ -0,0 +1,11 @@
+using System.Windows.Controls;
+
+namespace optimizerDuck.UI.Views.Dialogs;
+
+public partial class RestorePointDialog : UserControl
+{
+ public RestorePointDialog()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Pages/DashboardPage.xaml b/optimizerDuck/UI/Views/Pages/DashboardPage.xaml
new file mode 100644
index 0000000..482179f
--- /dev/null
+++ b/optimizerDuck/UI/Views/Pages/DashboardPage.xaml
@@ -0,0 +1,500 @@
+<Page
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ Margin="0,32,0,0"
+ ScrollViewer.CanContentScroll="False"
+ Title="Dashboard"
+ d:DesignHeight="650"
+ d:DesignWidth="800"
+ mc:Ignorable="d"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ x:Class="optimizerDuck.UI.Views.Pages.DashboardPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Helpers.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+
+ <Page.Resources>
+ <converters:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
+ <converters:MBToGBConverter x:Key="MBToGBConverter" />
+ <converters:GreaterThanNumberToVisibilityConverter Threshold="1" x:Key="GreaterThanOneToVisibilityConverter" />
+ <converters:MinusNumberConverter NumberToMinus="1" x:Key="MinusOneConverter" />
+ <converters:ThemeToGitHubIconConverter x:Key="ThemeToGitHubIconConverter" />
+ </Page.Resources>
+
+ <Grid RowDefinitions="Auto,Auto,*">
+ <!-- Loading Overlay -->
+ <Grid
+ Grid.RowSpan="3"
+ Panel.ZIndex="1000"
+ Visibility="{Binding ViewModel.IsLoading, Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border Background="{DynamicResource ApplicationBackgroundBrush}" Opacity="0.8" />
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
+ <ui:ProgressRing
+ Height="60"
+ IsIndeterminate="True"
+ Width="60" />
+ <ui:TextBlock
+ FontTypography="Subtitle"
+ HorizontalAlignment="Center"
+ Margin="0,16,0,0"
+ Text="{ext:Loc Dashboard.SystemInfo.Loading}"
+ TextWrapping="Wrap" />
+ </StackPanel>
+ </Grid>
+
+ <!-- Header -->
+ <Grid ColumnDefinitions="*,Auto" Margin="0,0,0,20">
+ <ui:TextBlock
+ FontTypography="Title"
+ Text="{ext:Loc Dashboard.Header.Title}"
+ TextWrapping="Wrap" />
+
+ <Menu Grid.Column="1">
+ <ui:MenuItem Header="{ext:Loc Dashboard.Header.Menu.Header.Options}">
+ <ui:MenuItem Header="{ext:Loc Dashboard.Header.Menu.Header.Run}" Icon="{ui:SymbolIcon Apps24}">
+ <ui:MenuItem
+ Command="{Binding ViewModel.RunCommand}"
+ CommandParameter="Settings"
+ Header="{ext:Loc Dashboard.Header.Menu.RunSettings}" />
+ <ui:MenuItem
+ Command="{Binding ViewModel.RunCommand}"
+ CommandParameter="TaskManager"
+ Header="{ext:Loc Dashboard.Header.Menu.RunTaskManager}" />
+ <ui:MenuItem
+ Command="{Binding ViewModel.RunCommand}"
+ CommandParameter="ControlPanel"
+ Header="{ext:Loc Dashboard.Header.Menu.RunControlPanel}" />
+ </ui:MenuItem>
+ <Separator />
+ <ui:MenuItem
+ Command="{Binding ViewModel.RefreshCommand}"
+ Header="{ext:Loc Dashboard.Header.Menu.Refresh}"
+ Icon="{ui:SymbolIcon ArrowClockwise24}" />
+ </ui:MenuItem>
+ </Menu>
+ </Grid>
+
+ <!-- Action Cards -->
+ <UniformGrid
+ Columns="3"
+ Grid.Row="1"
+ Margin="0,0,0,20">
+ <ui:CardAction
+ Command="{Binding ViewModel.OpenActionCommand}"
+ CommandParameter="Discord"
+ Margin="0,0,5,0"
+ VerticalAlignment="Stretch">
+ <ui:CardAction.Icon>
+ <ui:ImageIcon Height="25" Source="pack://application:,,,/Resources/Images/DiscordLogo.png" />
+ </ui:CardAction.Icon>
+ <StackPanel>
+ <ui:TextBlock FontTypography="BodyStrong" Text="{ext:Loc Dashboard.Actions.Discord.Title}" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc Dashboard.Actions.Discord.Description}"
+ TextWrapping="Wrap" />
+ </StackPanel>
+ </ui:CardAction>
+
+ <ui:CardAction
+ Command="{Binding ViewModel.OpenActionCommand}"
+ CommandParameter="GitHub"
+ Margin="5,0,5,0"
+ VerticalAlignment="Stretch">
+ <ui:CardAction.Icon>
+ <ui:ImageIcon Height="40" Source="{Binding ViewModel.CurrentApplicationTheme, Converter={StaticResource ThemeToGitHubIconConverter}}" />
+ </ui:CardAction.Icon>
+ <StackPanel>
+ <ui:TextBlock FontTypography="BodyStrong" Text="{ext:Loc Dashboard.Actions.GitHub.Title}" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc Dashboard.Actions.GitHub.Description}"
+ TextWrapping="Wrap" />
+ </StackPanel>
+ </ui:CardAction>
+
+ <ui:CardAction
+ Command="{Binding ViewModel.OpenActionCommand}"
+ CommandParameter="Support"
+ Icon="{ui:SymbolIcon Heart24,
+ Filled=True}"
+ Margin="5,0,0,0"
+ VerticalAlignment="Stretch">
+ <StackPanel>
+ <ui:TextBlock FontTypography="BodyStrong" Text="{ext:Loc Dashboard.Actions.SupportMe.Title}" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc Dashboard.Actions.SupportMe.Description}"
+ TextWrapping="Wrap" />
+ </StackPanel>
+ </ui:CardAction>
+ </UniformGrid>
+
+ <ScrollViewer
+ Grid.Row="2"
+ HorizontalScrollBarVisibility="Disabled"
+ Padding="20,0"
+ VerticalScrollBarVisibility="Auto">
+ <StackPanel>
+ <!-- System Info Cards -->
+ <UniformGrid Columns="2" Rows="2">
+ <!-- Operating System -->
+ <ui:CardControl
+ Icon="{ui:SymbolIcon Tv24}"
+ Margin="0,0,5,5"
+ VerticalAlignment="Stretch">
+ <ui:CardControl.Header>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+
+ <StackPanel Grid.Row="0">
+ <ui:TextBlock FontTypography="BodyStrong" Text="{Binding ViewModel.SystemInfo.Os.Name}" />
+ <ui:TextBlock Appearance="Secondary" FontTypography="Caption">
+ <Run Text="{Binding ViewModel.SystemInfo.Os.Edition}" />
+ <Run Text="·" />
+ <Run Text="{Binding ViewModel.SystemInfo.Os.Architecture}" />
+ </ui:TextBlock>
+ </StackPanel>
+
+ <WrapPanel
+ Grid.Row="1"
+ Margin="0,8,0,0"
+ Orientation="Horizontal">
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3">
+ <ui:TextBlock FontTypography="Caption" Text="{Binding ViewModel.SystemInfo.Os.BuildNumber, StringFormat='{}Build {0}'}" />
+ </Border>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3">
+ <ui:TextBlock FontTypography="Caption" Text="{Binding ViewModel.SystemInfo.Os.DeviceType}" />
+ </Border>
+ </WrapPanel>
+ </Grid>
+ </ui:CardControl.Header>
+ </ui:CardControl>
+
+ <!-- CPU -->
+ <ui:CardControl
+ Icon="{ui:SymbolIcon DeveloperBoard24}"
+ Margin="5,0,0,5"
+ VerticalAlignment="Stretch">
+ <ui:CardControl.Header>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+
+ <StackPanel Grid.Row="0">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{Binding ViewModel.SystemInfo.Cpu.Name}"
+ TextTrimming="CharacterEllipsis" />
+ <ui:TextBlock Appearance="Secondary" FontTypography="Caption">
+ <Run Text="{Binding ViewModel.SystemInfo.Cpu.Vendor}" />
+ <Run Text="·" />
+ <Run Text="{ext:Loc Dashboard.SystemInfo.Cpu.Cores, {Binding ViewModel.SystemInfo.Cpu.Cores}}" />
+ <Run Text="/" />
+ <Run Text="{ext:Loc Dashboard.SystemInfo.Cpu.Threads, {Binding ViewModel.SystemInfo.Cpu.Threads}}" />
+ </ui:TextBlock>
+ </StackPanel>
+
+ <WrapPanel
+ Grid.Row="1"
+ Margin="0,8,0,0"
+ Orientation="Horizontal">
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3">
+ <ui:TextBlock FontTypography="Caption">
+ <Run Text="{Binding ViewModel.SystemInfo.Cpu.CurrentClockMHz}" />
+ <Run Text="MHz" />
+ </ui:TextBlock>
+ </Border>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3">
+ <ui:TextBlock FontTypography="Caption">
+ <Run Text="L2:" />
+ <Run Text="{Binding ViewModel.SystemInfo.Cpu.L2CacheKB}" />
+ <Run Text="KB" />
+ </ui:TextBlock>
+ </Border>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3">
+ <ui:TextBlock FontTypography="Caption">
+ <Run Text="L3:" />
+ <Run Text="{Binding ViewModel.SystemInfo.Cpu.L3CacheKB}" />
+ <Run Text="KB" />
+ </ui:TextBlock>
+ </Border>
+ </WrapPanel>
+ </Grid>
+ </ui:CardControl.Header>
+ </ui:CardControl>
+
+ <!-- RAM -->
+ <ui:CardControl
+ Icon="{ui:SymbolIcon Memory16}"
+ Margin="0,5,5,0"
+ VerticalAlignment="Stretch">
+ <ui:CardControl.Header>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <StackPanel Grid.Row="0">
+ <ui:TextBlock FontTypography="BodyStrong">
+ <Run Text="{Binding ViewModel.RuntimeRam.TotalGB, StringFormat='{}{0:F1}'}" />
+ <Run Text="GB RAM" />
+ </ui:TextBlock>
+ <ui:TextBlock Appearance="Secondary" FontTypography="Caption">
+ <Run Text="{ext:Loc Dashboard.SystemInfo.Ram.Used, {Binding ViewModel.RuntimeRam.UsedGB, StringFormat='{}{0:F1}'}}" />
+ <Run Text="·" />
+ <Run Text="{ext:Loc Dashboard.SystemInfo.Ram.Available, {Binding ViewModel.RuntimeRam.AvailableGB, StringFormat='{}{0:F1}'}}" />
+ </ui:TextBlock>
+ </StackPanel>
+
+ <ProgressBar
+ Grid.Row="1"
+ Height="6"
+ Margin="0,8,0,0"
+ Maximum="100"
+ Value="{Binding ViewModel.RuntimeRam.UsedPercent}" />
+
+ <WrapPanel
+ Grid.Row="2"
+ Margin="0,8,0,0"
+ Orientation="Horizontal">
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Padding="6,3">
+ <ui:TextBlock FontTypography="Caption">
+ <Run Text="{ext:Loc Dashboard.SystemInfo.Ram.Modules, {Binding ViewModel.RuntimeRam.Modules.Count, Mode=OneWay}}" />
+ </ui:TextBlock>
+ </Border>
+ </WrapPanel>
+ </Grid>
+ </ui:CardControl.Header>
+ </ui:CardControl>
+
+ <!-- GPU -->
+ <ui:CardControl
+ Icon="{ui:SymbolIcon NetworkAdapter16}"
+ Margin="5,5,0,0"
+ VerticalAlignment="Stretch">
+ <ui:CardControl.Header>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+
+ <StackPanel Grid.Row="0">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{Binding ViewModel.SystemInfo.PrimaryGpu.Name}"
+ TextTrimming="CharacterEllipsis" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{Binding ViewModel.SystemInfo.PrimaryGpu.Vendor}" />
+ </StackPanel>
+
+ <WrapPanel
+ Grid.Row="1"
+ Margin="0,8,0,0"
+ Orientation="Horizontal">
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3">
+ <ui:TextBlock FontTypography="Caption">
+ <Run Text="{Binding ViewModel.SystemInfo.PrimaryGpu.MemoryMB, Converter={StaticResource MBToGBConverter}}" />
+ <Run Text="GB" />
+ </ui:TextBlock>
+ </Border>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3">
+ <ui:TextBlock
+ FontTypography="Caption"
+ Text="{Binding ViewModel.SystemInfo.PrimaryGpu.DriverVersion}"
+ TextTrimming="CharacterEllipsis" />
+ </Border>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,4"
+ Padding="6,3"
+ Visibility="{Binding ViewModel.SystemInfo.Gpus.Count, Converter={StaticResource GreaterThanOneToVisibilityConverter}}">
+ <ui:TextBlock FontTypography="Caption">
+ <Run Text="{ext:Loc Dashboard.SystemInfo.Gpu.More, {Binding ViewModel.SystemInfo.Gpus.Count, Mode=OneWay, Converter={StaticResource MinusOneConverter}}}" />
+ </ui:TextBlock>
+ </Border>
+ </WrapPanel>
+ </Grid>
+ </ui:CardControl.Header>
+ </ui:CardControl>
+ </UniformGrid>
+
+ <!-- Storage Section -->
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Margin="0,20,0,8"
+ Text="{ext:Loc Dashboard.SystemInfo.Storage.Header}" />
+
+ <ItemsControl ItemsSource="{Binding ViewModel.SystemInfo.Disk.Volumes}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <ui:CardControl Margin="0,0,0,8">
+ <ui:CardControl.Icon>
+ <ui:SymbolIcon Filled="True" Symbol="HardDrive20">
+ <ui:SymbolIcon.Style>
+ <Style TargetType="ui:SymbolIcon">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding SystemDrive}" Value="True">
+ <Setter Property="Foreground" Value="{DynamicResource SystemFillColorAttentionBrush}" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ui:SymbolIcon.Style>
+ </ui:SymbolIcon>
+ </ui:CardControl.Icon>
+ <ui:CardControl.Header>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <!-- Drive Letter and Label -->
+ <StackPanel Grid.Row="0" Orientation="Horizontal">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Margin="0,0,5,0"
+ Text="{Binding Letter, StringFormat='({0})'}" />
+
+ <ui:TextBlock
+ FontTypography="Caption"
+ Margin="0,0,5,0"
+ Text="{Binding Label}"
+ VerticalAlignment="Center" />
+
+ <Border
+ Background="{DynamicResource SystemFillColorAttentionBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,0"
+ Padding="5,2"
+ VerticalAlignment="Center"
+ Visibility="{Binding SystemDrive, Converter={StaticResource BoolToVisibilityConverter}}">
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="Black"
+ Text="{ext:Loc Dashboard.SystemInfo.Storage.System}" />
+ </Border>
+
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Margin="0,0,4,0"
+ Padding="5,2"
+ VerticalAlignment="Center">
+ <ui:TextBlock FontTypography="Caption" Text="{Binding MediaType}">
+ <ui:TextBlock.Style>
+ <Style TargetType="ui:TextBlock">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding MediaType}" Value="SSD">
+ <Setter Property="Foreground" Value="{DynamicResource SystemFillColorSuccessBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding MediaType}" Value="HDD">
+ <Setter Property="Foreground" Value="{DynamicResource SystemFillColorCautionBrush}" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ui:TextBlock.Style>
+ </ui:TextBlock>
+ </Border>
+
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="4"
+ Padding="5,2"
+ VerticalAlignment="Center">
+ <ui:TextBlock FontTypography="Caption" Text="{Binding FileSystem}" />
+ </Border>
+ </StackPanel>
+
+ <!-- Model Information -->
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Grid.Row="1"
+ Margin="0,4,0,0"
+ Text="{Binding Model}"
+ TextTrimming="CharacterEllipsis"
+ Visibility="{Binding Model, Converter={StaticResource NullToVisibilityConverter}}" />
+
+ <!-- Storage Stats -->
+ <StackPanel
+ Grid.Row="2"
+ Margin="0,4,0,0"
+ Orientation="Horizontal">
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Text="{ext:Loc Dashboard.SystemInfo.Storage.DiskInfo,
+ {Binding UsedSpaceGB, StringFormat='{}{0:F1}'},
+ {Binding TotalSizeGB, StringFormat='{}{0:F1}'},
+ {Binding FreeSpaceGB, StringFormat='{}{0:F1}'}}" />
+ </StackPanel>
+
+ <!-- Progress Bar -->
+ <ProgressBar
+ Grid.Row="3"
+ Height="6"
+ Margin="0,8,0,0"
+ Maximum="100"
+ Value="{Binding UsedPercent}" />
+ </Grid>
+ </ui:CardControl.Header>
+ </ui:CardControl>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
+ </ScrollViewer>
+ </Grid>
+</Page>
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Pages/DashboardPage.xaml.cs b/optimizerDuck/UI/Views/Pages/DashboardPage.xaml.cs
new file mode 100644
index 0000000..01ad799
--- /dev/null
+++ b/optimizerDuck/UI/Views/Pages/DashboardPage.xaml.cs
@@ -0,0 +1,17 @@
+using optimizerDuck.UI.ViewModels.Pages;
+using Wpf.Ui.Abstractions.Controls;
+
+namespace optimizerDuck.UI.Views.Pages;
+
+public partial class DashboardPage : INavigableView<DashboardViewModel>
+{
+ public DashboardPage(DashboardViewModel viewModel)
+ {
+ ViewModel = viewModel;
+ DataContext = this;
+
+ InitializeComponent();
+ }
+
+ public DashboardViewModel ViewModel { get; }
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Pages/Optimizations/OptimizationPage.xaml b/optimizerDuck/UI/Views/Pages/Optimizations/OptimizationPage.xaml
new file mode 100644
index 0000000..465f93c
--- /dev/null
+++ b/optimizerDuck/UI/Views/Pages/Optimizations/OptimizationPage.xaml
@@ -0,0 +1,208 @@
+<Page
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ Margin="0,32,0,0"
+ ScrollViewer.CanContentScroll="False"
+ Title="OptimizationPage"
+ d:DesignHeight="650"
+ d:DesignWidth="800"
+ mc:Ignorable="d"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ x:Class="optimizerDuck.UI.Views.Pages.Optimizations.OptimizationPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Helpers.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ <Page.Resources>
+ <converters:WidthToColumnConverter x:Key="WidthToColumnConverter" />
+ <converters:NullToVisibilityConverter
+ False="Visible"
+ True="Collapsed"
+ x:Key="NullToVisibilityConverter" />
+ </Page.Resources>
+
+ <Grid>
+ <ui:VirtualizingItemsControl ItemsSource="{Binding ViewModel.Optimizations}">
+ <ui:VirtualizingItemsControl.Template>
+ <ControlTemplate TargetType="ItemsControl">
+ <ScrollViewer HorizontalScrollBarVisibility="Disabled">
+ <ItemsPresenter />
+ </ScrollViewer>
+ </ControlTemplate>
+ </ui:VirtualizingItemsControl.Template>
+ <ui:VirtualizingItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <UniformGrid Columns="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ScrollViewer}, Converter={StaticResource WidthToColumnConverter}}" VerticalAlignment="Top" />
+ </ItemsPanelTemplate>
+ </ui:VirtualizingItemsControl.ItemsPanel>
+ <ui:VirtualizingItemsControl.ItemContainerStyle>
+ <Style TargetType="ContentPresenter">
+ <Setter Property="Margin" Value="5" />
+ <Setter Property="HorizontalAlignment" Value="Stretch" />
+ </Style>
+ </ui:VirtualizingItemsControl.ItemContainerStyle>
+
+ <ui:VirtualizingItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Border
+ Background="{DynamicResource CardBackground}"
+ BorderBrush="{DynamicResource CardBorderBrush}"
+ BorderThickness="1"
+ CornerRadius="5"
+ Padding="20,10">
+ <Grid RowDefinitions="Auto,Auto,Auto,Auto,*">
+ <ui:TextBlock
+ Appearance="Disabled"
+ FontTypography="Caption"
+ Grid.Row="0"
+ Text="{Binding Id}"
+ TextWrapping="Wrap" />
+ <ui:TextBlock
+ FontTypography="Subtitle"
+ Grid.Row="1"
+ Text="{Binding Name}"
+ TextWrapping="Wrap" />
+
+ <ui:VirtualizingItemsControl
+ Grid.Row="2"
+ ItemsSource="{Binding TagDisplays}"
+ Margin="0,2,0,2">
+ <ui:VirtualizingItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapPanel HorizontalAlignment="Left" VerticalAlignment="Top" />
+ </ItemsPanelTemplate>
+ </ui:VirtualizingItemsControl.ItemsPanel>
+ <ui:VirtualizingItemsControl.ItemContainerStyle>
+ <Style TargetType="ContentPresenter">
+ <Setter Property="Margin" Value="0,0,2,2" />
+ <Setter Property="HorizontalAlignment" Value="Left" />
+ </Style>
+ </ui:VirtualizingItemsControl.ItemContainerStyle>
+ <ui:VirtualizingItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Border
+ Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
+ CornerRadius="5"
+ HorizontalAlignment="Left"
+ Padding="4,2">
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Margin="0,0,5,0"
+ Symbol="{Binding Icon}" />
+
+ <ui:TextBlock
+ Appearance="Secondary"
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ HorizontalAlignment="Center"
+ Text="{Binding Display}"
+ TextWrapping="Wrap"
+ VerticalAlignment="Center" />
+ </StackPanel>
+ </Border>
+ </DataTemplate>
+ </ui:VirtualizingItemsControl.ItemTemplate>
+ </ui:VirtualizingItemsControl>
+
+ <ui:TextBlock
+ FontTypography="Body"
+ Grid.Row="3"
+ Margin="0,10,0,0"
+ Text="{Binding ShortDescription}"
+ TextTrimming="WordEllipsis"
+ TextWrapping="Wrap" />
+
+ <Grid
+ ColumnDefinitions="*,Auto"
+ Grid.Row="4"
+ Margin="0,10,0,0"
+ VerticalAlignment="Bottom">
+ <Grid RowDefinitions="Auto,Auto">
+ <Border
+ CornerRadius="5"
+ HorizontalAlignment="Left"
+ Padding="4,2">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorSuccessBrush}" />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Risk}" Value="Moderate">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorCautionBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Risk}" Value="Risky">
+ <Setter Property="Background" Value="{DynamicResource SystemFillColorCriticalBrush}" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <StackPanel Orientation="Horizontal">
+ <ui:SymbolIcon
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ Margin="0,0,5,0"
+ Symbol="{Binding RiskVisual.Icon}" />
+
+ <ui:TextBlock
+ FontTypography="Caption"
+ Foreground="{DynamicResource TextFillColorInverseBrush}"
+ HorizontalAlignment="Center"
+ Text="{Binding RiskVisual.Display}"
+ TextWrapping="Wrap"
+ VerticalAlignment="Center" />
+ </StackPanel>
+ </Border>
+
+ <Border
+ Background="{DynamicResource CardBackgroundDisabled}"
+ CornerRadius="5"
+ Grid.Row="1"
+ HorizontalAlignment="Left"
+ Margin="0,5,0,0"
+ Padding="4,2"
+ ToolTip="{Binding State.AppliedAt}"
+ ToolTipService.InitialShowDelay="150"
+ ToolTipService.Placement="Top"
+ Visibility="{Binding State.AppliedAt, Converter={StaticResource NullToVisibilityConverter}}">
+ <ui:TextBlock
+ FontTypography="Caption"
+ HorizontalAlignment="Center"
+ Text="{Binding State.RelativeTime}"
+ TextWrapping="Wrap"
+ VerticalAlignment="Center" />
+ </Border>
+ </Grid>
+
+ <Grid
+ ColumnDefinitions="*,Auto"
+ Grid.Column="1"
+ Margin="10,0,0,0"
+ VerticalAlignment="Bottom">
+ <ui:ToggleSwitch
+ Command="{Binding DataContext.ViewModel.ToggleOptimizationCommand, RelativeSource={RelativeSource AncestorType=Page}}"
+ CommandParameter="{Binding}"
+ Cursor="Hand"
+ HorizontalAlignment="Right"
+ IsChecked="{Binding State.IsApplied, Mode=TwoWay}"
+ Margin="0,0,5,0"
+ VerticalAlignment="Center" />
+ <ui:Button
+ Background="Transparent"
+ BorderBrush="Transparent"
+ Command="{Binding DataContext.ViewModel.ShowDetailsCommand, RelativeSource={RelativeSource AncestorType=Page}}"
+ CommandParameter="{Binding}"
+ Cursor="Hand"
+ Grid.Column="1"
+ HorizontalAlignment="Right"
+ Icon="{ui:SymbolIcon MoreVertical24}"
+ VerticalAlignment="Bottom" />
+ </Grid>
+ </Grid>
+ </Grid>
+ </Border>
+ </DataTemplate>
+ </ui:VirtualizingItemsControl.ItemTemplate>
+ </ui:VirtualizingItemsControl>
+ </Grid>
+</Page>
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Pages/Optimizations/OptimizationPage.xaml.cs b/optimizerDuck/UI/Views/Pages/Optimizations/OptimizationPage.xaml.cs
new file mode 100644
index 0000000..a73de2c
--- /dev/null
+++ b/optimizerDuck/UI/Views/Pages/Optimizations/OptimizationPage.xaml.cs
@@ -0,0 +1,17 @@
+using optimizerDuck.UI.ViewModels.Optimizer;
+using Wpf.Ui.Abstractions.Controls;
+
+namespace optimizerDuck.UI.Views.Pages.Optimizations;
+
+public partial class OptimizationPage : INavigableView<OptimizationCategoryViewModel>
+{
+ public OptimizationPage(OptimizationCategoryViewModel viewModel)
+ {
+ ViewModel = viewModel;
+ DataContext = this;
+
+ InitializeComponent();
+ }
+
+ public OptimizationCategoryViewModel ViewModel { get; }
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Pages/Optimizations/OptimizationPages.cs b/optimizerDuck/UI/Views/Pages/Optimizations/OptimizationPages.cs
new file mode 100644
index 0000000..cd40b74
--- /dev/null
+++ b/optimizerDuck/UI/Views/Pages/Optimizations/OptimizationPages.cs
@@ -0,0 +1,51 @@
+using optimizerDuck.UI.ViewModels.Optimizer;
+
+namespace optimizerDuck.UI.Views.Pages.Optimizations;
+
+public sealed class PowerManagementOptimizerPage : OptimizationPage
+{
+ public PowerManagementOptimizerPage(OptimizationCategoryViewModel viewModel) : base(viewModel)
+ {
+ InitializeComponent();
+ }
+}
+
+public sealed class UserExperienceOptimizerPage : OptimizationPage
+{
+ public UserExperienceOptimizerPage(OptimizationCategoryViewModel viewModel) : base(viewModel)
+ {
+ InitializeComponent();
+ }
+}
+
+public sealed class BloatwareAndServicesOptimizerPage : OptimizationPage
+{
+ public BloatwareAndServicesOptimizerPage(OptimizationCategoryViewModel viewModel) : base(viewModel)
+ {
+ InitializeComponent();
+ }
+}
+
+public sealed class GpuOptimizerPage : OptimizationPage
+{
+ public GpuOptimizerPage(OptimizationCategoryViewModel viewModel) : base(viewModel)
+ {
+ InitializeComponent();
+ }
+}
+
+public sealed class PerformanceOptimizerPage : OptimizationPage
+{
+ public PerformanceOptimizerPage(OptimizationCategoryViewModel viewModel) : base(viewModel)
+ {
+ InitializeComponent();
+ }
+}
+
+public sealed class SecurityAndPrivacyOptimizerPage : OptimizationPage
+{
+ public SecurityAndPrivacyOptimizerPage(OptimizationCategoryViewModel viewModel) : base(viewModel)
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Pages/OptimizePage.xaml b/optimizerDuck/UI/Views/Pages/OptimizePage.xaml
new file mode 100644
index 0000000..d479a45
--- /dev/null
+++ b/optimizerDuck/UI/Views/Pages/OptimizePage.xaml
@@ -0,0 +1,30 @@
+<Page
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ Margin="0,32,0,0"
+ ScrollViewer.CanContentScroll="False"
+ Title="OptimizerPage"
+ d:DesignHeight="650"
+ d:DesignWidth="800"
+ mc:Ignorable="d"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ x:Class="optimizerDuck.UI.Views.Pages.OptimizePage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ <Grid>
+ <ui:NavigationView
+ FrameMargin="0"
+ IsBackButtonVisible="Collapsed"
+ IsFooterSeparatorVisible="False"
+ IsPaneToggleVisible="False"
+ IsTopSeparatorVisible="False"
+ Margin="0"
+ MenuItemsSource="{Binding ViewModel.OptimizationCategories}"
+ Padding="42,0,42,0"
+ PaneDisplayMode="Top"
+ x:Name="RootNavigation" />
+ </Grid>
+</Page>
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Pages/OptimizePage.xaml.cs b/optimizerDuck/UI/Views/Pages/OptimizePage.xaml.cs
new file mode 100644
index 0000000..b7bcf72
--- /dev/null
+++ b/optimizerDuck/UI/Views/Pages/OptimizePage.xaml.cs
@@ -0,0 +1,32 @@
+using System.Windows.Threading;
+using optimizerDuck.UI.ViewModels.Pages;
+using Wpf.Ui.Abstractions;
+using Wpf.Ui.Abstractions.Controls;
+
+namespace optimizerDuck.UI.Views.Pages;
+
+public partial class OptimizePage : INavigableView<OptimizeViewModel>
+{
+ public OptimizePage(OptimizeViewModel viewModel, INavigationViewPageProvider pageProvider)
+ {
+ ViewModel = viewModel;
+ DataContext = this;
+
+ InitializeComponent();
+
+ RootNavigation.SetPageProviderService(pageProvider);
+ ViewModel.OptimizationsLoaded += OnOptimizationsLoaded;
+ }
+
+ public OptimizeViewModel ViewModel { get; }
+
+ private void OnOptimizationsLoaded()
+ {
+ Dispatcher.BeginInvoke(() =>
+ {
+ var first = ViewModel.OptimizationCategories.FirstOrDefault();
+ if (first?.TargetPageType != null)
+ RootNavigation.Navigate(first.TargetPageType);
+ }, DispatcherPriority.ContextIdle);
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Pages/SettingsPage.xaml b/optimizerDuck/UI/Views/Pages/SettingsPage.xaml
new file mode 100644
index 0000000..3b6144b
--- /dev/null
+++ b/optimizerDuck/UI/Views/Pages/SettingsPage.xaml
@@ -0,0 +1,252 @@
+<Page
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ Margin="0,32,0,0"
+ Title="SettingsPage"
+ d:DesignHeight="1200"
+ d:DesignWidth="800"
+ mc:Ignorable="d"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ x:Class="optimizerDuck.UI.Views.Pages.SettingsPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:converters="clr-namespace:optimizerDuck.Common.Helpers.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:ext="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+
+ <Page.Resources>
+ <converters:ThemeToIndexConverter x:Key="ThemeToIndexConverter" />
+ </Page.Resources>
+
+ <StackPanel>
+ <ui:TextBlock
+ FontTypography="Title"
+ Text="{ext:Loc Settings.Header.Title}"
+ TextWrapping="Wrap" />
+
+ <StackPanel Margin="0,20,0,0">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.Appearance.Header}"
+ TextWrapping="Wrap" />
+ <ui:CardControl Icon="{ui:SymbolIcon Globe24}">
+ <ui:CardControl.Header>
+ <StackPanel>
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Foreground="{DynamicResource TextFillColorPrimaryBrush}"
+ Margin="0"
+ Text="{ext:Loc Settings.Appearance.LanguageSelector.Title}"
+ TextWrapping="Wrap" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Foreground="{DynamicResource TextFillColorSecondaryBrush}"
+ Text="{ext:Loc Settings.Appearance.LanguageSelector.Description}"
+ TextWrapping="Wrap" />
+ </StackPanel>
+ </ui:CardControl.Header>
+ <ComboBox
+ DisplayMemberPath="DisplayName"
+ ItemsSource="{Binding ViewModel.Languages}"
+ SelectedValue="{Binding ViewModel.SelectedCultureName, Mode=TwoWay}"
+ SelectedValuePath="Culture.Name" />
+ </ui:CardControl>
+ <ui:CardControl Icon="{ui:SymbolIcon Color24}">
+ <ui:CardControl.Header>
+ <StackPanel>
+ <ui:TextBlock
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Margin="0"
+ Text="{ext:Loc Settings.Appearance.ThemeSelector.Title}"
+ TextWrapping="Wrap" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.Appearance.ThemeSelector.Description}"
+ TextWrapping="Wrap" />
+ </StackPanel>
+ </ui:CardControl.Header>
+ <ComboBox SelectedIndex="{Binding ViewModel.CurrentApplicationTheme, Converter={StaticResource ThemeToIndexConverter}, Mode=TwoWay}">
+ <ComboBoxItem Content="{ext:Loc Settings.Appearance.ThemeSelector.Light}" />
+ <ComboBoxItem Content="{ext:Loc Settings.Appearance.ThemeSelector.Dark}" />
+ <ComboBoxItem Content="{ext:Loc Settings.Appearance.ThemeSelector.HighContrast}" />
+ </ComboBox>
+ </ui:CardControl>
+
+ <StackPanel Margin="0,20,0,0">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.Optimize.Header}"
+ TextWrapping="Wrap" />
+
+ <ui:CardControl Icon="{ui:SymbolIcon Clock24}">
+ <ui:CardControl.Header>
+ <StackPanel>
+ <ui:TextBlock
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Margin="0"
+ Text="{ext:Loc Settings.Optimize.ShellTimeout.Title}"
+ TextWrapping="Wrap" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.Optimize.ShellTimeout.Description}"
+ TextWrapping="Wrap" />
+ <ui:TextBlock
+ Foreground="{DynamicResource SystemFillColorCriticalBrush}"
+ Text="{ext:Loc Settings.Optimize.ShellTimeout.Warning}"
+ TextWrapping="Wrap" />
+ </StackPanel>
+ </ui:CardControl.Header>
+
+ <ui:NumberBox
+ Minimum="1000"
+ SmallChange="1000"
+ Value="{Binding ViewModel.ShellTimeoutMs, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
+ </ui:CardControl>
+ </StackPanel>
+
+ <StackPanel Margin="0,20,0,0">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.Advanced.Header}"
+ TextWrapping="Wrap" />
+
+ <ui:CardControl Icon="{ui:SymbolIcon Archive24}">
+ <ui:CardControl.Header>
+ <StackPanel>
+ <ui:TextBlock
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Margin="0"
+ Text="{ext:Loc Settings.Advanced.ClearResources.Title}"
+ TextWrapping="Wrap" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.Advanced.ClearResources.Description}"
+ TextWrapping="Wrap" />
+ </StackPanel>
+ </ui:CardControl.Header>
+
+ <ui:Button
+ Appearance="Danger"
+ Command="{Binding ViewModel.ClearResourcesCommand}"
+ Content="{ext:Loc Button.Clear}"
+ Cursor="Hand"
+ Icon="{ui:SymbolIcon Delete24}"
+ VerticalAlignment="Center" />
+ </ui:CardControl>
+
+ <ui:CardControl Icon="{ui:SymbolIcon DatabaseLightning20}">
+ <ui:CardControl.Header>
+ <StackPanel>
+ <ui:TextBlock
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Margin="0"
+ Text="{ext:Loc Settings.Advanced.ClearRevertDatas.Title}"
+ TextWrapping="Wrap" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.Advanced.ClearRevertDatas.Description}"
+ TextWrapping="Wrap" />
+ </StackPanel>
+ </ui:CardControl.Header>
+
+ <ui:Button
+ Appearance="Danger"
+ Command="{Binding ViewModel.ClearAllRevertDataCommand}"
+ Content="{ext:Loc Button.Clear}"
+ Cursor="Hand"
+ Icon="{ui:SymbolIcon Delete24}"
+ VerticalAlignment="Center" />
+ </ui:CardControl>
+
+ <ui:CardControl Icon="{ui:SymbolIcon Folder24}">
+ <ui:CardControl.Header>
+ <StackPanel>
+ <ui:TextBlock
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Margin="0"
+ Text="{ext:Loc Settings.Advanced.OpenRootDir.Title}"
+ TextWrapping="Wrap" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.Advanced.OpenRootDir.Description}"
+ TextWrapping="Wrap" />
+ </StackPanel>
+ </ui:CardControl.Header>
+
+ <ui:Button
+ Command="{Binding ViewModel.OpenRootDirCommand}"
+ Content="{ext:Loc Button.Open}"
+ Cursor="Hand"
+ Icon="{ui:SymbolIcon OpenFolder24}"
+ VerticalAlignment="Center" />
+ </ui:CardControl>
+ </StackPanel>
+
+ <StackPanel Margin="0,20,0,0">
+ <ui:TextBlock
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.About.Header}"
+ TextWrapping="Wrap" />
+
+ <ui:CardControl>
+ <ui:CardControl.Icon>
+ <ui:ImageIcon Height="26" Source="pack://application:,,,/optimizerDuck;component/Resources/Images/Duck.png" />
+ </ui:CardControl.Icon>
+
+ <ui:CardControl.Header>
+ <StackPanel>
+ <ui:TextBlock
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Text="optimizerDuck"
+ TextWrapping="Wrap" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.About.Duck.Description,
+ {Binding ViewModel.Version}}"
+ TextWrapping="Wrap" />
+ </StackPanel>
+ </ui:CardControl.Header>
+ </ui:CardControl>
+
+ <ui:CardAction Command="{Binding ViewModel.OpenSourceLicensesCommand}" VerticalAlignment="Stretch">
+ <ui:CardAction.Icon>
+ <ui:SymbolIcon Symbol="DocumentHeart24" />
+ </ui:CardAction.Icon>
+ <StackPanel>
+ <ui:TextBlock
+ Appearance="Primary"
+ FontTypography="BodyStrong"
+ Text="{ext:Loc Settings.About.OpenSourceLicenses.Title}"
+ TextWrapping="Wrap" />
+ <ui:TextBlock
+ Appearance="Secondary"
+ Text="{ext:Loc Settings.About.OpenSourceLicenses.Description}"
+ TextWrapping="Wrap" />
+ </StackPanel>
+ </ui:CardAction>
+
+ <ui:TextBlock
+ FontTypography="Subtitle"
+ Margin="0,15,0,0"
+ Text="{ext:Loc Settings.About.LearnMore}"
+ TextTrimming="WordEllipsis"
+ TextWrapping="Wrap" />
+ <StackPanel Margin="7,0,0,0">
+ <ui:HyperlinkButton Content="{ext:Loc Settings.About.LearnMore.Documentation}" NavigateUri="{Binding ViewModel.Documentation}" />
+ <ui:HyperlinkButton Content="{ext:Loc Settings.About.LearnMore.Support}" NavigateUri="{Binding ViewModel.SupportMe}" />
+ <ui:HyperlinkButton Content="{ext:Loc Settings.About.LearnMore.Acknowledgements}" NavigateUri="{Binding ViewModel.Acknowledgements}" />
+ <ui:HyperlinkButton Content="{ext:Loc Settings.About.LearnMore.Discord}" NavigateUri="{Binding ViewModel.DiscordInvite}" />
+ <ui:HyperlinkButton Content="{ext:Loc Settings.About.LearnMore.GitHub}" NavigateUri="{Binding ViewModel.GitHubRepo}" />
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+</Page>
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Pages/SettingsPage.xaml.cs b/optimizerDuck/UI/Views/Pages/SettingsPage.xaml.cs
new file mode 100644
index 0000000..9456aab
--- /dev/null
+++ b/optimizerDuck/UI/Views/Pages/SettingsPage.xaml.cs
@@ -0,0 +1,16 @@
+using optimizerDuck.UI.ViewModels.Pages;
+using Wpf.Ui.Abstractions.Controls;
+
+namespace optimizerDuck.UI.Views.Pages;
+
+public partial class SettingsPage : INavigableView<SettingsViewModel>
+{
+ public SettingsPage(SettingsViewModel viewModel)
+ {
+ ViewModel = viewModel;
+ DataContext = this;
+ InitializeComponent();
+ }
+
+ public SettingsViewModel ViewModel { get; }
+}
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Windows/MainWindow.xaml b/optimizerDuck/UI/Views/Windows/MainWindow.xaml
new file mode 100644
index 0000000..f1f4544
--- /dev/null
+++ b/optimizerDuck/UI/Views/Windows/MainWindow.xaml
@@ -0,0 +1,71 @@
+<ui:FluentWindow
+ ExtendsContentIntoTitleBar="True"
+ Height="800"
+ SnapsToDevicePixels="True"
+ TextOptions.TextRenderingMode="ClearType"
+ Title="optimizerDuck"
+ UseLayoutRounding="True"
+ Width="1350"
+ WindowBackdropType="Mica"
+ WindowCornerPreference="Round"
+ WindowStartupLocation="CenterScreen"
+ mc:Ignorable="d"
+ ui:Design.Background="Black"
+ ui:Design.Foreground="White"
+ x:Class="optimizerDuck.UI.Views.Windows.MainWindow"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:extensions="clr-namespace:optimizerDuck.Common.Extensions"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:pages="clr-namespace:optimizerDuck.UI.Views.Pages"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ <Grid>
+ <ui:NavigationView
+ FrameMargin="0"
+ IsFooterSeparatorVisible="False"
+ IsPaneToggleVisible="True"
+ IsTopSeparatorVisible="False"
+ Margin="0"
+ OpenPaneLength="200"
+ Padding="42,0,42,0"
+ PaneDisplayMode="Left"
+ TitleBar="{Binding ElementName=TitleBar, Mode=OneWay}"
+ x:Name="RootNavigation">
+ <ui:NavigationView.MenuItems>
+ <ui:NavigationViewItem
+ Content="{extensions:Loc Sidebar.Dashboard}"
+ Icon="{ui:SymbolIcon Home24}"
+ TargetPageType="{x:Type pages:DashboardPage}" />
+ <ui:NavigationViewItemSeparator Margin="0,2,0,2" />
+
+ <ui:NavigationViewItem
+ Content="{extensions:Loc Sidebar.Optimize}"
+ Icon="{ui:SymbolIcon Rocket24}"
+ TargetPageType="{x:Type pages:OptimizePage}" />
+ </ui:NavigationView.MenuItems>
+
+ <ui:NavigationView.FooterMenuItems>
+ <ui:NavigationViewItemSeparator Margin="0,2,0,2" />
+ <ui:NavigationViewItem
+ Content="{extensions:Loc Sidebar.Settings}"
+ Icon="{ui:SymbolIcon Settings24}"
+ TargetPageType="{x:Type pages:SettingsPage}" />
+ </ui:NavigationView.FooterMenuItems>
+
+ <ui:NavigationView.ContentOverlay>
+ <Grid>
+ <ui:SnackbarPresenter x:Name="SnackbarPresenter" />
+ </Grid>
+ </ui:NavigationView.ContentOverlay>
+ </ui:NavigationView>
+
+ <ui:TitleBar Title="optimizerDuck" x:Name="TitleBar">
+ <ui:TitleBar.Icon>
+ <ui:ImageIcon Source="pack://application:,,,/Resources/Images/Duck.png" />
+ </ui:TitleBar.Icon>
+ </ui:TitleBar>
+
+ <ui:ContentDialogHost x:Name="RootContentDialogPresenter" />
+ </Grid>
+</ui:FluentWindow>
\ No newline at end of file
diff --git a/optimizerDuck/UI/Views/Windows/MainWindow.xaml.cs b/optimizerDuck/UI/Views/Windows/MainWindow.xaml.cs
new file mode 100644
index 0000000..d958496
--- /dev/null
+++ b/optimizerDuck/UI/Views/Windows/MainWindow.xaml.cs
@@ -0,0 +1,30 @@
+using System.Windows;
+using optimizerDuck.Core.Interfaces;
+using optimizerDuck.UI.Views.Pages;
+using Wpf.Ui;
+using Wpf.Ui.Abstractions;
+
+namespace optimizerDuck.UI.Views.Windows;
+
+public partial class MainWindow : IWindow
+{
+ public MainWindow(INavigationService navigationService, IContentDialogService contentDialogService,
+ INavigationViewPageProvider pageProvider, ISnackbarService snackbarService)
+ {
+ InitializeComponent();
+
+ snackbarService.SetSnackbarPresenter(SnackbarPresenter);
+ contentDialogService.SetDialogHost(RootContentDialogPresenter);
+ navigationService.SetNavigationControl(RootNavigation);
+
+ RootNavigation.SetPageProviderService(pageProvider);
+
+ RootNavigation.Loaded += OnRootNavigationLoaded;
+ }
+
+ private void OnRootNavigationLoaded(object sender, RoutedEventArgs e)
+ {
+ RootNavigation.Loaded -= OnRootNavigationLoaded;
+ RootNavigation.Navigate(typeof(DashboardPage));
+ }
+}
\ No newline at end of file
diff --git a/optimizerDuck/app.manifest b/optimizerDuck/app.manifest
index 99ac989..d968d71 100644
--- a/optimizerDuck/app.manifest
+++ b/optimizerDuck/app.manifest
@@ -5,14 +5,14 @@
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
- If you want to change the Windows User Account Control level replace the
+ If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
- Specifying requestedExecutionLevel element will disable file and registry virtualization.
+ Specifying requestedExecutionLevel element will disable file and registry virtualization.
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
@@ -46,19 +46,18 @@
</compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
- DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
- to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
- also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
-
+ DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
+ to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
+ also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
+
Makes the application long-path aware. See https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
- <!--
+
<application xmlns="urn:schemas-microsoft-com:asm.v3">
- <windowsSettings>
- <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
- <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
- </windowsSettings>
+ <windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
+ <dpiAwareness>PerMonitorV2, PerMonitor</dpiAwareness>
+ </windowsSettings>
</application>
- -->
+
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!--
diff --git a/optimizerDuck/optimizerDuck.csproj b/optimizerDuck/optimizerDuck.csproj
index 3c82ddc..2d17707 100644
--- a/optimizerDuck/optimizerDuck.csproj
+++ b/optimizerDuck/optimizerDuck.csproj
@@ -1,34 +1,79 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <OutputType>Exe</OutputType>
- <TargetFramework>net10.0</TargetFramework>
- <ImplicitUsings>enable</ImplicitUsings>
+ <OutputType>WinExe</OutputType>
+ <TargetFramework>net10.0-windows</TargetFramework>
+ <LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
- <LangVersion>preview</LangVersion>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <UseWPF>true</UseWPF>
+ <Authors>fatDuck</Authors>
<ApplicationIcon>Logo.ico</ApplicationIcon>
- <Configurations>Debug;Release</Configurations>
+ <Company>fatDuck</Company>
+ <FileVersion>2.0.0</FileVersion>
+ <Version>2.0.0</Version>
+ <Product>optimizerDuck</Product>
+ <Copyright>Copyright fatDuck 2026</Copyright>
+ <AssemblyTitle>optimizerDuck</AssemblyTitle>
+ <AssemblyDescription>Free, open-source Windows optimization tool for performance, privacy, and simplicity.</AssemblyDescription>
+ <NeutralLanguage>en-US</NeutralLanguage>
<ApplicationManifest>app.manifest</ApplicationManifest>
- <FileVersion>1.3.7</FileVersion>
- <Version>1.3.7</Version>
- <AssemblyTitle>Free, open-source Windows optimization tool for performance, privacy, and simplicity.</AssemblyTitle>
- <NeutralLanguage>en</NeutralLanguage>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<PlatformTarget>x64</PlatformTarget>
- <Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="ConsoleInk.Net" Version="0.1.6"/>
- <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="10.0.0"/>
- <PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.0"/>
- <PackageReference Include="Microsoft.PowerShell.SDK" Version="7.5.4"/>
+ <Page Update="Views\Windows\MainWindow.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <XamlRuntime>Wpf</XamlRuntime>
+ <SubType>Designer</SubType>
+ </Page>
+ <Page Update="Views\Pages\Optimizations\OptimizationPage.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <XamlRuntime>Wpf</XamlRuntime>
+ <SubType>Designer</SubType>
+ </Page>
+ </ItemGroup>
+
+ <ItemGroup>
+ <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0"/>
+ <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.2"/>
+ <PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.2"/>
+ <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.2"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.4"/>
- <PackageReference Include="Serilog" Version="4.3.1-dev-02387"/>
- <PackageReference Include="Serilog.Extensions.Logging" Version="9.0.2"/>
+ <PackageReference Include="Serilog" Version="4.3.0"/>
+ <PackageReference Include="Serilog.Extensions.Hosting" Version="10.0.0"/>
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0"/>
- <PackageReference Include="Spectre.Console" Version="0.53.0"/>
- <PackageReference Include="System.Management" Version="10.0.0"/>
- <PackageReference Include="System.ServiceProcess.ServiceController" Version="10.0.0"/>
- <PackageReference Include="vertical-spectreconsolelogger" Version="0.10.1-dev.20241201.35"/>
+ <PackageReference Include="System.Management.Automation" Version="7.5.4"/>
+ <PackageReference Include="WPF-UI" Version="4.2.0"/>
+ <PackageReference Include="WPF-UI.DependencyInjection" Version="4.2.0"/>
</ItemGroup>
+
+ <ItemGroup>
+ <EmbeddedResource Update="Resources\Languages\Translations.resx">
+ <Generator>PublicResXFileCodeGenerator</Generator>
+ <LastGenOutput>Translations.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Update="Resources\Languages\Translations.Designer.cs">
+ <DesignTime>True</DesignTime>
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Translations.resx</DependentUpon>
+ </Compile>
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Remove="Resources\Images\Duck.png"/>
+ <None Remove="Resources\Images\GitHubLogoBlack.png"/>
+ <Resource Include="Resources\Images\Duck.png"/>
+ <None Remove="Resources\Images\Windows11.png"/>
+ <Resource Include="Resources\Images\GitHubLogoBlack.png"/>
+ <Resource Include="Resources\Images\GitHubLogoWhite.png"/>
+ <Resource Include="Resources\Images\DiscordLogo.png"/>
+ </ItemGroup>
+
</Project>
diff --git a/optimizerDuck/src/Core/Defaults.cs b/optimizerDuck/src/Core/Defaults.cs
deleted file mode 100644
index cc975c6..0000000
--- a/optimizerDuck/src/Core/Defaults.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-using System.Diagnostics;
-using optimizerDuck.UI;
-using optimizerDuck.UI.Components;
-using Spectre.Console;
-
-namespace optimizerDuck.Core;
-
-public static class Defaults
-{
- public const string RawLogo = """
- _ _ _ _____ _
- | | (_) (_) | __ \ | |
- ___ _ __ | |_ _ _ __ ___ _ _______ _ __| | | |_ _ ___| | __
- / _ \| '_ \| __| | '_ ` _ \| |_ / _ \ '__| | | | | | |/ __| |/ /
- | (_) | |_) | |_| | | | | | | |/ / __/ | | |__| | |_| | (__| <
- \___/| .__/ \__|_|_| |_| |_|_/___\___|_| |_____/ \__,_|\___|_|\_\
- | |
- |_|
- """;
-
- public const string
- EscapeCancellableConsoleMultiSelectionPromptInstructionsText // ok
- = $"""
- [grey](Use [{Theme.Primary}]↑ ↓[/] to navigate)[/]
- [grey](Press [{Theme.Info}]<space>[/] to toggle an option, [{Theme.Success}]<enter>[/] to continue)[/]
- [grey][[[{Theme.Error}]CTRL + C[/] or [{Theme.Error}]Escape[/] to go back to previous menu]][/]
- """;
-
- public const string DiscordInvite = "https://discord.gg/tDUBDCYw9Q";
- public const string GitHubRepo = "https://github.com/itsfatduck/optimizerDuck";
-
- public const string ZwtDownloadUrl =
- "https://github.com/LuSlower/ZwTimerResolution/releases/download/0.0.0.6/ZwTimer.exe";
-
- public const string PowerPlanUrl =
- "https://github.com/itsfatduck/optimizerDuck/raw/refs/heads/master/optimizerDuck.Resources/optimizerDuck.pow";
-
- public const string RestorePointName = "optimizerDuck Restore Point";
- public const string PowerPlanGUID = "946c0ca5-6ee0-4f2a-9dd7-7addbb8e60f5";
- public static readonly bool IsDebug = Environment.GetCommandLineArgs().Contains("--debug");
-
- public static readonly Panel Logo = new(
- new Align(
- // @formatter:off
- new Markup(
- $"""
- [{Theme.Secondary}] _ _ _ [/][{Theme.Accent}] _____ _ [/]
- [{Theme.Secondary}] | | (_) (_) [/][{Theme.Accent}]| __ \ | | [/]
- [{Theme.Secondary}] ___ _ __ | |_ _ _ __ ___ _ _______ _ __[/][{Theme.Accent}]| | | |_ _ ___| | __[/]
- [{Theme.Secondary}] / _ \| '_ \| __| | '_ ` _ \| |_ / _ \ '__[/][{Theme.Accent}]| | | | | | |/ __| |/ /[/]
- [{Theme.Secondary}] | (_) | |_) | |_| | | | | | | |/ / __/ | [/][{Theme.Accent}]| |__| | |_| | (__| < [/]
- [{Theme.Secondary}] \___/| .__/ \__|_|_| |_| |_|_/___\___|_| [/][{Theme.Accent}]|_____/ \__,_|\___|_|\_\[/]
- [{Theme.Secondary}] | | [/]
- [{Theme.Secondary}] |_| [/]
- """),
- // @formatter:on
- HorizontalAlignment.Center
- ))
- { Border = CustomBoxBorder.UnderlineBorder, Padding = new Padding(0, 1, 0, 1) };
-
- public static readonly string ExePath = Environment.ProcessPath!;
- public static readonly string ExeDir = Path.GetDirectoryName(ExePath)!;
- public static readonly string ExeName = Path.GetFileName(ExePath);
- public static readonly string FileVersion = FileVersionInfo.GetVersionInfo(ExePath).FileVersion!;
-
- public static readonly string RootPath =
- Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "optimizerDuck");
-
- public static readonly string ResourcesPath =
- Path.Combine(RootPath, "Resources");
-
- public static readonly Dictionary<string, string> SafeApps = new()
- {
- // bing
- ["Microsoft.BingWeather"] = "Weather",
- ["Microsoft.BingNews"] = "Bing News",
- ["Microsoft.BingSearch"] = "Bing Search",
-
- ["Microsoft.GetHelp"] = "Get Help",
- ["Microsoft.GetStarted"] = "Get Started / Tips",
- ["Microsoft.Messaging"] = "Messaging",
- ["Microsoft.Microsoft3DViewer"] = "3D Viewer",
- ["Microsoft.MicrosoftSolitaireCollection"] = "Solitaire Collection",
- ["Microsoft.MicrosoftStickyNotes"] = "Sticky Notes",
- ["Microsoft.MixedReality.Portal"] = "Mixed Reality Portal",
- ["Microsoft.OneConnect"] = "OneConnect (Connect App)",
- ["Microsoft.People"] = "People",
- ["Microsoft.Print3D"] = "Print 3D",
- ["SkypeApp"] = "Skype",
- ["Microsoft.WindowsAlarms"] = "Alarms & Clock",
- ["Microsoft.WindowsCamera"] = "Camera",
- ["Microsoft.WindowsMaps"] = "Maps",
- ["Microsoft.WindowsFeedbackHub"] = "Feedback Hub",
- ["Microsoft.WindowsSoundRecorder"] = "Voice Recorder",
- ["Microsoft.ZuneMusic"] = "Media Player / Groove",
- ["Microsoft.Sway"] = "Microsoft Sway",
- ["Microsoft.3DBuilder"] = "3D Builder (legacy)",
- ["Microsoft.DrawboardPDF"] = "Drawboard PDF (OEM)",
- ["WindowsPhone"] = "Windows Phone (old)",
- ["CommsPhone"] = "Communications Phone (old)",
- ["Microsoft.Todos"] = "Microsoft To Do",
- ["Microsoft.WindowsCommunicationsApps"] = "Mail and Calendar",
- ["MicrosoftCorporationII.QuickAssist"] = "Quick Assist",
- ["Microsoft.Office.OneNote"] = "OneNote",
- ["Microsoft.YourPhone"] = "Phone Link",
- ["Microsoft.MicrosoftNews"] = "Microsoft News",
- ["Microsoft.MicrosoftOfficeHub"] = "Office Hub"
- };
-
-
- public static readonly Dictionary<string, string> CautionApps = new()
- {
- ["Microsoft.WindowsCalculator"] = "Calculator",
- ["Microsoft.Windows.Photos"] = "Photos",
- ["Microsoft.MSPaint"] = "Paint",
- ["Microsoft.Paint3D"] = "Paint 3D",
- ["Microsoft.ScreenSketch"] = "Snipping Tool & Sketch",
- ["Microsoft.WindowsStore"] = "Microsoft Store",
- ["Microsoft.XboxIdentityProvider"] = "Xbox Identity Provider",
- ["Microsoft.WindowsTerminal"] = "Windows Terminal",
- ["Microsoft.WindowsTerminalPreview"] = "Windows Terminal (Preview)",
- ["Clipchamp.Clipchamp"] = "Clipchamp (Video Editor)",
- ["Microsoft.WindowsNotepad"] = "Notepad",
- ["Microsoft.PowerAutomateDesktop"] = "Power Automate",
- ["MicrosoftTeams"] = "Microsoft Teams",
- ["MicrosoftCorporationII.MicrosoftFamily"] = "Microsoft Family Safety",
- ["MicrosoftCorporationII.MicrosoftSupportDiagnosticTool"] = "Support Diagnostic Tool",
- // Extensions
- ["Microsoft.HEIFImageExtension"] = "HEIF Image Extension",
- ["Microsoft.WebMediaExtensions"] = "Web Media Extensions",
- ["Microsoft.WebpImageExtension"] = "WebP Image Extension",
- ["Microsoft.RawImageExtension"] = "Raw Image Extension",
- ["Microsoft.VP9VideoExtensions"] = "VP9 Video Extension",
- ["Microsoft.AV1VideoExtension"] = "AV1 Video Extension",
- // Xbox / Game Bar
- ["Microsoft.XboxSpeechToTextOverlay"] = "Xbox Speech Overlay",
- ["Microsoft.XboxGameOverlay"] = "Xbox Game Overlay",
- ["Microsoft.XboxGamingOverlay"] = "Xbox Game Bar",
- ["Microsoft.XboxApp"] = "Xbox Console Companion",
- ["Microsoft.Xbox.TCUI"] = "Xbox TCUI"
- };
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Extensions/EnumExtensions.cs b/optimizerDuck/src/Core/Extensions/EnumExtensions.cs
deleted file mode 100644
index 29ee7a6..0000000
--- a/optimizerDuck/src/Core/Extensions/EnumExtensions.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.ComponentModel;
-using System.Reflection;
-
-namespace optimizerDuck.Core.Extensions;
-
-public static class EnumExtensions
-{
- public static string GetDescription(this Enum? value)
- {
- if (value == null) return string.Empty;
-
- var type = value.GetType();
- var name = value.ToString();
-
- var field = type.GetField(name);
- if (field == null)
- return name;
-
- var attribute = field.GetCustomAttribute<DescriptionAttribute>(false);
- return attribute?.Description ?? name;
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Extensions/StatusExtensions.cs b/optimizerDuck/src/Core/Extensions/StatusExtensions.cs
deleted file mode 100644
index 53721c5..0000000
--- a/optimizerDuck/src/Core/Extensions/StatusExtensions.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using optimizerDuck.UI.Logger;
-using Spectre.Console;
-
-namespace optimizerDuck.Core.Extensions;
-
-public static class StatusExtensions
-{
- extension(Status status)
- {
- public void StartGlobal(string message,
- Action<StatusContext> action)
- {
- var task = status.StartAsync(message, ctx =>
- {
- GlobalStatus.Current = ctx;
- action(ctx);
- return Task.CompletedTask;
- });
-
- task.GetAwaiter().GetResult();
- }
-
- public T StartGlobal<T>(string message,
- Func<StatusContext, T> func)
- {
- return status.Start(message, ctx =>
- {
- GlobalStatus.Current = ctx;
- return func(ctx);
- });
- }
-
- public async Task StartAsyncGlobal(string message,
- Func<StatusContext, Task> action)
- {
- ArgumentNullException.ThrowIfNull(status);
-
- _ = await status.StartAsync<object?>(message, async ctx =>
- {
- GlobalStatus.Current = ctx;
- await action(ctx).ConfigureAwait(false);
- return null;
- }).ConfigureAwait(false);
- }
-
- public async Task<T> StartAsyncGlobal<T>(string message,
- Func<StatusContext, Task<T>> func)
- {
- ArgumentNullException.ThrowIfNull(status);
- ArgumentNullException.ThrowIfNull(func);
-
- return await status.StartAsync<T>(message, async ctx =>
- {
- GlobalStatus.Current = ctx;
- return await func(ctx).ConfigureAwait(false);
- }).ConfigureAwait(false);
- }
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Helpers/OptimizationHelper.cs b/optimizerDuck/src/Core/Helpers/OptimizationHelper.cs
deleted file mode 100644
index d4c5730..0000000
--- a/optimizerDuck/src/Core/Helpers/OptimizationHelper.cs
+++ /dev/null
@@ -1,227 +0,0 @@
-using System.Reflection;
-using Microsoft.Extensions.Caching.Memory;
-using Microsoft.Extensions.Logging;
-using Newtonsoft.Json;
-using optimizerDuck.Core.Extensions;
-using optimizerDuck.Core.Managers;
-using optimizerDuck.Core.Services;
-using optimizerDuck.Interfaces;
-using optimizerDuck.Models;
-using optimizerDuck.UI;
-using optimizerDuck.UI.Logger;
-using Spectre.Console;
-
-namespace optimizerDuck.Core.Helpers;
-
-public static class OptimizationHelper
-{
- private static readonly ILogger Log = Logger.CreateLogger(typeof(OptimizationHelper));
-
- public static List<OptimizationCategoryChoice> LoadOptimizationChoices()
- {
- return CacheManager.GetOrCreate("optimization_choices", entry =>
- {
- entry.Priority = CacheItemPriority.NeverRemove;
-
- var optimizationCategories = ReflectionHelper
- .FindImplementationsInLoadedAssemblies(typeof(IOptimizationCategory))
- .ToArray();
-
- var allOptimizationsByCategory = optimizationCategories
- .Select(g => new
- {
- Category = (IOptimizationCategory)Activator.CreateInstance(g)!,
- Optimizations = g.GetNestedTypes(BindingFlags.Public)
- .Where(t => typeof(IOptimization).IsAssignableFrom(t))
- .Select(t => (IOptimization)Activator.CreateInstance(t)!)
- .ToList()
- })
- .ToList();
-
- var allOptimizations = allOptimizationsByCategory.SelectMany(x => x.Optimizations).ToList();
- var globalMaxNameLength = allOptimizations.DefaultIfEmpty().Max(t => t?.Name?.Length ?? 0) + 1;
- var maxImpactLength =
- allOptimizations.DefaultIfEmpty().Max(t => t?.Impact.GetDescription().Length ?? 0) + 1;
-
- var categories = new List<OptimizationCategoryChoice>();
-
- foreach (var g in allOptimizationsByCategory)
- {
- var optimizations = g.Optimizations
- .OrderByDescending(t => t.EnabledByDefault)
- .ThenBy(t => (int)t.Impact)
- .ToList();
-
- if (optimizations.Count == 0) continue; // Skip empty categories
-
- var optimizationChoices = optimizations.Select(t =>
- {
- var paddedName = t.Name.PadRight(globalMaxNameLength);
- var description = $"{t.Impact.GetDescription().PadRight(maxImpactLength)}[dim]{t.Description}[/]";
- return new OptimizationChoice(t, paddedName, description, t.EnabledByDefault);
- }).ToList();
-
- categories.Add(new OptimizationCategoryChoice(g.Category.Name, g.Category.Order, optimizationChoices));
- }
-
- var orderedCategories = categories.OrderBy(g => g.Order).ToList();
-
- foreach (var g in orderedCategories)
- {
- Log.LogDebug("Loaded category [{Category}]:", g.Name);
- foreach (var t in g.Optimizations)
- Log.LogDebug(" - {OptimizationName} {OptimizationDescription}", t.Name,
- Markup.Remove(t.Description));
- }
-
- return orderedCategories;
- });
- }
-
- public static AppxClassification GetBloatwareChoices()
- {
- try
- {
- var result = ShellService.PowerShell($$"""
- # list the SAFE_APPS
- $safeApps = @({{string.Join(", ", Defaults.SafeApps.Keys.Select(x => $"\"{x}\""))}})
-
- # list the CAUTION_APPS
- $cautionApps = @({{string.Join(", ", Defaults.CautionApps.Keys.Select(x => $"\"{x}\""))}})
-
- # get the installed apps
- $installedApps = Get-AppxPackage -AllUsers | Where-Object { $_.NonRemovable -eq 0 } # NonRemovable = 0 means the app can be removed
-
- # categorize the installed apps
- $safeInstalled = $installedApps | Where-Object {
- foreach ($s in $safeApps) {
- if ($_.Name.ToLower() -like "*$($s.ToLower())*") { return $true }
- }
- return $false
- } | Select-Object Name, Version, InstallLocation
-
- $cautionInstalled = $installedApps | Where-Object {
- foreach ($s in $cautionApps) {
- if ($_.Name.ToLower() -like "*$($s.ToLower())*") { return $true }
- }
- return $false
- } | Select-Object Name, Version, InstallLocation
-
- # create the JSON object
- $result = [PSCustomObject]@{
- SafeApps = @($safeInstalled | ForEach-Object {
- [PSCustomObject]@{
- Name = $_.Name
- Version = $_.Version
- InstallLocation = $_.InstallLocation
- }
- })
- CautionApps = @($cautionInstalled | ForEach-Object {
- [PSCustomObject]@{
- Name = $_.Name
- Version = $_.Version
- InstallLocation = $_.InstallLocation
- }
- })
- }
-
- # output JSON
- $result | ConvertTo-Json -Depth 4
- """);
-
-
- var raw = JsonConvert.DeserializeObject<AppxClassificationRaw>(result.Stdout);
-
- var allSafe = raw.SafeApps.SelectMany(x => x).ToList();
- var allCaution = raw.CautionApps.SelectMany(x => x).ToList();
-
- // Display Length
- var safeDisplayLength = allSafe.Count != 0
- ? allSafe.Max(x => Defaults.SafeApps.TryGetValue(x.Name, out var dn) ? dn.Length : x.Name.Length)
- : 0;
-
- var cautionDisplayLength = allCaution.Count != 0
- ? allCaution.Max(x => Defaults.CautionApps.TryGetValue(x.Name, out var dn) ? dn.Length : x.Name.Length)
- : 0;
-
- // Version Length
- var safeVersionLength = allSafe.Count != 0
- ? allSafe.Max(x => x.Version.Length)
- : 0;
-
- var cautionVersionLength = allCaution.Count != 0
- ? allCaution.Max(x => x.Version.Length)
- : 0;
-
-
- var maxDisplayNameLength = Math.Max(safeDisplayLength, cautionDisplayLength) + 1;
-
- var maxVersionLength = Math.Max(safeVersionLength, cautionVersionLength) + 1;
-
-
- var classification = new AppxClassification(
- allSafe
- .Select(app =>
- {
- return app with
- {
- DisplayName =
- Defaults.SafeApps.TryGetValue(app.Name, out var dn)
- ? dn
- : app.Name // get display name or fallback to app name
- };
- })
- .OrderBy(x => x.DisplayName)
- .Select(app => app with
- {
- DisplayName = app.DisplayName.PadRight(maxDisplayNameLength),
- Version = app.Version.PadRight(maxVersionLength)
- })
- .ToList(),
- allCaution
- .Select(app =>
- {
- return app with
- {
- DisplayName = Defaults.CautionApps.TryGetValue(app.Name, out var dn) ? dn : app.Name
- };
- })
- .OrderBy(x => x.DisplayName)
- .Select(app => app with
- {
- DisplayName = app.DisplayName.PadRight(maxDisplayNameLength),
- Version = app.Version.PadRight(maxVersionLength)
- })
- .ToList()
- );
-
- var parts = new List<string>();
-
- if (classification.SafeApps.Count > 0)
- {
- parts.Add($"[{Theme.Success}]{classification.SafeApps.Count}[/] safe apps");
- Log.LogDebug("Found {TotalSafeApps} safe apps: {SafeApps}", classification.SafeApps.Count,
- string.Join(", ", classification.SafeApps.Select(x => x.Name).ToList()));
- }
-
- if (classification.CautionApps.Count > 0)
- {
- parts.Add($"[{Theme.Error}]{classification.CautionApps.Count}[/] caution apps");
- Log.LogDebug("Found {TotalCautionApps} caution apps: {CautionApps}", classification.CautionApps.Count,
- string.Join(", ", classification.CautionApps.Select(x => x.Name).ToList()));
- }
-
- if (parts.Count != 0)
- Log.LogInformation($"Found {string.Join(" and ", parts)}.");
- else
- Log.LogWarning("No apps found.");
-
- return classification;
- }
- catch (Exception ex)
- {
- Log.LogError(ex, "Failed to get bloatware choices.");
- return new AppxClassification(new List<AppxPackage>(), new List<AppxPackage>());
- }
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Helpers/RequirementChecker.cs b/optimizerDuck/src/Core/Helpers/RequirementChecker.cs
deleted file mode 100644
index 44918d9..0000000
--- a/optimizerDuck/src/Core/Helpers/RequirementChecker.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Security.Principal;
-using Microsoft.Extensions.Logging;
-using optimizerDuck.Core.Services;
-using optimizerDuck.UI;
-using optimizerDuck.UI.Components;
-using optimizerDuck.UI.Logger;
-
-namespace optimizerDuck.Core.Helpers;
-
-public static class RequirementChecker
-{
- private static readonly ILogger Log = Logger.CreateLogger(typeof(RequirementChecker));
-
- public static bool IsAdmin()
- {
- using var identity = WindowsIdentity.GetCurrent();
- var principal = new WindowsPrincipal(identity);
- return principal.IsInRole(WindowsBuiltInRole.Administrator);
- }
-
- public static void ValidateSystemRequirements(SystemSnapshot s)
- {
- if (!OperatingSystem.IsWindows())
- {
- Log.LogWarning("Untested operating system.");
-
- PromptDialog.Warning(
- "Untested Operating System",
- """
- This optimizer has not been tested on non-Windows operating systems.
- You may continue at your own risk, but some features may not work as expected.
- """,
- new PromptOption("Exit", Theme.Error, () => Environment.Exit(1)),
- new PromptOption("Continue anyway", Theme.Warning)
- );
- }
-
- if (int.TryParse(s.Os.Version, out var version) && version < 10)
- {
- Log.LogWarning("Untested Windows version.");
-
- PromptDialog.Warning(
- "Untested Windows Version",
- $"""
- Your Windows version [{Theme.Error}]{s.Os.Version}[/] has not been tested with this optimizer.
- It is recommended to use Windows 10 or later.
- [{Theme.WarningMuted}]You may continue anyway, but some features may not behave as expected.[/]
- """,
- new PromptOption("Exit", Theme.Error, () => Environment.Exit(1)),
- new PromptOption("Continue anyway", Theme.Warning)
- );
- }
-
- if (!Environment.Is64BitOperatingSystem)
- {
- Log.LogWarning("Untested operating system architecture.");
-
- PromptDialog.Warning(
- "Untested Operating System Architecture",
- $"""
- Your system architecture [{Theme.Error}]{s.Os.Architecture}[/] has not been tested.
- This optimizer is designed for 64-bit Windows systems.
- [{Theme.WarningMuted}]You may continue anyway, but some features may not work properly.[/]
- """,
- new PromptOption("Exit", Theme.Error, () => Environment.Exit(1)),
- new PromptOption("Continue anyway", Theme.Warning)
- );
- }
- }
-
- public static void EnsureDirectoriesExists()
- {
- if (!Directory.Exists(Defaults.RootPath))
- {
- Log.LogInformation(@"AppData\optimizerDuck directory does not exist. Creating directory at: {Path}",
- Defaults.RootPath);
- Directory.CreateDirectory(Defaults.RootPath);
- }
-
- if (!Directory.Exists(Defaults.ResourcesPath))
- {
- Log.LogInformation("Resources directory does not exist. Creating directory at: {Path}",
- Defaults.ResourcesPath);
- Directory.CreateDirectory(Defaults.ResourcesPath);
- }
- }
-
- public static void Restart(bool force = false)
- {
- var args = Environment.GetCommandLineArgs();
- if (force || !args.Contains("--restart"))
- try
- {
- SystemHelper.Title("Restarting...");
- using var process = new Process
- {
- StartInfo = new ProcessStartInfo
- {
- FileName = Environment.ProcessPath,
- Arguments = $"--restart {string.Join(" ", args.Skip(1))}",
- WindowStyle = ProcessWindowStyle.Maximized,
- WorkingDirectory = Environment.CurrentDirectory,
- UseShellExecute = true,
- Verb = "runas"
- }
- };
- Log.LogInformation("Restarting application with administrator privileges and maximized window.");
- Log.LogInformation(
- $"Please press [{Theme.Success}]Yes[/] if [{Theme.Primary}]User Account Control[/] (UAC) prompt appears.");
-
- process.Start();
- Log.LogInformation("Operation completed successfully! Exiting...");
- Environment.Exit(0);
- }
- catch (Win32Exception ex) when
- (ex.ErrorCode == -2147467259) // The operation was canceled by the user.
- {
- Log.LogError("User [red]declined[/] the elevation prompt.");
-
- PromptDialog.Warning(
- "Administrator Privileges Required",
- $"""
- To run properly, this application needs administrator rights and should open in full screen.
- Restart the app and click [{Theme.Success}]Yes[/] if [{Theme.Primary}]User Account Control[/] (UAC) prompt appears.
- """,
- new PromptOption("Restart", Theme.Success, () => Restart(true)),
- new PromptOption("Exit", Theme.Error, () => Environment.Exit(1))
- );
- }
- catch (Exception ex)
- {
- Log.LogError(ex, "Failed to restart process");
-
- PromptDialog.Exception(ex,
- "Restart Failed",
- "An error occurred while trying to restart with administrator privileges."
- );
- }
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Helpers/StreamHelper.cs b/optimizerDuck/src/Core/Helpers/StreamHelper.cs
deleted file mode 100644
index 6474d18..0000000
--- a/optimizerDuck/src/Core/Helpers/StreamHelper.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using Microsoft.Extensions.Logging;
-using optimizerDuck.UI.Logger;
-
-namespace optimizerDuck.Core.Helpers;
-
-public static class StreamHelper
-{
- private static readonly ILogger Log = Logger.CreateLogger(typeof(StreamHelper));
-
- public static async Task<(bool Success, string? FilePath)> TryDownloadAsync(
- string url,
- string fileName)
- {
- var filePath = Path.Combine(Defaults.ResourcesPath, fileName);
-
- Log.LogInformation("Starting download from {Url} to {FilePath}", url, filePath);
-
- try
- {
- using var client = new HttpClient();
- using var response = await client.GetAsync(url).ConfigureAwait(false);
-
- Log.LogDebug("Received HTTP {StatusCode} from {Url}", response.StatusCode, url);
-
- response.EnsureSuccessStatusCode();
-
- await using var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.None);
- await response.Content.CopyToAsync(fs).ConfigureAwait(false);
-
- var length = fs.Length;
- Log.LogInformation("Successfully downloaded {Length} bytes from {Url} to {FilePath}", length, url,
- filePath);
-
- return (true, filePath);
- }
- catch (HttpRequestException ex)
- {
- Log.LogError(ex, "Network error while downloading {Url}", url);
- return (false, null);
- }
- catch (IOException ex)
- {
- Log.LogError(ex, "File I/O error while saving {FilePath}", filePath);
- return (false, null);
- }
- catch (UnauthorizedAccessException ex)
- {
- Log.LogError(ex, "Access denied when writing to {FilePath}", filePath);
- return (false, null);
- }
- catch (Exception ex)
- {
- Log.LogError(ex, "Unexpected error downloading {Url} to {FilePath}", url, filePath);
- return (false, null);
- }
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Helpers/SystemHelper.cs b/optimizerDuck/src/Core/Helpers/SystemHelper.cs
deleted file mode 100644
index 484c17e..0000000
--- a/optimizerDuck/src/Core/Helpers/SystemHelper.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-using System.Diagnostics;
-using Microsoft.Extensions.Logging;
-using Newtonsoft.Json;
-using optimizerDuck.Core.Services;
-using optimizerDuck.UI;
-using optimizerDuck.UI.Logger;
-
-namespace optimizerDuck.Core.Helpers;
-
-public static class SystemHelper
-{
- private static readonly ILogger Log = Logger.CreateLogger(typeof(SystemHelper));
-
- public static void OpenLogFile()
- {
- Process.Start(new ProcessStartInfo
- {
- FileName = Logger.LogFilePath,
- UseShellExecute = true
- });
- }
-
- public static void OpenWebsite(string url)
- {
- Process.Start(new ProcessStartInfo
- {
- FileName = url,
- UseShellExecute = true
- });
- }
-
- public static bool IsWindows11OrGreater()
- {
- return int.TryParse(SystemInfoService.Snapshot.Os.Version, out var v) && v >= 11;
- }
-
- public static void Title(string title)
- {
- Console.Title = $"optimizerDuck [{Defaults.FileVersion}] - {title}";
- }
-
- public static List<string> CheckForExclusions()
- {
- var exePath = Defaults.ExePath;
- var rootPath = Defaults.RootPath;
- try
- {
- var result = ShellService.PowerShell($$"""
- @{
- SelfPath = (Get-MpPreference).ExclusionPath -contains "{{exePath}}";
- RootPath = (Get-MpPreference).ExclusionPath -contains "{{rootPath}}"
- } | ConvertTo-Json
- """);
- var exclusions = JsonConvert.DeserializeObject<Dictionary<string, bool>>(result.Stdout);
- var missingPaths = new List<string>();
- if (exclusions != null && exclusions.TryGetValue("SelfPath", out var selfPathExcluded) && !selfPathExcluded)
- {
- Log.LogWarning("Path not excluded: {SelfPath}", exePath);
- missingPaths.Add(exePath);
- }
-
- if (exclusions != null && exclusions.TryGetValue("RootPath", out var rootPathExcluded) && !rootPathExcluded)
- {
- Log.LogWarning("Path not excluded: {RootPath}", rootPath);
- missingPaths.Add(rootPath);
- }
-
- return missingPaths;
- }
- catch (Exception ex)
- {
- Log.LogError(ex, "Failed to check for exclusions.");
- }
-
- return [];
- }
-
- public static void AddToExclusions(List<string> paths)
- {
- using var tracker = ServiceTracker.Begin(Log);
- foreach (var path in paths)
- {
- var result = ShellService.PowerShell($"Add-MpPreference -ExclusionPath \"{path}\"");
- if (result.ExitCode != 0) Log.LogError($"[{Theme.Error}]Failed to add path to exclusions: {path}[/]");
- }
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Helpers/SystemProtectionHelper.cs b/optimizerDuck/src/Core/Helpers/SystemProtectionHelper.cs
deleted file mode 100644
index e5cf40c..0000000
--- a/optimizerDuck/src/Core/Helpers/SystemProtectionHelper.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using Microsoft.Extensions.Logging;
-using optimizerDuck.Core.Services;
-using optimizerDuck.UI;
-using optimizerDuck.UI.Components;
-using optimizerDuck.UI.Logger;
-
-namespace optimizerDuck.Core.Helpers;
-
-public static class SystemProtectionHelper
-{
- private static readonly ILogger Log = Logger.CreateLogger(typeof(SystemProtectionHelper));
-
- public static bool Enable()
- {
- using var tracker = ServiceTracker.Begin(Log);
- Log.LogInformation("Enabling System Protection...");
-
- var result = ShellService.PowerShell("Enable-ComputerRestore -Drive \"$env:SystemDrive\"");
- if (result.ExitCode != 0)
- {
- Log.LogError($"[{Theme.Error}]Failed to enable System Protection.[/]");
- return PromptDialog.Warning("Failed to enable System Protection",
- $"""
- We were [{Theme.Error}]unable[/] to enable System Protection.
- [{Theme.Muted}]For more information, check the log file.[/]
- """,
- new PromptOption("Try again", Theme.Warning, Enable),
- new PromptOption("Skip", Theme.Error, () => false)
- );
- }
-
- Log.LogInformation($"[{Theme.Success}]System Protection enabled successfully.[/]");
- return true;
- }
-
- public static void Create()
- {
- using var tracker = ServiceTracker.Begin(Log);
- Log.LogInformation("Creating a restore point...");
-
- var result =
- ShellService.PowerShell(
- $"Checkpoint-Computer -Description \"{Defaults.RestorePointName}\" -RestorePointType MODIFY_SETTINGS");
- if (result.ExitCode != 0)
- {
- Log.LogError($"[{Theme.Error}]Failed to create restore point.[/]");
- PromptDialog.Warning("Failed to create Restore Point",
- $"""
- We were [{Theme.Error}]unable[/] to create a restore point.
- [{Theme.Muted}]For more information, check the log file.[/]
- """,
- new PromptOption("Try again", Theme.Warning, Create),
- new PromptOption("Skip", Theme.Error));
- }
- else
- {
- Log.LogInformation(
- $"[{Theme.Success}]A restore point [{Theme.Primary}]{Defaults.RestorePointName}[/] created successfully.[/]");
- }
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Managers/CacheManager.cs b/optimizerDuck/src/Core/Managers/CacheManager.cs
deleted file mode 100644
index f0f9264..0000000
--- a/optimizerDuck/src/Core/Managers/CacheManager.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using Microsoft.Extensions.Caching.Memory;
-
-namespace optimizerDuck.Core.Managers;
-
-public static class CacheManager
-{
- private static readonly MemoryCache Cache = new(new MemoryCacheOptions());
-
- public static T GetOrCreate<T>(string key, Func<ICacheEntry, T> factory)
- {
- return Cache.GetOrCreate(key, factory)!;
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Managers/OptimizationManager.cs b/optimizerDuck/src/Core/Managers/OptimizationManager.cs
deleted file mode 100644
index 761908f..0000000
--- a/optimizerDuck/src/Core/Managers/OptimizationManager.cs
+++ /dev/null
@@ -1,276 +0,0 @@
-using System.Diagnostics;
-using Microsoft.Extensions.Logging;
-using optimizerDuck.Core.Extensions;
-using optimizerDuck.Core.Helpers;
-using optimizerDuck.Core.Optimizers;
-using optimizerDuck.Core.Services;
-using optimizerDuck.Models;
-using optimizerDuck.UI;
-using optimizerDuck.UI.Components;
-using optimizerDuck.UI.Logger;
-using Spectre.Console;
-using ILogger = Microsoft.Extensions.Logging.ILogger;
-
-namespace optimizerDuck.Core.Managers;
-
-public class OptimizationManager(SystemSnapshot systemSnapshot)
-{
- private static readonly ILogger Log = Logger.CreateLogger<OptimizationManager>();
- private Queue<OptimizationChoice> _selectedOptimizations = new();
- private SystemSnapshot _systemSnapshot = systemSnapshot;
-
- public static Queue<AppxPackage> SelectedBloatware { get; private set; } =
- new(); // public and static for Remove Bloatware Apps optimization
-
-
- public async Task<bool> Begin()
- {
- AnsiConsole.Clear();
- AnsiConsole.Write(Defaults.Logo);
-
- Log.LogInformation("Loading optimizations...");
-
- var optimizationCategories = OptimizationHelper.LoadOptimizationChoices();
- Log.LogInformation("Loaded {CategoriesAmount} categories with {OptimizationAmount} optimizations.",
- optimizationCategories.Count,
- optimizationCategories.Sum(g => g.Optimizations.Count));
-
- SystemHelper.Title("Select the optimizations you want to apply");
- try
- {
- using var escapeCancellableConsole = new EscapeCancellableConsole(AnsiConsole.Console);
- var promptOptimizationChoice = new MultiSelectionPrompt<OptimizationChoice>()
- .Title("Select the optimizations you want to apply")
- .InstructionsText(Defaults.EscapeCancellableConsoleMultiSelectionPromptInstructionsText)
- .Required(true)
- .HighlightStyle(Theme.Primary)
- .UseConverter(t => $"{t.Name} {t.Description}")
- .PageSize(24);
-
- foreach (var g in optimizationCategories)
- promptOptimizationChoice.AddChoiceGroup(
- new OptimizationChoice(null, $"[bold underline]{g.Name}[/]", string.Empty,
- false),
- g.Optimizations
- );
-
- var optimizationsToSelect = _selectedOptimizations.Count == 0
- ? optimizationCategories.SelectMany(g => g.Optimizations).Where(t => t.EnabledByDefault)
- : _selectedOptimizations;
-
- foreach (var optimization in optimizationsToSelect) promptOptimizationChoice.Select(optimization);
-
- var optimizationChoices =
- await escapeCancellableConsole.PromptAsync(promptOptimizationChoice).ConfigureAwait(false);
-
- _selectedOptimizations = new Queue<OptimizationChoice>(optimizationChoices);
-
- if (_selectedOptimizations.Any(t =>
- t.Instance is BloatwareAndServices.RemoveBloatwareApps)) // if Bloatware selection is selected
- {
- Log.LogInformation("Getting installed bloatware apps...");
-
- var appxClassification = OptimizationHelper.GetBloatwareChoices();
-
- if (appxClassification.SafeApps.Count == 0 && appxClassification.CautionApps.Count == 0)
- return PromptDialog.Warning(
- "No Bloatware Detected",
- $"""
- [{Theme.Success}]Great news![/]
- We [{Theme.Warning}]couldn't[/] find any bloatware installed on your system.
- There's nothing you need to remove, so you can [{Theme.Success}]safely continue[/].
- """,
- new PromptOption("Continue", Theme.Success, () => true),
- new PromptOption("Back", Theme.Warning, () => false)
- );
-
- SystemHelper.Title("Select the bloatware apps you want to remove");
- var promptBloatware = new MultiSelectionPrompt<AppxPackage>()
- .Title("Select the bloatware apps you want to remove")
- .InstructionsText(Defaults.EscapeCancellableConsoleMultiSelectionPromptInstructionsText)
- .Required(true)
- .HighlightStyle(Theme.Primary)
- .UseConverter(app =>
- $"{(app.DisplayName.Contains("Safe Apps") || app.DisplayName.Contains("Caution Apps") ?
- app.DisplayName :
- $"[bold]{app.DisplayName}[/] [dim]{app.Version} {app.InstallLocation}[/]")}")
- .PageSize(24);
-
- if (appxClassification.SafeApps.Count > 0)
- promptBloatware.AddChoiceGroup(
- new AppxPackage
- {
- DisplayName =
- $"[bold underline {Theme.Success}]Safe Apps[/] - [{Theme.Success}]Safe to remove[/]",
- Name = "",
- Version = "",
- InstallLocation = ""
- },
- appxClassification.SafeApps);
-
- if (appxClassification.CautionApps.Count > 0)
- promptBloatware.AddChoiceGroup(
- new AppxPackage
- {
- DisplayName =
- $"[bold underline {Theme.Error}]Caution Apps[/] - [{Theme.Error}]May cause issues[/]",
- Name = "",
- Version = "",
- InstallLocation = ""
- },
- appxClassification.CautionApps);
-
-
- if (SelectedBloatware.Count == 0)
- foreach (var app in appxClassification.SafeApps)
- promptBloatware.Select(app);
- else
- foreach (var app in SelectedBloatware)
- promptBloatware.Select(app);
-
- var bloatwareSelection =
- await escapeCancellableConsole.PromptAsync(promptBloatware).ConfigureAwait(false);
-
- SelectedBloatware = new Queue<AppxPackage>(bloatwareSelection);
- }
- }
- catch (OperationCanceledException)
- {
- return false;
- }
-
- return true;
- }
-
- public static Task<bool> RestorePoint()
- {
- AnsiConsole.Clear();
- AnsiConsole.Write(Defaults.Logo);
-
- SystemHelper.Title("Create Restore Point");
-
- return Task.FromResult(PromptDialog.Warning("Create Restore Point",
- $"""
- For your safety, we [{Theme.Success}]highly recommend[/] creating a system Restore Point now.
- It acts as a safeguard, allowing you to [{Theme.Success}]roll back[/] any unwanted system changes later.
- """,
- new PromptOption("Yes", Theme.Success, () =>
- {
- if (SystemProtectionHelper.Enable())
- SystemProtectionHelper.Create();
- }),
- new PromptOption("Skip", Theme.Error, () => true),
- new PromptOption("Back", Theme.Warning, () => false)));
- }
-
- public async Task Run(CancellationToken cancellationToken)
- {
- AnsiConsole.Clear();
- AnsiConsole.Write(Defaults.Logo);
- SystemHelper.Title("Starting Optimization");
-
- Log.LogInformation("Refreshing system information...");
- _systemSnapshot = await SystemInfoService.RefreshAsync().ConfigureAwait(false);
-
- Log.LogDebug("Selected {OptimizationAmount} optimizations: {Optimizations}",
- _selectedOptimizations.Count,
- string.Join(", ", _selectedOptimizations.Select(t => t.Name)));
-
- if (_selectedOptimizations.Any(t =>
- t.Instance is BloatwareAndServices.RemoveBloatwareApps)) // if Bloatware selection is selected
- Log.LogDebug("Selected {BloatwareAmount} bloatware apps: {BloatwareApps}", SelectedBloatware.Count,
- string.Join(", ", SelectedBloatware.Select(app => $"{app.DisplayName.Trim()} ({app.Version.Trim()})")));
-
-
- Log.LogDebug(new string('=', 60));
- await AnsiConsole.Status()
- .Spinner(Spinner.Known.Dots2)
- .SpinnerStyle($"bold {Theme.Primary}")
- .StartAsyncGlobal("Initializing Optimization", async ctx =>
- {
- while (_selectedOptimizations.TryDequeue(out var selectedOptimization))
- try
- {
- cancellationToken.ThrowIfCancellationRequested();
-
- selectedOptimization = selectedOptimization with
- {
- Name = selectedOptimization.Name.Trim(),
- Description = selectedOptimization.Description.Trim()
- };
-
- SystemHelper.Title(selectedOptimization.Name);
- ctx.Status(
- $"Applying [{Theme.Primary}]{selectedOptimization.Name}[/]... [{Theme.Muted}][[Press [{Theme.Error}]CTRL + C[/] to cancel the optimization]][/]");
-
- using var scope = Log.BeginScope("Optimization: {OptimizationName}", selectedOptimization.Name);
-
-
- Rule($"[bold white] {selectedOptimization.Name} [/]", Theme.Success);
- Log.LogInformation("Applying {OptimizationName}...", selectedOptimization.Name);
-
- var stopwatch = Stopwatch.StartNew();
-
- await selectedOptimization.Instance!.Apply(_systemSnapshot, cancellationToken)
- .ConfigureAwait(false);
- //await Task.Delay(5000, cancellationToken);
- stopwatch.Stop();
-
- Log.LogDebug("Applied in {Elapsed} ms", stopwatch.ElapsedMilliseconds);
- }
- catch (OperationCanceledException)
- {
- break;
- }
- catch (Exception e)
- {
- Log.LogError(e, "Failed to apply optimization {OptimizationName}. Skipped.",
- selectedOptimization.Name);
- }
- finally
- {
- Log.LogDebug(new string('=', 60));
- }
- });
-
- if (cancellationToken.IsCancellationRequested)
- {
- SystemHelper.Title("Optimization Canceled");
-
- Rule("Optimization Canceled", Theme.Error);
- Log.LogInformation("Optimization canceled by user.");
- GlobalStatus.Current?.Status("Optimization canceled by user.");
-
- PromptDialog.Warning("Optimization Canceled",
- "You have canceled the optimization.",
- new PromptOption("Back", Theme.Warning, () => true));
- return;
- }
-
- Rule("Optimization completed!", Theme.Success);
- SystemHelper.Title("Optimization completed!");
-
- Log.LogInformation($"[{Theme.Success}]Optimization completed![/]");
-
- PromptDialog.Warning("Restart to Apply Changes",
- $"""
- The optimizations have been applied successfully.
- Please [{Theme.Success}]restart[/] your PC for the changes to take effect.
- """,
- new PromptOption("Restart now", Theme.Success, () =>
- {
- Log.LogInformation("Restarting...");
- ShellService.CMD("shutdown /r /t 0");
- }),
- new PromptOption("I will restart later", Theme.Warning)
- );
- }
-
- private static void Rule(string title, string ruleColor)
- {
- AnsiConsole.WriteLine();
- AnsiConsole.Write(new Rule(title)
- .RuleStyle(ruleColor));
- AnsiConsole.WriteLine();
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Optimizers/BloatwareAndServices.cs b/optimizerDuck/src/Core/Optimizers/BloatwareAndServices.cs
deleted file mode 100644
index 7f60981..0000000
--- a/optimizerDuck/src/Core/Optimizers/BloatwareAndServices.cs
+++ /dev/null
@@ -1,423 +0,0 @@
-using Microsoft.Extensions.Logging;
-using optimizerDuck.Core.Managers;
-using optimizerDuck.Core.Services;
-using optimizerDuck.Interfaces;
-using optimizerDuck.Models;
-using optimizerDuck.UI;
-using optimizerDuck.UI.Logger;
-
-namespace optimizerDuck.Core.Optimizers;
-
-public class BloatwareAndServices : IOptimizationCategory
-{
- public string Name { get; } = "Bloatware & Services";
- public OptimizationCategoryOrder Order { get; } = OptimizationCategoryOrder.BloatwareAndServices;
- public static ILogger Log { get; } = Logger.CreateLogger<BloatwareAndServices>();
-
- public class RemoveBloatwareApps : IOptimization
- {
- public string Name { get; } = "Remove Bloatware Apps";
-
- public string Description { get; } =
- "Removes selected bloatware apps (after continue) and bloatware that take up storage space and system resources";
-
- public bool EnabledByDefault { get; } = true;
-
- public OptimizationImpact Impact { get; } = OptimizationImpact.Aggressive;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
-
- while (OptimizationManager.SelectedBloatware.TryDequeue(out var appxPackage))
- {
- t.ThrowIfCancellationRequested();
- appxPackage = appxPackage with
- {
- DisplayName = appxPackage.DisplayName.Trim(), Version = appxPackage.Version.Trim()
- };
- Log.LogInformation(
- $"Removing bloatware app: [{Theme.Primary}]{appxPackage.DisplayName}[/] [{Theme.Success}]{appxPackage.Version}[/] ([dim]{appxPackage.Name}[/])");
-
- ShellService.PowerShell($$"""
- $packages = Get-AppxPackage -AllUsers | Where-Object { $_.Name -eq "{{appxPackage.Name}}" }
- Write-Output "Found $($packages.Count) packages for {{appxPackage.Name}}"
- foreach ($pkg in $packages) {
- Write-Output "Removing $($pkg.PackageFullName)"
- Remove-AppxPackage -Package $pkg.PackageFullName -AllUsers
- }
- """);
- }
-
- Log.LogInformation("Bloatware apps have been removed.");
-
- return Task.CompletedTask;
- }
- }
-
- public class DisablePreinstalledApps : IOptimization
- {
- public string Name { get; } = "Disable Preinstalled Apps";
-
- public string Description { get; } =
- "Disables all preinstalled apps, automatic app installs, and Windows content suggestions or ads";
-
- public bool EnabledByDefault { get; } = true;
-
- public OptimizationImpact Impact { get; } = OptimizationImpact.Significant;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "PreInstalledAppsEnabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "SilentInstalledAppsEnabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "OemPreInstalledAppsEnabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "ContentDeliveryAllowed", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "SubscribedContentEnabled", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "PreInstalledAppsEverEnabled", 0)
- );
- Log.LogInformation("Preinstalled apps have been disabled.");
-
- return Task.CompletedTask;
- }
- }
-
- public class RemoveMicrosoftEdge : IOptimization
- {
- public string Name { get; } = "Debloat Microsoft Edge";
-
- public string Description { get; } =
- "Removes unnecessary Microsoft Edge features and reduces its system integration for improved performance";
-
- public bool EnabledByDefault { get; } = false;
-
- public OptimizationImpact Impact { get; } = OptimizationImpact.Minimal;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- // thank you again, WinUtil
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\EdgeUpdate", "CreateDesktopShortcutDefault", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Edge", "PersonalizationReportingEnabled", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Edge", "ShowRecommendationsEnabled", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Edge", "HideFirstRunExperience", 1),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Edge", "UserFeedbackAllowed", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Edge", "ConfigureDoNotTrack", 1),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Edge", "AlternateErrorPagesEnabled", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Edge", "EdgeCollectionsEnabled", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Edge", "EdgeShoppingAssistantEnabled", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Edge", "MicrosoftEdgeInsiderPromotionEnabled", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Edge", "ShowMicrosoftRewards", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Edge", "WebWidgetAllowed", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Edge", "DiagnosticData", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Edge", "EdgeAssetDeliveryServiceEnabled", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Edge", "CryptoWalletEnabled", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Edge", "WalletDonationEnabled", 0)
- );
- Log.LogInformation("Microsoft Edge has been debloated.");
- return Task.CompletedTask;
- }
- }
-
- public class ConfigureServices : IOptimization
- {
- public string Name { get; } = "Configure Services";
-
- public string Description { get; } =
- "Optimizes Windows services by disabling unnecessary background services that consume system resources";
-
- public bool EnabledByDefault { get; } = true;
-
- public OptimizationImpact Impact { get; } = OptimizationImpact.Aggressive;
-
- public Task Apply(SystemSnapshot s, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- ServiceProcessService.ChangeServiceStartupType(
- new ServiceItem("AJRouter", ServiceStartupType.Disabled),
- new ServiceItem("ALG", ServiceStartupType.Manual),
- new ServiceItem("AppIDSvc", ServiceStartupType.Manual),
- new ServiceItem("AppMgmt", ServiceStartupType.Manual),
- new ServiceItem("AppReadiness", ServiceStartupType.Manual),
- new ServiceItem("AppVClient", ServiceStartupType.Disabled),
- new ServiceItem("AppXSvc", ServiceStartupType.Manual),
- new ServiceItem("Appinfo", ServiceStartupType.Manual),
- new ServiceItem("AssignedAccessManagerSvc", ServiceStartupType.Disabled),
- new ServiceItem("AudioEndpointBuilder", ServiceStartupType.Automatic),
- new ServiceItem("Audiosrv", ServiceStartupType.Automatic),
- new ServiceItem("AxInstSV", ServiceStartupType.Manual),
- new ServiceItem("BDESVC", ServiceStartupType.Manual),
- new ServiceItem("BFE", ServiceStartupType.Automatic),
- new ServiceItem("BITS", ServiceStartupType.Manual),
- new ServiceItem("BTAGService", ServiceStartupType.Manual),
- new ServiceItem("BrokerInfrastructure", ServiceStartupType.Automatic),
- new ServiceItem("Browser", ServiceStartupType.Manual),
- new ServiceItem("BthAvctpSvc", ServiceStartupType.Automatic),
- new ServiceItem("BthHFSrv", ServiceStartupType.Automatic),
- new ServiceItem("CDPSvc", ServiceStartupType.Manual),
- new ServiceItem("COMSysApp", ServiceStartupType.Manual),
- new ServiceItem("CertPropSvc", ServiceStartupType.Manual),
- new ServiceItem("ClipSVC", ServiceStartupType.Manual),
- new ServiceItem("CoreMessagingRegistrar", ServiceStartupType.Automatic),
- new ServiceItem("CryptSvc", ServiceStartupType.Automatic),
- new ServiceItem("CscService", ServiceStartupType.Manual),
- new ServiceItem("DPS", ServiceStartupType.Automatic),
- new ServiceItem("DcomLaunch", ServiceStartupType.Automatic),
- new ServiceItem("DcpSvc", ServiceStartupType.Disabled),
- new ServiceItem("DevQueryBroker", ServiceStartupType.Manual),
- new ServiceItem("DeviceAssociationService", ServiceStartupType.Manual),
- new ServiceItem("DeviceInstall", ServiceStartupType.Manual),
- new ServiceItem("Dhcp", ServiceStartupType.Automatic),
- new ServiceItem("DiagTrack", ServiceStartupType.Disabled),
- new ServiceItem("DialogBlockingService", ServiceStartupType.Disabled),
- new ServiceItem("DispBrokerDesktopSvc", ServiceStartupType.Automatic),
- new ServiceItem("DisplayEnhancementService", ServiceStartupType.Manual),
- new ServiceItem("DmEnrollmentSvc", ServiceStartupType.Manual),
- new ServiceItem("Dnscache", ServiceStartupType.Automatic),
- new ServiceItem("EFS", ServiceStartupType.Manual),
- new ServiceItem("EapHost", ServiceStartupType.Manual),
- new ServiceItem("EntAppSvc", ServiceStartupType.Manual),
- new ServiceItem("EventLog", ServiceStartupType.Automatic),
- new ServiceItem("EventSystem", ServiceStartupType.Automatic),
- new ServiceItem("FDResPub", ServiceStartupType.Manual),
- new ServiceItem("Fax", ServiceStartupType.Disabled),
- new ServiceItem("FontCache", ServiceStartupType.Automatic),
- new ServiceItem("FrameServer", ServiceStartupType.Manual),
- new ServiceItem("FrameServerMonitor", ServiceStartupType.Manual),
- new ServiceItem("GraphicsPerfSvc", ServiceStartupType.Manual),
- new ServiceItem("HomeGroupListener", ServiceStartupType.Disabled),
- new ServiceItem("HomeGroupProvider", ServiceStartupType.Disabled),
- new ServiceItem("HvHost", ServiceStartupType.Manual),
- new ServiceItem("IEEtwCollectorService", ServiceStartupType.Manual),
- new ServiceItem("IKEEXT", ServiceStartupType.Manual),
- new ServiceItem("InstallService", ServiceStartupType.Manual),
- new ServiceItem("InventorySvc", ServiceStartupType.Manual),
- new ServiceItem("IpxlatCfgSvc", ServiceStartupType.Manual),
- new ServiceItem("KeyIso", ServiceStartupType.Automatic),
- new ServiceItem("KtmRm", ServiceStartupType.Manual),
- new ServiceItem("LSM", ServiceStartupType.Automatic),
- new ServiceItem("LanmanServer", ServiceStartupType.Automatic),
- new ServiceItem("LanmanWorkstation", ServiceStartupType.Automatic),
- new ServiceItem("LicenseManager", ServiceStartupType.Manual),
- new ServiceItem("LxpSvc", ServiceStartupType.Manual),
- new ServiceItem("MSDTC", ServiceStartupType.Manual),
- new ServiceItem("MSiSCSI", ServiceStartupType.Manual),
- new ServiceItem("MapsBroker", ServiceStartupType.AutomaticDelayedStart),
- new ServiceItem("McpManagementService", ServiceStartupType.Manual),
- new ServiceItem("MicrosoftEdgeElevationService", ServiceStartupType.Manual),
- new ServiceItem("MixedRealityOpenXRSvc", ServiceStartupType.Manual),
- new ServiceItem("MpsSvc", ServiceStartupType.Automatic),
- new ServiceItem("MsKeyboardFilter", ServiceStartupType.Manual),
- new ServiceItem("NaturalAuthentication", ServiceStartupType.Manual),
- new ServiceItem("NcaSvc", ServiceStartupType.Manual),
- new ServiceItem("NcbService", ServiceStartupType.Manual),
- new ServiceItem("NcdAutoSetup", ServiceStartupType.Manual),
- new ServiceItem("NetSetupSvc", ServiceStartupType.Manual),
- new ServiceItem("NetTcpPortSharing", ServiceStartupType.Disabled),
- new ServiceItem("Netlogon", ServiceStartupType.Automatic),
- new ServiceItem("Netman", ServiceStartupType.Manual),
- new ServiceItem("NgcCtnrSvc", ServiceStartupType.Manual),
- new ServiceItem("NgcSvc", ServiceStartupType.Manual),
- new ServiceItem("NlaSvc", ServiceStartupType.Manual),
- new ServiceItem("PNRPAutoReg", ServiceStartupType.Manual),
- new ServiceItem("PNRPsvc", ServiceStartupType.Manual),
- new ServiceItem("PcaSvc", ServiceStartupType.Manual),
- new ServiceItem("PeerDistSvc", ServiceStartupType.Manual),
- new ServiceItem("PerfHost", ServiceStartupType.Manual),
- new ServiceItem("PhoneSvc", ServiceStartupType.Manual),
- new ServiceItem("PlugPlay", ServiceStartupType.Automatic),
- new ServiceItem("PolicyAgent", ServiceStartupType.Manual),
- new ServiceItem("Power", ServiceStartupType.Automatic),
- new ServiceItem("PrintNotify", ServiceStartupType.Disabled),
- new ServiceItem("ProfSvc", ServiceStartupType.Automatic),
- new ServiceItem("PushToInstall", ServiceStartupType.Manual),
- new ServiceItem("QWAVE", ServiceStartupType.Manual),
- new ServiceItem("RasAuto", ServiceStartupType.Manual),
- new ServiceItem("RasMan", ServiceStartupType.Manual),
- new ServiceItem("RemoteAccess", ServiceStartupType.Disabled),
- new ServiceItem("RemoteRegistry", ServiceStartupType.Disabled),
- new ServiceItem("RetailDemo", ServiceStartupType.Disabled),
- new ServiceItem("RmSvc", ServiceStartupType.Manual),
- new ServiceItem("RpcEptMapper", ServiceStartupType.Automatic),
- new ServiceItem("RpcLocator", ServiceStartupType.Manual),
- new ServiceItem("RpcSs", ServiceStartupType.Automatic),
- new ServiceItem("SCPolicySvc", ServiceStartupType.Manual),
- new ServiceItem("SCardSvr", ServiceStartupType.Manual),
- new ServiceItem("SDRSVC", ServiceStartupType.Manual),
- new ServiceItem("SEMgrSvc", ServiceStartupType.Manual),
- new ServiceItem("SENS", ServiceStartupType.Automatic),
- new ServiceItem("SNMPTRAP", ServiceStartupType.Manual),
- new ServiceItem("SSDPSRV", ServiceStartupType.Manual),
- new ServiceItem("SamSs", ServiceStartupType.Automatic),
- new ServiceItem("ScDeviceEnum", ServiceStartupType.Manual),
- new ServiceItem("Schedule", ServiceStartupType.Automatic),
- new ServiceItem("SecurityHealthService", ServiceStartupType.Manual),
- new ServiceItem("Sense", ServiceStartupType.Manual),
- new ServiceItem("SensorDataService", ServiceStartupType.Manual),
- new ServiceItem("SensorService", ServiceStartupType.Manual),
- new ServiceItem("SensrSvc", ServiceStartupType.Manual),
- new ServiceItem("SessionEnv", ServiceStartupType.Manual),
- new ServiceItem("SharedAccess", ServiceStartupType.Manual),
- new ServiceItem("SharedRealitySvc", ServiceStartupType.Manual),
- new ServiceItem("ShellHWDetection", ServiceStartupType.Automatic),
- new ServiceItem("SmsRouter", ServiceStartupType.Manual),
- new ServiceItem("Spooler", ServiceStartupType.Manual),
- new ServiceItem("SstpSvc", ServiceStartupType.Manual),
- new ServiceItem("StiSvc", ServiceStartupType.Manual),
- new ServiceItem("StorSvc", ServiceStartupType.Manual),
- new ServiceItem("SystemEventsBroker", ServiceStartupType.Automatic),
- new ServiceItem("TabletInputService", ServiceStartupType.Manual),
- new ServiceItem("TapiSrv", ServiceStartupType.Manual),
- new ServiceItem("TermService", ServiceStartupType.Automatic),
- new ServiceItem("Themes", ServiceStartupType.Automatic),
- new ServiceItem("TieringEngineService", ServiceStartupType.Manual),
- new ServiceItem("TimeBroker", ServiceStartupType.Manual),
- new ServiceItem("TimeBrokerSvc", ServiceStartupType.Manual),
- new ServiceItem("TokenBroker", ServiceStartupType.Manual),
- new ServiceItem("TrkWks", ServiceStartupType.Automatic),
- new ServiceItem("TroubleshootingSvc", ServiceStartupType.Manual),
- new ServiceItem("UI0Detect", ServiceStartupType.Manual),
- new ServiceItem("UevAgentService", ServiceStartupType.Disabled),
- new ServiceItem("UmRdpService", ServiceStartupType.Manual),
- new ServiceItem("UserManager", ServiceStartupType.Automatic),
- new ServiceItem("UsoSvc", ServiceStartupType.Manual),
- new ServiceItem("VGAuthService", ServiceStartupType.Automatic),
- new ServiceItem("VMTools", ServiceStartupType.Automatic),
- new ServiceItem("VSS", ServiceStartupType.Manual),
- new ServiceItem("VacSvc", ServiceStartupType.Manual),
- new ServiceItem("VaultSvc", ServiceStartupType.Automatic),
- new ServiceItem("W32Time", ServiceStartupType.Manual),
- new ServiceItem("WEPHOSTSVC", ServiceStartupType.Manual),
- new ServiceItem("WFDSConMgrSvc", ServiceStartupType.Manual),
- new ServiceItem("WMPNetworkSvc", ServiceStartupType.Disabled),
- new ServiceItem("WManSvc", ServiceStartupType.Manual),
- new ServiceItem("WPDBusEnum", ServiceStartupType.Manual),
- new ServiceItem("WSService", ServiceStartupType.Manual),
- new ServiceItem("WSearch", ServiceStartupType.Disabled),
- new ServiceItem("WaaSMedicSvc", ServiceStartupType.Manual),
- new ServiceItem("WalletService", ServiceStartupType.Manual),
- new ServiceItem("WarpJITSvc", ServiceStartupType.Manual),
- new ServiceItem("WbioSrvc", ServiceStartupType.Manual),
- new ServiceItem("Wcmsvc", ServiceStartupType.Automatic),
- new ServiceItem("WcsPlugInService", ServiceStartupType.Manual),
- new ServiceItem("WdNisSvc", ServiceStartupType.Manual),
- new ServiceItem("WdiServiceHost", ServiceStartupType.Manual),
- new ServiceItem("WdiSystemHost", ServiceStartupType.Manual),
- new ServiceItem("WebClient", ServiceStartupType.Manual),
- new ServiceItem("Wecsvc", ServiceStartupType.Manual),
- new ServiceItem("WerSvc", ServiceStartupType.Disabled),
- new ServiceItem("WiaRpc", ServiceStartupType.Manual),
- new ServiceItem("WinDefend", ServiceStartupType.Automatic),
- new ServiceItem("WinHttpAutoProxySvc", ServiceStartupType.Manual),
- new ServiceItem("WinRM", ServiceStartupType.Manual),
- new ServiceItem("Winmgmt", ServiceStartupType.Automatic),
- new ServiceItem("WlanSvc", ServiceStartupType.Automatic),
- new ServiceItem("WpcMonSvc", ServiceStartupType.Manual),
- new ServiceItem("WpnService", ServiceStartupType.Manual),
- new ServiceItem("XblAuthManager", ServiceStartupType.Manual),
- new ServiceItem("XblGameSave", ServiceStartupType.Manual),
- new ServiceItem("XboxGipSvc", ServiceStartupType.Manual),
- new ServiceItem("XboxNetApiSvc", ServiceStartupType.Manual),
- new ServiceItem("autotimesvc", ServiceStartupType.Manual),
- new ServiceItem("bthserv", ServiceStartupType.Manual),
- new ServiceItem("camsvc", ServiceStartupType.Manual),
- new ServiceItem("cloudidsvc", ServiceStartupType.Manual),
- new ServiceItem("dcsvc", ServiceStartupType.Manual),
- new ServiceItem("defragsvc", ServiceStartupType.Manual),
- new ServiceItem("diagnosticshub.standardcollector.service", ServiceStartupType.Disabled),
- new ServiceItem("diagsvc", ServiceStartupType.Manual),
- new ServiceItem("dmwappushservice", ServiceStartupType.Disabled),
- new ServiceItem("1394ohci", ServiceStartupType.Disabled),
- new ServiceItem("bowser", ServiceStartupType.Disabled),
- new ServiceItem("beep", ServiceStartupType.Disabled),
- new ServiceItem("dot3svc", ServiceStartupType.Manual),
- new ServiceItem("cdrom", ServiceStartupType.Manual),
- new ServiceItem("cdfs", ServiceStartupType.Manual),
- new ServiceItem("edgeupdate", ServiceStartupType.Manual),
- new ServiceItem("edgeupdatem", ServiceStartupType.Manual),
- new ServiceItem("embeddedmode", ServiceStartupType.Manual),
- new ServiceItem("fdPHost", ServiceStartupType.Manual),
- new ServiceItem("fhsvc", ServiceStartupType.Manual),
- new ServiceItem("gpsvc", ServiceStartupType.Automatic),
- new ServiceItem("hidserv", ServiceStartupType.Manual),
- new ServiceItem("icssvc", ServiceStartupType.Manual),
- new ServiceItem("iphlpsvc", ServiceStartupType.Automatic),
- new ServiceItem("lfsvc", ServiceStartupType.Manual),
- new ServiceItem("lltdsvc", ServiceStartupType.Manual),
- new ServiceItem("lmhosts", ServiceStartupType.Manual),
- new ServiceItem("msiserver", ServiceStartupType.Manual),
- new ServiceItem("netprofm", ServiceStartupType.Manual),
- new ServiceItem("nsi", ServiceStartupType.Automatic),
- new ServiceItem("p2pimsvc", ServiceStartupType.Manual),
- new ServiceItem("p2psvc", ServiceStartupType.Manual),
- new ServiceItem("perceptionsimulation", ServiceStartupType.Manual),
- new ServiceItem("pla", ServiceStartupType.Manual),
- new ServiceItem("seclogon", ServiceStartupType.Manual),
- new ServiceItem("shpamsvc", ServiceStartupType.Disabled),
- new ServiceItem("smphost", ServiceStartupType.Manual),
- new ServiceItem("spectrum", ServiceStartupType.Manual),
- new ServiceItem("sppsvc", ServiceStartupType.AutomaticDelayedStart),
- new ServiceItem("ssh-agent", ServiceStartupType.Disabled),
- new ServiceItem("svsvc", ServiceStartupType.Manual),
- new ServiceItem("swprv", ServiceStartupType.Manual),
- new ServiceItem("tiledatamodelsvc", ServiceStartupType.Automatic),
- new ServiceItem("tzautoupdate", ServiceStartupType.Disabled),
- new ServiceItem("uhssvc", ServiceStartupType.Disabled),
- new ServiceItem("upnphost", ServiceStartupType.Manual),
- new ServiceItem("vds", ServiceStartupType.Manual),
- new ServiceItem("vm3dservice", ServiceStartupType.Manual),
- new ServiceItem("vmicguestinterface", ServiceStartupType.Manual),
- new ServiceItem("vmicheartbeat", ServiceStartupType.Manual),
- new ServiceItem("vmickvpexchange", ServiceStartupType.Manual),
- new ServiceItem("vmicrdv", ServiceStartupType.Manual),
- new ServiceItem("vmicshutdown", ServiceStartupType.Manual),
- new ServiceItem("vmictimesync", ServiceStartupType.Manual),
- new ServiceItem("vmicvmsession", ServiceStartupType.Manual),
- new ServiceItem("vmicvss", ServiceStartupType.Manual),
- new ServiceItem("vmvss", ServiceStartupType.Manual),
- new ServiceItem("wbengine", ServiceStartupType.Manual),
- new ServiceItem("wcncsvc", ServiceStartupType.Manual),
- new ServiceItem("webthreatdefsvc", ServiceStartupType.Manual),
- new ServiceItem("wercplsupport", ServiceStartupType.Manual),
- new ServiceItem("wisvc", ServiceStartupType.Manual),
- new ServiceItem("wlidsvc", ServiceStartupType.Manual),
- new ServiceItem("wlpasvc", ServiceStartupType.Manual),
- new ServiceItem("wmiApSrv", ServiceStartupType.Manual),
- new ServiceItem("workfolderssvc", ServiceStartupType.Manual),
- new ServiceItem("wscsvc", ServiceStartupType.AutomaticDelayedStart),
- new ServiceItem("wuauserv", ServiceStartupType.Manual),
- new ServiceItem("wudfsvc", ServiceStartupType.Manual)
- );
- Log.LogInformation("Services have been configured.");
-
- var hasSystemSSD =
- s.Disk.Volumes.Any(volume => volume is { SystemDrive: true, DriveTypeDescription: "SSD" });
-
- ServiceProcessService.ChangeServiceStartupType(
- hasSystemSSD // Enable SysMain on SSD
- ? new ServiceItem("SysMain", ServiceStartupType.Automatic)
- : new ServiceItem("SysMain", ServiceStartupType.Disabled)
- );
- Log.LogDebug("System drive is {Type}, SysMain will be {Status}.", hasSystemSSD ? "SSD" : "HDD",
- hasSystemSSD ? "enabled" : "disabled");
-
- return Task.CompletedTask;
- }
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Optimizers/Performance.cs b/optimizerDuck/src/Core/Optimizers/Performance.cs
deleted file mode 100644
index ce096ad..0000000
--- a/optimizerDuck/src/Core/Optimizers/Performance.cs
+++ /dev/null
@@ -1,402 +0,0 @@
-using Microsoft.Extensions.Logging;
-using Microsoft.Win32;
-using optimizerDuck.Core.Helpers;
-using optimizerDuck.Core.Services;
-using optimizerDuck.Interfaces;
-using optimizerDuck.Models;
-using optimizerDuck.UI.Logger;
-
-namespace optimizerDuck.Core.Optimizers;
-
-public class Performance : IOptimizationCategory
-{
- public string Name { get; } = "Performance";
- public OptimizationCategoryOrder Order { get; } = OptimizationCategoryOrder.Performance;
- public static ILogger Log { get; } = Logger.CreateLogger<Performance>();
-
- public class BackgroundAppsOptimization : IOptimization
- {
- public string Name { get; } = "Disable Background Apps";
-
- public string Description { get; } =
- "Stops background applications from running to free up RAM and CPU resources";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Minimal;
-
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications",
- "GlobalUserDisabled", 1),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search", "BackgroundAppGlobalToggle",
- 0)
- );
- Log.LogInformation("Disabled background applications.");
- return Task.CompletedTask;
- }
- }
-
- public class ProcessPriorityOptimization : IOptimization
- {
- public string Name { get; } = "Optimize Process Priority";
-
- public string Description { get; } =
- "Adjusts foreground app priority for better responsiveness and reduced input lag";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Significant;
-
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- /*
- ref: https://forums.blurbusters.com/viewtopic.php?t=8535
- 42 Dec, 2A Hex = Short, Fixed , High foreground boost.
- 41 Dec, 29 Hex = Short, Fixed , Medium foreground boost.
- 40 Dec, 28 Hex = Short, Fixed , No foreground boost.
-
- 38 Dec, 26 Hex = Short, Variable , High foreground boost.
- 37 Dec, 25 Hex = Short, Variable , Medium foreground boost.
- 36 Dec, 24 Hex = Short, Variable , No foreground boost.
-
- 26 Dec, 1A Hex = Long, Fixed, High foreground boost.
- 25 Dec, 19 Hex = Long, Fixed, Medium foreground boost.
- 24 Dec, 18 Hex = Long, Fixed, No foreground boost.
-
- 22 Dec, 16 Hex = Long, Variable, High foreground boost.
- 21 Dec, 15 Hex = Long, Variable, Medium foreground boost.
- 20 Dec, 14 Hex = Long, Variable, No foreground boost.
- */
-
- const int win32Priority = 38; // Short, Variable, High foreground boost
-
-
- RegistryService.Write(
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\PriorityControl", "Win32PrioritySeparation",
- win32Priority)
- );
- Log.LogInformation("Applied process priority optimization (Win32PrioritySeparation = {Value}).",
- win32Priority);
- return Task.CompletedTask;
- }
- }
-
- public class GameSchedulingOptimization : IOptimization
- {
- public string Name { get; } = "Optimize Gaming Scheduling";
- public string Description { get; } = "Prioritizes GPU scheduling and system resources for gaming workloads";
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Moderate;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(
- @"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games",
- "Priority", 2),
- new RegistryItem(
- @"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games",
- "Scheduling Category", "High"),
- new RegistryItem(
- @"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games",
- "SFIO Priority", "High"),
- new RegistryItem(
- @"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games",
- "GPU Priority", 8),
- new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile",
- "NetworkThrottlingIndex", unchecked((int)0xFFFFFFFF), RegistryValueKind.DWord),
- new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile",
- "SystemResponsiveness", 10),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers", "HwSchMode", 2)
- );
- Log.LogInformation("Optimized gaming scheduling and priority.");
- return Task.CompletedTask;
- }
- }
-
- public class SvcHostSplitOptimization : IOptimization
- {
- public string Name { get; } = "SvcHost Split Threshold";
-
- public string Description { get; } =
- "Adjusts SvcHostSplitThresholdInKB based on total system RAM to control service isolation and improve system stability.";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Significant;
-
- public Task Apply(SystemSnapshot s, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- if (s.Ram.TotalKB <= 0)
- {
- Log.LogInformation("Invalid RAM value: {RamTotalKB}. Skipping...", s.Ram.TotalKB);
- return Task.CompletedTask;
- }
-
- RegistryService.Write(
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control", "SvcHostSplitThresholdInKB", s.Ram.TotalKB,
- RegistryValueKind.DWord)
- );
- Log.LogInformation("Set SvcHostSplitThresholdInKB to {Value}.", s.Ram.TotalKB);
- return Task.CompletedTask;
- }
- }
-
-
- public class DisableGameBar : IOptimization
- {
- public string Name { get; } = "Disable Game Bar";
-
- public string Description { get; } =
- "Disables the Xbox Game Bar overlay and background services to prevent performance drops and improve in-game responsiveness";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Minimal;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(@"HKCU\System\GameConfigStore", "GameBarEnabled", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\GameBar", "ShowStartupPanel", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\GameBar", "UseNexusForGameBarEnabled", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\GameBar", "GamePanelStartupTipIndex", 0)
- );
- Log.LogInformation("Game Bar has been disabled.");
- return Task.CompletedTask;
- }
- }
-
- public class EnableGameMode : IOptimization
- {
- public string Name { get; } = "Enable Game Mode";
- public string Description { get; } = "Enables Windows Game Mode (Recommended on Windows 11)";
- public bool EnabledByDefault { get; } = SystemHelper.IsWindows11OrGreater();
- public OptimizationImpact Impact { get; } = OptimizationImpact.Minimal;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(@"HKCU\Software\Microsoft\GameBar", "AllowAutoGameMode", 1),
- new RegistryItem(@"HKCU\Software\Microsoft\GameBar", "AutoGameModeEnabled", 1)
- );
- Log.LogInformation("Enabled Game Mode.");
-
- return Task.CompletedTask;
- }
- }
-
- public class DisableGameDVR : IOptimization
- {
- public string Name { get; } = "Disable Game DVR";
-
- public string Description { get; } =
- "Turns off Game DVR recording features to eliminate background video capture and reduce latency during gameplay";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Minimal;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR", "AppCaptureEnabled", 0),
- new RegistryItem(@"HKCU\System\GameConfigStore", "GameDVR_Enabled", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Windows\GameDVR", "AllowGameDVR", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Microsoft\PolicyManager\default\ApplicationManagement\AllowGameDVR",
- "value", 0)
- );
- Log.LogInformation("Game DVR has been disabled.");
- return Task.CompletedTask;
- }
- }
-
- public class GpuOptimization : IOptimization
- {
- public string Name { get; } = "GPU Optimization";
-
- public string Description { get; } =
- "Optimizes GPU driver settings to disable unnecessary features and improve stability & performance";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Significant;
-
- public Task Apply(SystemSnapshot s, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
- Log.LogInformation("Applying GPU optimizations for {GpuCount} GPUs...", s.Gpus.Count);
-
- const string basePath =
- @"HKLM\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}";
-
- foreach (var gpu in s.Gpus)
- {
- t.ThrowIfCancellationRequested();
- Log.LogDebug("GPU Info: {GPUInfo}", gpu);
- if (string.IsNullOrWhiteSpace(gpu.DeviceId))
- {
- Log.LogError("Skipping GPU with no Device ID: {GpuName} (Device ID: {DeviceId})", gpu.Name,
- gpu.DeviceId ?? "null");
- continue;
- }
-
- if (!TryParseDeviceIdToIndex(gpu.DeviceId, out var index))
- {
- Log.LogError("Skipping GPU with invalid Device ID: {GpuName} (Device ID: {DeviceId})", gpu.Name,
- gpu.DeviceId ?? "null");
- continue;
- }
-
- var path = $"{basePath}\\{index:D4}";
-
- switch (gpu.Vendor)
- {
- case GpuVendor.AMD:
- RegistryService.Write(
- new RegistryItem(path, "DisableDynamicPstate", 1),
- new RegistryItem(path, "DisableVCEPowerGating", 1),
- new RegistryItem(path, "EnableULPS", 0),
- new RegistryItem(path, "EnableAspmL0s", 0),
- new RegistryItem(path, "EnableAspmL1", 0),
- new RegistryItem(path, "EnableUvdClockGating", 0),
- new RegistryItem(path, "EnableVceSwClockGating", 0),
- new RegistryItem(path, "KMD_EnableContextBasedPowerManagement", 0),
- new RegistryItem(path, "PP_GPUPowerDownEnabled", 0),
- new RegistryItem(path, "DisablePowerGating", 1),
- new RegistryItem(path, "DisableVceClockGating", 1)
- );
- Log.LogInformation("Applied AMD GPU optimizations for {GpuName} at index {GpuIndex:D4}.",
- gpu.Name,
- index);
- break;
- case GpuVendor.NVIDIA:
- RegistryService.Write(
- new RegistryItem(path, "DisableDynamicPstate", 1),
- new RegistryItem(path, "DisableASyncPstates", 1)
- );
- Log.LogInformation("Applied NVIDIA GPU optimizations for {GpuName} at index {GpuIndex:D4}.",
- gpu.Name,
- index);
- break;
- case GpuVendor.Intel:
- RegistryService.Write(
- new RegistryItem(path, "Disable_OverlayDSQualityEnhancement", 1),
- new RegistryItem(path, "IncreaseFixedSegment", 1),
- new RegistryItem(path, "AdaptiveVsyncEnable", 0),
- new RegistryItem(path, "DisablePFonDP", 1),
- new RegistryItem(path, "EnableCompensationForDVI", 1),
- new RegistryItem(path, "Display1_DisableAsyncFlips", 1)
- );
- Log.LogInformation("Applied Intel GPU optimizations for {GpuName} at index {GpuIndex:D4}.",
- gpu.Name,
- index);
- break;
- case GpuVendor.Unknown:
- default:
- Log.LogError("Unsupported GPU vendor: {GpuVendor} for {GpuName} at index {GpuIndex:D4}.",
- gpu.Vendor, gpu.Name, index);
- break;
- }
- }
-
- return Task.CompletedTask;
- }
-
-
- /// <summary>
- /// Attempts to parse a WMI <c>DeviceID</c> (e.g., "VideoController1") into a zero-based registry index
- /// used in the Display Class registry path (e.g., "0000", "0001").
- /// </summary>
- /// <remarks>
- /// <para>
- /// Windows stores display adapter settings under:
- /// <c>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\XXXX</c>
- /// where <c>XXXX</c> is a 4-digit zero-padded index (e.g., <c>0000</c>).
- /// </para>
- /// <para>
- /// The <see cref="Win32_VideoController" /> WMI class provides a <c>DeviceID</c> property in the format:
- /// <c>"VideoController1"</c>, <c>"VideoController2"</c>, etc. This method converts:
- /// <list type="bullet">
- /// <item>
- /// <description><c>"VideoController1"</c> → index <c>0</c> → registry subkey <c>"0000"</c></description>
- /// </item>
- /// <item>
- /// <description><c>"VideoController2"</c> → index <c>1</c> → registry subkey <c>"0001"</c></description>
- /// </item>
- /// </list>
- /// </para>
- /// <para>
- /// This mapping is <strong>required</strong> because the order of GPUs in <see cref="SystemSnapshot.Gpus" />
- /// does <strong>not</strong> guarantee alignment with registry index order. Using array index (0, 1, 2...)
- /// leads to applying tweaks to the wrong GPU (e.g., iGPU instead of dGPU).
- /// </para>
- /// </remarks>
- /// <param name="deviceId">
- /// The <c>DeviceID</c> string from <c>Win32_VideoController</c>, typically in the form
- /// <c>"VideoControllerN"</c> where <c>N</c> is a positive integer starting from 1.
- /// </param>
- /// <param name="index">
- /// When the method returns <c>true</c>, contains the zero-based index suitable for formatting with
- /// <c>:D4</c> (e.g., <c>0</c> → <c>"0000"</c>). When <c>false</c>, the value is <c>-1</c>.
- /// </param>
- /// <returns>
- /// <c>true</c> if <paramref name="deviceId" /> is valid and successfully parsed; otherwise, <c>false</c>.
- /// </returns>
- /// <example>
- /// <code>
- /// string deviceId = "VideoController1";
- /// if (TryParseDeviceIdToIndex(deviceId, out int index))
- /// {
- /// string regPath = $@"HKLM\...\{{4d36e968-...\}}\{index:D4}"; // → "0000"
- /// Console.WriteLine($"Apply tweak to GPU at registry index: {index:D4}");
- /// }
- /// </code>
- /// </example>
- /// <exception cref="ArgumentNullException">
- /// Thrown if <paramref name="deviceId" /> is <c>null</c> — but this method uses <c>string.IsNullOrWhiteSpace</c>
- /// and returns <c>false</c> instead for consistency with TryParse pattern.
- /// </exception>
- /// <seealso cref="GpuInfo.DeviceId" />
- /// <seealso href="https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-videocontroller">
- /// Win32_VideoController WMI class
- /// </seealso>
- private static bool TryParseDeviceIdToIndex(string deviceId, out int index)
- {
- index = -1;
- if (string.IsNullOrWhiteSpace(deviceId))
- return false;
-
- const string prefix = "VideoController";
- if (!deviceId.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
- return false;
-
- var numberPart = deviceId[prefix.Length..];
- if (!int.TryParse(numberPart, out var deviceNumber) || deviceNumber <= 0)
- return false;
-
- index = deviceNumber - 1; // convert to zero-based index
- return true;
- }
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Optimizers/Power.cs b/optimizerDuck/src/Core/Optimizers/Power.cs
deleted file mode 100644
index 59003ca..0000000
--- a/optimizerDuck/src/Core/Optimizers/Power.cs
+++ /dev/null
@@ -1,147 +0,0 @@
-using Microsoft.Extensions.Logging;
-using optimizerDuck.Core.Helpers;
-using optimizerDuck.Core.Services;
-using optimizerDuck.Interfaces;
-using optimizerDuck.Models;
-using optimizerDuck.UI;
-using optimizerDuck.UI.Logger;
-
-namespace optimizerDuck.Core.Optimizers;
-
-public class Power : IOptimizationCategory
-{
- public string Name { get; } = "Power";
- public OptimizationCategoryOrder Order { get; } = OptimizationCategoryOrder.Power;
- public static ILogger Log { get; } = Logger.CreateLogger<Power>();
-
-
- public class DisableHibernate : IOptimization
- {
- public string Name { get; } = "Disable Hibernate";
-
- public string Description { get; } =
- "Disables hibernate, fast startup, and removes hibernate option from power menu";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Moderate;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\Power", "HibernateEnabled", 0),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\Power\PowerThrottling",
- "HibernateEnabledDefault", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings",
- "ShowHibernateOption", 0),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power", "HiberbootEnabled", 0)
- );
-
- Log.LogInformation("Disabled hibernate & fast startup.");
- return Task.CompletedTask;
- }
- }
-
- public class DisableUSBPowerSaving : IOptimization
- {
- public string Name { get; } = "Disable USB Power Saving";
-
- public string Description { get; } =
- "Disables USB selective suspend and other power management features that can cause input lag and performance drops";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Moderate;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- //https://discord.com/channels/1298592513816530994/1359513721738629140/1359524213047824517
- //from FrameSync Labs
- ShellService.PowerShell("""
- $devicesUSB = Get-PnpDevice | where {$_.InstanceId -like "*USB\ROOT*"} |
- ForEach-Object -Process {
- Get-CimInstance -ClassName MSPower_DeviceEnable -Namespace root\wmi
- }
- foreach ( $device in $devicesUSB )
- {
- Set-CimInstance -Namespace root\wmi -Query "SELECT * FROM MSPower_DeviceEnable WHERE InstanceName LIKE '%$($device.PNPDeviceID)%'" -Property @{Enable=$False} -PassThru
- }
- """);
- Log.LogInformation("Disabled USB power saving.");
- return Task.CompletedTask;
- }
- }
-
-
- public class InstallOptimizerDuckPowerPlan : IOptimization
- {
- public string Name { get; } = "Install optimizerDuck Power Plan";
-
- public string Description { get; } =
- "Installs a custom high-performance power plan optimized for gaming and maximum CPU performance";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Significant;
-
- public async Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
- var (success, powerPlanPath) =
- await StreamHelper.TryDownloadAsync(Defaults.PowerPlanUrl, "optimizerDuck.pow");
- if (success)
- {
- Log.LogInformation("Downloaded optimizerDuck power plan!");
-
- // set other power plan to delete old one (to avoid import errors)
- ShellService.CMD("powercfg /duplicatescheme 381b4222-f694-41f0-9685-ff5bb260df2e"); // restore Balanced
- ShellService.CMD("powercfg /setactive 381b4222-f694-41f0-9685-ff5bb260df2e"); // set Balanced
- ShellService.CMD($"powercfg /delete {Defaults.PowerPlanGUID}");
- Log.LogInformation("Deleted old power plan.");
-
- ShellService.CMD($"powercfg /import \"{powerPlanPath}\" {Defaults.PowerPlanGUID}");
- ShellService.CMD($"powercfg /setactive {Defaults.PowerPlanGUID}");
- Log.LogInformation($"Installed [{Theme.Primary}]optimizerDuck[/] power plan successfully!");
- }
- else
- {
- Log.LogError($"Failed to download [{Theme.Primary}]optimizerDuck[/] power plan! Skipping...");
- }
- }
- }
-
- public class DisablePowerSaving : IOptimization
- {
- public string Name { get; } = "Disable Power Saving";
-
- public string Description { get; } =
- "Disables power throttling and enables AlwaysOn multimedia mode for maximum responsiveness";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Moderate;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\USB\AutomaticSurpriseRemoval",
- "AttemptRecoveryFromUsbPowerDrain", 0),
- new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile",
- "NoLazyMode", 1),
- new RegistryItem(@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile",
- "AlwaysOn", 1),
- new RegistryItem(@"HKLM\SYSTEM\CurrentControlSet\Control\Power\PowerThrottling", "PowerThrottlingOff",
- 1)
- );
-
- Log.LogInformation("Disabled power saving features.");
- return Task.CompletedTask;
- }
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Optimizers/UserExperience.cs b/optimizerDuck/src/Core/Optimizers/UserExperience.cs
deleted file mode 100644
index 5c74180..0000000
--- a/optimizerDuck/src/Core/Optimizers/UserExperience.cs
+++ /dev/null
@@ -1,274 +0,0 @@
-using Microsoft.Extensions.Logging;
-using Microsoft.Win32;
-using optimizerDuck.Core.Helpers;
-using optimizerDuck.Core.Services;
-using optimizerDuck.Interfaces;
-using optimizerDuck.Models;
-using optimizerDuck.UI.Logger;
-
-namespace optimizerDuck.Core.Optimizers;
-
-public class UserExperience : IOptimizationCategory
-{
- public string Name { get; } = "User Experience";
- public OptimizationCategoryOrder Order { get; } = OptimizationCategoryOrder.UserExperience;
- public static ILogger Log { get; } = Logger.CreateLogger<UserExperience>();
-
- public class TaskbarOptimization : IOptimization
- {
- public string Name { get; } = "Taskbar Optimization";
- public string Description { get; } = "Simplifies and cleans up the Windows taskbar for better performance";
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Minimal;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(@"HKLM\SOFTWARE\Policies\Microsoft\Dsh", "AllowNewsAndInterests", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarDa", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarMn", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Search", "SearchboxTaskbarMode", 0),
- new RegistryItem(
- @"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings",
- "TaskbarEndTask", 1),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Search", "BingSearchEnabled", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Search", "CortanaConsent", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Search", "CortanaConsent2", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Search", "BackgroundAppGlobalToggle",
- 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- "ShowTaskViewButton", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People",
- "PeopleBand", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "HideSCAMeetNow",
- 1),
- new RegistryItem(@"HKCU\SOFTWARE\Policies\Microsoft\Windows\Windows Feeds", "EnableFeeds", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Feeds", "ShellFeedsTaskbarViewMode",
- 2),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ListviewShadow",
- 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- "TaskbarAnimations", 0)
- );
- Log.LogInformation("Taskbar cleaned up and simplified.");
- return Task.CompletedTask;
- }
- }
-
- public class DarkMode : IOptimization
- {
- public string Name { get; } = "Dark Mode";
- public string Description { get; } = "Forces Windows to use dark mode for apps and system";
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Minimal;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
- "AppsUseLightTheme", 0),
- new RegistryItem(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
- "SystemUsesLightTheme", 0)
- );
- Log.LogInformation("Switched to dark mode.");
- return Task.CompletedTask;
- }
- }
-
- public class ExplorerOptimization : IOptimization
- {
- public string Name { get; } = "Explorer Optimization";
- public string Description { get; } = "Optimizes Windows Explorer visuals and usability";
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Minimal;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- "ShowSyncProviderNotifications", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
- "SystemPaneSuggestionsEnabled", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\DWM", "EnableAeroPeek", 0),
- new RegistryItem(@"HKCU\Control Panel\Desktop\WindowMetrics", "MinAnimate", "0"),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
- "EnableTransparency", 0),
- new RegistryItem(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- "Hidden", 1),
- new RegistryItem(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize",
- "StartupDelayInMSec", 0),
- new RegistryItem(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- "ShowSecondsInSystemClock", 1),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowInfoTip", 0),
- new RegistryItem(@"HKCU\SOFTWARE\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32",
- ""), // old Win10 context menu
- new RegistryItem(@"HKCU\Control Panel\Desktop", "MenuShowDelay", "0")
- );
- Log.LogInformation("Explorer visuals optimized.");
- return Task.CompletedTask;
- }
- }
-
-
- public class VisualPerformanceOptimization : IOptimization
- {
- public string Name { get; } = "Visual Performance";
- public string Description { get; } = "Sets Windows visual effects for best performance";
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Minimal;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects",
- "VisualFXSetting", 3),
- new RegistryItem(@"HKCU\Control Panel\Desktop", "DragFullWindows", "0"),
- new RegistryItem(@"HKCU\Control Panel\Desktop", "UserPreferencesMask",
- new byte[] { 144, 18, 3, 128, 16, 0, 0, 0 }, RegistryValueKind.Binary)
- );
- Log.LogInformation("Visual performance set to best.");
- return Task.CompletedTask;
- }
- }
-
-
- public class DisableNotifications : IOptimization
- {
- public string Name { get; } = "Disable Notifications";
-
- public string Description { get; } =
- "Disables Windows notifications and action center to minimize distractions during gaming";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Minimal;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\PushNotifications",
- "ToastEnabled", 0),
- new RegistryItem(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\PushNotifications",
- "LockScreenToastEnabled", 0),
- new RegistryItem(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
- "EnableBalloonTips", 0)
- );
- Log.LogInformation("Notifications disabled.");
- return Task.CompletedTask;
- }
- }
-
- public class OptimizeMouse : IOptimization
- {
- public string Name { get; } = "Optimize Mouse";
-
- public string Description { get; } =
- "Reduces mouse input lag and improves accuracy by disabling mouse acceleration and adjusting sensitivity";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Minimal;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(@"HKCU\Control Panel\Mouse", "MouseSpeed", "0"),
- new RegistryItem(@"HKCU\Control Panel\Mouse", "MouseThreshold1", "0"),
- new RegistryItem(@"HKCU\Control Panel\Mouse", "MouseThreshold2", "0"),
- new RegistryItem(@"HKCU\Control Panel\Mouse", "MouseSensitivity", "10")
- );
- Log.LogInformation("Mouse acceleration disabled.");
- return Task.CompletedTask;
- }
- }
-
- public class OptimizeKeyboard : IOptimization
- {
- public string Name { get; } = "Optimize Keyboard";
-
- public string Description { get; } =
- "Improves keyboard responsiveness and disables unwanted accessibility features";
-
- public bool EnabledByDefault { get; } = true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Minimal;
-
- public Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- RegistryService.Write(
- new RegistryItem(@"HKEY_CURRENT_USER\Control Panel\Keyboard", "KeyboardDelay", "0"),
- new RegistryItem(@"HKEY_CURRENT_USER\Control Panel\Keyboard", "KeyboardSpeed", "31"),
- new RegistryItem(@"HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys", "Flags", "506"),
- new RegistryItem(@"HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response", "Flags", "122"),
- new RegistryItem(@"HKEY_CURRENT_USER\Control Panel\Accessibility\ToggleKeys", "Flags", "58")
- );
- Log.LogInformation("Keyboard accessibility features disabled.");
- return Task.CompletedTask;
- }
- }
-
- public class InstallZwTimerResolution : IOptimization
- {
- public string Name => "Install ZwTimerResolution";
-
- public string Description =>
- "Installs and configures ZwTimerResolution to reduce input lag and improve system responsiveness";
-
- public bool EnabledByDefault => true;
- public OptimizationImpact Impact { get; } = OptimizationImpact.Moderate;
-
- public async Task Apply(SystemSnapshot _, CancellationToken t)
- {
- t.ThrowIfCancellationRequested();
- using var tracker = ServiceTracker.Begin(Log);
-
- var (success, zwtPath) = await StreamHelper.TryDownloadAsync(Defaults.ZwtDownloadUrl, "zwtimer.exe")
- .ConfigureAwait(false);
- if (success)
- {
- Log.LogInformation("ZwTimerResolution downloaded successfully!");
- /*
- https://github.com/LuSlower/ZwTimerResolution/tree/main
- If you have Windows Server 2022/Windows 11 you must have in your registry:
- [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel] "GlobalTimerResolutionRequests"=dword:00000001
- */
- if (SystemHelper.IsWindows11OrGreater()) // i dont check for server versions..................
- RegistryService.Write(new RegistryItem(
- @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel",
- "GlobalTimerResolutionRequests", 1));
-
- RegistryService.Write(
- new RegistryItem(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "ZwTimer",
- zwtPath),
- new RegistryItem(@"HKEY_CURRENT_USER\Software\ZwTimer", "Start", "1"),
- new RegistryItem(@"HKEY_CURRENT_USER\Software\ZwTimer", "CustomTimer", "5052")
- );
-
- Log.LogInformation("Set ZwTimerResolution Start with System and value to 5052hns.");
- }
- else
- {
- Log.LogError("Failed to download ZwTimerResolution! Skipping...");
- }
- }
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Services/RegistryService.cs b/optimizerDuck/src/Core/Services/RegistryService.cs
deleted file mode 100644
index d618719..0000000
--- a/optimizerDuck/src/Core/Services/RegistryService.cs
+++ /dev/null
@@ -1,285 +0,0 @@
-using System.Diagnostics.CodeAnalysis;
-using Microsoft.Extensions.Logging;
-using Microsoft.Win32;
-using optimizerDuck.Models;
-using optimizerDuck.UI.Logger;
-
-namespace optimizerDuck.Core.Services;
-
-public static class RegistryService
-{
- private static readonly Dictionary<string, RegistryKey> RootKeysMap =
- new(StringComparer.OrdinalIgnoreCase)
- {
- ["HKLM"] = Registry.LocalMachine,
- ["HKLM:"] = Registry.LocalMachine,
- ["HKEY_LOCAL_MACHINE"] = Registry.LocalMachine,
-
- ["HKCU"] = Registry.CurrentUser,
- ["HKCU:"] = Registry.CurrentUser,
- ["HKEY_CURRENT_USER"] = Registry.CurrentUser,
-
- ["HKCR"] = Registry.ClassesRoot,
- ["HKCR:"] = Registry.ClassesRoot,
- ["HKEY_CLASSES_ROOT"] = Registry.ClassesRoot,
-
- ["HKU"] = Registry.Users,
- ["HKU:"] = Registry.Users,
- ["HKEY_USERS"] = Registry.Users,
-
- ["HKCC"] = Registry.CurrentConfig,
- ["HKCC:"] = Registry.CurrentConfig,
- ["HKEY_CURRENT_CONFIG"] = Registry.CurrentConfig
- };
-
- private static bool TryParsePath(
- string fullPath,
- [NotNullWhen(true)] out RegistryKey? rootKey,
- [NotNullWhen(true)] out string? subPath)
- {
- rootKey = null;
- subPath = null;
-
- if (string.IsNullOrWhiteSpace(fullPath))
- {
- ServiceTracker.Current?.Log.LogError("Registry path is null or empty");
- ServiceTracker.Current?.Track(nameof(RegistryService), false);
- return false;
- }
-
- var parts = fullPath.AsSpan();
- var idx = parts.IndexOf('\\');
- var rootToken = idx > 0 ? parts[..idx].ToString() : parts.ToString();
-
- if (!RootKeysMap.TryGetValue(rootToken, out rootKey))
- {
- ServiceTracker.Current?.Log.LogError("Unknown root key: {RootToken}", rootToken);
- ServiceTracker.Current?.Track(nameof(RegistryService), false);
- return false;
- }
-
- subPath = idx > 0 ? parts[(idx + 1)..].ToString() : string.Empty;
- return true;
- }
-
- private static bool TryOpenSubKey(
- RegistryKey rootKey,
- string? subPath,
- [NotNullWhen(true)] out RegistryKey? key,
- bool writable,
- bool createIfMissing,
- out bool shouldDispose)
- {
- key = null;
- shouldDispose = false;
-
- if (string.IsNullOrEmpty(subPath))
- {
- key = rootKey;
- return true;
- }
-
- try
- {
- var opened = writable
- ? rootKey.OpenSubKey(subPath, true)
- : rootKey.OpenSubKey(subPath);
-
- if (opened == null && writable && createIfMissing)
- opened = rootKey.CreateSubKey(subPath, true);
-
- if (opened != null)
- {
- key = opened;
- shouldDispose = true;
- return true;
- }
-
- ServiceTracker.Current?.Log.LogError("SubKey not found: {Root}\\{SubPath}", rootKey.Name, subPath);
- ServiceTracker.Current?.Track(nameof(RegistryService), false);
- return false;
- }
- catch (Exception ex)
- {
- ServiceTracker.Current?.Log.LogError(ex, "Failed to {Operation} sub key: {RootKey}\\{SubPath}",
- writable ? "create/open" : "open", rootKey.Name, subPath);
- ServiceTracker.Current?.Track(nameof(RegistryService), false);
- return false;
- }
- }
-
- private static T? WithKey<T>(RegistryItem item, Func<RegistryKey, T?> action, bool writable = false,
- bool createIfMissing = false)
- {
- if (!TryParsePath(item.Path, out var rootKey, out var subPath))
- return default;
-
- if (!TryOpenSubKey(rootKey, subPath, out var subKey, writable, createIfMissing, out var shouldDispose))
- return default;
-
- try
- {
- return action(subKey);
- }
- finally
- {
- if (shouldDispose)
- subKey.Dispose();
- }
- }
-
- public static T? Read<T>(RegistryItem item)
- {
- return WithKey(item, key =>
- {
- try
- {
- var value = key.GetValue(item.Name);
- if (value is null) return default;
-
- if (value is T tValue) return tValue;
-
- var targetType = typeof(T);
-
- if (targetType == typeof(byte[]) && value is byte[] bytes) return (T)(object)bytes;
- if (targetType == typeof(string[]) && value is string[] arr) return (T)(object)arr;
-
- if (targetType == typeof(int) && value is int i) return (T)(object)i;
- if (targetType == typeof(bool))
- {
- if (value is int i2) return (T)(object)(i2 != 0);
- if (value is string s && bool.TryParse(s, out var b)) return (T)(object)b;
- }
-
- return (T)Convert.ChangeType(value, targetType);
- }
- catch (Exception ex)
- {
- ServiceTracker.Current?.Log.LogError(ex,
- "Failed to read registry value {Path}:{Name} as {TargetType}",
- item.Path, item.Name, typeof(T).FullName);
- return default;
- }
- });
- }
-
-
- public static bool Write(RegistryItem registryItem)
- {
- if (registryItem.Value == null)
- {
- ServiceTracker.Current?.Log.LogError("Value can't be null when writing! {Path}:{Name}", registryItem.Path,
- registryItem.Name);
- ServiceTracker.Current?.Track(nameof(Write), false);
- return false;
- }
-
- return WithKey(registryItem, key =>
- {
- try
- {
- key.SetValue(registryItem.Name, registryItem.Value, registryItem.Kind);
- ServiceTracker.Current?.Track(nameof(Write), true);
- return true;
- }
- catch (UnauthorizedAccessException)
- {
- ServiceTracker.Current?.Log.LogError(
- "Failed to write registry value {Path}:{Name} due to missing access",
- registryItem.Path, registryItem.Name);
- ServiceTracker.Current?.Track(nameof(Write), false);
- return false;
- }
- catch (Exception ex)
- {
- ServiceTracker.Current?.Log.LogError(ex, "Failed to write registry value {Path}:{Name}",
- registryItem.Path, registryItem.Name);
- ServiceTracker.Current?.Track(nameof(Write), false);
- return false;
- }
- }, true, true);
- }
-
- public static bool DeleteValue(RegistryItem item)
- {
- return WithKey(item, key =>
- {
- try
- {
- if (key.GetValue(item.Name) == null)
- {
- //ServiceTracker.Current?.Log.LogWarning("Attempted to delete non-existent registry value {Path}:{Name}", item.Path, item.Name);
- ServiceTracker.Current?.Track(nameof(DeleteValue), true);
- return true; // after all, we try to delete this value.
- }
-
- key.DeleteValue(item.Name!, false);
- ServiceTracker.Current?.Track(nameof(DeleteValue), true);
- return true;
- }
- catch (UnauthorizedAccessException)
- {
- ServiceTracker.Current?.Log.LogError(
- "Failed to delete registry value {Path}:{Name} due to missing access", item.Path,
- item.Name);
- ServiceTracker.Current?.Track(nameof(DeleteValue), false);
- return false;
- }
- catch (Exception ex)
- {
- ServiceTracker.Current?.Log.LogError(ex, "Failed to delete registry value {Path}:{Name}", item.Path,
- item.Name);
- ServiceTracker.Current?.Track(nameof(DeleteValue), false);
- return false;
- }
- }, true);
- }
-
- public static bool DeleteSubKey(RegistryItem item)
- {
- if (!TryParsePath(item.Path, out var rootKey, out var subPath))
- return false;
-
- if (string.IsNullOrWhiteSpace(subPath))
- {
- ServiceTracker.Current?.Log.LogError("DeleteSubKey called with empty subpath! {Path}:{Name}", item.Path,
- item.Name);
- ServiceTracker.Current?.Track(nameof(DeleteSubKey), false);
- return false;
- }
-
- try
- {
- rootKey.DeleteSubKeyTree(subPath, false);
- ServiceTracker.Current?.Track(nameof(DeleteSubKey), true);
- return true;
- }
- catch (UnauthorizedAccessException)
- {
- ServiceTracker.Current?.Log.LogError("Failed to delete subkey {Path} due to missing access", item.Path);
- ServiceTracker.Current?.Track(nameof(DeleteSubKey), false);
- return false;
- }
- catch (Exception ex)
- {
- ServiceTracker.Current?.Log.LogError(ex, "Failed to delete subkey {Path}", item.Path);
- ServiceTracker.Current?.Track(nameof(DeleteSubKey), false);
- return false;
- }
- }
-
- public static void Write(params RegistryItem[] items)
- {
- foreach (var item in items.Distinct()) Write(item);
- }
-
- public static void DeleteValue(params RegistryItem[] items)
- {
- foreach (var item in items.Distinct()) DeleteValue(item);
- }
-
- public static void DeleteSubKey(params RegistryItem[] items)
- {
- foreach (var item in items.Distinct()) DeleteSubKey(item);
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Services/ServiceProcessService.cs b/optimizerDuck/src/Core/Services/ServiceProcessService.cs
deleted file mode 100644
index dfa0bb7..0000000
--- a/optimizerDuck/src/Core/Services/ServiceProcessService.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using System.Management;
-using Microsoft.Extensions.Logging;
-using optimizerDuck.Models;
-using optimizerDuck.UI.Logger;
-
-namespace optimizerDuck.Core.Services;
-
-public static class ServiceProcessService
-{
- private static readonly ManagementScope Scope = new(@"\\.\root\cimv2");
-
- public static bool ChangeServiceStartupType(ServiceItem item)
- {
- try
- {
- if (!Scope.IsConnected)
- Scope.Connect();
-
- using var searcher = new ManagementObjectSearcher(Scope,
- new ObjectQuery($"SELECT * FROM Win32_Service WHERE Name='{item.ServiceName.Replace("'", "''")}'"));
- var service = searcher.Get().OfType<ManagementObject>().FirstOrDefault();
-
- if (service == null)
- {
- ServiceTracker.Current?.Log.LogError("Service {ServiceName} not found.", item.ServiceName);
- ServiceTracker.Current?.Track(nameof(ChangeServiceStartupType), false);
- return false;
- }
-
- using var inParams = service.GetMethodParameters("ChangeStartMode");
- inParams["StartMode"] = item.StartupType switch
- {
- ServiceStartupType.AutomaticDelayedStart => "Automatic",
- _ => item.StartupType.ToString()
- };
-
- using var outParams = service.InvokeMethod("ChangeStartMode", inParams, null);
-
- var resultCode = outParams?["ReturnValue"] is uint val ? val : 1;
-
- if (resultCode == 0)
- {
- var result = item.StartupType == ServiceStartupType.AutomaticDelayedStart
- ? RegistryService.Write(new RegistryItem(
- @$"HKLM\SYSTEM\CurrentControlSet\Services\{item.ServiceName}", "DelayedAutoStart", 1))
- : RegistryService.DeleteValue(new RegistryItem(
- @$"HKLM\SYSTEM\CurrentControlSet\Services\{item.ServiceName}", "DelayedAutoStart"));
-
- ServiceTracker.Current?.Track(nameof(ChangeServiceStartupType), result);
- return result;
- }
-
- ServiceTracker.Current?.Log.LogError(
- "Failed to change startup type for {ServiceName}. ReturnValue: {Result}", item.ServiceName,
- resultCode);
- ServiceTracker.Current?.Track(nameof(ChangeServiceStartupType), false);
- return false;
- }
- catch (Exception ex)
- {
- ServiceTracker.Current?.Log.LogError(ex, "Failed to change startup type for {ServiceName}",
- item.ServiceName);
- ServiceTracker.Current?.Track(nameof(ChangeServiceStartupType), false);
- return false;
- }
- }
-
- public static void ChangeServiceStartupType(params ServiceItem[] items)
- {
- foreach (var item in items) ChangeServiceStartupType(item);
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Services/ShellService.cs b/optimizerDuck/src/Core/Services/ShellService.cs
deleted file mode 100644
index 263bf22..0000000
--- a/optimizerDuck/src/Core/Services/ShellService.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-using System.Diagnostics;
-using System.Text;
-using Microsoft.Extensions.Logging;
-using optimizerDuck.Core.Extensions;
-using optimizerDuck.UI.Logger;
-using Spectre.Console;
-
-namespace optimizerDuck.Core.Services;
-
-public record ShellResult(
- string Command,
- string Stdout,
- string Stderr,
- int ExitCode,
- TimeSpan Duration);
-
-public static class ShellService
-{
- private static ShellResult Run(string fileName, string arguments, string command, string serviceName)
- {
- var fullCommandForUser =
- $"{fileName} {arguments.Replace("-EncodedCommand", "-Command")} {command.DecodeBase64()}"; // let user see the real command
-
- var psi = new ProcessStartInfo
- {
- FileName = fileName,
- Arguments = $"{arguments} {command}",
- RedirectStandardOutput = true,
- RedirectStandardError = true,
- StandardOutputEncoding = Encoding.UTF8,
- StandardErrorEncoding = Encoding.UTF8,
- UseShellExecute = false,
- CreateNoWindow = true
- };
-
- using var process = new Process { StartInfo = psi };
-
- var stdoutBuilder = new StringBuilder();
- var stderrBuilder = new StringBuilder();
-
- process.OutputDataReceived += (_, e) =>
- {
- if (e.Data == null) return;
- stdoutBuilder.AppendLine(e.Data);
- };
-
- process.ErrorDataReceived += (_, e) =>
- {
- if (e.Data == null) return;
- stderrBuilder.AppendLine(e.Data);
- };
- process.Start();
-
- process.BeginOutputReadLine();
- process.BeginErrorReadLine();
-
- process.WaitForExit();
-
- var duration = process.ExitTime - process.StartTime;
-
- var stdout = Markup.Escape(stdoutBuilder.ToString().Trim());
- var stderr = stderrBuilder.ToString().ParseCliXml().Trim();
-
- var success = process.ExitCode == 0;
-
- var stdoutDisplay = string.IsNullOrWhiteSpace(stdout) ? "N/A" : stdout;
- var stderrDisplay = string.IsNullOrWhiteSpace(stderr) ? "N/A" : stderr;
-
- ServiceTracker.Current?.Track(serviceName, success);
- ServiceTracker.Current?.Log.LogDebug(
- """
- {FullCommand}
- | Stdout: {Stdout}
- | Stderr: {Stderr}
- | ExitCode: {ProcessExitCode}
- | Duration: {TimeSpan}
- """, fullCommandForUser, stdoutDisplay, stderrDisplay, process.ExitCode,
- ServiceTracker.FormatTime(duration));
-
- return new ShellResult(
- $"{fileName} {arguments} {command}",
- stdoutDisplay,
- stderrDisplay,
- process.ExitCode,
- duration);
- }
-
- public static ShellResult CMD(string command)
- {
- return Run("cmd.exe", "/c", command, nameof(CMD));
- }
-
- public static ShellResult PowerShell(string command)
- {
- command = "$ProgressPreference='SilentlyContinue'; " + command; // to hide progress bar clixml
- return Run("powershell.exe",
- "-NonInteractive -NoLogo -NoProfile -ExecutionPolicy Bypass -EncodedCommand",
- command.EncodeBase64(),
- nameof(PowerShell));
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Services/UpdateService.cs b/optimizerDuck/src/Core/Services/UpdateService.cs
deleted file mode 100644
index 28beddb..0000000
--- a/optimizerDuck/src/Core/Services/UpdateService.cs
+++ /dev/null
@@ -1,225 +0,0 @@
-using System.Diagnostics;
-using System.Net.Http.Headers;
-using System.Reflection;
-using ConsoleInk;
-using Microsoft.Extensions.Logging;
-using Newtonsoft.Json;
-using optimizerDuck.Core.Extensions;
-using optimizerDuck.Core.Helpers;
-using optimizerDuck.UI;
-using optimizerDuck.UI.Components;
-using optimizerDuck.UI.Logger;
-using Spectre.Console;
-
-namespace optimizerDuck.Core.Services;
-
-public class UpdateService
-{
- private const string Owner = "itsfatduck";
- private const string Repo = "optimizerDuck";
- private static readonly HttpClient HttpClient;
- private static readonly ILogger Log = Logger.CreateLogger<UpdateService>();
-
- static UpdateService()
- {
- HttpClient = new HttpClient();
- HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("optimizerDuck", "1.0"));
- }
-
- public static async Task CheckForUpdatesAsync()
- {
- SystemHelper.Title("Checking for Updates");
- Log.LogInformation("Checking for updates...");
-
- try
- {
- var response =
- await HttpClient.GetStringAsync($"https://api.github.com/repos/{Owner}/{Repo}/releases/latest");
- var latestRelease = JsonConvert.DeserializeObject<GitHubRelease>(response);
-
- if (latestRelease == null || string.IsNullOrEmpty(latestRelease.TagName))
- {
- Log.LogWarning("Could not retrieve latest release information.");
- return;
- }
-
- // "v1.1.0" -> "1.1.0"
- var latestVersionStr = latestRelease.TagName.TrimStart('v');
-
- // "1.1.0-fix" -> "1.1.0"
- var preReleaseSeparatorIndex = latestVersionStr.IndexOf('-');
- if (preReleaseSeparatorIndex != -1)
- latestVersionStr = latestVersionStr[..preReleaseSeparatorIndex];
-
- Log.LogDebug("Latest release version: {LatestReleaseTagName}", latestRelease.TagName);
-
- // Parse version
- if (!Version.TryParse(latestVersionStr, out var latestVersion))
- {
- Log.LogWarning("Could not parse latest release version: {LatestReleaseTagName}", latestRelease.TagName);
- return;
- }
-
- var currentVersion = Assembly.GetExecutingAssembly().GetName().Version
- ?? new Version(0, 0, 0);
-
- if (latestVersion > currentVersion)
- {
- var updateExecutableAsset = latestRelease.Assets
- .FirstOrDefault(a =>
- a.Name.StartsWith("optimizerDuck", StringComparison.OrdinalIgnoreCase)
- && a.Name.EndsWith(".exe", StringComparison.OrdinalIgnoreCase));
-
- if (updateExecutableAsset == null)
- {
- Log.LogWarning("No update executable (.exe) found in the latest release.");
- return;
- }
-
- Log.LogInformation("A new version ({LatestVersion}) is available!", latestVersionStr);
-
- if (!string.IsNullOrWhiteSpace(latestRelease.Body))
- {
- var options = new MarkdownRenderOptions
- {
- UseHyperlinks = true,
- EnableColors = true,
- Theme = ConsoleTheme.Default
- };
- MarkdownConsole.Render(latestRelease.Body, Console.Out, options);
- }
-
- if (PromptDialog.Warning(
- "Update Available",
- $"""
- A new version [{Theme.Primary}]{latestVersionStr}[/] is ready to install.
- Updating ensures you get the latest features and fixes.
-
- Would you like to download and install it now?
- """,
- new PromptOption("Yes", Theme.Success),
- new PromptOption("Not now", Theme.Warning, () => Task.FromResult(false))
- ))
- await DownloadAndApplyUpdate(updateExecutableAsset);
- }
- else
- {
- Log.LogInformation("You are running the latest version.");
- }
- }
- catch (Exception ex)
- {
- Log.LogError(ex, $"Error checking for updates: [{Theme.Error}]{ex.Message}[/]");
- }
- }
-
- private static async Task DownloadAndApplyUpdate(GitHubAsset asset)
- {
- SystemHelper.Title("Downloading Update");
- var tempDownloadPath = Path.Combine(Path.GetTempPath(), asset.Name);
- try
- {
- await AnsiConsole.Progress().StartAsync(async ctx =>
- {
- Log.LogInformation("Downloading update from {DownloadUrl} to {TempPath}", asset.BrowserDownloadUrl,
- tempDownloadPath);
- var task = ctx.AddTask($"Downloading [{Theme.Primary}]{asset.Name}[/]");
-
- using var response =
- await HttpClient.GetAsync(asset.BrowserDownloadUrl, HttpCompletionOption.ResponseHeadersRead);
- response.EnsureSuccessStatusCode();
-
- var totalBytes = response.Content.Headers.ContentLength ?? -1L;
- task.MaxValue = totalBytes;
-
- await using var contentStream = await response.Content.ReadAsStreamAsync();
- await using var fileStream = new FileStream(tempDownloadPath, FileMode.Create, FileAccess.Write,
- FileShare.None, 8192, true);
-
- var buffer = new byte[8192];
- long downloadedBytes = 0;
- int bytesRead;
-
- while ((bytesRead = await contentStream.ReadAsync(buffer.AsMemory(0, buffer.Length))) > 0)
- {
- await fileStream.WriteAsync(buffer.AsMemory(0, bytesRead));
- downloadedBytes += bytesRead;
- task.Value = downloadedBytes;
- }
- });
- }
- catch (Exception ex)
- {
- Log.LogError(ex, "Error downloading update: {Message}", ex.Message);
- PromptDialog.Warning("Download Failed", $"Failed to download the update: [{Theme.Error}]{ex.Message}[/]",
- new PromptOption("Continue anyway", Theme.Success),
- new PromptOption("Retry", Theme.Warning, async () => { await DownloadAndApplyUpdate(asset); })
- );
- }
- finally
- {
- Log.LogInformation("Download complete.");
- LaunchUpdater(tempDownloadPath);
- }
- }
-
- private static void LaunchUpdater(string newExePath)
- {
- SystemHelper.Title("Updating Application");
- Log.LogInformation("Starting update...");
- var currentProcess = Process.GetCurrentProcess();
- Log.LogDebug("Current process ID: {Pid}", currentProcess.Id);
- Log.LogDebug("New executable path: {ExePath}", newExePath);
- Log.LogDebug("Current (old) executable path: {OldExePath}", Defaults.ExePath);
-
- var finalExePath = Path.Combine(Defaults.ExeDir, Path.GetFileName(newExePath));
-
- var updateScript = $"""
- Write-Host "Waiting for main process ({currentProcess.Id}) to exit..."
- Wait-Process -Id {currentProcess.Id}
- Write-Host "Main process exited."
-
- Write-Host "Moving new version executable..."
- Move-Item -Path {newExePath} -Destination {finalExePath} -Force
-
- Write-Host "Starting updated application..."
- Start-Process -FilePath {finalExePath}
-
- Write-Host "Cleaning up..."
- Remove-Item -Path {Defaults.ExePath} -Force
- """;
-
- var process = new Process
- {
- StartInfo = new ProcessStartInfo
- {
- FileName = "powershell.exe",
- Arguments =
- $"-NonInteractive -NoLogo -NoProfile -ExecutionPolicy Bypass -EncodedCommand {updateScript.EncodeBase64()}",
- UseShellExecute =
- true, // start as a separate process via the shell so it doesn't inherit debugger/std handles
- CreateNoWindow = true
- }
- };
-
- process.Start();
- Environment.Exit(0);
- }
-}
-
-// Helper classes for deserializing GitHub API response
-public class GitHubRelease
-{
- [JsonProperty("tag_name")] public required string TagName { get; set; }
-
- [JsonProperty("assets")] public required List<GitHubAsset> Assets { get; set; }
-
- [JsonProperty("body")] public required string Body { get; set; }
-}
-
-public class GitHubAsset
-{
- [JsonProperty("name")] public required string Name { get; set; }
-
- [JsonProperty("browser_download_url")] public required string BrowserDownloadUrl { get; set; }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Interfaces/IOptimization.cs b/optimizerDuck/src/Interfaces/IOptimization.cs
deleted file mode 100644
index f75ad53..0000000
--- a/optimizerDuck/src/Interfaces/IOptimization.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using optimizerDuck.Core.Services;
-using optimizerDuck.Models;
-
-namespace optimizerDuck.Interfaces;
-
-public interface IOptimization
-{
- public string Name { get; }
- public string Description { get; }
- public bool EnabledByDefault { get; }
- public OptimizationImpact Impact { get; }
- public Task Apply(SystemSnapshot s, CancellationToken t);
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Interfaces/IOptimizationCategory.cs b/optimizerDuck/src/Interfaces/IOptimizationCategory.cs
deleted file mode 100644
index 3ab97a6..0000000
--- a/optimizerDuck/src/Interfaces/IOptimizationCategory.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Microsoft.Extensions.Logging;
-using optimizerDuck.Models;
-
-namespace optimizerDuck.Interfaces;
-
-public interface IOptimizationCategory
-{
- public string Name { get; }
- public OptimizationCategoryOrder Order { get; }
- public static abstract ILogger Log { get; }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Models/AppxClassification.cs b/optimizerDuck/src/Models/AppxClassification.cs
deleted file mode 100644
index 6d805cf..0000000
--- a/optimizerDuck/src/Models/AppxClassification.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace optimizerDuck.Models;
-
-public record struct AppxClassification(
- List<AppxPackage> SafeApps,
- List<AppxPackage> CautionApps
-);
\ No newline at end of file
diff --git a/optimizerDuck/src/Models/AppxClassificationRaw.cs b/optimizerDuck/src/Models/AppxClassificationRaw.cs
deleted file mode 100644
index b55503d..0000000
--- a/optimizerDuck/src/Models/AppxClassificationRaw.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace optimizerDuck.Models;
-
-public record struct AppxClassificationRaw(
- List<List<AppxPackage>> SafeApps,
- List<List<AppxPackage>> CautionApps
-);
\ No newline at end of file
diff --git a/optimizerDuck/src/Models/AppxPackage.cs b/optimizerDuck/src/Models/AppxPackage.cs
deleted file mode 100644
index 40a8325..0000000
--- a/optimizerDuck/src/Models/AppxPackage.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace optimizerDuck.Models;
-
-public record struct AppxPackage(
- string DisplayName,
- string Name,
- string Version,
- string InstallLocation
-);
\ No newline at end of file
diff --git a/optimizerDuck/src/Models/OptimizationCategoryChoice.cs b/optimizerDuck/src/Models/OptimizationCategoryChoice.cs
deleted file mode 100644
index 4f4b205..0000000
--- a/optimizerDuck/src/Models/OptimizationCategoryChoice.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace optimizerDuck.Models;
-
-public record struct OptimizationCategoryChoice(
- string Name,
- OptimizationCategoryOrder Order,
- List<OptimizationChoice> Optimizations);
\ No newline at end of file
diff --git a/optimizerDuck/src/Models/OptimizationCategoryOrder.cs b/optimizerDuck/src/Models/OptimizationCategoryOrder.cs
deleted file mode 100644
index ee3cd51..0000000
--- a/optimizerDuck/src/Models/OptimizationCategoryOrder.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace optimizerDuck.Models;
-
-public enum OptimizationCategoryOrder
-{
- Performance,
- SecurityAndPrivacy,
- Power,
- UserExperience,
- BloatwareAndServices
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Models/OptimizationChoice.cs b/optimizerDuck/src/Models/OptimizationChoice.cs
deleted file mode 100644
index d4f44c7..0000000
--- a/optimizerDuck/src/Models/OptimizationChoice.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using optimizerDuck.Interfaces;
-
-namespace optimizerDuck.Models;
-
-public record struct OptimizationChoice(
- IOptimization? Instance,
- string Name,
- string Description,
- bool EnabledByDefault);
\ No newline at end of file
diff --git a/optimizerDuck/src/Models/OptimizationImpact.cs b/optimizerDuck/src/Models/OptimizationImpact.cs
deleted file mode 100644
index 5197338..0000000
--- a/optimizerDuck/src/Models/OptimizationImpact.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System.ComponentModel;
-using optimizerDuck.UI;
-
-namespace optimizerDuck.Models;
-
-public enum OptimizationImpact
-{
- [Description($"[{Theme.Success}]Minimal Impact[/]")]
- Minimal,
-
- [Description($"[{Theme.Warning}]Moderate Impact[/]")]
- Moderate,
-
- [Description($"[{Theme.Error}]High Impact[/]")]
- Significant,
-
- [Description($"[{Theme.Error}]System-wide impact[/]")]
- Aggressive
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/Models/ServiceItem.cs b/optimizerDuck/src/Models/ServiceItem.cs
deleted file mode 100644
index 670ec01..0000000
--- a/optimizerDuck/src/Models/ServiceItem.cs
+++ /dev/null
@@ -1,3 +0,0 @@
-namespace optimizerDuck.Models;
-
-public record struct ServiceItem(string ServiceName, ServiceStartupType StartupType);
\ No newline at end of file
diff --git a/optimizerDuck/src/UI/Components/CustomBoxBorder.cs b/optimizerDuck/src/UI/Components/CustomBoxBorder.cs
deleted file mode 100644
index d79a53e..0000000
--- a/optimizerDuck/src/UI/Components/CustomBoxBorder.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-using Spectre.Console;
-using Spectre.Console.Rendering;
-
-namespace optimizerDuck.UI.Components;
-
-public static class CustomBoxBorder
-{
- public static BoxBorder UnderlineBorder => new CUnderlineBorder();
- public static BoxBorder LeftBorder => new CLeftBorder();
- public static BoxBorder EmptyBorder => new CEmptyBorder();
-
- private sealed class CUnderlineBorder : BoxBorder
- {
- public override string GetPart(BoxBorderPart part)
- {
- return part switch
- {
- BoxBorderPart.TopLeft => " ",
- BoxBorderPart.Top => " ",
- BoxBorderPart.TopRight => " ",
- BoxBorderPart.Left => " ",
- BoxBorderPart.Right => " ",
- BoxBorderPart.BottomLeft => "─",
- BoxBorderPart.Bottom => "─",
- BoxBorderPart.BottomRight => "─",
- _ => throw new InvalidOperationException("Unknown border part.")
- };
- }
- }
-
- private sealed class CLeftBorder : BoxBorder
- {
- public override string GetPart(BoxBorderPart part)
- {
- return part switch
- {
- BoxBorderPart.TopLeft => " ",
- BoxBorderPart.Top => " ",
- BoxBorderPart.TopRight => " ",
- BoxBorderPart.Left => "│",
- BoxBorderPart.Right => " ",
- BoxBorderPart.BottomLeft => " ",
- BoxBorderPart.Bottom => " ",
- BoxBorderPart.BottomRight => " ",
- _ => throw new InvalidOperationException("Unknown border part.")
- };
- }
- }
-
- private sealed class CEmptyBorder : BoxBorder
- {
- public override string GetPart(BoxBorderPart part)
- {
- return part switch
- {
- BoxBorderPart.TopLeft => " ",
- BoxBorderPart.Top => " ",
- BoxBorderPart.TopRight => " ",
- BoxBorderPart.Left => " ",
- BoxBorderPart.Right => " ",
- BoxBorderPart.BottomLeft => " ",
- BoxBorderPart.Bottom => " ",
- BoxBorderPart.BottomRight => " ",
- _ => throw new InvalidOperationException("Unknown border part.")
- };
- }
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/UI/Components/EscapeCancellableConsole.cs b/optimizerDuck/src/UI/Components/EscapeCancellableConsole.cs
deleted file mode 100644
index 7cd9e78..0000000
--- a/optimizerDuck/src/UI/Components/EscapeCancellableConsole.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-using Spectre.Console;
-using Spectre.Console.Rendering;
-
-namespace optimizerDuck.UI.Components;
-
-// original from https://github.com/spectreconsole/spectre.console/discussions/700#discussioncomment-12960984
-internal sealed class EscapeCancellableConsole : IAnsiConsole, IDisposable
-{
- private readonly IAnsiConsole _console;
- private readonly CancellationTokenSource _cts = new();
- private readonly EscapeCancellableInput _input;
-
- public EscapeCancellableConsole(IAnsiConsole console)
- {
- _console = console ?? throw new ArgumentNullException(nameof(console));
- _input = new EscapeCancellableInput(console.Input, _cts);
-
- Console.CancelKeyPress += OnCancelKeyPress;
- }
-
- public Profile Profile => _console.Profile;
- public IAnsiConsoleCursor Cursor => _console.Cursor;
- public IAnsiConsoleInput Input => _input;
- public IExclusivityMode ExclusivityMode => _console.ExclusivityMode;
- public RenderPipeline Pipeline => _console.Pipeline;
-
- public void Clear(bool home)
- {
- _console.Clear(home);
- }
-
- public void Write(IRenderable renderable)
- {
- _console.Write(renderable);
- }
-
- public void Dispose()
- {
- Console.CancelKeyPress -= OnCancelKeyPress;
- _cts.Dispose();
- }
-
-
- private void OnCancelKeyPress(object? sender, ConsoleCancelEventArgs e)
- {
- e.Cancel = true;
- if (!_cts.IsCancellationRequested)
- {
- _cts.Cancel();
- Console.CancelKeyPress -= OnCancelKeyPress;
- }
- }
-
- public Task<T> PromptAsync<T>(IPrompt<T> prompt, CancellationToken cancellationToken = default)
- {
- return AnsiConsoleExtensions.PromptAsync(this, prompt, MergeToken(cancellationToken));
- }
-
- private CancellationToken MergeToken(CancellationToken external)
- {
- if (external == CancellationToken.None || external == _cts.Token)
- return _cts.Token;
-
- var linked = CancellationTokenSource.CreateLinkedTokenSource(external, _cts.Token);
- return linked.Token;
- }
-}
-
-internal sealed class EscapeCancellableInput(IAnsiConsoleInput original, CancellationTokenSource cts)
- : IAnsiConsoleInput
-{
- private readonly CancellationTokenSource _cts = cts ?? throw new ArgumentNullException(nameof(cts));
- private readonly IAnsiConsoleInput _original = original ?? throw new ArgumentNullException(nameof(original));
-
- public bool IsKeyAvailable()
- {
- return _original.IsKeyAvailable();
- }
-
- public ConsoleKeyInfo? ReadKey(bool intercept)
- {
- var key = _original.ReadKey(intercept);
- if (key?.Key == ConsoleKey.Escape)
- _cts.Cancel();
-
- return key;
- }
-
- public async Task<ConsoleKeyInfo?> ReadKeyAsync(bool intercept, CancellationToken cancellationToken)
- {
- var key = await _original.ReadKeyAsync(intercept, cancellationToken).ConfigureAwait(false);
- if (key?.Key == ConsoleKey.Escape)
- await _cts.CancelAsync();
-
- return key;
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/UI/Components/PromptDialog.cs b/optimizerDuck/src/UI/Components/PromptDialog.cs
deleted file mode 100644
index a0e5da2..0000000
--- a/optimizerDuck/src/UI/Components/PromptDialog.cs
+++ /dev/null
@@ -1,203 +0,0 @@
-using Microsoft.Extensions.Logging;
-using optimizerDuck.Core.Helpers;
-using optimizerDuck.UI.Logger;
-using Spectre.Console;
-
-namespace optimizerDuck.UI.Components;
-
-public record PromptOption
-{
- public PromptOption(string key, string color, Action? action = null)
- {
- Key = key;
- Color = color;
- if (action != null)
- OnSelected = () =>
- {
- action();
- return true;
- }; // default to return true
- else
- OnSelected = () => true;
- }
-
- public PromptOption(string key, string color, Func<bool> func)
- {
- Key = key;
- Color = color;
- OnSelected = func;
- }
-
- public string Key { get; }
- public string Color { get; }
- public Func<bool> OnSelected { get; }
-}
-
-public class PromptDialog
-{
- private static readonly ILogger Log = Logger.Logger.CreateLogger<PromptDialog>();
- private static string _previousTitle = "";
-
- private readonly List<PromptOption> _options = [];
- private string _borderColor = "grey";
- private string _description = "";
-
- private string _title = "";
- private string _titleColor = "white";
-
- public PromptDialog Title(string title)
- {
- _title = title;
- return this;
- }
-
- public PromptDialog TitleColor(string color)
- {
- _titleColor = color;
- return this;
- }
-
- public PromptDialog Description(string description)
- {
- _description = description;
- return this;
- }
-
- public PromptDialog AddOption(params PromptOption[] options)
- {
- _options.AddRange(options);
- return this;
- }
-
- public PromptDialog BorderColor(string color)
- {
- _borderColor = color;
- return this;
- }
-
- private string Prompt()
- {
- var buttonList = new List<string>();
- var keyMap = new Dictionary<char, string>(); // "Yes" => Y: Yes
- foreach (var (option, key, rest, color) in from option in _options
- let key = char.ToUpper(option.Key[0])
- let rest = option.Key.Substring(1)
- let color = option.Color
- select (option, key, rest, color))
- {
- buttonList.Add($"[{color}][underline bold]{key}[/]{rest}[/]");
- keyMap[key] = option.Key;
- }
-
- var buttons = string.Join(" ", buttonList);
-
- var panelContent = new Rows(
- new Markup(_description).Centered(),
- new Text("\n"),
- new Markup(buttons).Centered()
- );
- var panel = new Panel(panelContent)
- {
- Header = new PanelHeader($"[bold {_titleColor}] {_title} [/]", Justify.Center),
- Border = BoxBorder.Rounded,
- BorderStyle = _borderColor,
- Padding = new Padding(5, 1, 5, 1)
- };
- AnsiConsole.Write(Align.Center(panel));
- Console.Beep();
-
- _previousTitle = Console.Title;
- SystemHelper.Title(_title);
-
-
- using (new StatusContextScope(
- GlobalStatus.Current,
- Spinner.Known.SimpleDotsScrolling,
- _borderColor,
- "Select an option (press its first character)"))
- {
- while (true)
- {
- Console.CursorVisible = false;
- var keyInfo = Console.ReadKey(true);
- Console.CursorVisible = true;
-
- if (!char.IsLetter(keyInfo.KeyChar)) continue;
-
-
- var pressed = char.ToUpper(keyInfo.KeyChar);
-
- if (keyMap.TryGetValue(pressed, out var value))
- {
- Log.LogDebug("[{Title}] User selected option: {Option}", _title, value);
- Console.Title = _previousTitle;
- return value;
- }
-
- AnsiConsole.MarkupLine("[red]Invalid key![/] [dim]Press the first character of the option![/]");
- }
- }
- }
-
-
- public static bool Warning(string title, string description, params PromptOption[] options)
- {
- var panel = new PromptDialog()
- .Title(title)
- .Description(description);
-
- var finalOptions = options is { Length: > 0 }
- ? options
- :
- [
- new PromptOption("Continue anyway", Theme.Success),
- new PromptOption("Exit", Theme.Error, () => Environment.Exit(1))
- ];
-
- panel.AddOption(finalOptions)
- .TitleColor($"black on {Theme.Warning}")
- .BorderColor(Theme.WarningMuted);
-
- var choice = panel.Prompt();
- var selected = finalOptions.FirstOrDefault(o => o.Key == choice)!;
-
- return selected!.OnSelected!.Invoke();
- }
-
-
- public static void Exception(Exception exception, string title, string description, params PromptOption[] options)
- {
- var panel = new PromptDialog()
- .Title(title)
- .Description($"""
- {description}
-
- [bold {Theme.Error}]Exception:[/]
- [italic]{exception.GetType().Name}[/]
- [bold {Theme.Error}]{Markup.Escape(exception.Message)}[/]
-
- [dim]──────────────────────────────[/]
- [grey]Please check the log file for more details.[/]
- """);
-
- var finalOptions = options is { Length: > 0 }
- ? options
- :
- [
- new PromptOption("Exit", Theme.Error, () => Environment.Exit(1)),
- new PromptOption("Restart", Theme.Success, () => RequirementChecker.Restart(true)),
- new PromptOption("Create a new issue on GitHub", Theme.Bright,
- () => SystemHelper.OpenWebsite("https://github.com/itsfatduck/optimizerDuck/issues/new")),
- new PromptOption("Open log", Theme.Warning, SystemHelper.OpenLogFile)
- ];
-
- panel.AddOption(finalOptions)
- .TitleColor($"black on {Theme.Error}")
- .BorderColor(Theme.ErrorMuted);
-
- var choice = panel.Prompt();
-
- var selected = finalOptions.FirstOrDefault(o => o.Key == choice);
- selected!.OnSelected.Invoke();
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/UI/Components/PromptPanel.cs b/optimizerDuck/src/UI/Components/PromptPanel.cs
deleted file mode 100644
index 7089c94..0000000
--- a/optimizerDuck/src/UI/Components/PromptPanel.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using optimizerDuck.Core.Extensions;
-using Spectre.Console;
-
-namespace optimizerDuck.UI.Components;
-
-public class PromptPanel
-{
- private readonly BoxBorder _border = BoxBorder.Rounded;
- private readonly string _color;
- private readonly string _description;
- private readonly char _index;
- private readonly string _title;
- private readonly int? _width;
-
- public PromptPanel(char index, string title, string description, string color, BoxBorder? border = null,
- int? width = null)
- {
- _index = index;
- _title = title;
- _description = description;
- _color = color;
- _width = width ?? _width;
- _border = border ?? _border;
- }
-
- public Panel Build()
- {
- var desc = _width.HasValue
- ? _description.LimitWidth(_width.Value)
- : _description;
-
- var panel = new Panel(
- $"[black on {_color}] {_index} [/] " +
- $"[bold {_color}]{_title}[/]\n[{Theme.Muted}]{desc}[/]"
- )
- {
- Padding = new Padding(2, 0),
- Border = _border,
- BorderStyle = _color,
- Expand = false
- };
-
- if (_width.HasValue)
- panel.Width = _width.Value;
-
- return panel;
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/UI/Logger/GlobalStatus.cs b/optimizerDuck/src/UI/Logger/GlobalStatus.cs
deleted file mode 100644
index 00598f3..0000000
--- a/optimizerDuck/src/UI/Logger/GlobalStatus.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Spectre.Console;
-
-namespace optimizerDuck.UI.Logger;
-
-public static class GlobalStatus
-{
- public static StatusContext? Current { get; set; }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/UI/Logger/Logger.cs b/optimizerDuck/src/UI/Logger/Logger.cs
deleted file mode 100644
index c91f05a..0000000
--- a/optimizerDuck/src/UI/Logger/Logger.cs
+++ /dev/null
@@ -1,208 +0,0 @@
-using Microsoft.Extensions.Logging;
-using optimizerDuck.Core;
-using Serilog;
-using Serilog.Core;
-using Serilog.Events;
-using Serilog.Formatting;
-using Serilog.Parsing;
-using Spectre.Console;
-using Vertical.SpectreLogger;
-using Vertical.SpectreLogger.Options;
-using Vertical.SpectreLogger.Rendering;
-using ILogger = Microsoft.Extensions.Logging.ILogger;
-
-namespace optimizerDuck.UI.Logger;
-
-public class PlainTextFormatter : ITextFormatter
-{
- public void Format(LogEvent logEvent, TextWriter output)
- {
- // [2025/10/30 21:15:43]
- output.Write($"[{logEvent.Timestamp:yyyy/MM/dd HH:mm:ss}]");
-
- // [SourceContext]
- if (logEvent.Properties.TryGetValue("SourceContext", out var ctx) && ctx is ScalarValue sv)
- output.Write($" [{sv.Value,-25}]");
-
-
- // [INFO ]
- var levelText = logEvent.Level switch
- {
- LogEventLevel.Verbose => "VERBOSE",
- LogEventLevel.Debug => "DEBUG",
- LogEventLevel.Information => "INFO",
- LogEventLevel.Warning => "WARNING",
- LogEventLevel.Error => "ERROR",
- LogEventLevel.Fatal => "FATAL",
- _ => "UNKNOWN"
- };
- output.Write($" [{levelText,-7}]");
-
- // [Scope1] [Scope2] ...
- if (logEvent.Properties.TryGetValue("Scope", out var scopeValue))
- {
- switch (scopeValue)
- {
- case SequenceValue seq:
- {
- foreach (var scope in seq.Elements)
- {
- var text = scope switch
- {
- ScalarValue s => s.Value?.ToString(),
- _ => scope.ToString()
- };
-
- if (!string.IsNullOrWhiteSpace(text))
- output.Write($" [{text}]");
- }
-
- break;
- }
- case ScalarValue single:
- output.Write($" [{single.Value}]");
- break;
- }
- }
-
-
- // Message
- var message = RenderWithoutQuotes(logEvent);
- if (logEvent.Level == LogEventLevel.Debug &&
- !Defaults.IsDebug) // i want to keep markup for debug logs when not in debug mode to avoid markup exceptions
- output.Write($" {message}");
- else
- output.Write($" {Markup.Remove(message)}");
-
- // Include exception details if present
- if (logEvent.Exception != null)
- {
- output.WriteLine();
- output.Write(logEvent.Exception.ToString());
- }
-
- // Add a new line at the end of the log event
- output.WriteLine();
- }
-
- private static string RenderWithoutQuotes(LogEvent logEvent)
- {
- var output = new StringWriter();
- foreach (var token in logEvent.MessageTemplate.Tokens)
- if (token is PropertyToken pt && logEvent.Properties.TryGetValue(pt.PropertyName, out var value))
- {
- if (value is ScalarValue { Value: string s })
- // write string without quotes
- output.Write(s);
- else
- // use default rendering for other types
- pt.Render(logEvent.Properties, output);
- }
- else
- {
- token.Render(logEvent.Properties, output);
- }
-
- return output.ToString();
- }
-}
-
-public class ShortSourceContextEnricher : ILogEventEnricher
-{
- //private readonly string _rootNamespace = Assembly.GetEntryAssembly()?.GetName().Name?.Replace(' ', '_') + ".";
-
- public void Enrich(LogEvent logEvent, ILogEventPropertyFactory factory)
- {
- if (logEvent.Properties.TryGetValue("SourceContext", out var value))
- {
- //Console.WriteLine(_rootNamespace);
-
- var fullName = value.ToString().Trim('"');
-
-
- // if the source context is in the root namespace, remove it
- // var name = fullName.StartsWith(_rootNamespace)
- // ? fullName.Substring(_rootNamespace.Length)
- // : fullName;
-
- var name = fullName.Split('.').Last();
-
- logEvent.AddOrUpdateProperty(factory.CreateProperty("SourceContext", name));
- }
- }
-}
-
-public static class Logger
-{
- public static readonly string LogFilePath = Path.Combine(Defaults.RootPath, "optimizerDuck.log");
- private static readonly ILoggerFactory LoggerFactory;
-
- static Logger()
- {
- Log.Logger = new LoggerConfiguration()
- .MinimumLevel.Debug()
- .Enrich.With<ShortSourceContextEnricher>()
- .WriteTo.File(new PlainTextFormatter(), LogFilePath, shared: true)
- .CreateLogger();
-
- // add a header to the log file
- Log.Logger.Information("\n\n{Logo}\nVersion: {Version}\n\n", Defaults.RawLogo, Defaults.FileVersion);
-
- LoggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(builder =>
- {
- builder.AddSpectreConsole(config =>
- {
- config.SetMinimumLevel(Defaults.IsDebug
- ? LogLevel.Debug
- : LogLevel.Information);
-
- config.ConfigureProfiles(profile =>
- {
- // https://github.com/verticalsoftware/vertical-spectreconsolelogger/issues/31
- profile.PreserveMarkupInFormatStrings = true;
-
- // https://github.com/verticalsoftware/vertical-spectreconsolelogger/blob/dev/src/Options/SerilogStyleLoggerOptions.cs
- // https://github.com/verticalsoftware/vertical-spectreconsolelogger/blob/dev/docs/styling.md
- profile
- .AddTypeFormatter<LogLevel>((_, value, _) =>
- value switch
- {
- LogLevel.Trace => "TRACE",
- LogLevel.Debug => "DEBUG",
- LogLevel.Information => "INFO",
- LogLevel.Warning => "WARNING",
- LogLevel.Error => "ERROR",
- LogLevel.Critical => "CRITICAL",
- _ => "UNKNOWN"
- })
- .AddTypeStyle<int>($"[{Theme.Primary}]")
- .AddTypeStyle<string>($"[{Theme.Primary}]")
- .AddTypeStyle<DateTimeRenderer.Value>($"[{Theme.Muted}]");
-
- profile.OutputTemplate = "{DateTime:yyyy/MM/dd HH:mm:ss} {LogLevel,-7} {Message}{NewLine}";
- profile.DefaultLogValueStyle = $"[{Theme.Primary}]";
- });
- config.ConfigureProfile(LogLevel.Information,
- profile => profile.AddTypeStyle<LogLevel>($"[{Theme.Info}]"));
- config.ConfigureProfile(LogLevel.Debug,
- profile => profile.AddTypeStyle<LogLevel>($"[{Theme.Warning}]"));
- config.ConfigureProfile(LogLevel.Warning,
- profile => profile.AddTypeStyle<LogLevel>($"[{Theme.Warning}]"));
- config.ConfigureProfile(LogLevel.Error, profile => profile.AddTypeStyle<LogLevel>($"[{Theme.Error}]"));
- config.ConfigureProfile(LogLevel.Critical,
- profile => profile.AddTypeStyle<LogLevel>($"[{Theme.Error}]"));
- });
- builder.AddSerilog(Log.Logger);
- });
- }
-
- public static ILogger CreateLogger<T>()
- {
- return LoggerFactory.CreateLogger<T>();
- }
-
- public static ILogger CreateLogger(Type type)
- {
- return LoggerFactory.CreateLogger(type);
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/UI/Logger/ServiceTracker.cs b/optimizerDuck/src/UI/Logger/ServiceTracker.cs
deleted file mode 100644
index d2c946f..0000000
--- a/optimizerDuck/src/UI/Logger/ServiceTracker.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using System.Collections.Concurrent;
-using System.Diagnostics;
-using Microsoft.Extensions.Logging;
-
-namespace optimizerDuck.UI.Logger;
-
-public class ServiceTracker : IDisposable
-{
- private static readonly AsyncLocal<ServiceTracker?> _current = new();
-
- private readonly ConcurrentDictionary<string, (int Success, int Fail)> _serviceStats;
- private readonly Stopwatch _stopwatch;
-
- private ServiceTracker(ILogger logger)
- {
- Log = logger;
- _stopwatch = Stopwatch.StartNew();
- _serviceStats = new ConcurrentDictionary<string, (int Success, int Fail)>();
- }
-
- public static ServiceTracker? Current => _current.Value;
-
- public ILogger Log { get; }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- _stopwatch.Stop();
- var time = FormatTime(_stopwatch.Elapsed);
-
- var stats = string.Join(" [dim]|[/] ", _serviceStats.Select(kvp =>
- $"{kvp.Key}: [{Theme.Success}]{kvp.Value.Success}[/][dim]/[/][{Theme.Error}]{kvp.Value.Fail}[/]"));
-
- Log.LogInformation($"[{Theme.Muted}]Time: {time}[/] [dim]|[/] {stats}");
- _current.Value = null;
- }
- }
-
-
- public static ServiceTracker Begin(ILogger? logger = null)
- {
- var log = logger ?? Logger.CreateLogger<ServiceTracker>();
- var tracker = new ServiceTracker(log);
- _current.Value = tracker;
- return tracker;
- }
-
- public void Track(string serviceName, bool success)
- {
- if (!_serviceStats.TryGetValue(serviceName, out var current))
- current = (0, 0);
-
- _serviceStats.AddOrUpdate(
- serviceName,
- success ? (1, 0) : (0, 1),
- (key, current) => success
- ? (current.Success + 1, current.Fail)
- : (current.Success, current.Fail + 1));
- }
-
- public static string FormatTime(TimeSpan time)
- {
- if (time.TotalSeconds >= 1) return $"{time.TotalSeconds:F1}s";
- if (time.TotalMilliseconds >= 1) return $"{time.TotalMilliseconds:F0}ms";
- return time.Ticks > 0 ? $"{time.Ticks} ticks" : "0";
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/UI/Logger/StatusContext.cs b/optimizerDuck/src/UI/Logger/StatusContext.cs
deleted file mode 100644
index d4831d8..0000000
--- a/optimizerDuck/src/UI/Logger/StatusContext.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using Spectre.Console;
-
-namespace optimizerDuck.UI.Logger;
-
-public sealed class StatusContextScope : IDisposable
-{
- private readonly StatusContext? _ctx;
- private readonly Spinner? _spinner;
- private readonly Style? _spinnerStyle;
- private readonly string? _status;
-
- public StatusContextScope(StatusContext? ctx, Spinner newSpinner, Style newStyle, string newStatus)
- {
- if (ctx is null)
- {
- _ctx = null;
- _spinner = null;
- _spinnerStyle = null;
- _status = null;
- return;
- }
-
- _ctx = ctx;
- _spinner = ctx.Spinner;
- _spinnerStyle = ctx.SpinnerStyle;
- _status = ctx.Status;
-
- // Apply temporary state
- ctx.Spinner(newSpinner);
- ctx.SpinnerStyle(newStyle);
- ctx.Status(newStatus);
- }
-
- public void Dispose()
- {
- if (_ctx is null)
- return;
-
- _ctx.Spinner(_spinner!);
- _ctx.SpinnerStyle = _spinnerStyle;
- _ctx.Status = _status!;
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/UI/MainMenu.cs b/optimizerDuck/src/UI/MainMenu.cs
deleted file mode 100644
index 2b0cd7f..0000000
--- a/optimizerDuck/src/UI/MainMenu.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using optimizerDuck.Core;
-using optimizerDuck.Core.Helpers;
-using optimizerDuck.Core.Services;
-using optimizerDuck.UI.Components;
-using Spectre.Console;
-
-namespace optimizerDuck.UI;
-
-internal static class MainMenu
-{
- public static void Display(SystemSnapshot systemSnapshot)
- {
- SystemHelper.Title(
- $"{systemSnapshot.Os.Name} {systemSnapshot.Os.Edition} ({systemSnapshot.Os.Architecture})");
- AnsiConsole.Clear();
- AnsiConsole.Write(Defaults.Logo);
-
- AnsiConsole.WriteLine();
-
- var start = Align.Center(
- new PromptPanel('E', "Start Optimization",
- $"""
- [bold]Customize your optimization process.[/]
- Browse the available options, pick the ones that suit you best,
- and apply them to improve your system.
-
- [bold {Theme.Warning}]Some changes may require a restart.[/]
- [dim white]Certain options may also need an internet connection.[/]
- """,
- Theme.Primary,
- CustomBoxBorder.LeftBorder).Build()
- );
-
- var middlePanels = Align.Center(
- new Columns(
- new PromptPanel('D', "Join our Discord",
- $"""
- [bold]{Emoji.Known.SpeechBalloon} Get help, share ideas, and stay updated.[/]
- Connect with the community and the dev team directly.
- """,
- Theme.Info,
- CustomBoxBorder.UnderlineBorder).Build(),
- new PromptPanel('G', "GitHub",
- $"""
- [bold]{Emoji.Known.Laptop} Explore the source code and releases.[/]
- Contribute, report issues, or check for the latest updates.
- """,
- "white",
- CustomBoxBorder.UnderlineBorder).Build(),
- new PromptPanel('I', "System Information",
- $"""
- [bold]{Emoji.Known.Gear} View system information.[/]
- Review detailed system information and diagnostics.
- """,
- Theme.Accent,
- CustomBoxBorder.UnderlineBorder).Build()
- )
- { Expand = false }
- );
- AnsiConsole.Write(start);
- AnsiConsole.Write(middlePanels);
-
- AnsiConsole.WriteLine();
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/UI/MenuHandler.cs b/optimizerDuck/src/UI/MenuHandler.cs
deleted file mode 100644
index 7d1022b..0000000
--- a/optimizerDuck/src/UI/MenuHandler.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-using Microsoft.Extensions.Logging;
-using optimizerDuck.Core;
-using optimizerDuck.Core.Helpers;
-using optimizerDuck.Core.Managers;
-using optimizerDuck.Core.Services;
-using Spectre.Console;
-
-namespace optimizerDuck.UI;
-
-internal class MenuHandler
-{
- private static readonly ILogger Log = Logger.Logger.CreateLogger<MenuHandler>();
- private readonly Dictionary<char, Func<Task>> _menuActions;
-
- private OptimizationManager? _optimizer;
- private SystemSnapshot _systemSnapshot;
-
- public MenuHandler(SystemSnapshot systemSnapshot)
- {
- _systemSnapshot = systemSnapshot;
- _menuActions = new Dictionary<char, Func<Task>>
- {
- { 'e', HandleStartOptimizationAsync },
- { 'd', HandleDiscordLinkAsync },
- { 'g', HandleGitHubLinkAsync },
- { 'i', HandleSystemInfoAsync }
- };
- }
-
- public async Task<SystemSnapshot> HandleInputAsync(char option)
- {
- if (_menuActions.TryGetValue(option, out var action)) await action();
-
- // If invalid key, do nothing and let the loop re-render the menu.
- return _systemSnapshot;
- }
-
- private async Task HandleStartOptimizationAsync()
- {
- _optimizer ??= new OptimizationManager(_systemSnapshot);
- if (await _optimizer.Begin().ConfigureAwait(false))
- if (await OptimizationManager.RestorePoint().ConfigureAwait(false))
- {
- using var cancelCancellationTokenSource = new CancellationTokenSource();
- ConsoleCancelEventHandler cancelHandler = null!;
-
- cancelHandler = (sender, e) =>
- {
- cancelCancellationTokenSource.Cancel();
- e.Cancel = true;
-
- Console.CancelKeyPress -= cancelHandler;
- };
- Console.CancelKeyPress += cancelHandler;
-
- await _optimizer.Run(cancelCancellationTokenSource.Token).ConfigureAwait(false);
- }
- }
-
- private static Task HandleDiscordLinkAsync()
- {
- SystemHelper.OpenWebsite(Defaults.DiscordInvite);
- return Task.CompletedTask;
- }
-
- private static Task HandleGitHubLinkAsync()
- {
- SystemHelper.OpenWebsite(Defaults.GitHubRepo);
- return Task.CompletedTask;
- }
-
- private async Task HandleSystemInfoAsync()
- {
- Log.LogInformation("Refreshing System Information...");
- _systemSnapshot = await SystemInfoService.RefreshAsync().ConfigureAwait(false);
-
- AnsiConsole.Clear();
- AnsiConsole.Write(Defaults.Logo);
-
- var detailedPanel = SystemInfoService.GetDetailedPanel(_systemSnapshot, Log);
- if (detailedPanel is not null)
- {
- AnsiConsole.Write(detailedPanel);
- AnsiConsole.Write(
- Align.Center(
- new Markup("[dim]Press any key to go back to the main menu.[/]"),
- VerticalAlignment.Middle)
- );
- Console.ReadKey();
- }
- }
-}
\ No newline at end of file
diff --git a/optimizerDuck/src/UI/Theme.cs b/optimizerDuck/src/UI/Theme.cs
deleted file mode 100644
index 2232dda..0000000
--- a/optimizerDuck/src/UI/Theme.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace optimizerDuck.UI;
-
-public static class Theme
-{
- public const string Primary = "#ffffb8";
- public const string Secondary = "#fb7a03";
- public const string Bright = "#fdf5ff";
- public const string Accent = "#fed114";
- public const string Warning = "#ffc16b";
- public const string Info = "#80ade0";
- public const string Success = "#70C27F";
- public const string Error = "#e67a7a";
-
- public const string Muted = "#9c9c9c";
- public const string PrimaryMuted = "#a8a37b";
- public const string ErrorMuted = "#aa7b7b";
- public const string SecondaryMuted = "#a6a279";
- public const string SuccessMuted = "#86c084";
- public const string WarningMuted = "#bfa682";
-}
\ No newline at end of file