Compare commits

...

22 Commits

Author SHA1 Message Date
Gordon Lam (SH)
d868a85b87 Add Version 2025-06-13 18:53:02 +08:00
Heiko
abc5c3e249 [RegistryPreview] Extended preview for value data (#37689)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

Add a button to the data grid that shows a windows for complex value
preview.

### Screenshots
**Button**

![image](https://github.com/user-attachments/assets/bb275831-be6d-490c-9193-5df719ce6c39)

**Context menu** (Usefull on long data, if button is scrolled out of
view.)

![image](https://github.com/user-attachments/assets/f5fb07ef-6f73-4eac-a289-9dce1c610ceb)

**Preview: REG_SZ**

![image](https://github.com/user-attachments/assets/e03fbbc7-adaa-40d0-967c-7783b1a97b74)

**Preview: REG_MULTI_SZ**

![image](https://github.com/user-attachments/assets/717590a6-7d91-4c9c-8e94-d875a5d2ba6b)

**Preview: REG_EXPAND_SZ**

![image](https://github.com/user-attachments/assets/20135b66-528f-40e7-beed-adfc2b50313d)

**Preview: REG_DWORD and REG_QWORD**

![image](https://github.com/user-attachments/assets/b60110ab-bfc7-40e7-ada3-d278a62b9d01)

**Preview: REG_BINARY**

![image](https://github.com/user-attachments/assets/95f81036-6833-439e-8c01-b3a45c2d8edd)

![image](https://github.com/user-attachments/assets/ce237664-da96-4dbd-835f-969982560b9f)


<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] **Closes:** #36877
- [x] **Communication:** I've discussed this with core contributors
already. If work hasn't been agreed, this work might be rejected
- [x] **Tests:** Added/updated and all pass
- [x] **Localization:** All end user facing strings can be localized =>
missing yet
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

Additionally this PR updates the context menu for values.

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

Tested code with a local build.
2025-06-13 18:08:01 +08:00
PesBandi
ce058f1dc7 [ColorPicker]Add option to choose what clicking individual mouse buttons does (#39025)
## Summary of the Pull Request
Enables the users to choose what left, right, and middle click does when
color picker is open.
<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] **Closes:** #39006
- [x] **Communication:** I've discussed this with core contributors
already
- [x] **Tests:** All pass
- [x] **Localization:** All end user facing strings can be localized
- [x] **Dev docs:** No need
- [x] **New binaries:** None
- [x] **Documentation updated:** No need
## Detailed Description of the Pull Request / Additional comments
![Screenshot of the
settings](https://github.com/user-attachments/assets/a3e1349b-6bb9-4e2f-97f3-a5106a7d92ce)
Adds option to choose from 3 click behaviors for each standard mouse
button:
* **Pick color and open editor**: Copies color to clipboard, saves it to
the color history and opens the editor
* **Pick color and close**: Copies color to clipboard, saves it to the
color history and exits
* **Close**: Closes color picker without copying the color

Pressing <kbd>Enter</kbd> or <kbd>Space</kbd> does what clicking the
primary button would.
Left and middle click actions execute on mouse down, right click on
mouse up for reasons discussed previously (I can't find the conversation
now)
Default settings are chosen in such a way that very little or nothing
changes by updating.
## Validation Steps Performed
Tested:
* Migrating settings from v2.0 to v2.1 (v1 to v2.1 not tested)
* Settings page displays and saves settings correctly
* Default settings load correctly
* All three click actions do what they are supposed to
* Activation behavior works as expected, doesn't affect click actions
2025-06-13 18:01:40 +08:00
leileizhang
2d1676b7df [CmdPal][AOT] Using ExprTk to make the Cal extension AOT-compatible (#39972)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
This PR replaces the original Mages-based expression evaluation engine
with a WinRT-wrapped version of Exprtk in the CmdPalCalculator module.

### Key Changes
**Expression Engine:**

- All expression parsing and evaluation now use Exprtk (via a WinRT
wrapper) instead of Mages.

**Base Conversion Handling:**

- Since Exprtk does not support non-decimal (binary, octal, hexadecimal)
input natively, added logic to convert all such inputs to decimal before
evaluation.

**Code Structure:**

- The overall logic and API surface remain unchanged except for the
engine and base conversion handling.
- All previous Mages references and dependencies have been removed.

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] **Closes:** #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end user facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2025-06-13 12:27:53 +08:00
Kai Tao
8506b47544 Workspaceslib ut (#40007)
This pull request introduces a new unit testing framework for the
`WorkspacesLib` module, adds test coverage for various utilities, and
integrates the new test project into the build system. Key changes
include adding the `WorkspacesLibUnitTests` project, implementing tests
for `AppUtils`, `JsonUtils`, and `PwaHelper`, and updating the build
configuration to include the new test project.

### Unit Tests Added:
* **`AppUtilsTests`**:
- Added comprehensive tests for methods such as `GetCurrentFolder`,
`IsEdge`, `IsChrome`, and `IsSteamGame` to validate their behavior under
various conditions.
* **`JsonUtilsTests`**:
- Implemented tests for reading and writing workspace data, including
scenarios for invalid JSON, non-existent files, and valid workspace
lists.
* **`PwaHelperTests`**:
- Added tests to ensure the stability of `PwaHelper` methods, such as
`GetEdgeAppId`, `GetChromeAppId`, and `SearchPwaName`, even with invalid
or empty inputs.

### Build System Updates:
* **New Test Project Integration**:
- Added the `WorkspacesLibUnitTests` project to the solution file
`PowerToys.sln` with appropriate dependencies.
- Updated build configurations to include the new test project for both
Debug and Release builds across architectures.
[[1]](diffhunk://#diff-ca837ce490070b91656ffffe31cbad8865ba9174e0f020231f77baf35ff3f811R2208-R2215)
[[2]](diffhunk://#diff-ca837ce490070b91656ffffe31cbad8865ba9174e0f020231f77baf35ff3f811R2841)

### Pipeline Adjustments:
* **Test Discovery**:
- Updated the pipeline configuration in
`.pipelines/v2/templates/job-build-project.yml` to discover the new
`WorkspacesLibUnitTests.dll` during test runs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2025-06-13 10:51:22 +08:00
Mengyuan
2b40c4d2f3 [Fuzzing Tests] Use valid areaPath in OneFuzz configuration and Update jobNotificationEmail (#39994)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

![image](https://github.com/user-attachments/assets/53c14889-88d3-4a77-af96-314d29a4a410)

Update the areapath in the OneFuzzConfig.json to "OS\\Windows Client and
Services\\WinPD\\DFX-Developer Fundamentals and
Experiences\\DEFT\\SALT",


<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] **Closes:** #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2025-06-13 10:20:04 +08:00
Clint Rutkas
38cae3ead8 Adjusting community.md (#40021)
adding Zach and removing Zhiwei
2025-06-13 10:00:20 +08:00
HO-COOH
e5b2b7fe82 Fix fancyzone editor dpi awareness (#39356)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
Enable dpi aware of FancyZone Editor.

Context:
I happened to drag the editor window to my other monitor that has a
different dpi, and the text are blurry.

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

<!-- Provide a more detailed description of the PR, other things fixed
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
Manual.
2025-06-13 09:58:59 +08:00
Muhammad Danish
a2c9517bed Updates to WinGet publish script (#40002)
Few updates to the WinGet publish workflow action
- Use GitHub release event instead of manually making an API call to
GitHub API and then fetching the target release. The target release is
directly accessible via the event. The refactor is similar to the GitHub
action of
[microsoft/edit](https://github.com/microsoft/edit/blob/main/.github/workflows/winget.yml)
repo's workflow
- With the latest winget-create release, the preferred method for
providing the GitHub token in CI/CD environment is via the environment
variable `WINGET_CREATE_GITHUB_TOKEN`. Removed use of `--token` and
switched to environment variable. See https://aka.ms/winget-create-token
for details.
2025-06-12 15:48:05 -07:00
Jakub Marcowski
e9dbcbaebb cziplib: Update to 0.3.3 (#39604)
## Summary of the Pull Request

Updated the `zip` dependency to the latest stable version
([0.3.3](https://github.com/kuba--/zip/releases/tag/v0.3.3)).
2025-06-12 18:38:04 +08:00
Dustin L. Howett
6e0f1819d5 build: adjust for changes in the Az.Accounts module (#40001)
They made secure strings the default. Doing it this way maintains
compatibility with the version before and after the default changed.

This fixes symbol publication.
2025-06-12 09:53:40 +08:00
Kai Tao
3f834d7a6b Build: Change CLR projects to portable type pdb (#39992)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
Since now githubcopilot is easier to used in vscode, would like to set
up debug in vscode. Full type pdb can't be loaded in visual studio code
debugging
Change the debugging type to make it debuggable from vscode.
<img width="800" alt="image"
src="https://github.com/user-attachments/assets/86e46188-ad42-4fbf-b8af-8e0353b1c615"
/>
from:
e6049bb603/Documentation/diagnostics/portable_pdb.md

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] **Closes:** #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
Can debug settings in vscode.
2025-06-12 09:44:32 +08:00
Gordon Lam
e9a79f5d6f Add the detail section (#39991)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
The `verifyNoticeMdAgainstNugetPackages.ps1` script previously only
reported "Notice.md does not match NuGet list." without providing any
details about which packages were different, making it difficult to
debug discrepancies.

## Changes Made

This enhancement adds detailed difference reporting when NuGet packages
don't match:

- **Extracts current package list from NOTICE.md** using regex pattern
matching
- **Shows packages missing from NOTICE.md** (highlighted in red)
- **Shows packages in NOTICE.md but not in generated list** (highlighted
in yellow)
- **Provides summary statistics** with package counts
- **Maintains backward compatibility** - all existing functionality
preserved

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
If there is no difference, the same behaviour.

If there is difference, here is the example:

![image](https://github.com/user-attachments/assets/63dad21a-9db5-4d20-8a2c-ddd44ce1ee80)

## Edge Cases Handled

- **Missing NuGet section**: Shows warning and treats as empty package
list
- **Empty package lists**: Handles gracefully with appropriate counts
- **Matching lists**: No additional output (preserves existing behavior)

This enhancement significantly improves the debugging experience when
NuGet package verification fails by providing specific, actionable
information about which packages need attention.
2025-06-12 09:15:25 +08:00
Dave Rayment
a9c5117f61 Command Palette: fix sample links in README.md (#39983)
Fix links to sample folders.

<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
Two links were broken in the Command Palette readme because of a folder
name being "Exts" instead of "ext".

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] **Closes:** #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end user facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments
N/A

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

Manually confirmed the following links are correct:


https://github.com/microsoft/PowerToys/tree/main/src/modules/cmdpal/ext/SamplePagesExtension

https://github.com/microsoft/PowerToys/tree/main/src/modules/cmdpal/ext/ProcessMonitorExtension
2025-06-12 07:08:23 +08:00
rovercoder
b9aac70de5 Spell Checking Fixes (#39985)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
Fixes spelling issues and spell checker warnings
2025-06-11 16:32:38 +00:00
Jeremy Sinclair
55b9b52349 [Deps] Update .NET packages from 9.0.5 to 9.0.6 (#39986)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
Updates .NET 9 Runtime / Library packages to the latest 9.0.6 servicing
release for security fixes.
<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] **Closes:** #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments
This PR also updates the version of System.Text.Json to 9.0.6 in the
CmdPal extension template.
<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

---------

Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com>
2025-06-11 13:43:53 +08:00
SkandaBT
13a7ceba6d Update documentation (#39603)
<!-- Enter a brief description/summary of your PR here. What does it
fix/change/how was it tested (even manually, if necessary)? -->
## Summary of the Pull Request
This PR applies a series of grammar, punctuation, and stylistic updates
across the main README and GitHub templates to improve consistency,
clarity, and alignment with formatting guidelines.

### File-Level Changes

| Change | Details | Files |
| ------ | ------- | ----- |
| Updated README.md for grammar, punctuation, and phrasing consistency |
<ul><li>Inserted missing commas and adjusted articles for clearer
sentences</li><li>Standardized hyphenation and removed extra spaces
around slashes</li><li>Refined bullet list punctuation and corrected
pluralization (‘number of bugs’)</li></ul> | `README.md` |
| Refined pull request template text for clarity and uniform formatting
| <ul><li>Hyphenated “end-user-facing” and added Oxford comma in
checklist items</li><li>Adjusted phrasing in communication bullet for
parallel structure</li><li>Reworded placeholder comment for detailed PR
description</li></ul> | `.github/pull_request_template.md` |
| Standardized issue templates with grammar and placeholder improvements
| <ul><li>Clarified label descriptions and added missing commas in
placeholders</li><li>Unified question phrasing across bug, feature,
translation, and docs templates</li><li>Corrected capitalization and
refined instructions for consistency</li></ul> |
`.github/ISSUE_TEMPLATE/bug_report.yml`<br/>`.github/ISSUE_TEMPLATE/feature_request.yml`<br/>`.github/ISSUE_TEMPLATE/translation_issue.yml`<br/>`.github/ISSUE_TEMPLATE/documentation-issue.yml`
|

---
## PR Checklist

- [ ] **Closes:** #xxx
- [X] **Communication:** I've already discussed this with core
contributors. If the work hasn't been agreed, this work might be
rejected
- [X] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [X] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here:
https://github.com/MicrosoftDocs/windows-dev-docs/pull/5447

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

---------

Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com>
2025-06-10 19:17:38 +00:00
ruslanlap
e14ace4bfc 📚 Add Definition Plugin for PowerToys Run (#39881)
This PR introduces the **Definition** plugin—a new PowerToys Run
extension that allows you to quickly lookup word definitions, phonetics,
and synonyms without leaving your keyboard.

🔗 **Learn more**  
| Plugin | Author | Description |  
|:-------|:------:|:------------|  
| [Definition](https://github.com/ruslanlap/PowerToysRun-Definition) |
[ruslanlap](https://github.com/ruslanlap) | Lookup word definitions,
phonetics, and synonyms without leaving your keyboard. |

---

##  Features

- **Instant Definitions**  
  Get definitions in real-time via dictionaryapi.dev.
- **Pronunciation Audio**  
  Play phonetic audio directly from your results.
- **Phonetics & Synonyms**  
  View phonetic spelling, synonyms, and antonyms.
- **Usage Examples**  
  See real-world examples of how words are used.
- **Delayed Execution**  
  Shows loading indicator before fetching results.
- **Caching**  
In-memory cache for repeat lookups (up to 100 entries) to improve
performance.
- **Theme Awareness**  
  Automatically switches icons for light/dark mode.
- **Context Menu**  
Copy definitions, play pronunciation, open source URL, or search for
related words via right-click or keyboard shortcuts.
- **Cancellable Requests**  
  Automatically cancels previous requests when typing new queries.
- **Wiktionary Integration**  
Open any word in Wiktionary for additional information and translations.

---

Thank you for reviewing the **Definition** plugin! 📚  
I'm excited to help PowerToys Run users look up words faster than ever.
2025-06-10 19:14:50 +00:00
ruslanlap
549ce60483 🚀 Add SpeedTest Plugin for PowerToys Run to Third-Party plugin (#39880)
# 🚀 Add SpeedTest Plugin for PowerToys Run

This PR introduces the **SpeedTest** plugin—a new PowerToys Run
extension that lets you run internet speed tests instantly, without
opening a browser or separate application. Also was problem with
formating previous Plugin "Linear"

🔗 **Learn more**  
| Plugin | Author | Description |  
|:-------|:------:|:------------|  
| [SpeedTest](https://github.com/ruslanlap/PowerToysRun-SpeedTest) |
[ruslanlap](https://github.com/ruslanlap) | One-command internet speed
tests with real-time results, modern UI, and shareable links. |

---

##  Plugin Highlights

- **One-command tests**  
Run a full speed test (download, upload, ping, server) via PowerToys Run
(). and hit Enter! (or change to or any other keyword in the settings)
- **Modern, theme-aware UI**  
WPF-based window adapts automatically to light or dark Windows modes.
- **Live progress & shareable links**  
Watch your test run in real time and copy a result URL when it finishes.
- **All-local, privacy-first**  
No third-party tracking—uses the bundled Speedtest CLI for 100% local
execution.
- **Robust error handling**  
Friendly messages for network failures, permission issues, or unexpected
errors.
- **x64 & ARM64 builds**  
  Native-optimized releases for both CPU architectures.  
- **Open source & community-driven**  
Contributions, issues, and feature requests are welcome—let's make it
even better!

---

Thank you for reviewing the **SpeedTest** plugin! 🚀  
I'm excited to help PowerToys Run users check their internet speeds
faster than ever.
2025-06-10 19:08:15 +00:00
Clint Rutkas
51b6e41d93 PowerToys.MonacoPreviewHandler crashes when rendering UTF-8 BOM (#39381)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] **Closes:** https://github.com/microsoft/PowerToys/issues/35258
- [ ] **Communication:** I've discussed this with core contributors
already. If work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end user facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2025-06-10 22:13:25 +08:00
dependabot[bot]
0d29f6aca6 Bump check-spelling/check-spelling from 0.0.24 to 0.0.25 (#39572)
Bumps
[check-spelling/check-spelling](https://github.com/check-spelling/check-spelling)
from 0.0.24 to 0.0.25.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/check-spelling/check-spelling/releases">check-spelling/check-spelling's
releases</a>.</em></p>
<blockquote>
<h2>Release 0.0.25</h2>
<h2> Upgrading</h2>
<ul>
<li>🧪 Test first <em>on a branch</em> 🏷️ by changing your workflow
tags/references to this release</li>
<li>See 🐣 <strong>Breaking Changes</strong> for how to adapt your
workflow</li>
<li>See 🐛 <strong>Known Issues</strong> for known issues</li>
</ul>
<h2>🐣 Breaking Changes</h2>
<ul>
<li><a
href="https://github.com/check-spelling/check-spelling/wiki/Breaking-Change:-Code-Scanning-action-requires-a-Code-Scanning-Ruleset">Code
Scanning action requires a Code Scanning Ruleset</a>
If you use SARIF reporting, then instead of the workflow yielding an 
when it fails, it will rely on <a
href="https://github.com/apps/github-advanced-security"><strong>github-advanced-security</strong>
🤖</a> to report the failure. You will need to adjust your checks for
PRs.</li>
<li><a
href="https://github.com/check-spelling/check-spelling/wiki/Breaking-change:-Dropping-support-for-on:-schedule">Dropping
support for <code>on: schedule</code></a></li>
<li><a
href="https://github.com/check-spelling/check-spelling/wiki/Breaking-Change:-Dropping-support-for-%60whitelist.txt%60-and-%60advice.txt%60">Dropping
support for <code>whitelist.txt</code> and
<code>advice.txt</code></a></li>
<li><a
href="https://github.com/check-spelling/check-spelling/wiki/Breaking-Change%3A-Dropping-support-for-out-of-tree-project-files">Dropping
support for out of tree project files</a></li>
<li>Dependent actions are referenced by full sha instead of version --
if you're using <a
href="https://docs.github.com/en/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#allowing-select-actions-and-reusable-workflows-to-run">Allow
specified actions and reusable workflows</a>, you will need to add:
<ul>

<li><code>check-spelling/checkout-merge@46bad523dcb6368efab50ff2729c00443785abca</code>
(if you run <code>on: pull_request</code>/<code>on:
pull_requesrt_target</code> and use <code>with:</code>/<code>checkout:
true</code>)</li>
</ul>
</li>
</ul>
<h2> New Features</h2>
<ul>
<li><a
href="https://github.com/check-spelling/check-spelling/wiki/Feature:-Subrepos">Check
submodules</a> using <a
href="https://github.com/check-spelling/check-spelling/wiki/Configuration#submodules"><code>submodules</code></a></li>
<li>Provide instructions for when <code>only_check_changed_files</code>
finds unrecognized words (<a
href="https://api.github.com/repos/check-spelling/check-spelling/issues/86">#86</a>)</li>
<li>Support <a
href="https://github.com/check-spelling/check-spelling/wiki/Configuration/_edit#unknown_file_word_limit"><code>unknown_file_word_limit</code></a>
to limit the number of times a path in a filename is reported when using
<a
href="https://github.com/check-spelling/check-spelling/wiki/Configuration#check_file_names"><code>check_file_names</code></a></li>
<li>Suggest <a
href="https://github.com/check-spelling/check-spelling/wiki/Configuration#checkout"><code>checkout:
true</code></a> for new <a
href="https://github.com/check-spelling/check-spelling/wiki/Event-descriptions#single-line-file"><code>missing-checkout</code></a>
error case</li>
<li>Suggest ignoring files that trigger <a
href="https://github.com/check-spelling/check-spelling/wiki/Event-descriptions#single-line-file"><code>single-line-file</code></a></li>
</ul>
<h2>Dictionaries</h2>
<ul>
<li>Fix <a
href="https://github.com/check-spelling/check-spelling/wiki/Event-descriptions/#fallback-dictionary-not-found"><code>fallback-dictionary-not-found</code></a>
handling</li>
</ul>
<h3>Hunspell dictionaries</h3>
<ul>
<li>Fix support for <code>.dic</code>/<code>.aff</code> dictionaries by
installing hunspell as needed (<a
href="https://api.github.com/repos/check-spelling/check-spelling/issues/79">#79</a>
/ <a
href="https://api.github.com/repos/check-spelling/check-spelling/issues/90">#90</a>)</li>
<li>Ensure that <a
href="https://docs.check-spelling.dev/Feature:-Configurable-word-characters.html#spanish">Spanish</a>
works (a consumer is using this, so it should work reliably)</li>
</ul>
<h2>Fixes</h2>
<ul>
<li>macOS: Consistently use check-spelling dictionary instead of looking
at the system dictionary (<a
href="https://api.github.com/repos/check-spelling/check-spelling/issues/84">#84</a>)</li>
<li>Fix <code>check_for_newline_at_eof</code> for <code>allow.txt</code>
(<a
href="https://api.github.com/repos/check-spelling/check-spelling/issues/81">#81</a>)</li>
<li>Improve handling of <a
href="https://github.com/check-spelling/check-spelling/wiki/Configuration#ignored"><code>inputs.ignored</code></a>
events</li>
<li>Fix <a
href="https://github.com/check-spelling/check-spelling/wiki/Configuration:-Advanced#debug"><code>inputs.debug</code></a>
handling</li>
<li>Fix <strong>merge</strong> instructions order</li>
<li>Fix pattern for validating expect entries</li>
<li>Fix <a
href="https://github.com/check-spelling/check-spelling/wiki/Event-descriptions/#noisy-file-list"><code>noisy-file-list</code></a>
handling</li>
<li>Fix 504 handling for <a
href="https://github.com/check-spelling/check-spelling/wiki/Configuration#only_check_changed_files"><code>only_check_changed_files</code></a>
when unshallowing</li>
<li>Restore comment (<code>#</code>) support for expect files</li>
<li>Include last character in <a
href="https://github.com/check-spelling/check-spelling/wiki/Event-descriptions/#token-is-substring"><code>token-is-substring</code></a>
warning</li>
</ul>
<h2>Improvements</h2>
<ul>
<li>Line ending detection (<a
href="https://api.github.com/repos/check-spelling/check-spelling/issues/83">#83</a>)</li>
<li><a
href="https://www.fileformat.info/info/unicode/char/2019/index.htm">RSQM</a>
handling</li>
<li>Dictionary download times by skipping delays for <code>30x</code>
redirects</li>
<li>Excludes paths generation</li>
<li>Error handling of various components</li>
<li>Documentation links</li>
<li>GitHub error detection patterns for when check-spelling has
bugs</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="c635c2f3f7"><code>c635c2f</code></a>
action: Release v0.0.25</li>
<li><a
href="a72db74f75"><code>a72db74</code></a>
Yaml: Fix REPORT_MATCHING_YAML=1 handling</li>
<li><a
href="72391946fe"><code>7239194</code></a>
checkout: suppress default branch message</li>
<li><a
href="5b54b9ba2d"><code>5b54b9b</code></a>
CheckDictionary: Tolerate empty INPUT_IGNORE_PATTERN</li>
<li><a
href="eedc53a05c"><code>eedc53a</code></a>
test: Add coverage for non-alpha-in-dictionary</li>
<li><a
href="35e2bbcc5b"><code>35e2bbc</code></a>
unknown-words: Split error streams</li>
<li><a
href="b73164407b"><code>b731644</code></a>
unknown-words: Use encoding(UTF-8)</li>
<li><a
href="d6cb009abb"><code>d6cb009</code></a>
test: Expose dependency timing</li>
<li><a
href="eac6da34a8"><code>eac6da3</code></a>
test: Improve local testing</li>
<li><a
href="a9ff41ecae"><code>a9ff41e</code></a>
Suggest using <code>#</code> to suppress candidates</li>
<li>Additional commits viewable in <a
href="67debf5066...c635c2f3f7">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=check-spelling/check-spelling&package-manager=github_actions&previous-version=0.0.24&new-version=0.0.25)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-10 13:10:57 +08:00
Gordon Lam
edffb99073 Log WPF crash exceptions instead of showing Report problem UI (#39918)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
Problem
-------------
We've observed multiple bug reports related to crashes with the
following exceptions:
System.Runtime.InteropServices.COMException (0xD0000701)
System.Runtime.InteropServices.COMException (0x80263001)

The root cause of these crashes has been traced to the WPF framework,
specifically this line in WindowChromeWorker.cs:

3439f20fb8/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Shell/WindowChromeWorker.cs (L1005)

These crashes are not necessarily caused by PowerToys Run itself being
used, or even visible. However, users perceive them as Run-related
because the "Report problem UI" is triggered by our global exception
handler, surfacing the underlying WPF crash.

Fix
------------
This PR:
- Suppresses the launch of the "Report problem UI" for exceptions known
to be triggered by unstable platform conditions (such as COMExceptions
from WPF internals).
- Continues to log the exception to preserve diagnostic data.

This change ensures we:
- Avoid showing an UI when WPF framework itself is already having
problem to handling DWM composition changes.
2025-06-10 13:00:12 +08:00
110 changed files with 53322 additions and 540 deletions

View File

@@ -12,7 +12,7 @@ body:
attributes:
label: Microsoft PowerToys version
placeholder: X.XX.X
description: Hover over system tray icon or look at Settings
description: Hover over the system tray icon or look at Settings
validations:
required: true
@@ -20,7 +20,7 @@ body:
type: dropdown
attributes:
label: Installation method
description: How / Where was PowerToys installed from?
description: How / where was PowerToys installed from?
multiple: true
options:
- GitHub

View File

@@ -6,7 +6,7 @@ labels:
body:
- type: textarea
attributes:
label: Provide a description of requested docs changes
label: Describe the requested doc changes
placeholder: Briefly describe which document needs to be corrected and why.
validations:
required: true

View File

@@ -13,7 +13,7 @@ body:
- type: textarea
attributes:
label: Scenario when this would be used?
placeholder: What is the scenario this would be used? Why is this important to your workflow as a power user?
placeholder: What is the scenario this would be used in? Why is this important to your workflow as a power user?
validations:
required: true
- type: textarea

View File

@@ -14,7 +14,7 @@ body:
attributes:
label: Microsoft PowerToys version
placeholder: 0.70.0
description: Hover over system tray icon or look at Settings
description: Hover over the system tray icon or look at Settings
validations:
required: true
- type: dropdown
@@ -65,7 +65,7 @@ body:
- type: textarea
attributes:
label: ❌ Actual phrase(s)
placeholder: What is there? Please include a screenshot as that is extremely helpful.
placeholder: What is there? Please include a screenshot, as that is extremely helpful.
validations:
required: true
- type: textarea

View File

@@ -91,6 +91,7 @@ Hemmerlein
hlaueriksson
Horvalds
Howett
hotkidfamily
htcfreek
Huynh
Ionut
@@ -98,6 +99,7 @@ jamrobot
Jaswal
Jaylyn
jefflord
Jeremic
Jordi
jyuwono
kai
@@ -173,6 +175,7 @@ Tadele
talynone
Taras
TBM
Teutsch
tilovell
Triet
urnotdfs
@@ -221,6 +224,7 @@ openai
Quickime
regedit
roslyn
Skia
Spotify
Vanara
wangyi

View File

@@ -92,6 +92,7 @@
^\.github/actions/spell-check/
^\.gitmodules$
^\Q.github/workflows/spelling2.yml\E$
^\Q.pipelines/272MSSharedLibSN2048.snk\E$
^\Q.pipelines/ESRPSigning_core.json\E$
^\Qdoc/devdocs/localization.md\E$
^\Qsrc/common/ManagedCommon/ColorFormatHelper.cs\E$
@@ -120,7 +121,9 @@
^src/modules/MouseWithoutBorders/App/Form/.*\.resx$
^src/modules/MouseWithoutBorders/App/Helper/.*\.resx$
^src/modules/previewpane/UnitTests-MarkdownPreviewHandler/HelperFiles/MarkdownWithHTMLImageTag\.txt$
^src/modules/ZoomIt/ZoomIt/ZoomIt\.idc$
^src/Monaco/
^src/common/sysinternals/Eula/
^tools/Verification scripts/Check preview handler registration\.ps1$
ignore$
^src/modules/registrypreview/RegistryPreviewUILib/Controls/HexBox/.*$

View File

@@ -69,6 +69,7 @@ appwiz
APSTUDIO
AQS
ARandom
Arash
ARCHITEW
ARemapped
ARPINSTALLLOCATION
@@ -328,7 +329,6 @@ DEFAULTTONULL
DEFAULTTOPRIMARY
DEFERERASE
DEFPUSHBUTTON
DEFT
deinitialization
DELA
DELETEDKEYIMAGE
@@ -470,6 +470,7 @@ EXPCMDFLAGS
EXPCMDSTATE
explr
exppowertoys
exprtk
exptas
exsb
exstyle
@@ -670,7 +671,6 @@ IBeam
icf
ICONERROR
ICONLOCATION
idc
IDCANCEL
IDD
idk
@@ -681,7 +681,6 @@ IDR
IDXGI
ietf
IEXPLORE
iextn
IFACEMETHOD
IFACEMETHODIMP
IFile
@@ -720,7 +719,6 @@ INPUTMOUSE
INPUTSINK
INPUTTYPE
INSTALLDESKTOPSHORTCUT
INSTALLDIR
installdir
INSTALLFOLDER
INSTALLFOLDERTOBOOTSTRAPPERINSTALLFOLDER
@@ -756,6 +754,7 @@ iwr
jfif
jgeosdfsdsgmkedfgdfgdfgbkmhcgcflmi
jjw
JLO
jobject
jpe
jpnime
@@ -812,7 +811,6 @@ LMENU
lnks
LOADFROMFILE
LOBYTE
localappdata
LOCALDISPLAY
localpackage
LOCALSYSTEM
@@ -912,6 +910,7 @@ metafile
mfc
Mgmt
Microwaved
middleclickaction
midl
mii
mindaro
@@ -977,7 +976,6 @@ msrc
msstore
mst
msvcp
msvsmon
MTND
MULTIPLEUSE
multizone
@@ -1155,6 +1153,7 @@ PARTIALCONFIRMATIONDIALOGTITLE
PATCOPY
PATHMUSTEXIST
PATINVERT
partow
PATPAINT
pbc
pbi
@@ -1253,6 +1252,7 @@ prg
prgh
prgms
pri
primaryclickaction
PRINTCLIENT
printmanagement
prm
@@ -1284,7 +1284,6 @@ pstm
PStr
pstream
pstrm
pswd
PSYSTEM
psz
ptb
@@ -1429,6 +1428,7 @@ SDKDDK
sdns
searchterm
SEARCHUI
secondaryclickaction
SECONDARYDISPLAY
secpol
securestring
@@ -1476,16 +1476,12 @@ SHELLDLL
shellex
SHELLEXECUTEINFO
SHELLEXECUTEINFOW
SHELLEXTENSION
SHELLICONSIZE
SHELLNEWVALUE
SHFILEINFO
SHFILEOPSTRUCT
SHGDN
SHGDNF
SHGFI
SHGFIICON
SHGFILARGEICON
SHIL
shinfo
shlwapi
@@ -1517,9 +1513,9 @@ SICHINT
SIDs
siex
sigdn
Signedness
SIGNINGSCENARIO
signtool
Signtool
SINGLEKEY
sipolicy
SIZEBOX
@@ -1695,7 +1691,6 @@ TLayout
tlb
tlbimp
tlc
TGM
TNP
Toolhelp
toolkitconverters
@@ -1783,7 +1778,6 @@ uxtheme
vabdq
validmodulename
valuegenerator
VARENUM
variantassignment
vcamp
VCENTER
@@ -2003,11 +1997,6 @@ CLSCTXINPROCALL
IIDI
irow
lcid
OTHERUNZOOM
OTHERZOOM
PARENTCLOSING
PARENTOPENING
ppwsz
rguid
SCROLLCHILDREN
VARTYPE
VARTYPE

View File

@@ -243,4 +243,4 @@ Process Process
# ZoomIt menu items with accelerator keys
E&xit
St&yle
St&yle

View File

@@ -5,9 +5,9 @@
## PR Checklist
- [ ] **Closes:** #xxx
- [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
- [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end user facing strings can be localized
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries
@@ -16,7 +16,7 @@
- [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx
<!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here -->
<!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments
<!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well -->

View File

@@ -1,5 +1,4 @@
name: WinGet submission on release
# based off of https://github.com/nushell/nushell/blob/main/.github/workflows/winget-submission.yml
on:
workflow_dispatch:
@@ -9,23 +8,31 @@ on:
jobs:
winget:
name: Publish winget package
# winget-create is only supported on Windows
runs-on: windows-latest
# winget-create will read the following environment variable to access the GitHub token needed for submitting a PR
# See https://aka.ms/winget-create-token
env:
WINGET_CREATE_GITHUB_TOKEN: ${{ secrets.PT_WINGET }}
# Only submit stable releases
if: ${{ !github.event.release.prerelease }}
steps:
- name: Submit Microsoft.PowerToys package to Windows Package Manager Community Repository
run: |
# Get installer info from GitHub release event
$assets = '${{ toJSON(github.event.release.assets) }}' | ConvertFrom-Json
$x64UserInstallerUrl = $assets | Where-Object -Property name -match 'PowerToysUserSetup.*x64' | Select -ExpandProperty browser_download_url
$x64MachineInstallerUrl = $assets | Where-Object -Property name -match 'PowerToysSetup.*x64' | Select -ExpandProperty browser_download_url
$arm64UserInstallerUrl = $assets | Where-Object -Property name -match 'PowerToysUserSetup.*arm64' | Select -ExpandProperty browser_download_url
$arm64MachineInstallerUrl = $assets | Where-Object -Property name -match 'PowerToysSetup.*arm64' | Select -ExpandProperty browser_download_url
$packageVersion = (${{ toJSON(github.event.release.tag_name) }}).Trim('v')
$wingetPackage = "Microsoft.PowerToys"
$gitToken = "${{ secrets.PT_WINGET }}"
$github = Invoke-RestMethod -uri "https://api.github.com/repos/Microsoft/PowerToys/releases"
$targetRelease = $github | Where-Object -Property name -match 'Release'| Select -First 1
$installerUserX64Url = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysUserSetup.*x64' | Select -ExpandProperty browser_download_url
$installerMachineX64Url = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysSetup.*x64' | Select -ExpandProperty browser_download_url
$installerUserArmUrl = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysUserSetup.*arm64' | Select -ExpandProperty browser_download_url
$installerMachineArmUrl = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysSetup.*arm64' | Select -ExpandProperty browser_download_url
$ver = $targetRelease.tag_name -ireplace '^v'
# getting latest wingetcreate file
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
.\wingetcreate.exe update $wingetPackage -s -v $ver -u "$installerUserX64Url|user" "$installerMachineX64Url|machine" "$installerUserArmUrl|user" "$installerMachineArmUrl|machine" -t $gitToken
# Update package using wingetcreate
curl.exe -JLO https://aka.ms/wingetcreate/latest
.\wingetcreate.exe update Microsoft.PowerToys `
--version $packageVersion `
--urls "$x64UserInstallerUrl|user" "$x64MachineInstallerUrl|machine" "$arm64UserInstallerUrl|user" "$arm64MachineInstallerUrl|machine" `
--submit

View File

@@ -93,7 +93,7 @@ jobs:
steps:
- name: check-spelling
id: spelling
uses: check-spelling/check-spelling@67debf50669c7fc76fc8f5d7f996384535a72b77 # v0.0.24
uses: check-spelling/check-spelling@c635c2f3f714eec2fcf27b643a1919b9a811ef2e # v0.0.25
with:
config: .github/actions/spell-check
suppress_push_for_open_pull_request: ${{ github.actor != 'dependabot[bot]' && 1 }}
@@ -156,7 +156,7 @@ jobs:
if: (success() || failure()) && needs.spelling.outputs.followup && github.event_name == 'push'
steps:
- name: comment
uses: check-spelling/check-spelling@67debf50669c7fc76fc8f5d7f996384535a72b77 # v0.0.24
uses: check-spelling/check-spelling@c635c2f3f714eec2fcf27b643a1919b9a811ef2e # v0.0.25
with:
config: .github/actions/spell-check
checkout: true
@@ -175,7 +175,7 @@ jobs:
if: (success() || failure()) && needs.spelling.outputs.followup && contains(github.event_name, 'pull_request')
steps:
- name: comment
uses: check-spelling/check-spelling@67debf50669c7fc76fc8f5d7f996384535a72b77 # v0.0.24
uses: check-spelling/check-spelling@c635c2f3f714eec2fcf27b643a1919b9a811ef2e # v0.0.25
with:
config: .github/actions/spell-check
checkout: true
@@ -202,7 +202,7 @@ jobs:
cancel-in-progress: false
steps:
- name: apply spelling updates
uses: check-spelling/check-spelling@67debf50669c7fc76fc8f5d7f996384535a72b77 # v0.0.24
uses: check-spelling/check-spelling@c635c2f3f714eec2fcf27b643a1919b9a811ef2e # v0.0.25
with:
experimental_apply_changes_via_bot: ${{ github.repository_owner != 'microsoft' && 1 }}
checkout: true

View File

@@ -3,226 +3,227 @@
"UseMinimatch": false,
"SignBatches": [
{
"MatchedPath": [
"*.resources.dll",
"WinUI3Apps\\Assets\\Settings\\Scripts\\*.ps1",
"MatchedPath": [
"*.resources.dll",
"PowerToys.ActionRunner.exe",
"PowerToys.Update.exe",
"PowerToys.BackgroundActivatorDLL.dll",
"Notifications.dll",
"os-detection.dll",
"PowerToys.exe",
"PowerToys.FilePreviewCommon.dll",
"PowerToys.Interop.dll",
"Tools\\PowerToys.BugReportTool.exe",
"StylesReportTool\\PowerToys.StylesReportTool.exe",
"Telemetry.dll",
"PowerToys.ManagedTelemetry.dll",
"PowerToys.ManagedCommon.dll",
"PowerToys.Common.UI.dll",
"PowerToys.Settings.UI.Lib.dll",
"PowerToys.GPOWrapper.dll",
"PowerToys.GPOWrapperProjection.dll",
"PowerToys.AllExperiments.dll",
"WinUI3Apps\\Assets\\Settings\\Scripts\\*.ps1",
"PowerToys.AlwaysOnTop.exe",
"PowerToys.AlwaysOnTopModuleInterface.dll",
"PowerToys.ActionRunner.exe",
"PowerToys.Update.exe",
"PowerToys.BackgroundActivatorDLL.dll",
"Notifications.dll",
"os-detection.dll",
"PowerToys.exe",
"PowerToys.FilePreviewCommon.dll",
"PowerToys.Interop.dll",
"Tools\\PowerToys.BugReportTool.exe",
"StylesReportTool\\PowerToys.StylesReportTool.exe",
"Telemetry.dll",
"CalculatorEngineCommon.dll",
"PowerToys.ManagedTelemetry.dll",
"PowerToys.ManagedCommon.dll",
"PowerToys.Common.UI.dll",
"PowerToys.Settings.UI.Lib.dll",
"PowerToys.GPOWrapper.dll",
"PowerToys.GPOWrapperProjection.dll",
"PowerToys.AllExperiments.dll",
"PowerToys.CmdNotFoundModuleInterface.dll",
"PowerToys.CmdNotFound.dll",
"PowerToys.AlwaysOnTop.exe",
"PowerToys.AlwaysOnTopModuleInterface.dll",
"PowerToys.ColorPicker.dll",
"PowerToys.ColorPickerUI.dll",
"PowerToys.ColorPickerUI.exe",
"PowerToys.CmdNotFoundModuleInterface.dll",
"PowerToys.CmdNotFound.dll",
"PowerToys.CropAndLockModuleInterface.dll",
"PowerToys.CropAndLock.exe",
"PowerToys.ColorPicker.dll",
"PowerToys.ColorPickerUI.dll",
"PowerToys.ColorPickerUI.exe",
"PowerToys.PowerOCRModuleInterface.dll",
"PowerToys.PowerOCR.dll",
"PowerToys.PowerOCR.exe",
"PowerToys.CropAndLockModuleInterface.dll",
"PowerToys.CropAndLock.exe",
"PowerToys.AdvancedPasteModuleInterface.dll",
"WinUI3Apps\\PowerToys.AdvancedPaste.exe",
"WinUI3Apps\\PowerToys.AdvancedPaste.dll",
"PowerToys.PowerOCRModuleInterface.dll",
"PowerToys.PowerOCR.dll",
"PowerToys.PowerOCR.exe",
"PowerToys.AwakeModuleInterface.dll",
"PowerToys.Awake.exe",
"PowerToys.Awake.dll",
"PowerToys.AdvancedPasteModuleInterface.dll",
"WinUI3Apps\\PowerToys.AdvancedPaste.exe",
"WinUI3Apps\\PowerToys.AdvancedPaste.dll",
"fancyzones.dll",
"PowerToys.FancyZonesEditor.exe",
"PowerToys.FancyZonesEditor.dll",
"PowerToys.FancyZonesEditorCommon.dll",
"PowerToys.FancyZonesModuleInterface.dll",
"PowerToys.FancyZones.exe",
"PowerToys.AwakeModuleInterface.dll",
"PowerToys.Awake.exe",
"PowerToys.Awake.dll",
"PowerToys.GcodePreviewHandler.dll",
"PowerToys.GcodePreviewHandler.exe",
"PowerToys.GcodePreviewHandlerCpp.dll",
"PowerToys.GcodeThumbnailProvider.dll",
"PowerToys.GcodeThumbnailProvider.exe",
"PowerToys.GcodeThumbnailProviderCpp.dll",
"PowerToys.ManagedTelemetry.dll",
"PowerToys.MarkdownPreviewHandler.dll",
"PowerToys.MarkdownPreviewHandler.exe",
"PowerToys.MarkdownPreviewHandlerCpp.dll",
"PowerToys.MonacoPreviewHandler.dll",
"PowerToys.MonacoPreviewHandler.exe",
"PowerToys.MonacoPreviewHandlerCpp.dll",
"PowerToys.PdfPreviewHandler.dll",
"PowerToys.PdfPreviewHandler.exe",
"PowerToys.PdfPreviewHandlerCpp.dll",
"PowerToys.PdfThumbnailProvider.dll",
"PowerToys.PdfThumbnailProvider.exe",
"PowerToys.PdfThumbnailProviderCpp.dll",
"PowerToys.powerpreview.dll",
"PowerToys.PreviewHandlerCommon.dll",
"PowerToys.QoiPreviewHandler.dll",
"PowerToys.QoiPreviewHandler.exe",
"PowerToys.QoiPreviewHandlerCpp.dll",
"PowerToys.QoiThumbnailProvider.dll",
"PowerToys.QoiThumbnailProvider.exe",
"PowerToys.QoiThumbnailProviderCpp.dll",
"PowerToys.StlThumbnailProvider.dll",
"PowerToys.StlThumbnailProvider.exe",
"PowerToys.StlThumbnailProviderCpp.dll",
"PowerToys.SvgPreviewHandler.dll",
"PowerToys.SvgPreviewHandler.exe",
"PowerToys.SvgPreviewHandlerCpp.dll",
"PowerToys.SvgThumbnailProvider.dll",
"PowerToys.SvgThumbnailProvider.exe",
"PowerToys.SvgThumbnailProviderCpp.dll",
"fancyzones.dll",
"PowerToys.FancyZonesEditor.exe",
"PowerToys.FancyZonesEditor.dll",
"PowerToys.FancyZonesEditorCommon.dll",
"PowerToys.FancyZonesModuleInterface.dll",
"PowerToys.FancyZones.exe",
"WinUI3Apps\\PowerToys.HostsModuleInterface.dll",
"WinUI3Apps\\PowerToys.HostsUILib.dll",
"WinUI3Apps\\PowerToys.Hosts.dll",
"WinUI3Apps\\PowerToys.Hosts.exe",
"PowerToys.GcodePreviewHandler.dll",
"PowerToys.GcodePreviewHandler.exe",
"PowerToys.GcodePreviewHandlerCpp.dll",
"PowerToys.GcodeThumbnailProvider.dll",
"PowerToys.GcodeThumbnailProvider.exe",
"PowerToys.GcodeThumbnailProviderCpp.dll",
"PowerToys.ManagedTelemetry.dll",
"PowerToys.MarkdownPreviewHandler.dll",
"PowerToys.MarkdownPreviewHandler.exe",
"PowerToys.MarkdownPreviewHandlerCpp.dll",
"PowerToys.MonacoPreviewHandler.dll",
"PowerToys.MonacoPreviewHandler.exe",
"PowerToys.MonacoPreviewHandlerCpp.dll",
"PowerToys.PdfPreviewHandler.dll",
"PowerToys.PdfPreviewHandler.exe",
"PowerToys.PdfPreviewHandlerCpp.dll",
"PowerToys.PdfThumbnailProvider.dll",
"PowerToys.PdfThumbnailProvider.exe",
"PowerToys.PdfThumbnailProviderCpp.dll",
"PowerToys.powerpreview.dll",
"PowerToys.PreviewHandlerCommon.dll",
"PowerToys.QoiPreviewHandler.dll",
"PowerToys.QoiPreviewHandler.exe",
"PowerToys.QoiPreviewHandlerCpp.dll",
"PowerToys.QoiThumbnailProvider.dll",
"PowerToys.QoiThumbnailProvider.exe",
"PowerToys.QoiThumbnailProviderCpp.dll",
"PowerToys.StlThumbnailProvider.dll",
"PowerToys.StlThumbnailProvider.exe",
"PowerToys.StlThumbnailProviderCpp.dll",
"PowerToys.SvgPreviewHandler.dll",
"PowerToys.SvgPreviewHandler.exe",
"PowerToys.SvgPreviewHandlerCpp.dll",
"PowerToys.SvgThumbnailProvider.dll",
"PowerToys.SvgThumbnailProvider.exe",
"PowerToys.SvgThumbnailProviderCpp.dll",
"WinUI3Apps\\PowerToys.FileLocksmithLib.Interop.dll",
"WinUI3Apps\\PowerToys.FileLocksmithExt.dll",
"WinUI3Apps\\PowerToys.FileLocksmithUI.exe",
"WinUI3Apps\\PowerToys.FileLocksmithUI.dll",
"WinUI3Apps\\PowerToys.FileLocksmithContextMenu.dll",
"FileLocksmithContextMenuPackage.msix",
"WinUI3Apps\\PowerToys.HostsModuleInterface.dll",
"WinUI3Apps\\PowerToys.HostsUILib.dll",
"WinUI3Apps\\PowerToys.Hosts.dll",
"WinUI3Apps\\PowerToys.Hosts.exe",
"WinUI3Apps\\Peek.Common.dll",
"WinUI3Apps\\Peek.FilePreviewer.dll",
"WinUI3Apps\\Powertoys.Peek.UI.dll",
"WinUI3Apps\\Powertoys.Peek.UI.exe",
"WinUI3Apps\\Powertoys.Peek.dll",
"WinUI3Apps\\PowerToys.FileLocksmithLib.Interop.dll",
"WinUI3Apps\\PowerToys.FileLocksmithExt.dll",
"WinUI3Apps\\PowerToys.FileLocksmithUI.exe",
"WinUI3Apps\\PowerToys.FileLocksmithUI.dll",
"WinUI3Apps\\PowerToys.FileLocksmithContextMenu.dll",
"FileLocksmithContextMenuPackage.msix",
"WinUI3Apps\\PowerToys.EnvironmentVariablesModuleInterface.dll",
"WinUI3Apps\\PowerToys.EnvironmentVariablesUILib.dll",
"WinUI3Apps\\PowerToys.EnvironmentVariables.dll",
"WinUI3Apps\\PowerToys.EnvironmentVariables.exe",
"WinUI3Apps\\Peek.Common.dll",
"WinUI3Apps\\Peek.FilePreviewer.dll",
"WinUI3Apps\\Powertoys.Peek.UI.dll",
"WinUI3Apps\\Powertoys.Peek.UI.exe",
"WinUI3Apps\\Powertoys.Peek.dll",
"PowerToys.ImageResizer.exe",
"PowerToys.ImageResizer.dll",
"PowerToys.ImageResizerExt.dll",
"PowerToys.ImageResizerContextMenu.dll",
"ImageResizerContextMenuPackage.msix",
"WinUI3Apps\\PowerToys.EnvironmentVariablesModuleInterface.dll",
"WinUI3Apps\\PowerToys.EnvironmentVariablesUILib.dll",
"WinUI3Apps\\PowerToys.EnvironmentVariables.dll",
"WinUI3Apps\\PowerToys.EnvironmentVariables.exe",
"PowerToys.KeyboardManager.dll",
"KeyboardManagerEditor\\PowerToys.KeyboardManagerEditor.exe",
"KeyboardManagerEngine\\PowerToys.KeyboardManagerEngine.exe",
"PowerToys.KeyboardManagerEditorLibraryWrapper.dll",
"PowerToys.ImageResizer.exe",
"PowerToys.ImageResizer.dll",
"PowerToys.ImageResizerExt.dll",
"PowerToys.ImageResizerContextMenu.dll",
"ImageResizerContextMenuPackage.msix",
"PowerToys.Launcher.dll",
"PowerToys.PowerLauncher.dll",
"PowerToys.PowerLauncher.exe",
"PowerToys.PowerLauncher.Telemetry.dll",
"Wox.dll",
"Wox.Infrastructure.dll",
"Wox.Plugin.dll",
"RunPlugins\\Calculator\\Microsoft.PowerToys.Run.Plugin.Calculator.dll",
"RunPlugins\\Folder\\Microsoft.Plugin.Folder.dll",
"RunPlugins\\Indexer\\Microsoft.Plugin.Indexer.dll",
"RunPlugins\\OneNote\\Microsoft.PowerToys.Run.Plugin.OneNote.dll",
"RunPlugins\\History\\Microsoft.PowerToys.Run.Plugin.History.dll",
"RunPlugins\\PowerToys\\Microsoft.PowerToys.Run.Plugin.PowerToys.dll",
"RunPlugins\\Program\\Microsoft.Plugin.Program.dll",
"RunPlugins\\Registry\\Microsoft.PowerToys.Run.Plugin.Registry.dll",
"RunPlugins\\WindowsSettings\\Microsoft.PowerToys.Run.Plugin.WindowsSettings.dll",
"RunPlugins\\Shell\\Microsoft.Plugin.Shell.dll",
"RunPlugins\\Uri\\Microsoft.Plugin.Uri.dll",
"RunPlugins\\WindowWalker\\Microsoft.Plugin.WindowWalker.dll",
"RunPlugins\\UnitConverter\\Community.PowerToys.Run.Plugin.UnitConverter.dll",
"RunPlugins\\VSCodeWorkspaces\\Community.PowerToys.Run.Plugin.VSCodeWorkspaces.dll",
"RunPlugins\\Service\\Microsoft.PowerToys.Run.Plugin.Service.dll",
"RunPlugins\\System\\Microsoft.PowerToys.Run.Plugin.System.dll",
"RunPlugins\\TimeDate\\Microsoft.PowerToys.Run.Plugin.TimeDate.dll",
"RunPlugins\\ValueGenerator\\Community.PowerToys.Run.Plugin.ValueGenerator.dll",
"RunPlugins\\WebSearch\\Community.PowerToys.Run.Plugin.WebSearch.dll",
"RunPlugins\\WindowsTerminal\\Microsoft.PowerToys.Run.Plugin.WindowsTerminal.dll",
"WinUI3Apps\\PowerToys.MeasureToolModuleInterface.dll",
"WinUI3Apps\\PowerToys.MeasureToolCore.dll",
"WinUI3Apps\\PowerToys.MeasureToolUI.dll",
"WinUI3Apps\\PowerToys.MeasureToolUI.exe",
"PowerToys.KeyboardManager.dll",
"KeyboardManagerEditor\\PowerToys.KeyboardManagerEditor.exe",
"KeyboardManagerEngine\\PowerToys.KeyboardManagerEngine.exe",
"PowerToys.KeyboardManagerEditorLibraryWrapper.dll",
"PowerToys.FindMyMouse.dll",
"PowerToys.MouseHighlighter.dll",
"PowerToys.MouseJump.dll",
"PowerToys.MouseJump.Common.dll",
"PowerToys.MousePointerCrosshairs.dll",
"PowerToys.MouseJumpUI.dll",
"PowerToys.MouseJumpUI.exe",
"PowerToys.Launcher.dll",
"PowerToys.PowerLauncher.dll",
"PowerToys.PowerLauncher.exe",
"PowerToys.PowerLauncher.Telemetry.dll",
"Wox.dll",
"Wox.Infrastructure.dll",
"Wox.Plugin.dll",
"RunPlugins\\Calculator\\Microsoft.PowerToys.Run.Plugin.Calculator.dll",
"RunPlugins\\Folder\\Microsoft.Plugin.Folder.dll",
"RunPlugins\\Indexer\\Microsoft.Plugin.Indexer.dll",
"RunPlugins\\OneNote\\Microsoft.PowerToys.Run.Plugin.OneNote.dll",
"RunPlugins\\History\\Microsoft.PowerToys.Run.Plugin.History.dll",
"RunPlugins\\PowerToys\\Microsoft.PowerToys.Run.Plugin.PowerToys.dll",
"RunPlugins\\Program\\Microsoft.Plugin.Program.dll",
"RunPlugins\\Registry\\Microsoft.PowerToys.Run.Plugin.Registry.dll",
"RunPlugins\\WindowsSettings\\Microsoft.PowerToys.Run.Plugin.WindowsSettings.dll",
"RunPlugins\\Shell\\Microsoft.Plugin.Shell.dll",
"RunPlugins\\Uri\\Microsoft.Plugin.Uri.dll",
"RunPlugins\\WindowWalker\\Microsoft.Plugin.WindowWalker.dll",
"RunPlugins\\UnitConverter\\Community.PowerToys.Run.Plugin.UnitConverter.dll",
"RunPlugins\\VSCodeWorkspaces\\Community.PowerToys.Run.Plugin.VSCodeWorkspaces.dll",
"RunPlugins\\Service\\Microsoft.PowerToys.Run.Plugin.Service.dll",
"RunPlugins\\System\\Microsoft.PowerToys.Run.Plugin.System.dll",
"RunPlugins\\TimeDate\\Microsoft.PowerToys.Run.Plugin.TimeDate.dll",
"RunPlugins\\ValueGenerator\\Community.PowerToys.Run.Plugin.ValueGenerator.dll",
"RunPlugins\\WebSearch\\Community.PowerToys.Run.Plugin.WebSearch.dll",
"RunPlugins\\WindowsTerminal\\Microsoft.PowerToys.Run.Plugin.WindowsTerminal.dll",
"PowerToys.MouseWithoutBorders.dll",
"PowerToys.MouseWithoutBorders.exe",
"PowerToys.MouseWithoutBordersModuleInterface.dll",
"PowerToys.MouseWithoutBordersService.dll",
"PowerToys.MouseWithoutBordersService.exe",
"PowerToys.MouseWithoutBordersHelper.dll",
"PowerToys.MouseWithoutBordersHelper.exe",
"WinUI3Apps\\PowerToys.MeasureToolModuleInterface.dll",
"WinUI3Apps\\PowerToys.MeasureToolCore.dll",
"WinUI3Apps\\PowerToys.MeasureToolUI.dll",
"WinUI3Apps\\PowerToys.MeasureToolUI.exe",
"WinUI3Apps\\PowerToys.NewPlus.ShellExtension.dll",
"WinUI3Apps\\NewPlusPackage.msix",
"WinUI3Apps\\PowerToys.NewPlus.ShellExtension.win10.dll",
"PowerToys.FindMyMouse.dll",
"PowerToys.MouseHighlighter.dll",
"PowerToys.MouseJump.dll",
"PowerToys.MouseJump.Common.dll",
"PowerToys.MousePointerCrosshairs.dll",
"PowerToys.MouseJumpUI.dll",
"PowerToys.MouseJumpUI.exe",
"PowerAccent.Core.dll",
"PowerToys.PowerAccent.dll",
"PowerToys.PowerAccent.exe",
"PowerToys.PowerAccentModuleInterface.dll",
"PowerToys.PowerAccentKeyboardService.dll",
"PowerToys.MouseWithoutBorders.dll",
"PowerToys.MouseWithoutBorders.exe",
"PowerToys.MouseWithoutBordersModuleInterface.dll",
"PowerToys.MouseWithoutBordersService.dll",
"PowerToys.MouseWithoutBordersService.exe",
"PowerToys.MouseWithoutBordersHelper.dll",
"PowerToys.MouseWithoutBordersHelper.exe",
"WinUI3Apps\\PowerToys.PowerRenameExt.dll",
"WinUI3Apps\\PowerToys.PowerRename.exe",
"WinUI3Apps\\PowerToys.PowerRenameContextMenu.dll",
"WinUI3Apps\\PowerRenameContextMenuPackage.msix",
"WinUI3Apps\\PowerToys.NewPlus.ShellExtension.dll",
"WinUI3Apps\\NewPlusPackage.msix",
"WinUI3Apps\\PowerToys.NewPlus.ShellExtension.win10.dll",
"PowerToys.WorkspacesSnapshotTool.exe",
"PowerToys.WorkspacesLauncher.exe",
"PowerToys.WorkspacesWindowArranger.exe",
"PowerToys.WorkspacesEditor.exe",
"PowerToys.WorkspacesEditor.dll",
"PowerToys.WorkspacesLauncherUI.exe",
"PowerToys.WorkspacesLauncherUI.dll",
"PowerToys.WorkspacesModuleInterface.dll",
"PowerToys.WorkspacesCsharpLibrary.dll",
"PowerAccent.Core.dll",
"PowerToys.PowerAccent.dll",
"PowerToys.PowerAccent.exe",
"PowerToys.PowerAccentModuleInterface.dll",
"PowerToys.PowerAccentKeyboardService.dll",
"WinUI3Apps\\PowerToys.RegistryPreviewExt.dll",
"WinUI3Apps\\PowerToys.RegistryPreviewUILib.dll",
"WinUI3Apps\\PowerToys.RegistryPreview.dll",
"WinUI3Apps\\PowerToys.RegistryPreview.exe",
"WinUI3Apps\\PowerToys.PowerRenameExt.dll",
"WinUI3Apps\\PowerToys.PowerRename.exe",
"WinUI3Apps\\PowerToys.PowerRenameContextMenu.dll",
"WinUI3Apps\\PowerRenameContextMenuPackage.msix",
"PowerToys.ShortcutGuide.exe",
"PowerToys.ShortcutGuideModuleInterface.dll",
"PowerToys.WorkspacesSnapshotTool.exe",
"PowerToys.WorkspacesLauncher.exe",
"PowerToys.WorkspacesWindowArranger.exe",
"PowerToys.WorkspacesEditor.exe",
"PowerToys.WorkspacesEditor.dll",
"PowerToys.WorkspacesLauncherUI.exe",
"PowerToys.WorkspacesLauncherUI.dll",
"PowerToys.WorkspacesModuleInterface.dll",
"PowerToys.WorkspacesCsharpLibrary.dll",
"PowerToys.ZoomIt.exe",
"PowerToys.ZoomItModuleInterface.dll",
"PowerToys.ZoomItSettingsInterop.dll",
"WinUI3Apps\\PowerToys.RegistryPreviewExt.dll",
"WinUI3Apps\\PowerToys.RegistryPreviewUILib.dll",
"WinUI3Apps\\PowerToys.RegistryPreview.dll",
"WinUI3Apps\\PowerToys.RegistryPreview.exe",
"WinUI3Apps\\PowerToys.Settings.dll",
"WinUI3Apps\\PowerToys.Settings.exe",
"PowerToys.ShortcutGuide.exe",
"PowerToys.ShortcutGuideModuleInterface.dll",
"PowerToys.CmdPalModuleInterface.dll",
"CmdPalKeyboardService.dll",
"*Microsoft.CmdPal.UI_*.msix"
],
"PowerToys.ZoomIt.exe",
"PowerToys.ZoomItModuleInterface.dll",
"PowerToys.ZoomItSettingsInterop.dll",
"WinUI3Apps\\PowerToys.Settings.dll",
"WinUI3Apps\\PowerToys.Settings.exe",
"PowerToys.CmdPalModuleInterface.dll",
"CmdPalKeyboardService.dll",
"*Microsoft.CmdPal.UI_*.msix"
],
"SigningInfo": {
"Operations": [
{

View File

@@ -41,6 +41,9 @@ Write-Output ""
Write-Output "Restoring dotnet tools..."
dotnet tool restore --disable-parallel --no-cache
# Use Regex syntax
$PathExcludes = "(\\obj\\)|(\\bin\\)|(\\x64\\)|(\\Generated Files\\PowerRenameXAML\\)|(\\RegistryPreviewUILib\\Controls\\HexBox\\)"
if (-not $Passive)
{
# Look for unstaged changed files by default
@@ -87,7 +90,7 @@ if (-not $Passive)
}
Write-Output "Running Git Diff: $gitDiffCommand"
$files = Invoke-Expression $gitDiffCommand | Select-String -Pattern "\.xaml$"
$files = Invoke-Expression $gitDiffCommand | Select-String -Pattern "\.xaml$" | Where-Object { $_ -notmatch $PathExcludes }
if (-not $Passive -and -not $Main -and -not $Unstaged -and -not $Staged -and -not $LastCommit)
{
@@ -107,7 +110,7 @@ if (-not $Passive)
else
{
Write-Output "Checking all files (passively)"
$files = Get-ChildItem -Path "$PSScriptRoot\..\src\*.xaml" -Recurse | Select-Object -ExpandProperty FullName | Where-Object { $_ -notmatch "(\\obj\\)|(\\bin\\)|(\\x64\\)|(\\Generated Files\\PowerRenameXAML\\)" }
$files = Get-ChildItem -Path "$PSScriptRoot\..\src\*.xaml" -Recurse | Select-Object -ExpandProperty FullName | Where-Object { $_ -notmatch $PathExcludes }
if ($files.count -gt 0)
{

View File

@@ -397,6 +397,7 @@ jobs:
**\UnitTests-CommonLib.dll
**\PowerRenameUnitTests.dll
**\UnitTests-FancyZones.dll
**\\WorkspacesLibUnitTests.dll
!**\obj\**
- pwsh: |-

View File

@@ -68,7 +68,7 @@ jobs:
pwsh: true
ScriptType: InlineScript
Inline: |-
$AzToken = (Get-AzAccessToken -ResourceUrl api://30471ccf-0966-45b9-a979-065dbedb24c1).Token
$AzToken = (Get-AzAccessToken -AsSecureString -ResourceUrl api://30471ccf-0966-45b9-a979-065dbedb24c1).Token | ConvertFrom-SecureString -AsPlainText
Write-Host "##vso[task.setvariable variable=SymbolAccessToken;issecret=true]$AzToken"

View File

@@ -72,9 +72,57 @@ $returnList = [System.Collections.Generic.HashSet[string]]($totalList) -join "`r
Write-Host $returnList
# Extract the current package list from NOTICE.md
$noticePattern = "## NuGet Packages used by PowerToys\s*((?:\r?\n- .+)+)"
$noticeMatch = [regex]::Match($noticeFile, $noticePattern)
if ($noticeMatch.Success) {
$currentNoticePackageList = $noticeMatch.Groups[1].Value.Trim()
} else {
Write-Warning "Warning: Could not find 'NuGet Packages used by PowerToys' section in NOTICE.md"
$currentNoticePackageList = ""
}
if (!$noticeFile.Trim().EndsWith($returnList.Trim()))
{
Write-Host -ForegroundColor Red "Notice.md does not match NuGet list."
# Show detailed differences
$generatedPackages = $returnList -split "`r`n|`n" | Where-Object { $_.Trim() -ne "" } | Sort-Object
$noticePackages = $currentNoticePackageList -split "`r`n|`n" | Where-Object { $_.Trim() -ne "" } | ForEach-Object { $_.Trim() } | Sort-Object
Write-Host ""
Write-Host -ForegroundColor Cyan "=== DETAILED DIFFERENCE ANALYSIS ==="
Write-Host ""
# Find packages in proj file list but not in NOTICE.md
$missingFromNotice = $generatedPackages | Where-Object { $noticePackages -notcontains $_ }
if ($missingFromNotice.Count -gt 0) {
Write-Host -ForegroundColor Red "MissingFromNotice:"
foreach ($pkg in $missingFromNotice) {
Write-Host -ForegroundColor Red " $pkg"
}
Write-Host ""
}
# Find packages in NOTICE.md but not in proj file list
$extraInNotice = $noticePackages | Where-Object { $generatedPackages -notcontains $_ }
if ($extraInNotice.Count -gt 0) {
Write-Host -ForegroundColor Yellow "ExtraInNotice:"
foreach ($pkg in $extraInNotice) {
Write-Host -ForegroundColor Yellow " $pkg"
}
Write-Host ""
}
# Show counts for summary
Write-Host -ForegroundColor Cyan "Summary:"
Write-Host " Proj file list has $($generatedPackages.Count) packages"
Write-Host " NOTICE.md has $($noticePackages.Count) packages"
Write-Host " MissingFromNotice: $($missingFromNotice.Count) packages"
Write-Host " ExtraInNotice: $($extraInNotice.Count) packages"
Write-Host ""
exit 1
}

View File

@@ -21,7 +21,7 @@ Connor was the creator of Workspaces and helped create Command Palette (PowerToy
### [@damienleroy](https://github.com/damienleroy) - [Damien Leroy](https://www.linkedin.com/in/Damien-Leroy-b2734416a/)
Damien has helped out by developing and contributing the Quick Accent utility.
### [@daverayment ](https://github.com/daverayment) - [David Rayment](https://www.linkedin.com/in/david-rayment-168b5251/)
### [@daverayment](https://github.com/daverayment) - [David Rayment](https://www.linkedin.com/in/david-rayment-168b5251/)
Dave has helped improve the experience inside of Peek by adding in new features and fixing bugs.
### [@davidegiacometti](https://github.com/davidegiacometti) - [Davide Giacometti](https://www.linkedin.com/in/davidegiacometti/)
@@ -184,7 +184,6 @@ ZoomIt source code was originally implemented by [Sysinternals](https://sysinter
- [@nguyen-dows](https://github.com/nguyen-dows) - Christopher Nguyen - Product Manager
- [@craigloewen-msft](https://github.com/craigloewen-msft) - Craig Loewen - Product Manager
- [@niels9001](https://github.com/niels9001/) - Niels Laute - Product Manager
- [@zhiwei-ms](https://github.com/zhiwei-ms) - Zhiwei Yu - Product Manager
- [@dhowett](https://github.com/dhowett) - Dustin Howett - Dev lead
- [@yeelam-gordon](https://github.com/yeelam-gordon) - Gordon Lam - Dev lead
- [@jamrobot](https://github.com/jamrobot) - Jerry Xu - Dev lead
@@ -205,6 +204,7 @@ ZoomIt source code was originally implemented by [Sysinternals](https://sysinter
- [@chatasweetie](https://github.com/chatasweetie) - Jessica Earley-Cha - Dev
- [@MichaelJolley](https://github.com/MichaelJolley) - Michael Jolley - Dev
- [@Jaylyn-Barbee](https://github.com/Jaylyn-Barbee) - Jaylyn Barbee - Dev
- [@zateutsch](https://github.com/zateutsch) - Zach Teutsch - Dev
- [@crutkas](https://github.com/crutkas/) - Clint Rutkas - Overhead
## Former PowerToys core team members

View File

@@ -31,22 +31,22 @@
<!-- Including MessagePack to force version, since it's used by StreamJsonRpc but contains vulnerabilities. After StreamJsonRpc updates the version of MessagePack, we can upgrade StreamJsonRpc instead. -->
<PackageVersion Include="MessagePack" Version="3.1.3" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="9.0.5" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="9.0.6" />
<!-- Including Microsoft.Bcl.AsyncInterfaces to force version, since it's used by Microsoft.SemanticKernel. -->
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.5" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.6" />
<PackageVersion Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="3.1.16" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.5" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.5" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.5" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.5" />
<PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="9.0.5" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.6" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.6" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.6" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.6" />
<PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="9.0.6" />
<PackageVersion Include="Microsoft.SemanticKernel" Version="1.15.0" />
<PackageVersion Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.2" />
<PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.2903.40" />
<!-- Package Microsoft.Win32.SystemEvents added as a hack for being able to exclude the runtime assets so they don't conflict with 8.0.1. This is a dependency of System.Drawing.Common but the 8.0.1 version wasn't published to nuget. -->
<PackageVersion Include="Microsoft.Win32.SystemEvents" Version="9.0.5" />
<PackageVersion Include="Microsoft.Win32.SystemEvents" Version="9.0.6" />
<PackageVersion Include="Microsoft.WindowsPackageManager.ComInterop" Version="1.10.340" />
<PackageVersion Include="Microsoft.Windows.Compatibility" Version="9.0.5" />
<PackageVersion Include="Microsoft.Windows.Compatibility" Version="9.0.6" />
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.2.46-beta" />
<!-- CsWinRT version needs to be set to have a WinRT.Runtime.dll at the same version contained inside the NET SDK we're currently building on CI. -->
<!--
@@ -69,31 +69,33 @@
<PackageVersion Include="ReverseMarkdown" Version="4.1.0" />
<PackageVersion Include="ScipBe.Common.Office.OneNote" Version="3.0.1" />
<PackageVersion Include="SharpCompress" Version="0.37.2" />
<!-- Don't update SkiaSharp.Views.WinUI to version 3.* branch as this brakes the HexBox control in Registry Preview. -->
<PackageVersion Include="SkiaSharp.Views.WinUI" Version="2.88.9" />
<PackageVersion Include="StreamJsonRpc" Version="2.21.69" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<!-- Package System.CodeDom added as a hack for being able to exclude the runtime assets so they don't conflict with 8.0.1. This is a dependency of System.Management but the 8.0.1 version wasn't published to nuget. -->
<PackageVersion Include="System.CodeDom" Version="9.0.5" />
<PackageVersion Include="System.CodeDom" Version="9.0.6" />
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageVersion Include="System.ComponentModel.Composition" Version="9.0.5" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="9.0.5" />
<PackageVersion Include="System.Data.OleDb" Version="9.0.5" />
<PackageVersion Include="System.ComponentModel.Composition" Version="9.0.6" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="9.0.6" />
<PackageVersion Include="System.Data.OleDb" Version="9.0.6" />
<!-- Package System.Data.SqlClient added to force it as a dependency of Microsoft.Windows.Compatibility to the latest version available at this time. -->
<PackageVersion Include="System.Data.SqlClient" Version="4.8.6" />
<PackageVersion Include="System.Data.SqlClient" Version="4.9.0" />
<!-- Package System.Diagnostics.EventLog added as a hack for being able to exclude the runtime assets so they don't conflict with 8.0.1. This is a dependency of System.Data.OleDb but the 8.0.1 version wasn't published to nuget. -->
<PackageVersion Include="System.Diagnostics.EventLog" Version="9.0.5" />
<PackageVersion Include="System.Diagnostics.EventLog" Version="9.0.6" />
<!-- Package System.Diagnostics.PerformanceCounter added as a hack for being able to exclude the runtime assets so they don't conflict with 8.0.11. -->
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="9.0.5" />
<PackageVersion Include="System.Drawing.Common" Version="9.0.5" />
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="9.0.6" />
<PackageVersion Include="System.Drawing.Common" Version="9.0.6" />
<PackageVersion Include="System.IO.Abstractions" Version="22.0.13" />
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="22.0.13" />
<PackageVersion Include="System.Management" Version="9.0.5" />
<PackageVersion Include="System.Management" Version="9.0.6" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
<PackageVersion Include="System.Reactive" Version="6.0.1" />
<PackageVersion Include="System.Runtime.Caching" Version="9.0.5" />
<PackageVersion Include="System.ServiceProcess.ServiceController" Version="9.0.5" />
<PackageVersion Include="System.Text.Encoding.CodePages" Version="9.0.5" />
<PackageVersion Include="System.Text.Json" Version="9.0.5" />
<PackageVersion Include="System.Runtime.Caching" Version="9.0.6" />
<PackageVersion Include="System.ServiceProcess.ServiceController" Version="9.0.6" />
<PackageVersion Include="System.Text.Encoding.CodePages" Version="9.0.6" />
<PackageVersion Include="System.Text.Json" Version="9.0.6" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageVersion Include="UnicodeInformation" Version="2.6.0" />
<PackageVersion Include="UnitsNet" Version="5.56.0" />

151
NOTICE.md
View File

@@ -79,6 +79,43 @@ For more information, please refer to <http://unlicense.org/>
### Calculator
#### exprtk
We use the exprtk library (exprtk.hpp) to evaluate mathematical expressions.
**Source**: [https://github.com/ArashPartow/exprtk](https://github.com/ArashPartow/exprtk)
```
MIT License
Copyright (c) 1999-2024 Arash Partow
https://www.partow.net/programming/exprtk/index.html
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.
```
## Utility: PowerToys Run Built-in Extensions
### Calculator
#### Mages
We use the Mages NuGet package for calculating the result of expression.
@@ -807,30 +844,25 @@ DEALINGS IN THE SOFTWARE.
**Source**: https://github.com/kuba--/zip
This is free and unencumbered software released into the public domain.
All Rights Reserved.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
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:
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
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 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.
For more information, please refer to <http://unlicense.org/>
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.
## Utility: Measure tool
@@ -1395,6 +1427,37 @@ EXHIBIT A -Mozilla Public License.
## Utility: Registry Preview
### HexBox.WinUI
We use HexBox.WinUI to show a preview of binary values.
**Source**: https://github.com/hotkidfamily/HexBox.WinUI
```
MIT License
Copyright (c) 2019 Filip Jeremic
Copyright (c) 2024~2025 hotkidfamily@gmail.com
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.
```
### Monaco Editor
**Source**: https://github.com/Microsoft/monaco-editor
@@ -1425,6 +1488,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
## NuGet Packages used by PowerToys
- AdaptiveCards.ObjectModel.WinUI3 2.0.0-beta
@@ -1453,22 +1517,22 @@ SOFTWARE.
- Mages 3.0.0
- Markdig.Signed 0.34.0
- MessagePack 3.1.3
- Microsoft.Bcl.AsyncInterfaces 9.0.5
- Microsoft.Bcl.AsyncInterfaces 9.0.6
- Microsoft.CodeAnalysis.NetAnalyzers 9.0.0
- Microsoft.Data.Sqlite 9.0.5
- Microsoft.Data.Sqlite 9.0.6
- Microsoft.Diagnostics.Tracing.TraceEvent 3.1.16
- Microsoft.DotNet.ILCompiler (A)
- Microsoft.Extensions.DependencyInjection 9.0.5
- Microsoft.Extensions.Hosting 9.0.5
- Microsoft.Extensions.Hosting.WindowsServices 9.0.5
- Microsoft.Extensions.Logging 9.0.5
- Microsoft.Extensions.Logging.Abstractions 9.0.5
- Microsoft.Extensions.DependencyInjection 9.0.6
- Microsoft.Extensions.Hosting 9.0.6
- Microsoft.Extensions.Hosting.WindowsServices 9.0.6
- Microsoft.Extensions.Logging 9.0.6
- Microsoft.Extensions.Logging.Abstractions 9.0.6
- Microsoft.NET.ILLink.Tasks (A)
- Microsoft.SemanticKernel 1.15.0
- Microsoft.Toolkit.Uwp.Notifications 7.1.2
- Microsoft.Web.WebView2 1.0.2903.40
- Microsoft.Win32.SystemEvents 9.0.5
- Microsoft.Windows.Compatibility 9.0.5
- Microsoft.Win32.SystemEvents 9.0.6
- Microsoft.Windows.Compatibility 9.0.6
- Microsoft.Windows.CsWin32 0.2.46-beta
- Microsoft.Windows.CsWinRT 2.2.0
- Microsoft.Windows.SDK.BuildTools 10.0.22621.2428
@@ -1485,27 +1549,28 @@ SOFTWARE.
- ReverseMarkdown 4.1.0
- ScipBe.Common.Office.OneNote 3.0.1
- SharpCompress 0.37.2
- SkiaSharp.Views.WinUI 2.88.9
- StreamJsonRpc 2.21.69
- StyleCop.Analyzers 1.2.0-beta.556
- System.CodeDom 9.0.5
- System.CodeDom 9.0.6
- System.CommandLine 2.0.0-beta4.22272.1
- System.ComponentModel.Composition 9.0.5
- System.Configuration.ConfigurationManager 9.0.5
- System.Data.OleDb 9.0.5
- System.Data.SqlClient 4.8.6
- System.Diagnostics.EventLog 9.0.5
- System.Diagnostics.PerformanceCounter 9.0.5
- System.Drawing.Common 9.0.5
- System.ComponentModel.Composition 9.0.6
- System.Configuration.ConfigurationManager 9.0.6
- System.Data.OleDb 9.0.6
- System.Data.SqlClient 4.9.0
- System.Diagnostics.EventLog 9.0.6
- System.Diagnostics.PerformanceCounter 9.0.6
- System.Drawing.Common 9.0.6
- System.IO.Abstractions 22.0.13
- System.IO.Abstractions.TestingHelpers 22.0.13
- System.Management 9.0.5
- System.Management 9.0.6
- System.Net.Http 4.3.4
- System.Private.Uri 4.3.2
- System.Reactive 6.0.1
- System.Runtime.Caching 9.0.5
- System.ServiceProcess.ServiceController 9.0.5
- System.Text.Encoding.CodePages 9.0.5
- System.Text.Json 9.0.5
- System.Runtime.Caching 9.0.6
- System.ServiceProcess.ServiceController 9.0.6
- System.Text.Encoding.CodePages 9.0.6
- System.Text.Json 9.0.6
- System.Text.RegularExpressions 4.3.1
- UnicodeInformation 2.6.0
- UnitsNet 5.56.0

View File

@@ -604,6 +604,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WindowProperties", "WindowP
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorkspacesLib", "src\modules\Workspaces\WorkspacesLib\WorkspacesLib.vcxproj", "{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorkspacesLibUnitTests", "src\modules\Workspaces\WorkspacesLib.UnitTests\WorkspacesLibUnitTests.vcxproj", "{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}"
ProjectSection(ProjectDependencies) = postProject
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332} = {B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WorkspacesLauncherUI", "src\modules\Workspaces\WorkspacesLauncherUI\WorkspacesLauncherUI.csproj", "{9C53CC25-0623-4569-95BC-B05410675EE3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorkspacesModuleInterface", "src\modules\Workspaces\WorkspacesModuleInterface\WorkspacesModuleInterface.vcxproj", "{45285DF2-9742-4ECA-9AC9-58951FC26489}"
@@ -712,6 +717,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CmdPalKeyboardService", "sr
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRename.FuzzingTest", "src\modules\powerrename\PowerRename.FuzzingTest\PowerRename.FuzzingTest.vcxproj", "{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalculatorEngineCommon", "src\common\CalculatorEngineCommon\CalculatorEngineCommon.vcxproj", "{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
@@ -2200,6 +2207,14 @@ Global
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Release|ARM64.Build.0 = Release|ARM64
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Release|x64.ActiveCfg = Release|x64
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Release|x64.Build.0 = Release|x64
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Debug|ARM64.ActiveCfg = Debug|ARM64
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Debug|ARM64.Build.0 = Debug|ARM64
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Debug|x64.ActiveCfg = Debug|x64
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Debug|x64.Build.0 = Debug|x64
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Release|ARM64.ActiveCfg = Release|ARM64
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Release|ARM64.Build.0 = Release|ARM64
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Release|x64.ActiveCfg = Release|x64
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Release|x64.Build.0 = Release|x64
{9C53CC25-0623-4569-95BC-B05410675EE3}.Debug|ARM64.ActiveCfg = Debug|ARM64
{9C53CC25-0623-4569-95BC-B05410675EE3}.Debug|ARM64.Build.0 = Debug|ARM64
{9C53CC25-0623-4569-95BC-B05410675EE3}.Debug|x64.ActiveCfg = Debug|x64
@@ -2584,6 +2599,14 @@ Global
{64B88F02-CD88-4ED8-9624-989A800230F9}.Release|ARM64.Build.0 = Release|ARM64
{64B88F02-CD88-4ED8-9624-989A800230F9}.Release|x64.ActiveCfg = Release|x64
{64B88F02-CD88-4ED8-9624-989A800230F9}.Release|x64.Build.0 = Release|x64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|ARM64.ActiveCfg = Debug|ARM64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|ARM64.Build.0 = Debug|ARM64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|x64.ActiveCfg = Debug|x64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|x64.Build.0 = Debug|x64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|ARM64.ActiveCfg = Release|ARM64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|ARM64.Build.0 = Release|ARM64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|x64.ActiveCfg = Release|x64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|x64.Build.0 = Release|x64
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Debug|ARM64.ActiveCfg = Debug|ARM64
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Debug|ARM64.Build.0 = Debug|ARM64
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Debug|x64.ActiveCfg = Debug|x64
@@ -2598,14 +2621,14 @@ Global
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Release|ARM64.ActiveCfg = Release|ARM64
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Release|x64.ActiveCfg = Release|x64
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Release|x64.Build.0 = Release|x64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|ARM64.ActiveCfg = Debug|ARM64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|ARM64.Build.0 = Debug|ARM64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|x64.ActiveCfg = Debug|x64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|x64.Build.0 = Debug|x64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|ARM64.ActiveCfg = Release|ARM64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|ARM64.Build.0 = Release|ARM64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|x64.ActiveCfg = Release|x64
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|x64.Build.0 = Release|x64
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Debug|ARM64.ActiveCfg = Debug|ARM64
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Debug|ARM64.Build.0 = Debug|ARM64
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Debug|x64.ActiveCfg = Debug|x64
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Debug|x64.Build.0 = Debug|x64
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Release|ARM64.ActiveCfg = Release|ARM64
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Release|ARM64.Build.0 = Release|ARM64
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Release|x64.ActiveCfg = Release|x64
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -2825,6 +2848,7 @@ Global
{BE126CBB-AE12-406A-9837-A05ACFCA57A7} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
{14CB58B7-D280-4A7A-95DE-4B2DF14EA000} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
{9C53CC25-0623-4569-95BC-B05410675EE3} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
{45285DF2-9742-4ECA-9AC9-58951FC26489} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
{3D63307B-9D27-44FD-B033-B26F39245B85} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
@@ -2879,6 +2903,7 @@ Global
{0217E86E-3476-9946-DE8E-9D200CEBD47A} = {D1D6BC88-09AE-4FB4-AD24-5DED46A791DD}
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2} = {3846508C-77EB-4034-A702-F8BB263C4F79}
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3}
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6} = {1AFB6476-670D-4E80-A464-657E01DFF482}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}

View File

@@ -53,10 +53,10 @@ This is our preferred method.
### Via Microsoft Store
Install from the [Microsoft Store's PowerToys page][microsoft-store-link]. You must be using the [new Microsoft Store](https://blogs.windows.com/windowsExperience/2021/06/24/building-a-new-open-microsoft-store-on-windows-11/) which is available for both Windows 11 and Windows 10.
Install from the [Microsoft Store's PowerToys page][microsoft-store-link]. You must be using the [new Microsoft Store](https://blogs.windows.com/windowsExperience/2021/06/24/building-a-new-open-microsoft-store-on-windows-11/), which is available for both Windows 11 and Windows 10.
### Via WinGet
Download PowerToys from [WinGet][winget-link]. Updating PowerToys via winget will respect current PowerToys installation scope. To install PowerToys, run the following command from the command line / PowerShell:
Download PowerToys from [WinGet][winget-link]. Updating PowerToys via winget will respect the current PowerToys installation scope. To install PowerToys, run the following command from the command line / PowerShell:
#### User scope installer [default]
```powershell
@@ -79,7 +79,7 @@ There is a collection of [third-party plugins](./doc/thirdPartyRunPlugins.md) cr
## Contributing
This project welcomes contributions of all types. Besides coding features / bug fixes, other ways to assist include spec writing, design, documentation, and finding bugs. We are excited to work with the power user community to build a set of tools for helping you get the most out of Windows.
This project welcomes contributions of all types. Besides coding features / bug fixes, other ways to assist include spec writing, design, documentation, and finding bugs. We are excited to work with the power user community to build a set of tools for helping you get the most out of Windows.
We ask that **before you start work on a feature that you would like to contribute**, please read our [Contributor's Guide](CONTRIBUTING.md). We would be happy to work with you to figure out the best approach, provide guidance and mentorship throughout feature development, and help avoid any wasted or duplicate effort.
@@ -99,7 +99,7 @@ In this release, we focused on new features, stability, and automation.
**✨Highlights**
- We focused on greatly improving Command Palette's performance and fixing a large amount of bugs. Some new features we've added are:
- We focused on greatly improving the Command Palette's performance and fixing a large number of bugs. Some new features we've added are:
- Added the ability for Command Palette to search any file using a fallback command.
- Added the ability to make the Command Palette global hotkey a low-level keyboard hook.
- Added open URL fallback command for the WebSearch extension, enabling users to directly open URLs in the browser from Command Palette.
@@ -117,17 +117,17 @@ In this release, we focused on new features, stability, and automation.
### Command Not Found
- Updated the WinGet Command Not Found script to only enable the experimental features if they actually exist.
- Updated the WinGet Command Not Found script to only enable the experimental features if they exist.
### Command Palette
- Updated bug template to include Command Palette module.
- Fixed an issue where the toast window was not scaled for DPI, causing layout issues under display scaling.
- Fixed an issue where Up/Down keyboard navigation didn't move selection when caret was at position 0, and add continuous navigation like PT Run v1. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fixed an issue where Up/Down keyboard navigation didn't move selection when the caret was at position 0, and added continuous navigation like PT Run v1. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Updated the Time and Date extension code to simplify it and improve clarity.
- Fixed an issue where capitalization in the command causes failure when trying to go to the mouse pointer, resolved by adjusting the command to lowercase.
- Added open URL fallback command for the WebSearch extension, enabling users to directly open URLs in the browser from Command Palette. Thanks [@htcfreek](https://github.com/htcfreek)!
- Added setting to enable/disable system tray icon in CmdPal and align terminology with Windows 11. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Added open URL fallback command for the WebSearch extension, enabling users to directly open URLs in the browser from the Command Palette. Thanks [@htcfreek](https://github.com/htcfreek)!
- Added setting to enable/disable system tray icon in CmdPal and aligned terminology with Windows 11. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fixed an alias update issue by removing the old alias when a new one is set.
- Resolved GitHub casing conflict by migrating Exts and exts into a new ext directory, ensuring consistent structure across platforms and preventing path fragmentation.
- Fix an issue where the 'Create New Extension' command generated empty file names.
@@ -155,9 +155,9 @@ In this release, we focused on new features, stability, and automation.
- Refactored CmdPal classes to improve JSON serialization and introduced new serialization contexts for better performance and maintainability.
- Added support for ahead-of-time (AoT) compilation.
- Added retry mechanism for CmdPal launch.
- Removed some unused files from CmdPal.Common to simplify codebase and facilitate marking it as AoT-compatible.
- Removed some unused files from CmdPal.Common to simplify the codebase and facilitate marking it as AoT-compatible.
- Fixed a bug where a race condition in the update of SearchText caused the cursor in the input box to automatically jump to the end of the line, ensuring SearchText is only updated after it has actually been changed.
- Added support for searching any file in fallback command.
- Added support for searching any file in the fallback command.
- Cleaned up AoT-related code to prevent duplicate operations during testing.
- Reduced CmdPal load time by parallelizing extension startup and adding timeouts to prevent misbehaving extensions from blocking others.
- Enhanced UI behavior by dismissing the details pane when the list gets emptied, avoiding inconsistent visual states.
@@ -179,7 +179,7 @@ In this release, we focused on new features, stability, and automation.
### Keyboard Manager
- Fixed an issue where a modifier key, when set without specifying left or right, would get stuck due to incorrect key handling, by tracking the pressed keys and sending the correct key accordingly. Thanks [@mantaionut](https://github.com/mantaionut)!
- Fixed an issue where a modifier key, when set without specifying left or right, would get stuck due to incorrect key handling by tracking the pressed keys and sending the correct key accordingly. Thanks [@mantaionut](https://github.com/mantaionut)!
### PowerRename
@@ -187,7 +187,7 @@ In this release, we focused on new features, stability, and automation.
### PowerToys Run
- Added support for custom formats in the "Time and Date" plugin and improves error messages for invalid input formats. Thanks [@htcfreek](https://github.com/htcfreek)!
- Added support for custom formats in the "Time and Date" plugin and improved error messages for invalid input formats. Thanks [@htcfreek](https://github.com/htcfreek)!
- Fix two crashes: one for WFT on very early dates and another for calculating the week of the month on very late dates (e.g., 31.12.9999), and reorder UI settings. Thanks [@htcfreek](https://github.com/htcfreek)!
- Fix an issue where capitalization in the command causes failure when trying to go to the mouse pointer, resolved by adjusting the command to lowercase.
- Added version details to plugin error messages for 'Loading error' and 'Init error'. Thanks [@htcfreek](https://github.com/htcfreek)!
@@ -254,7 +254,7 @@ For [v0.92][github-next-release-work], we'll work on the items below:
- New UI Automation tests
- Working on installer upgrades
- Upgrading Keyboard Manager's editor UI
- Stability / bug fixes
- Stability, bug fixes
## PowerToys Community
@@ -266,7 +266,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][oss-conduct
## Privacy Statement
The application logs basic diagnostic data (telemetry). For more information on privacy and what we collect, see our [PowerToys Data and Privacy documentation](https://aka.ms/powertoys-data-and-privacy-documentation).
The application logs basic diagnostic data (telemetry). For more privacy information and what we collect, see our [PowerToys Data and Privacy documentation](https://aka.ms/powertoys-data-and-privacy-documentation).
[oss-CLA]: https://cla.opensource.microsoft.com
[oss-conduct-code]: CODE_OF_CONDUCT.md

2
deps/cziplib vendored

View File

@@ -46,6 +46,7 @@ Contact the developers of a plugin directly for assistance with a specific plugi
| [QuickNotes](https://github.com/ruslanlap/CommunityPowerToysRunPlugin-QuickNotes) | [ruslanlap](https://github.com/ruslanlap) | Create, manage, and search notes directly from PowerToys Run. |
| [Weather](https://github.com/ruslanlap/PowerToysRun-Weather) | [ruslanlap](https://github.com/ruslanlap) | Get real-time weather information directly from PowerToys Run. |
| [Pomodoro](https://github.com/ruslanlap/PowerToysRun-Pomodoro) | [ruslanlap](https://github.com/ruslanlap) | Manage Pomodoro productivity sessions directly from PowerToys Run. |
| [Definition](https://github.com/ruslanlap/PowerToysRun-Definition) | [ruslanlap](https://github.com/ruslanlap) | Lookup word definitions, phonetics, and synonyms directly in PowerToys Run. |
## Extending software plugins
@@ -68,4 +69,5 @@ Below are community created plugins that target a website or software. They are
| [Bilibili](https://github.com/Whuihuan/PowerToysRun-Bilibili) | [Whuihuan](https://github.com/Whuihuan) | Use AVID or BVID to parse and jump to Bilibili |
| [YubicoOauthOTP](https://github.com/dlnilsson/Community.PowerToys.Run.Plugin.YubicoOauthOTP) | [dlnilsson](https://github.com/dlnilsson) | Display generated codes from OATH accounts stored on the YubiKey in powerToys Run |
| [Firefox Bookmark](https://github.com/8LWXpg/PowerToysRun-FirefoxBookmark) | [8LWXpg](https://github.com/8LWXpg) | Open bookmarks in Firefox based browser |
[Linear](https://github.com/vednig/powertoys-linear) | [vednig](https://github.com/vednig) | Create Linear Issues directly from Powertoys Run |
| [Linear](https://github.com/vednig/powertoys-linear) | [vednig](https://github.com/vednig) | Create Linear Issues directly from Powertoys Run |
| [SpeedTest](https://github.com/ruslanlap/PowerToysRun-SpeedTest) | [ruslanlap](https://github.com/ruslanlap) | One-command internet speed tests with real-time results, modern UI, and shareable links. |

View File

@@ -22,7 +22,7 @@
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DebugSymbols>true</DebugSymbols>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
@@ -43,4 +43,4 @@
<Analyzer Remove="@(Analyzer)" Condition="%(Analyzer.NuGetPackageId) == 'Microsoft.Windows.CsWinRT'" />
</ItemGroup>
</Target>
</Project>
</Project>

View File

@@ -76,3 +76,47 @@ using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "MVVMTK0049:Using [INotifyPropertyChanged] is not AOT compatible for WinRT", Justification = "Updated MVVM toolkit package introduced this.", Scope = "namespaceanddescendants", Target = "Peek.FilePreviewer")]
[assembly: SuppressMessage("CommunityToolkit.Mvvm.SourceGenerators.INotifyPropertyChangedGenerator", "MVVMTK0049:Using [INotifyPropertyChanged] is not AOT compatible for WinRT", Justification = "Updated MVVM toolkit package introduced this.", Scope = "type", Target = "~T:Peek.UI.Views.TitleBar")]
[assembly: SuppressMessage("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "MVVMTK0049:Using [INotifyPropertyChanged] is not AOT compatible for WinRT", Justification = "Updated MVVM toolkit package introduced this.", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib")]
// HexBox control in RegistryPreviewUILib (We decided to copy the original code and not fix all theses problems for easier updating.)
[assembly: SuppressMessage("Design", "CA1001:Types that own disposable fields should be disposable", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("Globalization", "CA1305:Specify IFormatProvider", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("Naming", "CA1720:Identifiers should not contain type names", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("Performance", "CA1805:Do not initialize unnecessarily", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1623:Property summary documentation should match accessors", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1642:Constructor summary documentation should begin with standard text", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1648:<inheritdoc> has been used on an element that doesn't inherit from a base class or implement an interface.", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1500:Braces for multi-line statements should not share line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1502:Element should not be on a single line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1505:Opening braces should not be followed by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1507:Code should not contain multiple blank lines in a row", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1508:Closing braces should not be preceded by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1509:Opening braces should not be preceded by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1512:Single-line comments should not be followed by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1513:Closing brace should be followed by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1514:Element documentation header should be preceded by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1515:Single-line comment should be preceded by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1516:Elements should be separated by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1119:Statement should not use unnecessary parenthesis", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:Fields should be private", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1407:Arithmetic expressions should declare precedence", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1413:Use trailing comma in multi-line initializers", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1306:Field names should begin with lower-case letter", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1312:Variable names should begin with lower-case letter", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1313:Parameter names should begin with lower-case letter", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1200:Using directives should be placed correctly", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1108:Block statements should not contain embedded comments", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1116:Split parameters should start on line after declaration", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1117:Parameters should be on same line or separate lines", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1129:Do not use default value type constructor", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1000:Keywords should be spaced correctly", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1003:Symbols should be spaced correctly", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1005:Single line comments should begin with single space", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1024:Colons Should Be Spaced Correctly", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1025:Code should not contain multiple whitespace in a row", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1028:Code should not contain trailing whitespace", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
[assembly: SuppressMessage("Usage", "CsWinRT1028:Class is not marked partial", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]

View File

@@ -0,0 +1,24 @@
#include "pch.h"
#include "Calculator.h"
#include "Calculator.g.cpp"
#include "ExprtkEvaluator.h"
namespace winrt::CalculatorEngineCommon::implementation
{
Calculator::Calculator(winrt::Windows::Foundation::Collections::IPropertySet const& constants)
{
for (auto const& pair : constants)
{
auto key = pair.Key();
auto value = winrt::unbox_value<double>(pair.Value());
m_constants.emplace(winrt::to_string(key), value);
}
}
hstring Calculator::EvaluateExpression(hstring const& expression)
{
auto result = ExprtkCalculator::internal::EvaluateExpression(winrt::to_string(expression), m_constants);
return hstring(result);
}
}

View File

@@ -0,0 +1,25 @@
#pragma once
#include "Calculator.g.h"
namespace winrt::CalculatorEngineCommon::implementation
{
struct Calculator : CalculatorT<Calculator>
{
Calculator() = default;
Calculator(winrt::Windows::Foundation::Collections::IPropertySet const& constants);
winrt::hstring EvaluateExpression(winrt::hstring const& expression);
private:
std::unordered_map<std::string, double> m_constants;
};
}
namespace winrt::CalculatorEngineCommon::factory_implementation
{
struct Calculator : CalculatorT<Calculator, implementation::Calculator>
{
};
}

View File

@@ -0,0 +1,10 @@
namespace CalculatorEngineCommon
{
[default_interface]
runtimeclass Calculator
{
Calculator();
Calculator(Windows.Foundation.Collections.IPropertySet constants);
String EvaluateExpression(String expression);
}
}

View File

@@ -0,0 +1,3 @@
EXPORTS
DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE

View File

@@ -0,0 +1,186 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
<ProjectGuid>{2cf78cf7-8feb-4be1-9591-55fa25b48fc6}</ProjectGuid>
<ProjectName>CalculatorEngineCommon</ProjectName>
<RootNamespace>CalculatorEngineCommon</RootNamespace>
<AppxPackage>false</AppxPackage>
</PropertyGroup>
<!-- BEGIN common.build.pre.props -->
<PropertyGroup Label="Configuration">
<EnableHybridCRT>true</EnableHybridCRT>
<UseCrtSDKReferenceStaticWarning Condition="'$(EnableHybridCRT)'=='true'">false</UseCrtSDKReferenceStaticWarning>
</PropertyGroup>
<!-- END common.build.pre.props -->
<!-- BEGIN cppwinrt.build.pre.props -->
<PropertyGroup Label="Globals">
<CppWinRTEnabled>true</CppWinRTEnabled>
<CppWinRTOptimized>true</CppWinRTOptimized>
<DefaultLanguage>en-US</DefaultLanguage>
<MinimumVisualStudioVersion>17.0</MinimumVisualStudioVersion>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
</PropertyGroup>
<PropertyGroup>
<MinimalCoreWin>true</MinimalCoreWin>
<AppContainerApplication>true</AppContainerApplication>
<WindowsStoreApp>true</WindowsStoreApp>
<ApplicationType>Windows Store</ApplicationType>
<UseCrtSDKReference Condition="'$(EnableHybridCRT)'=='true'">false</UseCrtSDKReference>
<!-- The SDK reference breaks the Hybrid CRT -->
</PropertyGroup>
<PropertyGroup>
<!-- We have to use the Desktop platform for Hybrid CRT to work. -->
<_VC_Target_Library_Platform>Desktop</_VC_Target_Library_Platform>
<_NoWinAPIFamilyApp>true</_NoWinAPIFamilyApp>
</PropertyGroup>
<!-- END cppwinrt.build.pre.props -->
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="PropertySheet.props" />
</ImportGroup>
<PropertyGroup>
<TargetName>CalculatorEngineCommon</TargetName>
<OutDir>..\..\..\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<WarningLevel>Level4</WarningLevel>
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
<PreprocessorDefinitions>_WINRT_DLL;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
<ModuleDefinitionFile>CalculatorEngineCommon.def</ModuleDefinitionFile>
<AdditionalDependencies>Shell32.lib;user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="ExprtkEvaluator.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="exprtk.hpp" />
<ClInclude Include="Calculator.h">
<DependentUpon>Calculator.idl</DependentUpon>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ExprtkEvaluator.cpp">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Calculator.cpp">
<DependentUpon>Calculator.idl</DependentUpon>
</ClCompile>
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
</ItemGroup>
<ItemGroup>
<Midl Include="Calculator.idl" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="CalculatorEngineCommon.def" />
</ItemGroup>
<ItemGroup>
<None Include="PropertySheet.props" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="..\..\..\deps\spdlog.props" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<ItemGroup>
<ProjectReference Include="..\version\version.vcxproj">
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
</ProjectReference>
</ItemGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
<!-- BEGIN common.build.post.props -->
<!--
The Hybrid CRT model statically links the runtime and STL and dynamically
links the UCRT instead of the VC++ CRT. The UCRT ships with Windows.
WinAppSDK asserts that this is "supported according to the CRT maintainer."
This must come before Microsoft.Cpp.targets because it manipulates ClCompile.RuntimeLibrary.
-->
<ItemDefinitionGroup Condition="'$(EnableHybridCRT)'=='true' and '$(Configuration)'=='Debug'">
<ClCompile>
<!-- We use MultiThreadedDebug, rather than MultiThreadedDebugDLL, to avoid DLL dependencies on VCRUNTIME140d.dll and MSVCP140d.dll. -->
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<!-- Link statically against the runtime and STL, but link dynamically against the CRT by ignoring the static CRT
lib and instead linking against the Universal CRT DLL import library. This "hybrid" linking mechanism is
supported according to the CRT maintainer. Dynamic linking against the CRT makes the binaries a bit smaller
than they would otherwise be if the CRT, runtime, and STL were all statically linked in. -->
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries);libucrtd.lib</IgnoreSpecificDefaultLibraries>
<AdditionalOptions>%(AdditionalOptions) /defaultlib:ucrtd.lib</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(EnableHybridCRT)'=='true' and ('$(Configuration)'=='Release' or '$(Configuration)'=='AuditMode')">
<ClCompile>
<!-- We use MultiThreaded, rather than MultiThreadedDLL, to avoid DLL dependencies on VCRUNTIME140.dll and MSVCP140.dll. -->
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<!-- Link statically against the runtime and STL, but link dynamically against the CRT by ignoring the static CRT
lib and instead linking against the Universal CRT DLL import library. This "hybrid" linking mechanism is
supported according to the CRT maintainer. Dynamic linking against the CRT makes the binaries a bit smaller
than they would otherwise be if the CRT, runtime, and STL were all statically linked in. -->
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries);libucrt.lib</IgnoreSpecificDefaultLibraries>
<AdditionalOptions>%(AdditionalOptions) /defaultlib:ucrt.lib</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<!-- END common.build.post.props -->
</Project>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Resources">
<UniqueIdentifier>accd3aa8-1ba0-4223-9bbe-0c431709210b</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{926ab91d-31b4-48c3-b9a4-e681349f27f0}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp" />
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<Midl Include="Calculator.idl" />
</ItemGroup>
<ItemGroup>
<None Include="CalculatorEngineCommon.def" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<None Include="PropertySheet.props" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,50 @@
#include "ExprtkEvaluator.h"
#include "exprtk.hpp"
#include <iomanip>
#include <iostream>
#include <sstream>
namespace ExprtkCalculator::internal
{
std::wstring ToWStringFullPrecision(double value)
{
std::wostringstream oss;
oss << std::fixed << std::setprecision(15) << value;
return oss.str();
}
std::wstring EvaluateExpression(
const std::string& expressionText,
const std::unordered_map<std::string, double>& constants)
{
exprtk::symbol_table<double> symbol_table;
for (auto const& [name, value] : constants)
{
symbol_table.add_constant(name, value);
}
exprtk::expression<double> expression;
expression.register_symbol_table(symbol_table);
exprtk::parser<double> parser;
// Enable all base functions and arithmetic operators
parser.settings().enable_all_base_functions(); // Enable all base functions like sin, cos, log, etc.
parser.settings().enable_all_arithmetic_ops(); // Enable all arithmetic operators like +, -, *, /, etc.
// Disable all control structures and assignment operators to ensure only expressions are evaluated
parser.settings().disable_all_control_structures(); // Disable control structures like if, for, while, etc.
parser.settings().disable_all_assignment_ops(); // Disable assignment operators like =, +=, -=, etc.
// Disabled for now, but can be enabled later for enhanced functionality
parser.settings().disable_all_logic_ops(); // Disable logical operators like &&, ||, !, etc.
parser.settings().disable_all_inequality_ops(); // Disable inequality operators like <, >, <=, >=, !=, etc.
if (!parser.compile(expressionText, expression))
return L"NaN";
return ToWStringFullPrecision(expression.value());
}
}

View File

@@ -0,0 +1,10 @@
#pragma once
#include <string>
#include <unordered_map>
namespace ExprtkCalculator::internal
{
std::wstring EvaluateExpression(
const std::string& expression,
const std::unordered_map<std::string, double>& constants);
}

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<!--
To customize common C++/WinRT project properties:
* right-click the project node
* expand the Common Properties item
* select the C++/WinRT property page
For more advanced scenarios, and complete documentation, please see:
https://github.com/Microsoft/cppwinrt/tree/master/nuget
-->
<PropertyGroup />
<ItemDefinitionGroup />
</Project>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
</packages>

View File

@@ -0,0 +1 @@
#include "pch.h"

View File

@@ -0,0 +1,4 @@
#pragma once
#include <unknwn.h>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Foundation.Collections.h>

View File

@@ -0,0 +1,29 @@
# C++/WinRT CalculatorEngine Project Overview
This project wraps the exprtk expression parsing library with a C++/WinRT component,
making advanced mathematical evaluation capabilities available to Windows applications.
It is designed specifically to provide calculation support for the CmdPal calculator extension.
## Using exprtk
This project uses [exprtk](https://github.com/ArashPartow/exprtk) as the
expression parsing and evaluation engine.
How to use exprtk in this project:
- The exprtk header file (`exprtk.hpp`) is included in the project source.
- You can use exprtk to parse and evaluate mathematical expressions in your
C++ code. For example:
```cpp
#include "exprtk.hpp"
exprtk::expression<double> expression;
exprtk::parser<double> parser;
std::string formula = "3 + 4 * 2";
parser.compile(formula, expression);
double result = expression.value();
```
How to update exprtk:
1. Download the latest `exprtk.hpp` from the [official repository](https://github.com/ArashPartow/exprtk).
2. Replace the existing `exprtk.hpp` file in the project with the new version.
3. Rebuild the project to ensure compatibility and take advantage of any updates.

View File

@@ -20,7 +20,7 @@
"AreaPath": "OS\\Windows Client and Services\\WinPD\\DFX-Developer Fundamentals and Experiences\\DEFT\\SALT",
"IterationPath": "OS\\Future"
},
"jobNotificationEmail": "leilzh@microsoft.com",
"jobNotificationEmail": "PowerToys@microsoft.com",
"skip": false,
"rebootAfterSetup": false,
"oneFuzzJobs": [

View File

@@ -143,7 +143,7 @@
"AreaPath": "OS\\Windows Client and Services\\WinPD\\DFX-Developer Fundamentals and Experiences\\DEFT\\SALT",
"IterationPath": "OS\\Future"
},
"jobNotificationEmail": "mengyuanchen@microsoft.com",
"jobNotificationEmail": "PowerToys@microsoft.com",
"skip": false,
"rebootAfterSetup": false,
"oneFuzzJobs": [

View File

@@ -51,7 +51,7 @@
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">System</dpiAwareness>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
</windowsSettings>
</application>

View File

@@ -0,0 +1,239 @@
#include "pch.h"
#include <filesystem> // Add this line
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace WorkspacesLibUnitTests
{
TEST_CLASS(AppUtilsTests)
{
public:
TEST_METHOD(GetCurrentFolder_ReturnsNonEmptyPath)
{
// Act
const std::wstring& result = Utils::Apps::GetCurrentFolder();
// Assert
Assert::IsFalse(result.empty());
Assert::IsTrue(std::filesystem::exists(result));
}
TEST_METHOD(GetCurrentFolderUpper_ReturnsUppercasePath)
{
// Act
const std::wstring& currentFolder = Utils::Apps::GetCurrentFolder();
const std::wstring& currentFolderUpper = Utils::Apps::GetCurrentFolderUpper();
// Assert
Assert::IsFalse(currentFolderUpper.empty());
Assert::AreEqual(currentFolder.length(), currentFolderUpper.length());
// Verify it's actually uppercase
std::wstring expectedUpper = currentFolder;
std::transform(expectedUpper.begin(), expectedUpper.end(), expectedUpper.begin(), towupper);
Assert::AreEqual(expectedUpper, currentFolderUpper);
}
TEST_METHOD(GetCurrentFolder_ConsistentResults)
{
// Act
const std::wstring& result1 = Utils::Apps::GetCurrentFolder();
const std::wstring& result2 = Utils::Apps::GetCurrentFolder();
// Assert
Assert::AreEqual(result1, result2);
}
TEST_METHOD(GetCurrentFolderUpper_ConsistentResults)
{
// Act
const std::wstring& result1 = Utils::Apps::GetCurrentFolderUpper();
const std::wstring& result2 = Utils::Apps::GetCurrentFolderUpper();
// Assert
Assert::AreEqual(result1, result2);
}
TEST_METHOD(AppData_IsEdge_EdgePath_ReturnsTrue)
{
// Arrange
Utils::Apps::AppData appData;
appData.installPath = L"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe";
// Act
bool result = appData.IsEdge();
// Assert
Assert::IsTrue(result);
}
TEST_METHOD(AppData_IsEdge_NonEdgePath_ReturnsFalse)
{
// Arrange
Utils::Apps::AppData appData;
appData.installPath = L"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
// Act
bool result = appData.IsEdge();
// Assert
Assert::IsFalse(result);
}
TEST_METHOD(AppData_IsEdge_EmptyPath_ReturnsFalse)
{
// Arrange
Utils::Apps::AppData appData;
appData.installPath = L"";
// Act
bool result = appData.IsEdge();
// Assert
Assert::IsFalse(result);
}
TEST_METHOD(AppData_IsChrome_ChromePath_ReturnsTrue)
{
// Arrange
Utils::Apps::AppData appData;
appData.installPath = L"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
// Act
bool result = appData.IsChrome();
// Assert
Assert::IsTrue(result);
}
TEST_METHOD(AppData_IsChrome_NonChromePath_ReturnsFalse)
{
// Arrange
Utils::Apps::AppData appData;
appData.installPath = L"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe";
// Act
bool result = appData.IsChrome();
// Assert
Assert::IsFalse(result);
}
TEST_METHOD(AppData_IsChrome_EmptyPath_ReturnsFalse)
{
// Arrange
Utils::Apps::AppData appData;
appData.installPath = L"";
// Act
bool result = appData.IsChrome();
// Assert
Assert::IsFalse(result);
}
TEST_METHOD(AppData_IsSteamGame_SteamProtocol_ReturnsTrue)
{
// Arrange
Utils::Apps::AppData appData;
appData.protocolPath = L"steam://run/123456";
// Act
bool result = appData.IsSteamGame();
// Assert
Assert::IsTrue(result);
}
TEST_METHOD(AppData_IsSteamGame_NonSteamProtocol_ReturnsFalse)
{
// Arrange
Utils::Apps::AppData appData;
appData.protocolPath = L"https://example.com";
// Act
bool result = appData.IsSteamGame();
// Assert
Assert::IsFalse(result);
}
TEST_METHOD(AppData_IsSteamGame_EmptyProtocol_ReturnsFalse)
{
// Arrange
Utils::Apps::AppData appData;
appData.protocolPath = L"";
// Act
bool result = appData.IsSteamGame();
// Assert
Assert::IsFalse(result);
}
TEST_METHOD(AppData_IsSteamGame_PartialSteamString_ReturnsFalse)
{
// Arrange
Utils::Apps::AppData appData;
appData.protocolPath = L"http://run/123456";
// Act
bool result = appData.IsSteamGame();
// Assert
Assert::IsFalse(result);
}
TEST_METHOD(AppData_DefaultValues)
{
// Arrange & Act
Utils::Apps::AppData appData;
// Assert
Assert::IsTrue(appData.name.empty());
Assert::IsTrue(appData.installPath.empty());
Assert::IsTrue(appData.packageFullName.empty());
Assert::IsTrue(appData.appUserModelId.empty());
Assert::IsTrue(appData.pwaAppId.empty());
Assert::IsTrue(appData.protocolPath.empty());
Assert::IsFalse(appData.canLaunchElevated);
}
TEST_METHOD(AppData_MultipleBrowserDetection)
{
// Arrange
Utils::Apps::AppData edgeApp;
edgeApp.installPath = L"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe";
Utils::Apps::AppData chromeApp;
chromeApp.installPath = L"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
Utils::Apps::AppData otherApp;
otherApp.installPath = L"C:\\Program Files\\Firefox\\firefox.exe";
// Act & Assert
Assert::IsTrue(edgeApp.IsEdge());
Assert::IsFalse(edgeApp.IsChrome());
Assert::IsFalse(edgeApp.IsSteamGame());
Assert::IsFalse(chromeApp.IsEdge());
Assert::IsTrue(chromeApp.IsChrome());
Assert::IsFalse(chromeApp.IsSteamGame());
Assert::IsFalse(otherApp.IsEdge());
Assert::IsFalse(otherApp.IsChrome());
Assert::IsFalse(otherApp.IsSteamGame());
}
TEST_METHOD(GetAppsList_ReturnsAppList)
{
// Act
Utils::Apps::AppList apps = Utils::Apps::GetAppsList();
// Assert
// The list can be empty or non-empty depending on the system
// But it should not crash and should return a valid list
Assert::IsTrue(apps.size() >= 0);
}
};
}

View File

@@ -0,0 +1,186 @@
#include "pch.h"
#include <filesystem>
#include <fstream>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace WorkspacesLibUnitTests
{
TEST_CLASS (JsonUtilsTests)
{
private:
std::wstring CreateTempJsonFile(const std::wstring& content)
{
std::wstring tempPath = std::filesystem::temp_directory_path();
tempPath += L"\\test_workspace_" + std::to_wstring(GetTickCount64()) + L".json";
std::wofstream file(tempPath);
file << content;
file.close();
return tempPath;
}
void DeleteTempFile(const std::wstring& filePath)
{
if (std::filesystem::exists(filePath))
{
std::filesystem::remove(filePath);
}
}
public:
TEST_METHOD (ReadSingleWorkspace_NonExistentFile_ReturnsEmptyWorkspace)
{
// Arrange
std::wstring nonExistentFile = L"C:\\NonExistent\\File.json";
// Act
auto result = JsonUtils::ReadSingleWorkspace(nonExistentFile);
// Assert
Assert::IsTrue(result.isOk());
auto workspace = result.value();
Assert::IsTrue(workspace.name.empty());
}
TEST_METHOD (ReadSingleWorkspace_InvalidJsonFile_ReturnsError)
{
// Arrange
std::wstring tempFile = CreateTempJsonFile(L"invalid json content {");
// Act
auto result = JsonUtils::ReadSingleWorkspace(tempFile);
// Assert
Assert::IsTrue(result.isError());
Assert::AreEqual(static_cast<int>(JsonUtils::WorkspacesFileError::IncorrectFileError),
static_cast<int>(result.error()));
// Cleanup
DeleteTempFile(tempFile);
}
TEST_METHOD (ReadWorkspaces_NonExistentFile_ReturnsEmptyVector)
{
// Arrange
std::wstring nonExistentFile = L"C:\\NonExistent\\File.json";
// Act
auto result = JsonUtils::ReadWorkspaces(nonExistentFile);
// Assert
Assert::IsTrue(result.isError());
Assert::AreEqual(static_cast<int>(JsonUtils::WorkspacesFileError::IncorrectFileError),
static_cast<int>(result.error()));
}
TEST_METHOD (ReadWorkspaces_InvalidJsonFile_ReturnsError)
{
// Arrange
std::wstring tempFile = CreateTempJsonFile(L"invalid json content {");
// Act
auto result = JsonUtils::ReadWorkspaces(tempFile);
// Assert
Assert::IsTrue(result.isError());
Assert::AreEqual(static_cast<int>(JsonUtils::WorkspacesFileError::IncorrectFileError),
static_cast<int>(result.error()));
// Cleanup
DeleteTempFile(tempFile);
}
TEST_METHOD (Write_ValidWorkspace_ReturnsTrue)
{
// Arrange
std::wstring tempPath = std::filesystem::temp_directory_path();
tempPath += L"\\test_write_workspace_" + std::to_wstring(GetTickCount64()) + L".json";
WorkspacesData::WorkspacesProject workspace;
workspace.name = L"Test Workspace";
// Convert string to time_t
std::tm tm = {};
workspace.creationTime = std::mktime(&tm);
// Act
bool result = JsonUtils::Write(tempPath, workspace);
// Assert
Assert::IsTrue(result);
Assert::IsTrue(std::filesystem::exists(tempPath));
// Cleanup
DeleteTempFile(tempPath);
}
TEST_METHOD (Write_ValidWorkspacesList_ReturnsTrue)
{
// Arrange
std::wstring tempPath = std::filesystem::temp_directory_path();
tempPath += L"\\test_write_workspaces_" + std::to_wstring(GetTickCount64()) + L".json";
std::vector<WorkspacesData::WorkspacesProject> workspaces;
WorkspacesData::WorkspacesProject workspace1;
workspace1.name = L"Test Workspace 1";
workspace1.creationTime = std::time(nullptr);
WorkspacesData::WorkspacesProject workspace2;
workspace2.name = L"Test Workspace 2";
workspace2.creationTime = std::time(nullptr);
workspaces.push_back(workspace1);
workspaces.push_back(workspace2);
// Act
bool result = JsonUtils::Write(tempPath, workspaces);
// Assert
Assert::IsTrue(result);
Assert::IsTrue(std::filesystem::exists(tempPath));
// Cleanup
DeleteTempFile(tempPath);
}
TEST_METHOD (Write_EmptyWorkspacesList_ReturnsTrue)
{
// Arrange
std::wstring tempPath = std::filesystem::temp_directory_path();
tempPath += L"\\test_write_empty_" + std::to_wstring(GetTickCount64()) + L".json";
std::vector<WorkspacesData::WorkspacesProject> emptyWorkspaces;
// Act
bool result = JsonUtils::Write(tempPath, emptyWorkspaces);
// Assert
Assert::IsTrue(result);
Assert::IsTrue(std::filesystem::exists(tempPath));
// Cleanup
DeleteTempFile(tempPath);
}
/*
TEST_METHOD(Write_InvalidPath_ReturnsFalse)
{
// Arrange
std::wstring invalidPath = L"C:\\NonExistent\\Path\\workspace.json";
WorkspacesData::WorkspacesProject workspace;
workspace.name = L"Test Workspace";
workspace.creationTime = std::time(nullptr);
// Act
bool result = JsonUtils::Write(invalidPath, workspace);
// Assert
Assert::IsFalse(result);
}
*/
};
}

View File

@@ -0,0 +1,114 @@
#include "pch.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace WorkspacesLibUnitTests
{
TEST_CLASS (PwaHelperTests)
{
public:
TEST_METHOD (PwaHelper_Constructor_DoesNotThrow)
{
// Act & Assert - Constructor should not crash when called
try
{
Utils::PwaHelper helper;
// If we get here, the constructor didn't throw
Assert::IsTrue(true);
}
catch (...)
{
Assert::Fail(L"PwaHelper constructor should not throw exceptions");
}
}
TEST_METHOD (PwaHelper_GetEdgeAppId_EmptyAumid_ReturnsEmpty)
{
// Arrange
Utils::PwaHelper helper;
std::wstring emptyAumid = L"";
// Act
auto result = helper.GetEdgeAppId(emptyAumid);
// Assert
Assert::IsFalse(result.has_value());
}
TEST_METHOD (PwaHelper_GetChromeAppId_EmptyAumid_ReturnsEmpty)
{
// Arrange
Utils::PwaHelper helper;
std::wstring emptyAumid = L"";
// Act
auto result = helper.GetChromeAppId(emptyAumid);
// Assert
Assert::IsFalse(result.has_value());
}
TEST_METHOD (PwaHelper_SearchPwaName_EmptyParameters_ReturnsEmpty)
{
// Arrange
Utils::PwaHelper helper;
std::wstring emptyPwaAppId = L"";
std::wstring emptyWindowAumid = L"";
// Act
std::wstring result = helper.SearchPwaName(emptyPwaAppId, emptyWindowAumid);
// Assert
Assert::IsTrue(result.empty());
}
TEST_METHOD (PwaHelper_SearchPwaName_NonExistentIds_ReturnsEmpty)
{
// Arrange
Utils::PwaHelper helper;
std::wstring nonExistentPwaAppId = L"nonexistent_app_id";
std::wstring nonExistentWindowAumid = L"nonexistent_aumid";
// Act
std::wstring result = helper.SearchPwaName(nonExistentPwaAppId, nonExistentWindowAumid);
// TODO: is it really expected?
Assert::IsTrue(result == nonExistentWindowAumid);
}
TEST_METHOD (PwaHelper_GetAUMIDFromWindow_InvalidWindow_ReturnsEmpty)
{
// Arrange
Utils::PwaHelper helper;
HWND invalidWindow = nullptr;
// Act
std::wstring result = helper.GetAUMIDFromWindow(invalidWindow);
// Assert
Assert::IsTrue(result.empty());
}
TEST_METHOD (PwaHelper_GetEdgeAppId_ValidConstruction_DoesNotCrash)
{
// Arrange
Utils::PwaHelper helper;
std::wstring testAumid = L"Microsoft.MicrosoftEdge_8wekyb3d8bbwe!App";
// Act & Assert - Should not crash
auto result = helper.GetEdgeAppId(testAumid);
// Result can be empty or have value, but should not crash
}
TEST_METHOD (PwaHelper_GetChromeAppId_ValidConstruction_DoesNotCrash)
{
// Arrange
Utils::PwaHelper helper;
std::wstring testAumid = L"Chrome.App.TestId";
// Act & Assert - Should not crash
auto result = helper.GetChromeAppId(testAumid);
// Result can be empty or have value, but should not crash
}
};
}

View File

@@ -0,0 +1,115 @@
#include "pch.h"
#include <StringUtils.h>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace WorkspacesLibUnitTests
{
TEST_CLASS(StringUtilsTests)
{
public:
TEST_METHOD(CaseInsensitiveEquals_SameStrings_ReturnsTrue)
{
// Arrange
std::wstring str1 = L"test";
std::wstring str2 = L"test";
// Act
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
// Assert
Assert::IsTrue(result);
}
TEST_METHOD(CaseInsensitiveEquals_DifferentCase_ReturnsTrue)
{
// Arrange
std::wstring str1 = L"Test";
std::wstring str2 = L"TEST";
// Act
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
// Assert
Assert::IsTrue(result);
}
TEST_METHOD(CaseInsensitiveEquals_MixedCase_ReturnsTrue)
{
// Arrange
std::wstring str1 = L"TeSt StRiNg";
std::wstring str2 = L"test STRING";
// Act
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
// Assert
Assert::IsTrue(result);
}
TEST_METHOD(CaseInsensitiveEquals_DifferentStrings_ReturnsFalse)
{
// Arrange
std::wstring str1 = L"test";
std::wstring str2 = L"different";
// Act
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
// Assert
Assert::IsFalse(result);
}
TEST_METHOD(CaseInsensitiveEquals_DifferentLengths_ReturnsFalse)
{
// Arrange
std::wstring str1 = L"test";
std::wstring str2 = L"testing";
// Act
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
// Assert
Assert::IsFalse(result);
}
TEST_METHOD(CaseInsensitiveEquals_EmptyStrings_ReturnsTrue)
{
// Arrange
std::wstring str1 = L"";
std::wstring str2 = L"";
// Act
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
// Assert
Assert::IsTrue(result);
}
TEST_METHOD(CaseInsensitiveEquals_OneEmpty_ReturnsFalse)
{
// Arrange
std::wstring str1 = L"test";
std::wstring str2 = L"";
// Act
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
// Assert
Assert::IsFalse(result);
}
TEST_METHOD(CaseInsensitiveEquals_SpecialCharacters_ReturnsTrue)
{
// Arrange
std::wstring str1 = L"Test-123_Special!";
std::wstring str2 = L"test-123_special!";
// Act
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
// Assert
Assert::IsTrue(result);
}
};
}

View File

@@ -0,0 +1,194 @@
#include "pch.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace WorkspacesLibUnitTests
{
TEST_CLASS(WorkspacesDataTests)
{
public:
TEST_METHOD(WorkspacesFile_ReturnsValidPath)
{
// Act
std::wstring result = WorkspacesData::WorkspacesFile();
// Assert
Assert::IsFalse(result.empty());
Assert::IsTrue(result.find(L"workspaces.json") != std::wstring::npos);
}
TEST_METHOD(TempWorkspacesFile_ReturnsValidPath)
{
// Act
std::wstring result = WorkspacesData::TempWorkspacesFile();
// Assert
Assert::IsFalse(result.empty());
Assert::IsTrue(result.find(L"temp-workspaces.json") != std::wstring::npos);
}
TEST_METHOD(WorkspacesFile_TempWorkspacesFile_DifferentPaths)
{
// Act
std::wstring workspacesFile = WorkspacesData::WorkspacesFile();
std::wstring tempWorkspacesFile = WorkspacesData::TempWorkspacesFile();
// Assert
Assert::AreNotEqual(workspacesFile, tempWorkspacesFile);
}
TEST_METHOD(Position_ToRect_ConvertsCorrectly)
{
// Arrange
WorkspacesData::WorkspacesProject::Application::Position position;
position.x = 100;
position.y = 200;
position.width = 800;
position.height = 600;
// Act
RECT rect = position.toRect();
// Assert
Assert::AreEqual(100, static_cast<int>(rect.left));
Assert::AreEqual(200, static_cast<int>(rect.top));
Assert::AreEqual(900, static_cast<int>(rect.right)); // x + width
Assert::AreEqual(800, static_cast<int>(rect.bottom)); // y + height
}
TEST_METHOD(Position_ToRect_ZeroPosition)
{
// Arrange
WorkspacesData::WorkspacesProject::Application::Position position;
position.x = 0;
position.y = 0;
position.width = 0;
position.height = 0;
// Act
RECT rect = position.toRect();
// Assert
Assert::AreEqual(0, static_cast<int>(rect.left));
Assert::AreEqual(0, static_cast<int>(rect.top));
Assert::AreEqual(0, static_cast<int>(rect.right));
Assert::AreEqual(0, static_cast<int>(rect.bottom));
}
TEST_METHOD(Position_ToRect_NegativeCoordinates)
{
// Arrange
WorkspacesData::WorkspacesProject::Application::Position position;
position.x = -100;
position.y = -50;
position.width = 200;
position.height = 150;
// Act
RECT rect = position.toRect();
// Assert
Assert::AreEqual(-100, static_cast<int>(rect.left));
Assert::AreEqual(-50, static_cast<int>(rect.top));
Assert::AreEqual(100, static_cast<int>(rect.right)); // -100 + 200
Assert::AreEqual(100, static_cast<int>(rect.bottom)); // -50 + 150
}
TEST_METHOD(Application_DefaultValues)
{
// Arrange & Act
WorkspacesData::WorkspacesProject::Application app;
// Assert
Assert::IsTrue(app.id.empty());
Assert::IsTrue(app.name.empty());
Assert::IsTrue(app.title.empty());
Assert::IsTrue(app.path.empty());
Assert::IsTrue(app.packageFullName.empty());
Assert::IsTrue(app.appUserModelId.empty());
Assert::IsTrue(app.pwaAppId.empty());
Assert::IsTrue(app.commandLineArgs.empty());
Assert::IsFalse(app.isElevated);
Assert::IsFalse(app.canLaunchElevated);
Assert::IsFalse(app.isMinimized);
Assert::IsFalse(app.isMaximized);
Assert::AreEqual(0, static_cast<int>(app.position.x));
Assert::AreEqual(0, static_cast<int>(app.position.y));
Assert::AreEqual(0, static_cast<int>(app.position.width));
Assert::AreEqual(0, static_cast<int>(app.position.height));
Assert::AreEqual(0u, static_cast<unsigned int>(app.monitor));
}
TEST_METHOD(Application_Comparison_EqualObjects)
{
// Arrange
WorkspacesData::WorkspacesProject::Application app1;
app1.id = L"test-id";
app1.name = L"Test App";
app1.position.x = 100;
app1.position.y = 200;
WorkspacesData::WorkspacesProject::Application app2;
app2.id = L"test-id";
app2.name = L"Test App";
app2.position.x = 100;
app2.position.y = 200;
// Act & Assert
Assert::IsTrue(app1 == app2);
}
TEST_METHOD(Application_Comparison_DifferentObjects)
{
// Arrange
WorkspacesData::WorkspacesProject::Application app1;
app1.id = L"test-id-1";
app1.name = L"Test App 1";
WorkspacesData::WorkspacesProject::Application app2;
app2.id = L"test-id-2";
app2.name = L"Test App 2";
// Act & Assert
Assert::IsTrue(app1 != app2);
}
TEST_METHOD(Position_Comparison_EqualPositions)
{
// Arrange
WorkspacesData::WorkspacesProject::Application::Position pos1;
pos1.x = 100;
pos1.y = 200;
pos1.width = 800;
pos1.height = 600;
WorkspacesData::WorkspacesProject::Application::Position pos2;
pos2.x = 100;
pos2.y = 200;
pos2.width = 800;
pos2.height = 600;
// Act & Assert
Assert::IsTrue(pos1 == pos2);
}
TEST_METHOD(Position_Comparison_DifferentPositions)
{
// Arrange
WorkspacesData::WorkspacesProject::Application::Position pos1;
pos1.x = 100;
pos1.y = 200;
pos1.width = 800;
pos1.height = 600;
WorkspacesData::WorkspacesProject::Application::Position pos2;
pos2.x = 150;
pos2.y = 200;
pos2.width = 800;
pos2.height = 600;
// Act & Assert
Assert::IsTrue(pos1 != pos2);
}
};
}

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<ProjectGuid>{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>WorkspacesLibUnitTests</RootNamespace>
<ProjectName>WorkspacesLibUnitTests</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup>
<ConfigurationType>DynamicLibrary</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<OutDir>..\..\..\..\$(Platform)\$(Configuration)\tests\Workspaces\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\;..\WorkspacesLib\;$(SolutionDir)src\;$(SolutionDir)src\common;$(SolutionDir)src\common\Telemetry;..\..\;..\..\..\;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\\lib;$(SolutionDir)$(Platform)\\$(Configuration)\\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>propsys.lib;comctl32.lib;pathcch.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="WorkspacesDataTests.cpp" />
<ClCompile Include="StringUtilsTests.cpp" />
<ClCompile Include="JsonUtilsTests.cpp" />
<ClCompile Include="AppUtilsTests.cpp" />
<ClCompile Include="PwaHelperTests.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
</ProjectReference>
<ProjectReference Include="..\WorkspacesLib\WorkspacesLib.vcxproj">
<Project>{b31fcc55-b5a4-4ea7-b414-2dceae6af332}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="WorkspacesDataTests.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="StringUtilsTests.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="JsonUtilsTests.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="AppUtilsTests.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PwaHelperTests.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
</packages>

View File

@@ -0,0 +1 @@
#include "pch.h"

View File

@@ -0,0 +1,21 @@
#pragma once
#include "targetver.h"
// Headers for CppUnitTest
#pragma warning(disable : 26466)
#include "CppUnitTest.h"
// Windows headers
#include <windows.h>
#include <string>
#include <memory>
#include <vector>
#include <optional>
// Workspaces headers
#include <WorkspacesLib/WorkspacesData.h>
#include <WorkspacesLib/JsonUtils.h>
#include <WorkspacesLib/Result.h>
#include <WorkspacesLib/AppUtils.h>
#include <WorkspacesLib/PwaHelper.h>

View File

@@ -0,0 +1,8 @@
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>

View File

@@ -6,7 +6,7 @@
namespace StringUtils
{
bool CaseInsensitiveEquals(const std::wstring& str1, const std::wstring& str2)
inline bool CaseInsensitiveEquals(const std::wstring& str1, const std::wstring& str2)
{
if (str1.size() != str2.size())
{

View File

@@ -69,10 +69,10 @@ namespace WorkspacesData
std::wstring id;
std::wstring name;
time_t creationTime;
time_t creationTime{};
std::optional<time_t> lastLaunchedTime;
bool isShortcutNeeded;
bool moveExistingWindows;
bool isShortcutNeeded{};
bool moveExistingWindows{};
std::vector<Monitor> monitors;
std::vector<Application> apps;
};

View File

@@ -12,6 +12,6 @@
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.7.250513003" />
<PackageVersion Include="Shmuelie.WinRTServer" Version="2.1.1" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<PackageVersion Include="System.Text.Json" Version="9.0.5" />
<PackageVersion Include="System.Text.Json" Version="9.0.6" />
</ItemGroup>
</Project>

View File

@@ -18,7 +18,7 @@ public sealed partial class ContentFormControl : UserControl
// LOAD-BEARING: if you don't hang onto a reference to the RenderedAdaptiveCard
// then the GC might clean it up sometime, even while the card is in the UI
// tree. If this gets GC'd, then it'll revoke our Action handler, and the
// tree. If this gets GC'ed, then it'll revoke our Action handler, and the
// form will do seemingly nothing.
private RenderedAdaptiveCard? _renderedCard;

View File

@@ -39,8 +39,8 @@ Projects of interest are:
[Initial SDK Spec]: ./doc/initial-sdk-spec/initial-sdk-spec.md
[generic samples]: ./Exts/SamplePagesExtension
[real samples]: ./Exts/ProcessMonitorExtension
[generic samples]: ./ext/SamplePagesExtension
[real samples]: ./ext/ProcessMonitorExtension
[real extensions that we've "shipped" already]: https://github.com/zadjii/CmdPalExtensions/blob/main/src/extensions

View File

@@ -6,20 +6,20 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
using Mages.Core;
using CalculatorEngineCommon;
using Windows.Foundation.Collections;
namespace Microsoft.CmdPal.Ext.Calc.Helper;
public static class CalculateEngine
{
private static readonly Engine _magesEngine = new Engine(new Configuration
private static readonly PropertySet _constants = new()
{
Scope = new Dictionary<string, object>
{
{ "e", Math.E }, // e is not contained in the default mages engine
},
});
{ "pi", Math.PI },
{ "e", Math.E },
};
private static readonly Calculator _calculator = new Calculator(_constants);
public const int RoundingDigits = 10;
@@ -68,28 +68,26 @@ public static class CalculateEngine
// Expand conversions between trig units
input = CalculateHelper.ExpandTrigConversions(input, trigMode);
var result = _magesEngine.Interpret(input);
var result = _calculator.EvaluateExpression(input);
// This could happen for some incorrect queries, like pi(2)
if (result == null)
if (result == "NaN")
{
error = Properties.Resources.calculator_expression_not_complete;
return default;
}
result = TransformResult(result);
if (result is string)
{
error = result as string;
return default;
}
if (string.IsNullOrEmpty(result?.ToString()))
if (string.IsNullOrEmpty(result))
{
return default;
}
var decimalResult = Convert.ToDecimal(result, cultureInfo);
// Remove trailing zeros from the decimal string representation (e.g., "1.2300" -> "1.23")
// This is necessary because the value extracted from exprtk may contain unnecessary trailing zeros.
var formatted = decimalResult.ToString("G29", cultureInfo);
decimalResult = Convert.ToDecimal(formatted, cultureInfo);
var roundedResult = Round(decimalResult);
return new CalculateResult()
@@ -103,25 +101,4 @@ public static class CalculateEngine
{
return Math.Round(value, RoundingDigits, MidpointRounding.AwayFromZero);
}
private static dynamic TransformResult(object result)
{
if (result.ToString() == "NaN")
{
return Properties.Resources.calculator_not_a_number;
}
if (result is Function)
{
return Properties.Resources.calculator_expression_not_complete;
}
if (result is double[,])
{
// '[10,10]' is interpreted as array by mages engine
return Properties.Resources.calculator_double_array_returned;
}
return result;
}
}

View File

@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
@@ -63,46 +64,61 @@ public class NumberTranslator
return Translate(input, targetCulture, sourceCulture, splitRegexForTarget);
}
private static string ConvertBaseLiteral(string token, CultureInfo cultureTo)
{
var prefixes = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase)
{
{ "0x", 16 },
{ "0b", 2 },
{ "0o", 8 },
};
foreach (var (prefix, numberBase) in prefixes)
{
if (token.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
{
try
{
var num = Convert.ToInt64(token.Substring(prefix.Length), numberBase);
return num.ToString(cultureTo);
}
catch
{
return null; // fallback
}
}
}
return null;
}
private static string Translate(string input, CultureInfo cultureFrom, CultureInfo cultureTo, Regex splitRegex)
{
var outputBuilder = new StringBuilder();
var hexRegex = new Regex(@"(?:(0x[\da-fA-F]+))");
var hexTokens = hexRegex.Split(input);
// Match numbers in hexadecimal (0x..), binary (0b..), or octal (0o..) format,
// and convert them to decimal form for compatibility with ExprTk (which only supports decimal input).
var baseNumberRegex = new Regex(@"(0[xX][\da-fA-F]+|0[bB][0-9]+|0[oO][0-9]+)");
foreach (var hexToken in hexTokens)
var tokens = baseNumberRegex.Split(input);
foreach (var token in tokens)
{
if (hexToken.StartsWith("0x", StringComparison.InvariantCultureIgnoreCase))
{
// Mages engine has issues processing large hex number (larger than 7 hex digits + 0x prefix = 9 characters). So we convert it to decimal and pass it to the engine.
if (hexToken.Length > 9)
{
try
{
var num = Convert.ToInt64(hexToken, 16);
var numStr = num.ToString(cultureFrom);
outputBuilder.Append(numStr);
}
catch (Exception)
{
outputBuilder.Append(hexToken);
}
}
else
{
outputBuilder.Append(hexToken);
}
// Currently, we only convert base literals (hexadecimal, binary, octal) to decimal.
var converted = ConvertBaseLiteral(token, cultureTo);
if (converted != null)
{
outputBuilder.Append(converted);
continue;
}
var tokens = splitRegex.Split(hexToken);
foreach (var token in tokens)
foreach (var inner in splitRegex.Split(token))
{
var leadingZeroCount = 0;
// Count leading zero characters.
foreach (var c in token)
foreach (var c in inner)
{
if (c != '0')
{
@@ -113,7 +129,7 @@ public class NumberTranslator
}
// number is all zero characters. no need to add zero characters at the end.
if (token.Length == leadingZeroCount)
if (inner.Length == leadingZeroCount)
{
leadingZeroCount = 0;
}
@@ -121,9 +137,9 @@ public class NumberTranslator
decimal number;
outputBuilder.Append(
decimal.TryParse(token, NumberStyles.Number, cultureFrom, out number)
decimal.TryParse(inner, NumberStyles.Number, cultureFrom, out number)
? (new string('0', leadingZeroCount) + number.ToString(cultureTo))
: token.Replace(cultureFrom.TextInfo.ListSeparator, cultureTo.TextInfo.ListSeparator));
: inner.Replace(cultureFrom.TextInfo.ListSeparator, cultureTo.TextInfo.ListSeparator));
}
}

View File

@@ -65,11 +65,6 @@ public static partial class QueryHelper
return ResultHelper.CreateResult(result.RoundedResult, inputCulture, outputCulture, query, handleSave);
}
catch (Mages.Core.ParseException)
{
// Invalid input
return ErrorHandler.OnError(isFallbackSearch, query, Properties.Resources.calculator_expression_not_complete);
}
catch (OverflowException)
{
// Result to big to convert to decimal

View File

@@ -9,15 +9,25 @@
<!-- MRT from windows app sdk will search for a pri file with the same name of the module before defaulting to resources.pri -->
<ProjectPriFileName>Microsoft.CmdPal.Ext.Calc.pri</ProjectPriFileName>
</PropertyGroup>
<PropertyGroup>
<CsWinRTIncludes>CalculatorEngineCommon</CsWinRTIncludes>
<CsWinRTGeneratedFilesDir>$(OutDir)</CsWinRTGeneratedFilesDir>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\common\CalculatorEngineCommon\CalculatorEngineCommon.vcxproj" />
<ProjectReference Include="..\..\..\..\common\ManagedCommon\ManagedCommon.csproj" />
<ProjectReference Include="..\..\extensionsdk\Microsoft.CommandPalette.Extensions.Toolkit\Microsoft.CommandPalette.Extensions.Toolkit.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Mages" />
<CsWinRTInputs Include="..\..\..\..\..\$(Platform)\$(Configuration)\CalculatorEngineCommon.winmd" />
<Content Include="..\..\..\..\..\$(Platform)\$(Configuration)\CalculatorEngineCommon.winmd" Link="CalculatorEngineCommon.winmd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\..\$(Platform)\$(Configuration)\CalculatorEngineCommon.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DependentUpon>Resources.resx</DependentUpon>

View File

@@ -107,21 +107,14 @@ namespace ColorPicker.Helpers
}
}
public void OnColorPickerMouseDown()
public void OpenColorEditor()
{
if (_userSettings.ActivationAction.Value == ColorPickerActivationAction.OpenColorPickerAndThenEditor || _userSettings.ActivationAction.Value == ColorPickerActivationAction.OpenEditor)
lock (_colorPickerVisibilityLock)
{
lock (_colorPickerVisibilityLock)
{
HideColorPicker();
}
HideColorPicker();
}
ShowColorPickerEditor();
}
else
{
EndUserSession();
}
ShowColorPickerEditor();
}
public static void SetTopMost()

View File

@@ -16,10 +16,12 @@ namespace ColorPicker.Mouse
// position and bool indicating zoom in or zoom out
event EventHandler<Tuple<System.Windows.Point, bool>> OnMouseWheel;
event MouseUpEventHandler OnMouseDown;
event PrimaryMouseDownEventHandler OnPrimaryMouseDown;
event SecondaryMouseUpEventHandler OnSecondaryMouseUp;
event MiddleMouseDownEventHandler OnMiddleMouseDown;
System.Windows.Point CurrentPosition { get; }
Color CurrentColor { get; }

View File

@@ -7,17 +7,18 @@ using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Input;
using ColorPicker.Helpers;
using ManagedCommon;
using static ColorPicker.NativeMethods;
namespace ColorPicker.Mouse
{
public delegate void MouseUpEventHandler(object sender, System.Drawing.Point p);
public delegate void PrimaryMouseDownEventHandler(object sender, IntPtr wParam);
public delegate void SecondaryMouseUpEventHandler(object sender, IntPtr wParam);
public delegate void MiddleMouseDownEventHandler(object sender, IntPtr wParam);
internal class MouseHook
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop object")]
@@ -30,23 +31,25 @@ namespace ColorPicker.Mouse
private const int WM_RBUTTONUP = 0x0205;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop object")]
private const int WM_RBUTTONDOWN = 0x0204;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop object")]
private const int WM_MBUTTONDOWN = 0x0207;
private IntPtr _mouseHookHandle;
private HookProc _mouseDelegate;
private event MouseUpEventHandler MouseDown;
private event PrimaryMouseDownEventHandler PrimaryMouseDown;
public event MouseUpEventHandler OnMouseDown
public event PrimaryMouseDownEventHandler OnPrimaryMouseDown
{
add
{
Subscribe();
MouseDown += value;
PrimaryMouseDown += value;
}
remove
{
MouseDown -= value;
PrimaryMouseDown -= value;
Unsubscribe();
}
}
@@ -68,6 +71,23 @@ namespace ColorPicker.Mouse
}
}
private event MiddleMouseDownEventHandler MiddleMouseDown;
public event MiddleMouseDownEventHandler OnMiddleMouseDown
{
add
{
Subscribe();
MiddleMouseDown += value;
}
remove
{
MiddleMouseDown -= value;
Unsubscribe();
}
}
private event MouseWheelEventHandler MouseWheel;
public event MouseWheelEventHandler OnMouseWheel
@@ -126,9 +146,9 @@ namespace ColorPicker.Mouse
MSLLHOOKSTRUCT mouseHookStruct = (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT));
if (wParam.ToInt32() == WM_LBUTTONDOWN)
{
if (MouseDown != null)
if (PrimaryMouseDown != null)
{
MouseDown.Invoke(null, new System.Drawing.Point(mouseHookStruct.pt.x, mouseHookStruct.pt.y));
PrimaryMouseDown.Invoke(null, wParam);
}
return new IntPtr(-1);
@@ -150,6 +170,16 @@ namespace ColorPicker.Mouse
return new IntPtr(-1);
}
if (wParam.ToInt32() == WM_MBUTTONDOWN)
{
if (MiddleMouseDown != null)
{
MiddleMouseDown.Invoke(null, wParam);
}
return new IntPtr(-1);
}
if (wParam.ToInt32() == WM_MOUSEWHEEL)
{
if (MouseWheel != null)

View File

@@ -56,10 +56,12 @@ namespace ColorPicker.Mouse
public event EventHandler<Tuple<System.Windows.Point, bool>> OnMouseWheel;
public event MouseUpEventHandler OnMouseDown;
public event PrimaryMouseDownEventHandler OnPrimaryMouseDown;
public event SecondaryMouseUpEventHandler OnSecondaryMouseUp;
public event MiddleMouseDownEventHandler OnMiddleMouseDown;
public System.Windows.Point CurrentPosition
{
get
@@ -148,9 +150,10 @@ namespace ColorPicker.Mouse
_timer.Start();
}
_mouseHook.OnMouseDown += MouseHook_OnMouseDown;
_mouseHook.OnPrimaryMouseDown += MouseHook_OnPrimaryMouseDown;
_mouseHook.OnMouseWheel += MouseHook_OnMouseWheel;
_mouseHook.OnSecondaryMouseUp += MouseHook_OnSecondaryMouseUp;
_mouseHook.OnMiddleMouseDown += MouseHook_OnMiddleMouseDown;
if (_userSettings.ChangeCursor.Value)
{
@@ -169,10 +172,10 @@ namespace ColorPicker.Mouse
OnMouseWheel?.Invoke(this, new Tuple<System.Windows.Point, bool>(_previousMousePosition, zoomIn));
}
private void MouseHook_OnMouseDown(object sender, Point p)
private void MouseHook_OnPrimaryMouseDown(object sender, IntPtr wParam)
{
DisposeHook();
OnMouseDown?.Invoke(this, p);
OnPrimaryMouseDown?.Invoke(this, wParam);
}
private void MouseHook_OnSecondaryMouseUp(object sender, IntPtr wParam)
@@ -181,6 +184,12 @@ namespace ColorPicker.Mouse
OnSecondaryMouseUp?.Invoke(this, wParam);
}
private void MouseHook_OnMiddleMouseDown(object sender, IntPtr wParam)
{
DisposeHook();
OnMiddleMouseDown?.Invoke(this, wParam);
}
private void CopiedColorRepresentation_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
_colorFormatChanged = true;
@@ -194,9 +203,10 @@ namespace ColorPicker.Mouse
}
_previousMousePosition = new System.Windows.Point(-1, 1);
_mouseHook.OnMouseDown -= MouseHook_OnMouseDown;
_mouseHook.OnPrimaryMouseDown -= MouseHook_OnPrimaryMouseDown;
_mouseHook.OnMouseWheel -= MouseHook_OnMouseWheel;
_mouseHook.OnSecondaryMouseUp -= MouseHook_OnSecondaryMouseUp;
_mouseHook.OnMiddleMouseDown -= MouseHook_OnMiddleMouseDown;
if (_userSettings.ChangeCursor.Value)
{

View File

@@ -21,6 +21,12 @@ namespace ColorPicker.Settings
SettingItem<ColorPickerActivationAction> ActivationAction { get; }
SettingItem<ColorPickerClickAction> PrimaryClickAction { get; }
SettingItem<ColorPickerClickAction> MiddleClickAction { get; }
SettingItem<ColorPickerClickAction> SecondaryClickAction { get; }
RangeObservableCollection<string> ColorHistory { get; }
SettingItem<int> ColorHistoryLimit { get; }

View File

@@ -49,7 +49,10 @@ namespace ColorPicker.Settings
ChangeCursor = new SettingItem<bool>(true);
ActivationShortcut = new SettingItem<string>(DefaultActivationShortcut);
CopiedColorRepresentation = new SettingItem<string>(ColorRepresentationType.HEX.ToString());
ActivationAction = new SettingItem<ColorPickerActivationAction>(ColorPickerActivationAction.OpenEditor);
ActivationAction = new SettingItem<ColorPickerActivationAction>(ColorPickerActivationAction.OpenColorPicker);
PrimaryClickAction = new SettingItem<ColorPickerClickAction>(ColorPickerClickAction.PickColorThenEditor);
MiddleClickAction = new SettingItem<ColorPickerClickAction>(ColorPickerClickAction.PickColorAndClose);
SecondaryClickAction = new SettingItem<ColorPickerClickAction>(ColorPickerClickAction.Close);
ColorHistoryLimit = new SettingItem<int>(20);
ColorHistory.CollectionChanged += ColorHistory_CollectionChanged;
ShowColorName = new SettingItem<bool>(false);
@@ -78,6 +81,12 @@ namespace ColorPicker.Settings
public SettingItem<ColorPickerActivationAction> ActivationAction { get; private set; }
public SettingItem<ColorPickerClickAction> PrimaryClickAction { get; private set; }
public SettingItem<ColorPickerClickAction> MiddleClickAction { get; private set; }
public SettingItem<ColorPickerClickAction> SecondaryClickAction { get; private set; }
public RangeObservableCollection<string> ColorHistory { get; private set; } = new RangeObservableCollection<string>();
public SettingItem<int> ColorHistoryLimit { get; }
@@ -121,6 +130,9 @@ namespace ColorPicker.Settings
CopiedColorRepresentation.Value = settings.Properties.CopiedColorRepresentation;
CopiedColorRepresentationFormat = new SettingItem<string>(string.Empty);
ActivationAction.Value = settings.Properties.ActivationAction;
PrimaryClickAction.Value = settings.Properties.PrimaryClickAction;
MiddleClickAction.Value = settings.Properties.MiddleClickAction;
SecondaryClickAction.Value = settings.Properties.SecondaryClickAction;
ColorHistoryLimit.Value = settings.Properties.ColorHistoryLimit;
ShowColorName.Value = settings.Properties.ShowColorName;

View File

@@ -16,6 +16,7 @@ using ColorPicker.Settings;
using ColorPicker.ViewModelContracts;
using Common.UI;
using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
using PowerToys.Interop;
namespace ColorPicker.ViewModels
@@ -79,9 +80,10 @@ namespace ColorPicker.ViewModels
{
SetColorDetails(mouseInfoProvider.CurrentColor);
mouseInfoProvider.MouseColorChanged += Mouse_ColorChanged;
mouseInfoProvider.OnMouseDown += MouseInfoProvider_OnMouseDown;
mouseInfoProvider.OnPrimaryMouseDown += MouseInfoProvider_OnPrimaryMouseDown;
mouseInfoProvider.OnMouseWheel += MouseInfoProvider_OnMouseWheel;
mouseInfoProvider.OnSecondaryMouseUp += MouseInfoProvider_OnSecondaryMouseUp;
mouseInfoProvider.OnMiddleMouseDown += MouseInfoProvider_OnMiddleMouseDown;
}
_userSettings.ShowColorName.PropertyChanged += (s, e) => { OnPropertyChanged(nameof(ShowColorName)); };
@@ -113,7 +115,7 @@ namespace ColorPicker.ViewModels
private void AppStateHandler_EnterPressed(object sender, EventArgs e)
{
MouseInfoProvider_OnMouseDown(null, default(System.Drawing.Point));
MouseInfoProvider_OnPrimaryMouseDown(null, default);
}
/// <summary>
@@ -167,18 +169,50 @@ namespace ColorPicker.ViewModels
SetColorDetails(color);
}
/// <summary>
/// Tell the color picker that the user have press a mouse button (after release the button)
/// </summary>
/// <param name="sender">The sender of this event</param>
/// <param name="p">The current <see cref="System.Drawing.Point"/> of the mouse cursor</param>
private void MouseInfoProvider_OnMouseDown(object sender, System.Drawing.Point p)
private void MouseInfoProvider_OnPrimaryMouseDown(object sender, IntPtr wParam)
{
ClipboardHelper.CopyToClipboard(ColorText);
HandleMouseClickAction(_userSettings.PrimaryClickAction.Value);
}
var color = GetColorString();
private void MouseInfoProvider_OnMiddleMouseDown(object sender, IntPtr wParam)
{
HandleMouseClickAction(_userSettings.MiddleClickAction.Value);
}
var oldIndex = _userSettings.ColorHistory.IndexOf(color);
private void MouseInfoProvider_OnSecondaryMouseUp(object sender, IntPtr wParam)
{
HandleMouseClickAction(_userSettings.SecondaryClickAction.Value);
}
private void HandleMouseClickAction(ColorPickerClickAction action)
{
switch (action)
{
case ColorPickerClickAction.PickColorThenEditor:
ClipboardHelper.CopyToClipboard(ColorText);
UpdateColorHistory(GetColorString());
_appStateHandler.OpenColorEditor();
break;
case ColorPickerClickAction.PickColorAndClose:
ClipboardHelper.CopyToClipboard(ColorText);
UpdateColorHistory(GetColorString());
_appStateHandler.EndUserSession();
break;
case ColorPickerClickAction.Close:
_appStateHandler.EndUserSession();
break;
}
}
private void UpdateColorHistory(string color)
{
int oldIndex = _userSettings.ColorHistory.IndexOf(color);
if (oldIndex != -1)
{
_userSettings.ColorHistory.Move(oldIndex, 0);
@@ -192,13 +226,6 @@ namespace ColorPicker.ViewModels
{
_userSettings.ColorHistory.RemoveAt(_userSettings.ColorHistory.Count - 1);
}
_appStateHandler.OnColorPickerMouseDown();
}
private void MouseInfoProvider_OnSecondaryMouseUp(object sender, IntPtr wParam)
{
_appStateHandler.EndUserSession();
}
private string GetColorString()

View File

@@ -17,10 +17,10 @@
"org": "microsoft",
"project": "OS",
"AssignedTo": "mengyuanchen@microsoft.com",
"AreaPath": "OS\\Windows Client and Services\\WinPD\\DEEP-Developer Experience, Ecosystem and Partnerships\\SHINE\\PowerToys",
"AreaPath": "OS\\Windows Client and Services\\WinPD\\DFX-Developer Fundamentals and Experiences\\DEFT\\SALT",
"IterationPath": "OS\\Future"
},
"jobNotificationEmail": "mengyuanchen@microsoft.com",
"jobNotificationEmail": "PowerToys@microsoft.com",
"skip": false,
"rebootAfterSetup": false,
"oneFuzzJobs": [

View File

@@ -51,7 +51,7 @@
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">System</dpiAwareness>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
</windowsSettings>
</application>

View File

@@ -14,25 +14,7 @@ namespace PowerLauncher.Helper
{
public static class ErrorReporting
{
private static void Report(Exception e, bool waitForClose)
{
if (e != null)
{
var logger = LogManager.GetLogger("UnHandledException");
logger.Fatal(ExceptionFormatter.FormatException(e));
var reportWindow = new ReportWindow(e);
if (waitForClose)
{
reportWindow.ShowDialog();
}
else
{
reportWindow.Show();
}
}
}
private const string LoggerName = "UnHandledException";
public static void ShowMessageBox(string title, string message)
{
@@ -47,17 +29,20 @@ namespace PowerLauncher.Helper
// handle non-ui thread exceptions
System.Windows.Application.Current.Dispatcher.Invoke(() =>
{
Report((Exception)e?.ExceptionObject, true);
HandleException(e?.ExceptionObject as Exception, true);
});
}
public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
// handle ui thread exceptions
Report(e?.Exception, false);
if (e != null)
{
// handle ui thread exceptions
HandleException(e.Exception, false);
// prevent application exist, so the user can copy prompted error info
e.Handled = true;
// prevent application exist, so the user can copy prompted error info
e.Handled = true;
}
}
public static string RuntimeInfo()
@@ -68,5 +53,60 @@ namespace PowerLauncher.Helper
$"\nx64: {Environment.Is64BitOperatingSystem}";
return info;
}
private static void HandleException(Exception e, bool isNotUIThread)
{
// The crash occurs in PresentationFramework.dll, not necessarily when the Runner UI is visible, originating from this line:
// https://github.com/dotnet/wpf/blob/3439f20fb8c685af6d9247e8fd2978cac42e74ac/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Shell/WindowChromeWorker.cs#L1005
// Many bug reports because users see the "Report problem UI" after "the" crash with System.Runtime.InteropServices.COMException 0xD0000701 or 0x80263001.
// However, displaying this "Report problem UI" during WPF crashes, especially when DWM composition is changing, is not ideal; some users reported it hangs for up to a minute before the "Report problem UI" appears.
// This change modifies the behavior to log the exception instead of showing the "Report problem UI".
if (IsDwmCompositionException(e as System.Runtime.InteropServices.COMException))
{
var logger = LogManager.GetLogger(LoggerName);
logger.Error($"From {(isNotUIThread ? "non" : string.Empty)} UI thread's exception: {ExceptionFormatter.FormatException(e)}");
}
else
{
Report(e, isNotUIThread);
}
}
private static void Report(Exception e, bool waitForClose)
{
if (e != null)
{
var logger = LogManager.GetLogger(LoggerName);
logger.Fatal($"From {(waitForClose ? "non" : string.Empty)} UI thread's exception: {ExceptionFormatter.FormatException(e)}");
var reportWindow = new ReportWindow(e);
if (waitForClose)
{
reportWindow.ShowDialog();
}
else
{
reportWindow.Show();
}
}
}
private static bool IsDwmCompositionException(System.Runtime.InteropServices.COMException comException)
{
if (comException == null)
{
return false;
}
var stackTrace = comException.StackTrace;
if (string.IsNullOrEmpty(stackTrace))
{
return false;
}
// Check for common DWM composition changed patterns in the stack trace
return stackTrace.Contains("DwmCompositionChanged");
}
}
}

View File

@@ -389,7 +389,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Monaco
}
fileReader.Close();
_base64FileCode = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(fileContent));
_base64FileCode = Convert.ToBase64String(encodingToUse.GetBytes(fileContent));
Logger.LogInfo("Reading requested file ended");
}

View File

@@ -23,7 +23,7 @@
"AreaPath": "OS\\Windows Client and Services\\WinPD\\DFX-Developer Fundamentals and Experiences\\DEFT\\SALT",
"IterationPath": "OS\\Future"
},
"jobNotificationEmail": "mengyuanchen@microsoft.com",
"jobNotificationEmail": "PowerToys@microsoft.com",
"skip": false,
"rebootAfterSetup": false,
"oneFuzzJobs": [

View File

@@ -31,7 +31,7 @@
<ItemGroup>
<Folder Include="RegistryPreviewXAML\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.DataGrid" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Sizers" />

View File

@@ -10,7 +10,31 @@
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<SolidColorBrush x:Key="HexBox_SelectionTextBrush" Color="{ThemeResource TextOnAccentFillColorSelectedText}" />
<SolidColorBrush x:Key="HexBox_SelectionBackgroundBrush" Color="{ThemeResource SystemAccentColor}" />
<SolidColorBrush x:Key="HexBox_VerticalLineBrush" Color="{ThemeResource DividerStrokeColorDefault}" />
<StaticResource x:Key="HexBox_ControlBorderBrush" ResourceKey="TextControlElevationBorderBrush" />
<StaticResource x:Key="HexBox_ControlBorderFocusedBrush" ResourceKey="TextControlElevationBorderFocusedBrush" />
<Thickness x:Key="HexBox_ControlBorderThickness">1</Thickness>
<Thickness x:Key="HexBox_ControlBorderFocusedThickness">1,1,1,2</Thickness>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<SolidColorBrush x:Key="HexBox_SelectionTextBrush" Color="{ThemeResource SystemColorHighlightTextColor}" />
<SolidColorBrush x:Key="HexBox_SelectionBackgroundBrush" Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="HexBox_VerticalLineBrush" Color="{ThemeResource SystemColorWindowTextColor}" />
<LinearGradientBrush x:Key="HexBox_ControlBorderBrush" StartPoint="0,0" EndPoint="1,1">
<GradientStop Offset="0" Color="{ThemeResource SystemColorButtonTextColor}" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="HexBox_ControlBorderFocusedBrush" StartPoint="0,0" EndPoint="1,1">
<GradientStop Offset="0" Color="{ThemeResource SystemColorHighlightColor}" />
</LinearGradientBrush>
<Thickness x:Key="HexBox_ControlBorderThickness">1</Thickness>
<Thickness x:Key="HexBox_ControlBorderFocusedThickness">2</Thickness>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@@ -0,0 +1,43 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// <history>
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
// </history>
namespace RegistryPreviewUILib.HexBox
{
/// <summary>
/// Enumerates the address column formatting options.
/// </summary>
public enum AddressFormat
{
/// <summary>
/// 16 bit HEX address "0000".
/// </summary>
Address16,
/// <summary>
/// 24 bit HEX address "00:0000".
/// </summary>
Address24,
/// <summary>
/// 32 bit HEX address "0000:0000".
/// </summary>
Address32,
/// <summary>
/// 48 bit HEX address "0000:00000000".
/// </summary>
Address48,
/// <summary>
/// 64 bit HEX address "00000000:00000000".
/// </summary>
Address64,
}
}

View File

@@ -0,0 +1,43 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// <history>
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
// </history>
using System;
using System.Windows.Input;
namespace RegistryPreviewUILib.HexBox
{
public class RelayCommand : ICommand
{
private readonly Action<object> _execute;
private readonly Func<object, bool> _canExecute;
public RelayCommand(Action<object> execute, Func<object, bool> canExecute = null)
{
_execute = execute;
_canExecute = canExecute;
}
public event EventHandler CanExecuteChanged;
public bool CanExecute(object parameter)
{
return _canExecute == null || _canExecute(parameter);
}
public void Execute(object parameter)
{
_execute(parameter);
}
public void RaiseCanExecuteChanged()
{
CanExecuteChanged?.Invoke(this, EventArgs.Empty);
}
}
}

View File

@@ -0,0 +1,28 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// <history>
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
// </history>
namespace RegistryPreviewUILib.HexBox
{
/// <summary>
/// Enumerates the format to display integral data in.
/// </summary>
public enum DataFormat
{
/// <summary>
/// Display the data in decimal format.
/// </summary>
Decimal,
/// <summary>
/// Display the data in hexadecimal format.
/// </summary>
Hexadecimal,
}
}

View File

@@ -0,0 +1,28 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// <history>
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
// </history>
namespace RegistryPreviewUILib.HexBox
{
/// <summary>
/// Enumerates the signedness of the data to display.
/// </summary>
public enum DataSignedness
{
/// <summary>
/// Display the data as signed values.
/// </summary>
Signed,
/// <summary>
/// Display the data as unsigned values.
/// </summary>
Unsigned,
}
}

View File

@@ -0,0 +1,43 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// <history>
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
// </history>
namespace RegistryPreviewUILib.HexBox
{
/// <summary>
/// Enumerates how the data (bytes read from the buffer) is to be interpreted when displayed.
/// </summary>
public enum DataType
{
/// <summary>
/// Display the data as integral (integer) values.
/// </summary>
Int_1 = 1,
/// <summary>
/// Display the data as integral (integer) values.
/// </summary>
Int_2 = 2,
/// <summary>
/// Display the data as integral (integer) values.
/// </summary>
Int_4 = 4,
/// <summary>
/// Display the data as integral (integer) values.
/// </summary>
Int_8 = 8,
/// <summary>
/// Display the data as floating point values.
/// </summary>
Float_32 = 32,
/// <summary>
/// Display the data as floating point values.
/// </summary>
Float_64 = 64,
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,231 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// <history>
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
// </history>
namespace RegistryPreviewUILib.HexBox.Library.EndianConvert
{
using System;
using System.IO;
using System.Text;
/// <summary>
/// Reads primitive data types as binary values in a specific encoding and endianness.
/// </summary>
public class EndianBinaryReader : BinaryReader
{
/// <summary>
/// Initializes a new instance of the <see cref="EndianBinaryReader"/> class based on the specified stream, endianness, and using UTF-8
/// encoding.
/// </summary>
///
/// <param name="input">
/// The input stream.
/// </param>
///
/// <param name="endianness">
/// The endianness of the data in the input stream.
/// </param>
///
/// <exception cref="System.ArgumentException">
/// The stream does not support reading, is null, or is already closed.
/// </exception>
public EndianBinaryReader(Stream input, Endianness endianness)
: this(input, endianness, Encoding.UTF8)
{
// Void
}
/// <summary>
/// Initializes a new instance of the <see cref="EndianBinaryReader"/> class based on the specified stream, endianness, and character
/// encoding.
/// </summary>
///
/// <param name="input">
/// The input stream.
/// </param>
///
/// <param name="endianness">
/// The endianness of the data in the input stream.
/// </param>
///
/// <param name="encoding">
/// The character encoding to use.
/// </param>
///
/// <exception cref="System.ArgumentException">
/// The stream does not support reading, is null, or is already closed.
/// </exception>
public EndianBinaryReader(Stream input, Endianness endianness, Encoding encoding)
: this(input, endianness, encoding, false)
{
// Void
}
/// <summary>
/// Initializes a new instance of the <see cref="EndianBinaryReader"/> class based on the specified stream, endianness, and character
/// encoding, and optionally leaves the stream open.
/// </summary>
///
/// <param name="input">
/// The input stream.
/// </param>
///
/// <param name="endianness">
/// The endianness of the data in the input stream.
/// </param>
///
/// <param name="encoding">
/// The character encoding to use.
/// </param>
///
/// <param name="leaveOpen">
/// <c>true</c> to leave the stream open after the <see cref="EndianBinaryReader"/> object is disposed; <c>false</c> otherwise.
/// </param>
///
/// <exception cref="System.ArgumentException">
/// The stream does not support reading, is null, or is already closed.
/// </exception>
public EndianBinaryReader(Stream input, Endianness endianness, Encoding encoding, bool leaveOpen)
: base(input, encoding, leaveOpen)
{
Endianness = endianness;
}
/// <summary>
/// Gets the endianness of the data in the input stream.
/// </summary>
public Endianness Endianness
{
get;
}
/// <summary>
/// Reads a decimal value from the current stream and advances the current position of the stream by sixteen bytes.
/// </summary>
///
/// <returns>
/// A decimal value read from the current stream.
/// </returns>
public override decimal ReadDecimal()
{
throw new NotImplementedException();
}
/// <summary>
/// Reads an 8-byte floating point value from the current stream and advances the current position of the stream by eight bytes.
/// </summary>
///
/// <returns>
/// An 8-byte floating point value read from the current stream.
/// </returns>
public override double ReadDouble()
{
throw new NotImplementedException();
}
/// <summary>
/// Reads a 2-byte signed integer from the current stream and advances the current position of the stream by two bytes.
/// </summary>
///
/// <returns>
/// A 2-byte signed integer read from the current stream.
/// </returns>
public override short ReadInt16()
{
return EndianBitConverter.Convert(base.ReadInt16(), Endianness);
}
/// <summary>
/// Reads a 4-byte signed integer from the current stream and advances the current position of the stream by four bytes.
/// </summary>
///
/// <returns>
/// A 4-byte signed integer read from the current stream.
/// </returns>
public override int ReadInt32()
{
return EndianBitConverter.Convert(base.ReadInt32(), Endianness);
}
/// <summary>
/// Reads an 8-byte signed integer from the current stream and advances the current position of the stream by eight bytes.
/// </summary>
///
/// <returns>
/// An 8-byte signed integer read from the current stream.
/// </returns>
public override long ReadInt64()
{
return EndianBitConverter.Convert(base.ReadInt64(), Endianness);
}
/// <summary>
/// Reads a 4-byte floating point value from the current stream and advances the current position of the stream by four bytes.
/// </summary>
///
/// <returns>
/// A 4-byte floating point value read from the current stream.
/// </returns>
public override float ReadSingle()
{
throw new NotImplementedException();
}
/// <summary>
/// Reads a string from the current stream. The string is prefixed with the length, encoded as an integer seven bits at a time.
/// </summary>
///
/// <returns>
/// The string being read.
/// </returns>
public override string ReadString()
{
throw new NotImplementedException();
}
/// <summary>
/// Reads a 2-byte unsigned integer from the current stream using little-endian encoding and advances the position of the stream by
/// two bytes.
/// </summary>
///
/// <returns>
/// A 2-byte unsigned integer read from this stream.
/// </returns>
public override ushort ReadUInt16()
{
return EndianBitConverter.Convert(base.ReadUInt16(), Endianness);
}
/// <summary>
/// Reads a 4-byte unsigned integer from the current stream using little-endian encoding and advances the position of the stream by
/// four bytes.
/// </summary>
///
/// <returns>
/// A 4-byte unsigned integer read from this stream.
/// </returns>
public override uint ReadUInt32()
{
return EndianBitConverter.Convert(base.ReadUInt32(), Endianness);
}
/// <summary>
/// Reads an 8-byte unsigned integer from the current stream using little-endian encoding and advances the position of the stream by
/// eight bytes.
/// </summary>
///
/// <returns>
/// An 8-byte unsigned integer read from this stream.
/// </returns>
public override ulong ReadUInt64()
{
return EndianBitConverter.Convert(base.ReadUInt64(), Endianness);
}
}
}

View File

@@ -0,0 +1,186 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// <history>
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
// </history>
namespace RegistryPreviewUILib.HexBox.Library.EndianConvert
{
using System;
/// <summary>
/// Converts integral values to the native endianness of this computer architecture.
/// </summary>
public static class EndianBitConverter
{
/// <summary>
/// Gets the native endianness of this computer architecture.
/// </summary>
public static readonly Endianness NativeEndianness = BitConverter.IsLittleEndian ? Endianness.LittleEndian : Endianness.BigEndian;
/// <summary>
/// Converts a value from the specified endianness to the native endianness.
/// </summary>
///
/// <param name="value">
/// The value to convert.
/// </param>
///
/// <param name="endianness">
/// The endianness of <paramref name="value"/>.
/// </param>
///
/// <returns>
/// The value converted from the specified endianness to the native endianness (<see cref="NativeEndianness"/>).
/// </returns>
public static ushort Convert(ushort value, Endianness endianness)
{
if (endianness == NativeEndianness)
{
return value;
}
else
{
unchecked
{
return (ushort)((value & 0x00FFU) << 8 |
(value & 0xFF00U) >> 8);
}
}
}
/// <summary>
/// Converts a value from the specified endianness to the native endianness.
/// </summary>
///
/// <param name="value">
/// The value to convert.
/// </param>
///
/// <param name="endianness">
/// The endianness of <paramref name="value"/>.
/// </param>
///
/// <returns>
/// The value converted from the specified endianness to the native endianness (<see cref="NativeEndianness"/>).
/// </returns>
public static uint Convert(uint value, Endianness endianness)
{
if (endianness == NativeEndianness)
{
return value;
}
else
{
unchecked
{
return (value & 0x000000FFU) << 24 |
(value & 0xFF000000U) >> 24 |
(value & 0x0000FF00U) << 8 |
(value & 0x00FF0000U) >> 8;
}
}
}
/// <summary>
/// Converts a value from the specified endianness to the native endianness.
/// </summary>
///
/// <param name="value">
/// The value to convert.
/// </param>
///
/// <param name="endianness">
/// The endianness of <paramref name="value"/>.
/// </param>
///
/// <returns>
/// The value converted from the specified endianness to the native endianness (<see cref="NativeEndianness"/>).
/// </returns>
public static ulong Convert(ulong value, Endianness endianness)
{
if (endianness == NativeEndianness)
{
return value;
}
else
{
unchecked
{
return (value & 0x00000000000000FFUL) << 56 |
(value & 0xFF00000000000000UL) >> 56 |
(value & 0x000000000000FF00UL) << 40 |
(value & 0x00FF000000000000UL) >> 40 |
(value & 0x0000000000FF0000UL) << 24 |
(value & 0x0000FF0000000000UL) >> 24 |
(value & 0x00000000FF000000UL) << 8 |
(value & 0x000000FF00000000UL) >> 8;
}
}
}
/// <summary>
/// Converts a value from the specified endianness to the native endianness.
/// </summary>
///
/// <param name="value">
/// The value to convert.
/// </param>
///
/// <param name="endianness">
/// The endianness of <paramref name="value"/>.
/// </param>
///
/// <returns>
/// The value converted from the specified endianness to the native endianness (<see cref="NativeEndianness"/>).
/// </returns>
public static short Convert(short value, Endianness endianness)
{
return (short)Convert((ushort)value, endianness);
}
/// <summary>
/// Converts a value from the specified endianness to the native endianness.
/// </summary>
///
/// <param name="value">
/// The value to convert.
/// </param>
///
/// <param name="endianness">
/// The endianness of <paramref name="value"/>.
/// </param>
///
/// <returns>
/// The value converted from the specified endianness to the native endianness (<see cref="NativeEndianness"/>).
/// </returns>
public static int Convert(int value, Endianness endianness)
{
return (int)Convert((uint)value, endianness);
}
/// <summary>
/// Converts a value from the specified endianness to the native endianness.
/// </summary>
///
/// <param name="value">
/// The value to convert.
/// </param>
///
/// <param name="endianness">
/// The endianness of <paramref name="value"/>.
/// </param>
///
/// <returns>
/// The value converted from the specified endianness to the native endianness (<see cref="NativeEndianness"/>).
/// </returns>
public static long Convert(long value, Endianness endianness)
{
return (long)Convert((ulong)value, endianness);
}
}
}

View File

@@ -0,0 +1,28 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// <history>
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
// </history>
namespace RegistryPreviewUILib.HexBox.Library.EndianConvert
{
/// <summary>
/// Represents the endianness of a value in a computer architecture.
/// </summary>
public enum Endianness
{
/// <summary>
/// Most significant byte first.
/// </summary>
BigEndian,
/// <summary>
/// Least significant byte first.
/// </summary>
LittleEndian,
}
}

View File

@@ -0,0 +1,60 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// <history>
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
// </history>
namespace RegistryPreviewUILib.HexBox.Library.EndianConvert
{
using System;
/// <summary>
/// The exception that is thrown when an input file or a data stream is malformed.
/// </summary>
[Serializable]
public sealed class FileFormatException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="FileFormatException"/> class.
/// </summary>
public FileFormatException()
{
// Void
}
/// <summary>
/// Initializes a new instance of the <see cref="FileFormatException"/> class with a specified error message.
/// </summary>
///
/// <param name="message">
/// The message that describes the error.
/// </param>
public FileFormatException(string message)
: base(message)
{
// Void
}
/// <summary>
/// Initializes a new instance of the <see cref="FileFormatException"/> class with a specified error message and a reference to the inner
/// exception that is the cause of this exception.
/// </summary>
///
/// <param name="message">
/// The message that describes the error.
/// </param>
///
/// <param name="innerException">
/// The exception that is the cause of the current exception, or a null reference if no inner exception is specified.
/// </param>
public FileFormatException(string message, Exception innerException)
: base(message, innerException)
{
// Void
}
}
}

View File

@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// <history>
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
// </history>
namespace RegistryPreviewUILib.HexBox
{
/// <summary>
/// Enumerates the text section encodings/formats that the control is able to display.
/// </summary>
public enum TextFormat
{
/// <summary>
/// Display data in ASCII (ISO-8859-1) encoding.
/// </summary>
Ascii,
}
}

View File

@@ -0,0 +1,170 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:convert="using:CommunityToolkit.WinUI.Converters"
xmlns:local="using:RegistryPreviewUILib.HexBox"
xmlns:skia="using:SkiaSharp.Views.Windows">
<Style TargetType="local:HexBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:HexBox">
<Grid
Margin="{TemplateBinding Margin}"
Padding="4"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
IsTabStop="False">
<Grid.Resources>
<convert:BoolNegationConverter x:Key="BoolNegationConverter" />
<local:BigEndianConverter x:Key="BigEndianConverter" />
<local:HexboxDataFormatConverter x:Key="HexboxDataFormatConverter" />
<local:HexboxDataSignednessConverter x:Key="HexboxDataSignednessConverter" />
<local:HexboxDataFormatBoolConverter x:Key="HexboxDataFormatBoolConverter" />
<local:HexboxDataTypeConverter x:Key="HexboxDataTypeConverter" />
<MenuFlyout x:Key="DataMenuFlyout">
<!-- New code for PowerToys implementation -->
<MenuFlyoutItem
x:Uid="/PowerToys.RegistryPreviewUILib/Resources/HexBox_CopyCommand"
Command="{Binding CopyCommand, RelativeSource={RelativeSource Mode=TemplatedParent}}"
Icon="Copy">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator Key="C" Modifiers="Control" />
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
<MenuFlyoutItem
x:Uid="/PowerToys.RegistryPreviewUILib/Resources/HexBox_CopyTextCommand"
Command="{Binding CopyTextCommand, RelativeSource={RelativeSource Mode=TemplatedParent}}"
Icon="Font">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator Key="C" Modifiers="Control,Shift" />
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
<MenuFlyoutItem
x:Uid="/PowerToys.RegistryPreviewUILib/Resources/HexBox_SelectAllCommand"
Command="{Binding SelectAllCommand, RelativeSource={RelativeSource Mode=TemplatedParent}}"
Icon="SelectAll">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator Key="A" Modifiers="Control" />
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
<!-- Original source code from HexBox.WinUI.HexBox
<MenuFlyoutItem
Command="{Binding CopyCommand, RelativeSource={RelativeSource Mode=TemplatedParent}}"
Icon="Copy"
Text="Copy">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator Key="C" Modifiers="Control" />
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
<MenuFlyoutItem
Command="{Binding CopyTextCommand, RelativeSource={RelativeSource Mode=TemplatedParent}}"
Icon="Font"
Text="Copy text">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator Key="C" Modifiers="Control,Shift"/>
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
<MenuFlyoutItem
Command="{Binding SelectAllCommand, RelativeSource={RelativeSource Mode=TemplatedParent}}"
Icon="SelectAll"
Text="Select all">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator Key="A" Modifiers="Control" />
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
<MenuFlyoutSeparator />
<MenuFlyoutSubItem IsEnabled="{Binding EnforceProperties, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}" Text="Address properties">
<ToggleMenuFlyoutItem IsChecked="{Binding ShowAddress, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource BoolNegationConverter}}" Text="No Address" />
</MenuFlyoutSubItem>
<MenuFlyoutSubItem IsEnabled="{Binding EnforceProperties, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}" Text="Data properties">
<ToggleMenuFlyoutItem IsChecked="{Binding ShowData, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource BoolNegationConverter}}" Text="No Data" />
<RadioMenuFlyoutItem
GroupName="DataType"
IsChecked="{Binding DataType, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataTypeConverter}, ConverterParameter=Int_1}"
IsEnabled="{Binding ShowData, RelativeSource={RelativeSource Mode=TemplatedParent}}"
Text="1 byte-integer" />
<RadioMenuFlyoutItem
GroupName="DataType"
IsChecked="{Binding DataType, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataTypeConverter}, ConverterParameter=Int_2}"
IsEnabled="{Binding ShowData, RelativeSource={RelativeSource Mode=TemplatedParent}}"
Text="2 byte-integer" />
<RadioMenuFlyoutItem
GroupName="DataType"
IsChecked="{Binding DataType, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataTypeConverter}, ConverterParameter=Int_4}"
IsEnabled="{Binding ShowData, RelativeSource={RelativeSource Mode=TemplatedParent}}"
Text="4 byte-integer" />
<RadioMenuFlyoutItem
GroupName="DataType"
IsChecked="{Binding DataType, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataTypeConverter}, ConverterParameter=Int_8}"
IsEnabled="{Binding ShowData, RelativeSource={RelativeSource Mode=TemplatedParent}}"
Text="8 byte-integer" />
<RadioMenuFlyoutItem
GroupName="DataType"
IsChecked="{Binding DataType, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataTypeConverter}, ConverterParameter=Float_32}"
IsEnabled="{Binding ShowData, RelativeSource={RelativeSource Mode=TemplatedParent}}"
Text="32-bit Floating Point" />
<RadioMenuFlyoutItem
GroupName="DataType"
IsChecked="{Binding DataType, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataTypeConverter}, ConverterParameter=Float_64}"
IsEnabled="{Binding ShowData, RelativeSource={RelativeSource Mode=TemplatedParent}}"
Text="64-bit Floating Point" />
<MenuFlyoutSeparator />
<ToggleMenuFlyoutItem
IsChecked="{Binding DataSignedness, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataSignednessConverter}, ConverterParameter=Signed}"
IsEnabled="{Binding DataFormat, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource HexboxDataFormatBoolConverter}, ConverterParameter={Binding DataFormat}}"
Text="Signed" />
<ToggleMenuFlyoutItem
IsChecked="{Binding DataSignedness, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataSignednessConverter}, ConverterParameter=Unsigned}"
IsEnabled="{Binding DataFormat, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource HexboxDataFormatBoolConverter}, ConverterParameter={Binding DataFormat}}"
Text="Unsigned" />
<MenuFlyoutSeparator />
<ToggleMenuFlyoutItem IsChecked="{Binding DataFormat, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataFormatConverter}, ConverterParameter=Decimal}" Text="Decimal" />
<ToggleMenuFlyoutItem IsChecked="{Binding DataFormat, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataFormatConverter}, ConverterParameter=Hexadecimal}" Text="Hexadecimal" />
<MenuFlyoutSeparator />
<ToggleMenuFlyoutItem IsChecked="{Binding Endianness, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource BigEndianConverter}, ConverterParameter=BigEndian}" Text="Big-Endian" />
<ToggleMenuFlyoutItem IsChecked="{Binding Endianness, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource BigEndianConverter}, ConverterParameter=LittleEndian}" Text="Little-Endian" />
</MenuFlyoutSubItem>
<MenuFlyoutSubItem IsEnabled="{Binding EnforceProperties, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}" Text="Text properties">
<ToggleMenuFlyoutItem IsChecked="{Binding ShowText, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource BoolNegationConverter}}" Text="No Text" />
<ToggleMenuFlyoutItem
IsChecked="{Binding ShowText, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}"
IsEnabled="False"
Text="ASCII" />
</MenuFlyoutSubItem>-->
</MenuFlyout>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="24" />
</Grid.ColumnDefinitions>
<skia:SKXamlCanvas
Name="ElementCanvas"
Grid.Column="0"
Margin="2,0,2,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ContextFlyout="{StaticResource DataMenuFlyout}" />
<ScrollBar
Name="ElementScrollBar"
Grid.Column="1"
Margin="0,0,2,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
IndicatorMode="MouseIndicator"
Orientation="Vertical" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@@ -0,0 +1,264 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// <history>
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
// </history>
#pragma warning disable SA1210 // Using directives should be ordered alphabetically by namespace
#pragma warning disable SA1208 // System using directives should be placed before other using directives
using RegistryPreviewUILib.HexBox.Library.EndianConvert;
using Microsoft.UI.Xaml.Data;
using System;
#pragma warning restore SA1208 // System using directives should be placed before other using directives
#pragma warning restore SA1210 // Using directives should be ordered alphabetically by namespace
namespace RegistryPreviewUILib.HexBox
{
public partial class HexboxDataTypeConverter : IValueConverter
{
/// <summary>
/// Convert a DataType value to its negation.
/// </summary>
/// <param name="value">The <see cref="DataType"/> value to negate.</param>
/// <param name="targetType">The type of the target property, as a type reference.</param>
/// <param name="parameter">Optional parameter. Not used.</param>
/// <param name="language">The language of the conversion. Not used</param>
/// <returns>The value to be passed to the target dependency property.</returns>
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is DataType b)
{
if (parameter is string c)
{
return c == b.ToString();
}
}
throw new NotImplementedException();
}
/// <summary>
/// Convert back a DataType value to its negation.
/// </summary>
/// <param name="value">The <see cref="DataType"/> value to negate.</param>
/// <param name="targetType">The type of the target property, as a type reference.</param>
/// <param name="parameter">Optional parameter. Not used.</param>
/// <param name="language">The language of the conversion. Not used</param>
/// <returns>The value to be passed to the target dependency property.</returns>
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
if (value is bool b && parameter is string c)
{
if(c == "Int_1")
{
return DataType.Int_1;
}
else if (c == "Int_2")
{
return DataType.Int_2;
}
else if (c == "Int_4")
{
return DataType.Int_4;
}
else if (c == "Int_8")
{
return DataType.Int_8;
}
else if (c == "Float_32")
{
return DataType.Float_32;
}
else /*if (c == "Float_64")*/
{
return DataType.Float_64;
}
}
throw new NotImplementedException();
}
}
public class HexboxDataSignednessConverter : IValueConverter
{
/// <summary>
/// Convert a DataSignedness value to its negation.
/// </summary>
/// <param name="value">The <see cref="DataSignedness"/> value to negate.</param>
/// <param name="targetType">The type of the target property, as a type reference.</param>
/// <param name="parameter">Optional parameter. Not used.</param>
/// <param name="language">The language of the conversion. Not used</param>
/// <returns>The value to be passed to the target dependency property.</returns>
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is DataSignedness b)
{
if (parameter is string c)
{
var end = c == "Signed" ? DataSignedness.Signed : DataSignedness.Unsigned;
return (b == end);
}
}
throw new NotImplementedException();
}
/// <summary>
/// Convert back a DataSignedness value to its negation.
/// </summary>
/// <param name="value">The <see cref="DataSignedness"/> value to negate.</param>
/// <param name="targetType">The type of the target property, as a type reference.</param>
/// <param name="parameter">Optional parameter. Not used.</param>
/// <param name="language">The language of the conversion. Not used</param>
/// <returns>The value to be passed to the target dependency property.</returns>
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
if (value is bool b && parameter is string c)
{
var end = c == "Signed" ? DataSignedness.Signed : DataSignedness.Unsigned;
if (b)
{
return end;
}
else
{
return c == "Signed" ? DataSignedness.Unsigned : DataSignedness.Signed;
}
}
throw new NotImplementedException();
}
}
public class HexboxDataFormatBoolConverter : IValueConverter
{
/// <summary>
/// Convert a DataFormat value to its negation.
/// </summary>
/// <param name="value">The <see cref="DataFormat"/> value to negate.</param>
/// <param name="targetType">The type of the target property, as a type reference.</param>
/// <param name="parameter">Optional parameter. Not used.</param>
/// <param name="language">The language of the conversion. Not used</param>
/// <returns>The value to be passed to the target dependency property.</returns>
public object Convert(object value, Type targetType, object parameter, string language)
{
if(value is DataFormat f)
{
return f != DataFormat.Hexadecimal;
}
throw new NotImplementedException();
}
/// <summary>
/// Convert back a DataFormat value to its negation.
/// </summary>
/// <param name="value">The <see cref="DataFormat"/> value to negate.</param>
/// <param name="targetType">The type of the target property, as a type reference.</param>
/// <param name="parameter">Optional parameter. Not used.</param>
/// <param name="language">The language of the conversion. Not used</param>
/// <returns>The value to be passed to the target dependency property.</returns>
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
public class HexboxDataFormatConverter : IValueConverter
{
/// <summary>
/// Convert a DataFormat value to its negation.
/// </summary>
/// <param name="value">The <see cref="DataFormat"/> value to negate.</param>
/// <param name="targetType">The type of the target property, as a type reference.</param>
/// <param name="parameter">Optional parameter. Not used.</param>
/// <param name="language">The language of the conversion. Not used</param>
/// <returns>The value to be passed to the target dependency property.</returns>
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is DataFormat b)
{
if (parameter is string c)
{
var end = c == "Decimal" ? DataFormat.Decimal: DataFormat.Hexadecimal;
return (b == end);
}
}
throw new NotImplementedException();
}
/// <summary>
/// Convert back a DataFormat value to its negation.
/// </summary>
/// <param name="value">The <see cref="DataFormat"/> value to negate.</param>
/// <param name="targetType">The type of the target property, as a type reference.</param>
/// <param name="parameter">Optional parameter. Not used.</param>
/// <param name="language">The language of the conversion. Not used</param>
/// <returns>The value to be passed to the target dependency property.</returns>
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
if (value is bool b && parameter is string c)
{
var end = c == "Decimal" ? DataFormat.Decimal : DataFormat.Hexadecimal;
if (b)
{
return end;
}
else
{
return end == DataFormat.Decimal ? DataFormat.Hexadecimal : DataFormat.Decimal;
}
}
throw new NotImplementedException();
}
}
public class BigEndianConverter : IValueConverter
{
/// <summary>
/// Convert a Endian value to its negation.
/// </summary>
/// <param name="value">The <see cref="Endian"/> value to negate.</param>
/// <param name="targetType">The type of the target property, as a type reference.</param>
/// <param name="parameter">Optional parameter. Not used.</param>
/// <param name="language">The language of the conversion. Not used</param>
/// <returns>The value to be passed to the target dependency property.</returns>
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is Endianness b)
{
if (parameter is string c)
{
var end = c == "BigEndian" ? Endianness.BigEndian : Endianness.LittleEndian;
return (b == end);
}
}
throw new NotImplementedException();
}
/// <summary>
/// Convert back a Endian value to its negation.
/// </summary>
/// <param name="value">The <see cref="Endian"/> value to negate.</param>
/// <param name="targetType">The type of the target property, as a type reference.</param>
/// <param name="parameter">Optional parameter. Not used.</param>
/// <param name="language">The language of the conversion. Not used</param>
/// <returns>The value to be passed to the target dependency property.</returns>
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
if (value is bool b && parameter is string c)
{
var end = c == "BigEndian" ? Endianness.BigEndian : Endianness.LittleEndian;
if (b)
{
return end;
}
else
{
return end == Endianness.BigEndian ? Endianness.LittleEndian : Endianness.BigEndian;
}
}
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,81 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// <history>
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
// </history>
namespace RegistryPreviewUILib.HexBox
{
using System;
/// <summary>
/// A utility class with miscellaneous methods.
/// </summary>
internal static class Utilities
{
/// <summary>
/// Clamps the <paramref name="value"/> to the range [<paramref name="min"/>, <paramref name="max"/>].
/// </summary>
///
/// <typeparam name="T">
/// The type of the value to clamp.
/// </typeparam>
///
/// <param name="value">
/// The value to clamp.
/// </param>
///
/// <param name="min">
/// The upper bound on the clamped value.
/// </param>
///
/// <param name="max">
/// The lower bound on the clmaped value.
/// </param>
///
/// <returns>
/// The nearest value of <paramref name="value"/> in the range [<paramref name="min"/>,
/// <paramref name="max"/>].
/// </returns>
public static T Clamp<T>(this T value, T min, T max)
where T : IComparable<T>
{
return value.CompareTo(min) < 0 ? min : value.CompareTo(max) > 0 ? max : value;
}
/// <summary>
/// Calculates the arithmetic modulus of <paramref name="n"/> modulo <paramref name="m"/>.
/// </summary>
///
/// <typeparam name="T">
/// The type of the values.
/// </typeparam>
///
/// <param name="n">
/// The value to compute the modulus of.
/// </param>
///
/// <param name="m">
/// The modulus.
/// </param>
///
/// <returns>
/// The non-negative value <c>r</c> such that for some integral value <c>q</c>:
/// <c><paramref name="n"/> = q*m + r</c>.
/// </returns>
public static T Mod<T>(this T n, T m)
where T : IComparable<T>
{
dynamic dn = n;
dynamic dm = m;
dynamic dr = dn % dm;
return dr.CompareTo(0) < 0 ? dr + dm : dr;
}
}
}

View File

@@ -0,0 +1,341 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Automation;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.Windows.ApplicationModel.Resources;
using Windows.Foundation.Metadata;
using HB = RegistryPreviewUILib.HexBox;
namespace RegistryPreviewUILib
{
public sealed partial class RegistryPreviewMainPage : Page
{
private static bool _isDataPreviewHexBoxLoaded;
internal async Task ShowExtendedDataPreview(string name, string type, string value)
{
// Create dialog
_isDataPreviewHexBoxLoaded = false;
var panel = new StackPanel()
{
Spacing = 16,
Padding = new Thickness(0),
};
ContentDialog contentDialog = new ContentDialog()
{
Title = resourceLoader.GetString("DataPreviewTitle") + " - " + name,
Content = panel,
CloseButtonText = resourceLoader.GetString("DataPreviewClose"),
DefaultButton = ContentDialogButton.Primary,
Padding = new Thickness(0),
};
contentDialog.Opened += ExtendedDataPreview_Opened;
// Add content based on value type
switch (type)
{
case "REG_DWORD":
case "REG_QWORD":
AddHexView(ref panel, ref resourceLoader, value);
break;
case "REG_NONE":
case "REG_BINARY":
// Convert value to BinaryReader
byte[] byteArray = Convert.FromHexString(value.Replace(" ", string.Empty));
MemoryStream memoryStream = new MemoryStream(byteArray);
BinaryReader binaryData = new BinaryReader(memoryStream);
binaryData.ReadBytes(byteArray.Length);
// Convert value to text
// For more printable asci characters the following code lines are required:
// var cpW1252 = CodePagesEncodingProvider.Instance.GetEncoding(1252);
// || b == 128 || (b >= 130 && b <= 140) || b == 142 || (b >= 145 & b <= 156) || b >= 158
// cpW1252.GetString([b]);
string binaryDataText = string.Empty;
foreach (byte b in byteArray)
{
// ASCII codes:
// 9, 10, 13: Space, Line Feed, Carriage Return
// 32-126: Printable characters
// 128, 130-140, 142, 145-156, 158-255: Extended printable characters
if (b == 9 || b == 10 || b == 13 || (b >= 32 && b <= 126))
{
binaryDataText += Convert.ToChar(b);
}
}
// Add controls
AddBinaryView(ref panel, ref resourceLoader, ref binaryData, binaryDataText);
break;
case "REG_MULTI_SZ":
var multiLineBox = new TextBox()
{
IsReadOnly = true,
AcceptsReturn = true,
TextWrapping = TextWrapping.NoWrap,
MaxHeight = 200,
FontSize = 14,
RequestedTheme = panel.ActualTheme,
Text = value,
};
ScrollViewer.SetVerticalScrollBarVisibility(multiLineBox, ScrollBarVisibility.Auto);
ScrollViewer.SetHorizontalScrollBarVisibility(multiLineBox, ScrollBarVisibility.Auto);
AutomationProperties.SetName(multiLineBox, resourceLoader.GetString("DataPreview_AutomationPropertiesName_MultilineTextValue"));
panel.Children.Add(multiLineBox);
break;
case "REG_EXPAND_SZ":
AddExpandStringView(ref panel, ref resourceLoader, value);
break;
default: // REG_SZ
var stringBox = new TextBox()
{
IsReadOnly = true,
FontSize = 14,
RequestedTheme = panel.ActualTheme,
Text = value,
};
AutomationProperties.SetName(stringBox, resourceLoader.GetString("DataPreview_AutomationPropertiesName_TextValue"));
panel.Children.Add(stringBox);
break;
}
// Use this code to associate the dialog to the appropriate AppWindow by setting
// the dialog's XamlRoot to the same XamlRoot as an element that is already present in the AppWindow.
if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8))
{
contentDialog.XamlRoot = this.Content.XamlRoot;
}
// Show dialog and wait.
ChangeCursor(gridPreview, false);
_ = await contentDialog.ShowAsync();
}
private static void AddHexView(ref StackPanel panel, ref ResourceLoader resourceLoader, string value)
{
var hexBox = new TextBox()
{
Header = resourceLoader.GetString("DataPreviewHex"),
IsReadOnly = true,
FontSize = 14,
RequestedTheme = panel.ActualTheme,
Text = value.Split(" ")[0],
};
var decimalBox = new TextBox()
{
Header = resourceLoader.GetString("DataPreviewDec"),
IsReadOnly = true,
FontSize = 14,
RequestedTheme = panel.ActualTheme,
Text = value.Split(" ")[1].TrimStart('(').TrimEnd(')'),
};
panel.Children.Add(hexBox);
panel.Children.Add(decimalBox);
}
private static void AddBinaryView(ref StackPanel panel, ref ResourceLoader resourceLoader, ref BinaryReader data, string dataText)
{
// Create SelectorBar
var navBar = new SelectorBar()
{
RequestedTheme = panel.ActualTheme,
};
navBar.SelectionChanged += BinaryPreview_SelectorChanged;
navBar.Items.Add(new SelectorBarItem()
{
Text = resourceLoader.GetString("DataPreviewDataView"),
Tag = "DataView",
FontSize = 14,
RequestedTheme = panel.ActualTheme,
IsSelected = true,
});
navBar.Items.Add(new SelectorBarItem()
{
Text = resourceLoader.GetString("DataPreviewVisibleText"),
Tag = "TextView",
FontSize = 14,
RequestedTheme = panel.ActualTheme,
IsSelected = false,
IsEnabled = !string.IsNullOrWhiteSpace(dataText),
});
// Create HexBox
var binaryPreviewBox = new HB.HexBox()
{
Height = 300,
Width = 495,
ShowAddress = true,
ShowData = true,
ShowText = true,
Columns = 8,
FontSize = 13,
RequestedTheme = panel.ActualTheme,
AddressBrush = (SolidColorBrush)Application.Current.Resources["AccentTextFillColorPrimaryBrush"],
AlternatingDataColumnTextBrush = (SolidColorBrush)Application.Current.Resources["TextFillColorSecondaryBrush"],
SelectionTextBrush = (SolidColorBrush)Application.Current.Resources["HexBox_SelectionTextBrush"],
SelectionBrush = (SolidColorBrush)Application.Current.Resources["HexBox_SelectionBackgroundBrush"],
VerticalSeparatorLineBrush = (SolidColorBrush)Application.Current.Resources["HexBox_VerticalLineBrush"],
BorderBrush = (LinearGradientBrush)Application.Current.Resources["HexBox_ControlBorderBrush"],
BorderThickness = (Thickness)Application.Current.Resources["HexBox_ControlBorderThickness"],
CornerRadius = (CornerRadius)Application.Current.Resources["ControlCornerRadius"],
DataFormat = HB.DataFormat.Hexadecimal,
DataSignedness = HB.DataSignedness.Unsigned,
DataType = HB.DataType.Int_1,
EnforceProperties = true,
Visibility = Visibility.Collapsed,
DataSource = data,
};
AutomationProperties.SetName(binaryPreviewBox, resourceLoader.GetString("DataPreview_AutomationPropertiesName_BinaryDataPreview"));
binaryPreviewBox.Loaded += BinaryPreview_HexBoxLoaded;
binaryPreviewBox.GotFocus += BinaryPreview_HexBoxFocused;
binaryPreviewBox.LostFocus += BinaryPreview_HexBoxFocusLost;
// Create TextBox
var visibleText = new TextBox()
{
IsReadOnly = true,
AcceptsReturn = true,
TextWrapping = TextWrapping.Wrap,
Height = 300,
Width = 495,
FontSize = 13,
Text = dataText,
RequestedTheme = panel.ActualTheme,
Visibility = Visibility.Collapsed,
};
AutomationProperties.SetName(visibleText, resourceLoader.GetString("DataPreview_AutomationPropertiesName_VisibleTextPreview"));
// Add controls: 0 = SelectorBar, 1 = ProgressRing, 2 = HexBox, 3 = TextBox
panel.Children.Add(navBar);
panel.Children.Add(new ProgressRing());
panel.Children.Add(binaryPreviewBox);
panel.Children.Add(visibleText);
}
private static void AddExpandStringView(ref StackPanel panel, ref ResourceLoader resourceLoader, string value)
{
var stringBoxRaw = new TextBox()
{
Header = resourceLoader.GetString("DataPreviewRawValue"),
IsReadOnly = true,
FontSize = 14,
RequestedTheme = panel.ActualTheme,
Text = value,
};
var stringBoxExp = new TextBox()
{
Header = resourceLoader.GetString("DataPreviewExpandedValue"),
IsReadOnly = true,
FontSize = 14,
RequestedTheme = panel.ActualTheme,
Text = Environment.ExpandEnvironmentVariables(value),
};
panel.Children.Add(stringBoxRaw);
panel.Children.Add(stringBoxExp);
}
private static void BinaryPreview_SelectorChanged(SelectorBar sender, SelectorBarSelectionChangedEventArgs args)
{
// Child controls: 0 = SelectorBar, 1 = ProgressRing, 2 = HexBox, 3 = TextBox
var stackPanel = sender.Parent as StackPanel;
var progressRing = (ProgressRing)stackPanel.Children[1];
var hexBox = (HB.HexBox)stackPanel.Children[2];
var textBox = (TextBox)stackPanel.Children[3];
if (sender.SelectedItem.Tag.ToString() == "DataView")
{
textBox.Visibility = Visibility.Collapsed;
if (_isDataPreviewHexBoxLoaded)
{
progressRing.Visibility = Visibility.Collapsed;
hexBox.Visibility = Visibility.Visible;
// Clear selection aligned to TextBox
hexBox.ClearSelection();
hexBox.Focus(FocusState.Programmatic);
}
else
{
hexBox.Visibility = Visibility.Collapsed;
progressRing.Visibility = Visibility.Visible;
progressRing.Focus(FocusState.Programmatic);
}
}
else
{
progressRing.Visibility = Visibility.Collapsed;
hexBox.Visibility = Visibility.Collapsed;
textBox.Visibility = Visibility.Visible;
// Workaround for wrong text selection (color) after switching back to "Visible text"
textBox.Focus(FocusState.Programmatic);
textBox.Select(0, 0);
}
}
private static void BinaryPreview_HexBoxLoaded(object sender, RoutedEventArgs e)
{
_isDataPreviewHexBoxLoaded = true;
// Child controls: 0 = SelectorBar, 1 = ProgressRing, 2 = HexBox, 3 = TextBox
var hexBox = (HB.HexBox)sender;
var stackPanel = hexBox.Parent as StackPanel;
var selectorBar = stackPanel.Children[0] as SelectorBar;
var progressRing = stackPanel.Children[1] as ProgressRing;
if (selectorBar.SelectedItem.Tag.ToString() == "DataView")
{
progressRing.Visibility = Visibility.Collapsed;
hexBox.Visibility = Visibility.Visible;
}
}
/// <summary>
/// Event handler to set correct control border if focused.
/// </summary>
private static void BinaryPreview_HexBoxFocused(object sender, RoutedEventArgs e)
{
var hexBox = (HB.HexBox)sender;
hexBox.BorderThickness = (Thickness)Application.Current.Resources["HexBox_ControlBorderFocusedThickness"];
hexBox.BorderBrush = (LinearGradientBrush)Application.Current.Resources["HexBox_ControlBorderFocusedBrush"];
}
/// <summary>
/// Event handler to set correct control border if not focused.
/// </summary>
private static void BinaryPreview_HexBoxFocusLost(object sender, RoutedEventArgs e)
{
var hexBox = (HB.HexBox)sender;
// Workaround: Verify that the newly focused control isn't the context menu of the HexBox control
if (FocusManager.GetFocusedElement(hexBox.XamlRoot).GetType() != typeof(MenuFlyoutPresenter))
{
hexBox.BorderThickness = (Thickness)Application.Current.Resources["HexBox_ControlBorderThickness"];
hexBox.BorderBrush = (LinearGradientBrush)Application.Current.Resources["HexBox_ControlBorderBrush"];
}
}
/// <summary>
/// Make sure that for REG_Binary preview the HexBox control is focused after opening.
/// </summary>
private static void ExtendedDataPreview_Opened(ContentDialog sender, ContentDialogOpenedEventArgs e)
{
// If <_isDataPreviewHexBoxLoaded == true> then we have the right content on the dialog.
if (_isDataPreviewHexBoxLoaded)
{
// Child controls: 0 = SelectorBar, 1 = ProgressRing, 2 = HexBox, 3 = TextBox
(sender.Content as StackPanel).Children[2].Focus(FocusState.Programmatic);
}
}
}
}

View File

@@ -8,7 +8,6 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using CommunityToolkit.WinUI.UI.Controls;
using Microsoft.UI.Dispatching;
using Microsoft.UI.Xaml;
@@ -415,5 +414,48 @@ namespace RegistryPreviewUILib
saveButton.IsEnabled = true;
});
}
// Commands to show data preview
public void ButtonExtendedPreview_Click(object sender, RoutedEventArgs e)
{
var data = ((Button)sender).DataContext as RegistryValue;
InvokeExtendedDataPreview(data);
}
public void MenuExtendedPreview_Click(object sender, RoutedEventArgs e)
{
var data = ((MenuFlyoutItem)sender).DataContext as RegistryValue;
InvokeExtendedDataPreview(data);
}
private async void InvokeExtendedDataPreview(RegistryValue valueData)
{
// Only one content dialog can be open at the same time and multiple instances of data preview can crash the app.
if (_dialogSemaphore.CurrentCount == 0)
{
return;
}
try
{
// Lock ui and request dialog lock
_dialogSemaphore.Wait();
ChangeCursor(gridPreview, true);
await ShowExtendedDataPreview(valueData.Name, valueData.Type, valueData.Value);
}
catch
{
#if DEBUG
throw;
#endif
}
finally
{
// Unblock ui and release dialog lock
ChangeCursor(gridPreview, false);
_dialogSemaphore.Release();
}
}
}
}

View File

@@ -503,6 +503,7 @@ namespace RegistryPreviewUILib
case "REG_NONE":
if (value.Length <= 0)
{
registryValue.IsEmptyBinary = true;
value = resourceLoader.GetString("ZeroLength");
}
else

View File

@@ -2,6 +2,7 @@
x:Class="RegistryPreviewUILib.RegistryPreviewMainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converter="using:CommunityToolkit.WinUI.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:RegistryPreviewUILib"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -10,6 +11,12 @@
xmlns:ui="using:CommunityToolkit.WinUI"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<converter:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
</ResourceDictionary>
</Page.Resources>
<Grid
x:Name="gridPreview"
Grid.Row="1"
@@ -178,7 +185,7 @@
Spacing="8">
<StackPanel.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem x:Uid="ContextMenu_CopyName" Command="{Binding Content.CopyToClipboardName_Click}" />
<MenuFlyoutItem x:Uid="ContextMenu_CopyKeyName" Command="{Binding Content.CopyToClipboardName_Click}" />
<MenuFlyoutItem x:Uid="ContextMenu_CopyKeyPath" Command="{Binding Content.CopyToClipboardKeyPath_Click}" />
</MenuFlyout>
</StackPanel.ContextFlyout>
@@ -225,10 +232,18 @@
Spacing="8">
<StackPanel.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem x:Uid="ContextMenu_CopyName" Command="{Binding CopyToClipboardName_Click}" />
<MenuFlyoutSeparator />
<MenuFlyoutItem
x:Uid="ContextMenu_CopyName"
Command="{Binding CopyToClipboardName_Click}"
Icon="Copy" />
<MenuFlyoutItem x:Uid="ContextMenu_CopyValue" Command="{Binding CopyToClipboardEntry_Click}" />
<MenuFlyoutItem x:Uid="ContextMenu_CopyValueWithPath" Command="{Binding CopyToClipboardWithPath_Click}" />
<MenuFlyoutSeparator />
<MenuFlyoutItem
x:Uid="ContextMenu_DataPreview"
Click="MenuExtendedPreview_Click"
Icon="Zoom"
IsEnabled="{Binding ShowPreviewButton}" />
</MenuFlyout>
</StackPanel.ContextFlyout>
<Image
@@ -255,10 +270,18 @@
<Setter Property="ContextFlyout">
<Setter.Value>
<MenuFlyout>
<MenuFlyoutItem x:Uid="ContextMenu_CopyType" Command="{Binding CopyToClipboardType_Click}" />
<MenuFlyoutSeparator />
<MenuFlyoutItem
x:Uid="ContextMenu_CopyType"
Command="{Binding CopyToClipboardType_Click}"
Icon="Copy" />
<MenuFlyoutItem x:Uid="ContextMenu_CopyValue" Command="{Binding CopyToClipboardEntry_Click}" />
<MenuFlyoutItem x:Uid="ContextMenu_CopyValueWithPath" Command="{Binding CopyToClipboardWithPath_Click}" />
<MenuFlyoutSeparator />
<MenuFlyoutItem
x:Uid="ContextMenu_DataPreview"
Click="MenuExtendedPreview_Click"
Icon="Zoom"
IsEnabled="{Binding ShowPreviewButton}" />
</MenuFlyout>
</Setter.Value>
</Setter>
@@ -274,20 +297,36 @@
<StackPanel
Margin="4"
VerticalAlignment="Center"
Orientation="Horizontal">
Orientation="Horizontal"
Spacing="6">
<StackPanel.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem x:Uid="ContextMenu_CopyData" Command="{Binding CopyToClipboardData_Click}" />
<MenuFlyoutSeparator />
<MenuFlyoutItem
x:Uid="ContextMenu_CopyData"
Command="{Binding CopyToClipboardData_Click}"
Icon="Copy" />
<MenuFlyoutItem x:Uid="ContextMenu_CopyValue" Command="{Binding CopyToClipboardEntry_Click}" />
<MenuFlyoutItem x:Uid="ContextMenu_CopyValueWithPath" Command="{Binding CopyToClipboardWithPath_Click}" />
<MenuFlyoutSeparator />
<MenuFlyoutItem
x:Uid="ContextMenu_DataPreview"
Click="MenuExtendedPreview_Click"
Icon="Zoom"
IsEnabled="{Binding ShowPreviewButton}" />
</MenuFlyout>
</StackPanel.ContextFlyout>
<Button
x:Uid="ShowDataPreviewButton"
Padding="2"
Click="ButtonExtendedPreview_Click"
Content="&#xe71e;"
FontFamily="{StaticResource SymbolThemeFontFamily}"
Visibility="{Binding ShowPreviewButton, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
<TextBlock
VerticalAlignment="Center"
IsTabStop="False"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding ValueOneLine}"
ToolTipService.ToolTip="{Binding Value}" />
Text="{Binding ValueOneLine}" />
</StackPanel>
</DataTemplate>
</tk7controls:DataGridTemplateColumn.CellTemplate>

View File

@@ -40,7 +40,9 @@
</ItemGroup>
<ItemGroup>
<None Remove="MonacoEditorControl.xaml" />
<None Remove="Controls\MonacoEditor\MonacoEditorControl.xaml" />
<None Remove="Controls\HexBox\Themes\Generic.xaml" />
<None Remove="Themes\Generic.xaml" />
</ItemGroup>
<ItemGroup>
@@ -51,6 +53,7 @@
<PackageReference Include="CommunityToolkit.WinUI.Extensions" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
<PackageReference Include="Microsoft.WindowsAppSDK" />
<PackageReference Include="SkiaSharp.Views.WinUI" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
@@ -59,10 +62,21 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Page Update="MonacoEditorControl.xaml">
<Page Update="Controls\MonacoEditor\MonacoEditorControl.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="Controls\HexBox\Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Folder Include="Controls\MonacoEditor\" />
<Folder Include="Controls\HexBox\" />
</ItemGroup>
</Project>

View File

@@ -6,7 +6,6 @@ using System;
using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
using Microsoft.UI.Xaml;
using Windows.ApplicationModel.DataTransfer;
namespace RegistryPreviewUILib
{
@@ -29,6 +28,8 @@ namespace RegistryPreviewUILib
public string Value { get; set; }
public bool IsEmptyBinary { private get; set; }
public string ValueOneLine => Value.Replace('\r', ' ');
public string ToolTipText { get; set; }
@@ -54,6 +55,10 @@ namespace RegistryPreviewUILib
}
}
public bool ShowPreviewButton =>
Type != "ERROR" && Type != string.Empty &&
Value != string.Empty && IsEmptyBinary != true;
public RegistryValue(string name, string type, string value, string key)
{
this.Name = name;

View File

@@ -277,16 +277,20 @@
<value>Copy path</value>
<comment>Like "Copy item"</comment>
</data>
<data name="ContextMenu_CopyName.Text" xml:space="preserve">
<data name="ContextMenu_CopyKeyName.Text" xml:space="preserve">
<value>Copy name</value>
<comment>Like "Copy item"</comment>
</data>
<data name="ContextMenu_CopyName.Text" xml:space="preserve">
<value>Copy</value>
<comment>Like "Copy item"</comment>
</data>
<data name="ContextMenu_CopyType.Text" xml:space="preserve">
<value>Copy type</value>
<value>Copy</value>
<comment>Like "Copy item"</comment>
</data>
<data name="ContextMenu_CopyData.Text" xml:space="preserve">
<value>Copy data</value>
<value>Copy</value>
<comment>Like "Copy item"</comment>
</data>
<data name="ContextMenu_CopyValue.Text" xml:space="preserve">
@@ -297,6 +301,65 @@
<value>Copy value with key path</value>
<comment>Like "Copy item"</comment>
</data>
<data name="ShowDataPreviewButton.ToolTipService.ToolTip" xml:space="preserve">
<value>Show extended preview</value>
</data>
<data name="ShowDataPreviewButton.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Show extended preview</value>
</data>
<data name="DataPreviewTitle" xml:space="preserve">
<value>View data</value>
</data>
<data name="DataPreviewClose" xml:space="preserve">
<value>Close</value>
<comment>like "Close window"</comment>
</data>
<data name="DataPreviewHex" xml:space="preserve">
<value>Hexadecimal</value>
</data>
<data name="DataPreviewDec" xml:space="preserve">
<value>Decimal</value>
</data>
<data name="DataPreviewRawValue" xml:space="preserve">
<value>Raw value</value>
</data>
<data name="DataPreviewExpandedValue" xml:space="preserve">
<value>Expanded value</value>
</data>
<data name="DataPreviewVisibleText" xml:space="preserve">
<value>Readable text</value>
<comment>Means text that is human readable and not only control characters.</comment>
</data>
<data name="DataPreviewDataView" xml:space="preserve">
<value>Data</value>
<comment>Like "binary data"</comment>
</data>
<data name="DataPreview_AutomationPropertiesName_MultilineTextValue" xml:space="preserve">
<value>Multiline text value</value>
</data>
<data name="DataPreview_AutomationPropertiesName_TextValue" xml:space="preserve">
<value>Text value</value>
</data>
<data name="DataPreview_AutomationPropertiesName_BinaryDataPreview" xml:space="preserve">
<value>Binary data preview</value>
</data>
<data name="DataPreview_AutomationPropertiesName_VisibleTextPreview" xml:space="preserve">
<value>Preview of readable text</value>
</data>
<data name="HexBox_CopyCommand.Text" xml:space="preserve">
<value>Copy</value>
<comment>Like "copy the value"</comment>
</data>
<data name="HexBox_CopyTextCommand.Text" xml:space="preserve">
<value>Copy text</value>
<comment>Like "Copy the text"</comment>
</data>
<data name="HexBox_SelectAllCommand.Text" xml:space="preserve">
<value>Select all</value>
</data>
<data name="ContextMenu_DataPreview.Text" xml:space="preserve">
<value>Extended data preview</value>
</data>
<data name="NewButton.Label" xml:space="preserve">
<value>New</value>
</data>

Some files were not shown because too many files have changed in this diff Show More