Compare commits

..

12 Commits

Author SHA1 Message Date
vanzue
df3e3cec1b Dev 2025-07-10 17:57:48 +08:00
vanzue
ec655f7dfd try luck 2025-07-07 12:00:29 +08:00
Kai Tao
d0fcd6aebb Fix wix build (#40387)
<!-- 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:** #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-07-04 10:09:08 +08:00
Peiyao Zhao
f3c05d7e93 [Installer] Remove unused wix related files (#40350)
<!-- 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
Remove unused files when migrate to wix5.


<!-- 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-07-02 20:35:19 +08:00
Peiyao Zhao (from Dev Box)
fcdf6dab2f code update 2025-07-02 20:27:00 +08:00
Peiyao Zhao (from Dev Box)
a6abd967a6 Merge branch 'main' into feature/wix_migration 2025-07-02 11:26:13 +08:00
Peiyao Zhao (from Dev Box)
e6f574dd4d Merge branch 'main' into feature/wix_migration 2025-06-19 14:50:43 +08:00
Peiyao Zhao (from Dev Box)
6ec4f5ab0b Merge branch 'main' into feature/wix_migration 2025-05-22 14:59:48 +08:00
Peiyao Zhao (from Dev Box)
8106a82614 Merge branch 'main' into feature/wix_migration 2025-05-16 15:07:22 +08:00
Peiyao Zhao
f90fc35200 [Installer] Separate .wxs backup operation in PowerToysSetupCustomActions project (#39253) 2025-05-12 13:37:49 +08:00
Peiyao Zhao (from Dev Box)
8b651e0a2e Merge branch 'main' into feature/wix_migration 2025-05-05 11:15:28 +08:00
Peiyao Zhao
3394c756e3 [Installer] Init Wix migration project (#37652)
* fix conflict

* add .gitignore

* update expect.txt

* update

* update

* update

* fix build error

* test

* update pipeline

* fix pipeline build error

* fix spell-check

* fix pipelien build error

* fix pipeline errors

* update folder path to vnext

* fix

* revert update folder path to vnext, since this path is bound to wix tool

---------

Co-authored-by: Jerry Xu <n.xu@outlook.com>
2025-04-27 23:12:38 +08:00
428 changed files with 15026 additions and 6275 deletions

View File

@@ -53,6 +53,8 @@ YVU
YVYU
zipfolder
CODEOWNERS
VNext
vnext
# FONTS

View File

@@ -1,9 +1,6 @@
# D2D
#D?2D
# Repeated letters
\b([a-z])\g{-1}{2,}\b
# marker to ignore all code on line
^.*/\* #no-spell-check-line \*/.*$
# marker to ignore all code on line
@@ -13,9 +10,6 @@
# cspell inline
^.*\b[Cc][Ss][Pp][Ee][Ll]{2}:\s*[Dd][Ii][Ss][Aa][Bb][Ll][Ee]-[Ll][Ii][Nn][Ee]\b
# copyright
Copyright (?:\([Cc]\)|)(?:[-\d, ]|and)+(?: [A-Z][a-z]+ [A-Z][a-z]+,?)+
# patch hunk comments
^@@ -\d+(?:,\d+|) \+\d+(?:,\d+|) @@ .*
# git index header
@@ -24,9 +18,6 @@ index (?:[0-9a-z]{7,40},|)[0-9a-z]{7,40}\.\.[0-9a-z]{7,40}
# file permissions
['"`\s][-bcdLlpsw](?:[-r][-w][-Ssx]){2}[-r][-w][-SsTtx]\+?['"`\s]
# css fonts
\bfont(?:-family|):[^;}]+
# css url wrappings
\burl\([^)]+\)
@@ -38,7 +29,7 @@ index (?:[0-9a-z]{7,40},|)[0-9a-z]{7,40}\.\.[0-9a-z]{7,40}
# data url in quotes
([`'"])data:(?:[^ `'"].*?|)(?:[A-Z]{3,}|[A-Z][a-z]{2,}|[a-z]{3,}).*\g{-1}
# data url
\bdata:[-a-zA-Z=;:/0-9+_]*,\S*
\bdata:[-a-zA-Z=;:/0-9+]*,\S*
# https/http/file urls
#(?:\b(?:https?|ftp|file)://)[-A-Za-z0-9+&@#/*%?=~_|!:,.;]+[-A-Za-z0-9+&@#/*%=~_|]
@@ -77,8 +68,6 @@ magnet:[?=:\w]+
# Amazon
\bamazon\.com/[-\w]+/(?:dp/[0-9A-Z]+|)
# AWS ARN
arn:aws:[-/:\w]+
# AWS S3
\b\w*\.s3[^.]*\.amazonaws\.com/[-\w/&#%_?:=]*
# AWS execute-api
@@ -105,8 +94,6 @@ vpc-\w+
\bgoogle-analytics\.com/collect.[-0-9a-zA-Z?%=&_.~]*
# Google APIs
\bgoogleapis\.(?:com|dev)/[a-z]+/(?:v\d+/|)[a-z]+/[-@:./?=\w+|&]+
# Google Artifact Registry
\.pkg\.dev(?:/[-\w]+)+(?::[-\w]+|)
# Google Storage
\b[-a-zA-Z0-9.]*\bstorage\d*\.googleapis\.com(?:/\S*|)
# Google Calendar
@@ -142,8 +129,6 @@ themes\.googleusercontent\.com/static/fonts/[^/\s"]+/v\d+/[^.]+.
\bscholar\.google\.com/citations\?user=[A-Za-z0-9_]+
# Google Colab Research Drive
\bcolab\.research\.google\.com/drive/[-0-9a-zA-Z_?=]*
# Google Cloud regions
(?:us|(?:north|south)america|europe|asia|australia|me|africa)-(?:north|south|east|west|central){1,2}\d+
# GitHub SHAs (api)
\bapi.github\.com/repos(?:/[^/\s"]+){3}/[0-9a-f]+\b
@@ -182,12 +167,6 @@ GHSA(?:-[0-9a-z]{4}){3}
# GitLab commits
\bgitlab\.[^/\s"]*/(?:[^/\s"]+/){2}commits?/[0-9a-f]+\b
# #includes
^\s*#include\s*(?:<.*?>|".*?")
# #pragma lib
^\s*#pragma comment\(lib, ".*?"\)
# binance
accounts\.binance\.com/[a-z/]*oauth/authorize\?[-0-9a-zA-Z&%]*
@@ -240,7 +219,7 @@ accounts\.binance\.com/[a-z/]*oauth/authorize\?[-0-9a-zA-Z&%]*
\bmedium\.com/@?[^/\s"]+/[-\w]+
# microsoft
\b(?:https?://|)(?:(?:(?:blogs|download\.visualstudio|docs|msdn2?|research)\.|)microsoft|blogs\.msdn)\.co(?:m|\.\w\w)/[-_a-zA-Z0-9()=./%]*
\b(?:https?://|)(?:(?:download\.visualstudio|docs|msdn2?|research)\.microsoft|blogs\.msdn)\.com/[-_a-zA-Z0-9()=./%]*
# powerbi
\bapp\.powerbi\.com/reportEmbed/[^"' ]*
# vs devops
@@ -414,7 +393,7 @@ ipfs://[0-9a-zA-Z]{3,}
\bgetopts\s+(?:"[^"]+"|'[^']+')
# ANSI color codes
(?:\\(?:u00|x)1[Bb]|\\03[1-7]|\x1b|\\u\{1[Bb]\})\[\d+(?:;\d+)*m
(?:\\(?:u00|x)1[Bb]|\x1b|\\u\{1[Bb]\})\[\d+(?:;\d+|)m
# URL escaped characters
%[0-9A-F][A-F](?=[A-Za-z])
@@ -450,14 +429,10 @@ sha\d+:[0-9a-f]*?[a-f]{3,}[0-9a-f]*
# pki (base64)
LS0tLS1CRUdJT.*
# C# includes
^\s*using [^;]+;
# uuid:
\b[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}\b
# hex digits including css/html color classes:
(?:[\\0][xX]|\\u\{?|[uU]\+|#x?|%23|&H)[0-9_a-fA-FgGrR]*?[a-fA-FgGrR]{2,}[0-9_a-fA-FgGrR]*(?:[uUlL]{0,3}|[iu]\d+)\b
(?:[\\0][xX]|\\u|[uU]\+|#x?|%23)[0-9_a-fA-FgGrR]*?[a-fA-FgGrR]{2,}[0-9_a-fA-FgGrR]*(?:[uUlL]{0,3}|[iu]\d+)\b
# integrity
integrity=(['"])(?:\s*sha\d+-[-a-zA-Z=;:/0-9+]{40,})+\g{-1}
@@ -475,10 +450,7 @@ integrity=(['"])(?:\s*sha\d+-[-a-zA-Z=;:/0-9+]{40,})+\g{-1}
Name\[[^\]]+\]=.*
# IServiceProvider / isAThing
(?:(?:\b|_|(?<=[a-z]))I|(?:\b|_)(?:nsI|isA))(?=(?:[A-Z][a-z]{2,})+(?:[A-Z\d]|\b))
# python
#\b(?i)py(?!gments|gmy|lon|ramid|ro|th)(?=[a-z]{2,})
(?:\b|_)(?:(?:ns|)I|isA)(?=(?:[A-Z][a-z]{2,})+(?:[A-Z\d]|\b))
# crypt
(['"])\$2[ayb]\$.{56}\g{-1}
@@ -492,14 +464,17 @@ Name\[[^\]]+\]=.*
# machine learning (?)
#\b(?i)ml(?=[a-z]{2,})
# python
#\b(?i)py(?!gments|gmy|lon|ramid|ro|th)(?=[a-z]{2,})
# scrypt / argon
\$(?:scrypt|argon\d+[di]*)\$\S+
# go.sum
\bh1:\S+
# imports
^import\s+(?:(?:static|type)\s+|)(?:[\w.]|\{\s*\w*?(?:,\s*(?:\w*|\*))+\s*\})+
# scala imports
^import (?:[\w.]|\{\w*?(?:,\s*(?:\w*|\*))+\})+
# scala modules
#("[^"]+"\s*%%?\s*){2,3}"[^"]+"
@@ -508,13 +483,13 @@ Name\[[^\]]+\]=.*
image: [-\w./:@]+
# Docker images
^\s*(?i)FROM\s+\S+:\S+(?:\s+AS\s+\S+|)
^\s*FROM\s+\S+:\S+(?:\s+AS\s+\S+|)
# `docker images` REPOSITORY TAG IMAGE ID CREATED SIZE
\s*\S+/\S+\s+\S+\s+[0-9a-f]{8,}\s+\d+\s+(?:hour|day|week)s ago\s+[\d.]+[KMGT]B
# Intel intrinsics
_mm\d*_(?!dd)\w+
_mm_(?!dd)\w+
# Input to GitHub JSON
content: (['"])[-a-zA-Z=;:/0-9+]*=\g{-1}
@@ -548,7 +523,7 @@ content: (['"])[-a-zA-Z=;:/0-9+]*=\g{-1}
# javascript replace regex
\.replace\(/[^/\s"]{3,}/[gim]*\s*,
# assign regex
= /[^*].*?(?:[a-z]{3,}|[A-Z]{3,}|[A-Z][a-z]{2,}).*/[gim]*(?=\W|$)
= /[^*].*?(?:[a-z]{3,}|[A-Z]{3,}|[A-Z][a-z]{2,}).*/[gi]?(?=\W|$)
# perl regex test
[!=]~ (?:/.*/|m\{.*?\}|m<.*?>|m([|!/@#,;']).*?\g{-1})
@@ -562,7 +537,7 @@ perl(?:\s+-[a-zA-Z]\w*)+
#(?:\d|\bh)to(?!ken)(?=[a-z])|to(?=[adhiklpun]\()
# Go regular expressions
regexp?\.MustCompile\((?:`[^`]*`|".*"|'.*')\)
regexp?\.MustCompile\(`[^`]*`\)
# regex choice
\(\?:[^)]+\|[^)]+\)
@@ -610,7 +585,7 @@ urn:shemas-jetbrains-com
# xcode
# xcodeproject scenes
(?:Controller|destination|(?:first|second)Item|ID|id)="\w{3}-\w{2}-\w{3}"
(?:Controller|destination|ID|id)="\w{3}-\w{2}-\w{3}"
# xcode api botches
customObjectInstantitationMethod
@@ -625,33 +600,27 @@ PrependWithABINamepsace
\.fa-[-a-z0-9]+
# bearer auth
(['"])[Bb]ear[e][r] .{3,}?\g{-1}
(['"])[Bb]ear[e][r] .*?\g{-1}
# bearer auth
\b[Bb]ear[e][r]:? [-a-zA-Z=;:/0-9+.]{3,}
\b[Bb]ear[e][r]:? [-a-zA-Z=;:/0-9+.]+
# basic auth
(['"])[Bb]asic [-a-zA-Z=;:/0-9+]{3,}\g{-1}
# basic auth
: [Bb]asic [-a-zA-Z=;:/0-9+.]{3,}
# base64 encoded content
#([`'"])[-a-zA-Z=;:/0-9+]{3,}=\g{-1}
# base64 encoded content in xml/sgml
>[-a-zA-Z=;:/0-9+]{3,}=</
# base64 encoded content, possibly wrapped in mime
#(?:^|[\s=;:?])[-a-zA-Z=;:/0-9+]{50,}(?:[\s=;:?]|$)
(?:^|[\s=;:?])[-a-zA-Z=;:/0-9+]{50,}(?:[\s=;:?]|$)
# base64 encoded json
\beyJ[-a-zA-Z=;:/0-9+]+
# base64 encoded pkcs
#\bMII[-a-zA-Z=;:/0-9+]+
# uuencoded
#[!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_]{40,}
\bMII[-a-zA-Z=;:/0-9+]+
# DNS rr data
#(?:\d+\s+){3}(?:[-+/=.\w]{2,}\s*){1,2}
(?:\d+\s+){3}(?:[-+/=.\w]{2,}\s*){1,2}
# encoded-word
=\?[-a-zA-Z0-9"*%]+\?[BQ]\?[^?]{0,75}\?=
@@ -660,7 +629,7 @@ PrependWithABINamepsace
\bnumer\b(?=.*denom)
# Time Zones
\b(?:Africa|Atlantic|America|Antarctica|Arctic|Asia|Australia|Europe|Indian|Pacific)(?:/[-\w]+)+
\b(?:Africa|Atlantic|America|Antarctica|Asia|Australia|Europe|Indian|Pacific)(?:/\w+)+
# linux kernel info
^(?:bugs|flags|Features)\s+:.*
@@ -700,13 +669,13 @@ systemd.*?running in system mode \([-+].*\)$
TeX/AMS
# File extensions
#\*\.[+\w]+,
\*\.[+\w]+,
# eslint
"varsIgnorePattern": ".+"
# nolint
nolint:\s*[\w,]+
nolint:\w+
# Windows short paths
[/\\][^/\\]{5,6}~\d{1,2}(?=[/\\])
@@ -714,9 +683,6 @@ nolint:\s*[\w,]+
# Windows Resources with accelerators
\b[A-Z]&[a-z]+\b(?!;)
# signed off by
(?i)Signed-off-by: .*
# cygwin paths
/cygdrive/[a-zA-Z]/(?:Program Files(?: \(.*?\)| ?)(?:/[-+.~\\/()\w ]+)*|[-+.~\\/()\w])+
@@ -749,31 +715,29 @@ W/"[^"]+"
# Compiler flags (Unix, Java/Scala)
# Use if you have things like `-Pdocker` and want to treat them as `docker`
#(?:^|[\t ,>"'`=(#])-(?:(?:J-|)[DPWXY]|[Llf])(?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,})
#(?:^|[\t ,>"'`=(])-(?:(?:J-|)[DPWXY]|[Llf])(?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,})
# Compiler flags (Windows / PowerShell)
# This is a subset of the more general compiler flags pattern.
# It avoids matching `-Path` to prevent it from being treated as `ath`
#(?:^|[\t ,"'`=(#])-(?:[DPL](?=[A-Z]{2,})|[WXYlf](?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,}))
#(?:^|[\t ,"'`=(])-(?:[DPL](?=[A-Z]{2,})|[WXYlf](?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,}))
# Compiler flags (linker)
,-B
# Library prefix
# e.g., `lib`+`archive`, `lib`+`raw`, `lib`+`unwind`
# (ignores some words that happen to start with `lib`)
(?:\b|_)[Ll]ib(?:re(?=office)|)(?!era[lt]|ero|erty|rar(?:i(?:an|es)|y))(?=[a-z])
# iSCSI iqn (approximate regex)
\biqn\.[0-9]{4}-[0-9]{2}(?:[\.-][a-z][a-z0-9]*)*\b
# libraries
(?:\b|_)lib(?:re(?=office)|)(?!era[lt]|ero|erty|rar(?:i(?:an|es)|y))(?=[a-z])
# WWNN/WWPN (NAA identifiers)
\b(?:0x)?10[0-9a-f]{14}\b|\b(?:0x|3)?[25][0-9a-f]{15}\b|\b(?:0x|3)?6[0-9a-f]{31}\b
# iSCSI iqn (approximate regex)
\biqn\.[0-9]{4}-[0-9]{2}(?:[\.-][a-z][a-z0-9]*)*\b
# curl arguments
\b(?:\\n|)curl(?:\.exe|)(?:\s+-[a-zA-Z]{1,2}\b)*(?:\s+-[a-zA-Z]{3,})(?:\s+-[a-zA-Z]+)*
# set arguments
\b(?:bash|sh|set)(?:\s+[-+][abefimouxE]{1,2})*\s+[-+][abefimouxE]{3,}(?:\s+[-+][abefimouxE]+)*
\b(?:bash|sh|set)(?:\s+-[abefimouxE]{1,2})*\s+-[abefimouxE]{3,}(?:\s+-[abefimouxE]+)*
# tar arguments
\b(?:\\n|)g?tar(?:\.exe|)(?:(?:\s+--[-a-zA-Z]+|\s+-[a-zA-Z]+|\s[ABGJMOPRSUWZacdfh-pr-xz]+\b)(?:=[^ ]*|))+
# tput arguments -- https://man7.org/linux/man-pages/man5/terminfo.5.html -- technically they can be more than 5 chars long...

View File

@@ -73,9 +73,7 @@
\.qm$
\.s$
\.sig$
\.snk$
\.so$
\.stl$
\.svgz?$
\.sys$
\.tar$
@@ -92,41 +90,40 @@
\.xz$
\.zip$
^\.github/actions/spell-check/
^\.github/workflows/spelling\d*\.yml$
^\.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$
^\Qsrc/common/notifications/BackgroundActivatorDLL/cpp.hint\E$
^\Qsrc/modules/cmdpal/doc/initial-sdk-spec/list-elements-mock-002.pdn\E$
^\Qsrc/modules/colorPicker/ColorPickerUI/Assets/ColorPicker/colorPicker.cur\E$
^\Qsrc/modules/colorPicker/ColorPickerUI/Shaders/GridShader.cso\E$
^\Qsrc/modules/MouseUtils/MouseJump.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SYSTEM_METRICS_INDEX.cs\E$
^\Qsrc/modules/MouseUtils/MouseJumpUI/MainForm.resx\E$
^\Qsrc/modules/MouseWithoutBorders/App/Form/frmAbout.cs\E$
^\Qsrc/modules/MouseWithoutBorders/App/Form/frmInputCallback.resx\E$
^\Qsrc/modules/MouseWithoutBorders/App/Form/frmLogon.resx\E$
^\Qsrc/modules/MouseWithoutBorders/App/Form/frmMatrix.resx\E$
^\Qsrc/modules/MouseWithoutBorders/App/Form/frmMessage.resx\E$
^\Qsrc/modules/MouseWithoutBorders/App/Form/frmMouseCursor.resx\E$
^\Qsrc/modules/MouseWithoutBorders/App/Form/frmScreen.resx\E$
^\Qsrc/modules/MouseWithoutBorders/ModuleInterface/generateSecurityDescriptor.h\E$
^\Qsrc/modules/peek/Peek.Common/NativeMethods.txt\E$
^\Qsrc/modules/previewpane/SvgPreviewHandler/SvgHTMLPreviewGenerator.cs\E$
^\Qsrc/modules/previewpane/UnitTests-StlThumbnailProvider/HelperFiles/sample.stl\E$
^\Qtools/project_template/ModuleTemplate/resource.h\E$
^doc/devdocs/akaLinks\.md$
^NOTICE\.md$
^src/common/CalculatorEngineCommon/exprtk\.hpp$
^src/common/ManagedCommon/ColorFormatHelper\.cs$
^src/common/notifications/BackgroundActivatorDLL/cpp\.hint$
^src/common/sysinternals/Eula/
^src/modules/cmdpal/doc/initial-sdk-spec/list-elements-mock-002\.pdn$
^src/modules/colorPicker/ColorPickerUI/Shaders/GridShader\.cso$
^src/modules/launcher/Plugins/Microsoft\.PowerToys\.Run\.Plugin\.TimeDate/Properties/
^src/modules/MouseUtils/MouseJumpUI/MainForm\.resx$
^src/modules/MouseWithoutBorders/App/.*/NativeMethods\.cs$
^src/modules/MouseWithoutBorders/App/Form/.*\.Designer\.cs$
^src/modules/MouseWithoutBorders/App/Form/.*\.resx$
^src/modules/MouseWithoutBorders/App/Form/frmAbout\.cs$
^src/modules/MouseWithoutBorders/App/Form/frmInputCallback\.resx$
^src/modules/MouseWithoutBorders/App/Form/frmLogon\.resx$
^src/modules/MouseWithoutBorders/App/Form/frmMatrix\.resx$
^src/modules/MouseWithoutBorders/App/Form/frmMessage\.resx$
^src/modules/MouseWithoutBorders/App/Form/frmMouseCursor\.resx$
^src/modules/MouseWithoutBorders/App/Form/frmScreen\.resx$
^src/modules/MouseWithoutBorders/App/Helper/.*\.resx$
^src/modules/MouseWithoutBorders/ModuleInterface/generateSecurityDescriptor\.h$
^src/modules/peek/Peek.Common/NativeMethods\.txt$
^src/modules/previewpane/SvgPreviewHandler/SvgHTMLPreviewGenerator\.cs$
^src/modules/previewpane/UnitTests-MarkdownPreviewHandler/HelperFiles/MarkdownWithHTMLImageTag\.txt$
^src/modules/registrypreview/RegistryPreviewUILib/Controls/HexBox/.*$
^src/modules/ZoomIt/ZoomIt/ZoomIt\.idc$
^src/Monaco/
^tools/project_template/ModuleTemplate/resource\.h$
^src/common/sysinternals/Eula/
^tools/Verification scripts/Check preview handler registration\.ps1$
ignore$
^src/modules/registrypreview/RegistryPreviewUILib/Controls/HexBox/.*$
^src/common/CalculatorEngineCommon/exprtk\.hpp$

File diff suppressed because it is too large Load Diff

View File

@@ -8,31 +8,6 @@
# you might not want to check in code where you skip all the other tests.
#\bfit\(
# English does not use a hyphen between adverbs and nouns
# https://twitter.com/nyttypos/status/1894815686192685239
(?:^|\s)[A-Z]?[a-z]+ly-(?=[a-z]{3,})(?:[.,?!]?\s|$)
# Smart quotes should match
\s[^.?!]+[^.?!]+[^.?!]+|\s[^.?!]+[^.?!]+[^.?!]+|\s”[^.?!“”]+”[^.?!“”]+“[^.?!“”]+”|\s“[^.?!“”]+”[^.?!“”]+”[^.?!“”]+”
# Don't use `requires that` + `to be`
# https://twitter.com/nyttypos/status/1894816551435641027
\brequires that \w+\b[^.]+to be\b
# A fully parenthetical sentences period goes inside the parentheses, not outside.
# https://twitter.com/nyttypos/status/1898844061873639490
\([A-Z][a-z]{2,}(?: [a-z]+){3,}\)\.\s
# Complete sentences shouldn't be in the middle of another sentence as a parenthetical.
(?<!\.)(?<!\betc)\.\),
# Complete sentences in parentheticals should not have a space before the period.
\s\.\)(?!.*\}\})
# This probably indicates Mojibake https://en.wikipedia.org/wiki/Mojibake
# You probably should try to unbake this content
Ã(?:Â[¤¶¥]|[£¢])|Ã
# Should be `HH:MM:SS`
\bHH:SS:MM\b
@@ -49,74 +24,18 @@
# Should be `a priori` or `and prior`
(?i)(?<!posteriori)\sand priori\s
# Should be `a`
\san (?=(?:[b-df-gj-npqtv-xz]|h(?!our|tml|ttp)|r(?!c\b)|s(?!sh|vg))[a-z])
# Articles generally shouldn't be used without a noun and a verb
# - Perhaps you're missing a verb between the noun and the second article.
# - Or, perhaps you should remove the first verb and treat the intervening word as a verb?
# - In some cases you should add a `,` between the noun and the second article.
\s(?:an?|the(?! action))\s(?!way|wh|how\b)[A-Za-z][a-z]+[a-qs-z]\s(?:a(?! bit)n?|the)\s
# Should only be one of `a`, `an`, or `the`
\b(?:(?:an?|the)\s+){2,}\b
# Should be a list `something, a second thing, or a third thing` or `something, a thing to do a thing`
# -- This rule is experimental, if you find it has a high false-positive rate, please let the maintainer know
#(?:^|[?!.] )[^()?!;,.]+, a(?:\s+(?!to\b)\w+)+?\s+an?\b
# Should only be `are` or `can`, not both
\b(?:(?:are|can)\s+){2,}\b
# Should probably be `ABCDEFGHIJKLMNOPQRSTUVWXYZ`
(?i)(?!ABCDEFGHIJKLMNOPQRSTUVWXYZ)ABC[A-Z]{21}YZ
# Should be `an`
#(?<!\b[Ii] |\.)\bam\b
# Should be `anymore`
\bany more[,.]
# Should be `Ask`
(?:^|[.?]\s+)As\s+[A-Z][a-z]{2,}\s[^.?]*?(?:how|if|wh\w+)\b
# Should be `at one fell swoop`
# and only when talking about killing, not some other completion
# Act 4 Scene 3, Macbeth
# https://www.opensourceshakespeare.org/views/plays/play_view.php?WorkID=macbeth&Act=4&Scene=3&Scope=scene
\bin one fell s[lw]?oop\b
# Should be `'`
(?i)\b(?:(?:i|s?he|they|what|who|you)[`"]ll|(?:are|ca|did|do|does|ha[ds]|have|is|should|were|wo|would)n[`"]t|(?:s?he|let|that|there|what|where|who)[`"]s|(?:i|they|we|what|who|you)[`"]ve)\b
# Should be `background` / `intro text` / `introduction` / `prologue` unless it's a brand or relates to _subterfuge_
(?i)\bpretext\b
# Should be `bearer`
\b(?<=the )burden(?= of bad news\b)
# Should be `bona`
# unless talking about bones
\bbone(?= fide\b)
# Should be `branches`
# ... unless it's really about the meal that replaces breakfast and lunch.
\b[Bb]runches\b
(?i)\b(?:(?:i|s?he|they|what|who|you)"ll|(?:are|ca|did|do|does|ha[ds]|have|is|should|were|wo|would)n"t|(?:s?he|let|that|there|what|where|who)"s|(?:i|they|we|what|who|you)"ve)\b
# Should be `briefcase`
\bbrief-case\b
# Should be `by far` or `far and away`
\bby far and away\b
# Should be `by and large`
\bby in large\b
# Should be `bytes`
# unless talking about sports where a team gets to skip a game, or
# saying `goodbyes` (even this is questionable)
(?<!\\)\bbyes\b
# Should be `can, not only ..., ... also...`
\bcan not only.*can also\b
@@ -127,10 +46,7 @@
# > In formal writing and where contractions are frowned upon, use `cannot`.
# > It is possible to write `can not`, but you generally find it only as part of some other construction, such as `not only . . . but also.`
# - if you encounter such a case, add a pattern for that case to patterns.txt.
\b[Cc]an not\b(?! only\b)
# Should be `chart`
(?i)\bhelm\b.*\bchard\b
\b[Cc]an not\b
# Do not use `(click) here` links
# For more information, see:
@@ -140,49 +56,19 @@
# * https://heyoka.medium.com/dont-use-click-here-f32f445d1021
(?i)(?:>|\[)(?:(?:click |)here|this(?=\]\([^\)]+:/)|link|(?:read |)more(?!</value))(?:</|\]\()
# Including "image of" or "picture of" in alt text is unnecessary.
\balt=['"](?:an? |)(?:image|picture) of
# Alt text should be short
\balt=(?:'[^']{126,}'|"[^"]{126,}")
# Should be `effect`
(?<=\btake )affect\b
# Should be `-endian`
\b(?i)(?<=big|little) endian\b
# Should be `equals` to `is equal to`
\bequals to\b
# Should be `ECMA` 262 (JavaScript)
(?i)\bTS\/EMCA\b|\bEMCA(?: \d|\s*Script)|\bEMCA\b(?=.*\bTS\b)
# Should be `ECMA` 340 (Near Field Communications)
(?i)EMCA[- ]340
# Should be `fall back`
\bfallback(?= to)\b
# Should be `for`, `for, to` or `to`
\b(?:for to|to for)\b
# Should be `GitHub`
(?<![&*.]|// |\b(?:from|import|type) )\bGithub\b(?![{()])
# Should be `GitLab`
(?<![&*.]|// |\b(?:from|import|type) )\bGitlab\b(?![{()])
# Should be `heartrending` unless talking about drawing hearts
\b(?i)heart[- ]rendering\b(?![^.?!]*(?:hearts|quirk))
# Should probably be `https://`...
# Markdown generally doesn't assume that links are to urls
\]\(www\.\w
# Should be `intents and purposes`
(?<=[Ff]or all )intensive purposes\b
# Should be `JavaScript`
\bJavascript\b
@@ -198,14 +84,11 @@
# Should be `RabbitMQ`
\bRabbitmq\b
# Should be `TensorFlow`
\bTensorflow\b
# Should be `TypeScript`
\bTypescript\b
# Should be `another`
\ban[- ]other(?!-)\b
\ban[- ]other\b
# Should be `case-(in)sensitive`
\bcase (?:in|)sensitive\b
@@ -225,14 +108,11 @@
# Should be `here-in`, `the`, `them`, `this`, `these` or reworded in some other way
\bthe here(?:\.|,| (?!and|defined))
# Should be `going to bed` or `going to a bad`
\bgoing to bad(?!-)\b
# Should be `greater than`
#\bhigher than\b
\bhigher than\b
# Should be `ID` (unless it's a flag/property)
#(?<![-\.])\bId\b(?![(])
# Should be `ID`
#\bId\b
# Should be `in front of`
\bin from of\b
@@ -245,26 +125,14 @@
# Should be `use`
\sin used by\b
# Should be `in-depth` if used as an adjective (but `in depth` when used as an adverb)
\bin depth\s(?!rather\b)\w{6,}
# Should be `in-flight` or `on the fly` (unless actually talking about airline flights)
\bon[- ]flight\b(?!=\s+(?:(?:\w{2}|)\d+|availability|booking|computer|data|delay|departure|management|performance|radar|reservation|scheduling|software|status|ticket|time|type|.*(?:hotel|taxi)))
# Should be `is obsolete`
\bis obsolescent\b
# Should be `it's` or `its`
(?<![.'])\bits[']
\bits[']
# Should be `its`
\bit's(?= (?:child|only purpose|own(?:er|)|parent|sibling)\b)
# Should be `for its` (possessive) or `because it is`
\bfor it(?:'s| is)\b
# Should be `lends`
\bleads(?= credence)
\bit's(?= own\b)
# Should be `log in`
\blogin to the
@@ -272,34 +140,12 @@
# Should be `long-standing`
\blong standing\b
# Should be `lose`
(?<=\bwill )loose\b
# `apt-key` is deprecated
# ... instead you should be writing a pair of files:
# ... * the gpg key added to a distinct key ring file based on your project/distro/key...
# ... * the sources.list in a district file -- not simply appended to `/etc/apt/sources.list` -- (there is a newer format [DEB822](https://manpages.debian.org/bookworm/dpkg-dev/deb822.5.en.html)) that references the gpg key.
# Consider:
# ````sh
# curl http://download.something.example.com/$DISTRO/Release.key | \
# gpg --dearmor --yes --output /usr/share/keyrings/something-distro.gpg
# echo "deb [signed-by=/usr/share/keyrings/something-distro.gpg] http://download.something.example.com/repositories/home:/$DISTRO ./" \
# >> /etc/apt/sources.list.d/something-distro.list
# ````
\bapt-key add\b
# Should be `nearby`
\bnear by\b
# Should probably be a person named `Nick` or the abbreviation `NIC`
\bNic\b
# Should be `not supposed`
\bsupposed not\b
# Should be `Once this` or `On this` or even `One that`. Rarely `One, this`
[?!.] One this\b
# Should probably be `much more`
\bmore much\b
@@ -307,10 +153,7 @@
\bperform it's\b
# Should be `opt-in`
(?<!\scan|for)(?<!\smust)(?<!\sif)\sopt in\s
# Should be `out-of-date` if acting as an adjective before a noun
\bout of date(?= \w{3,}\b)
(?<!\scan|for)(?<!\sif)\sopt in\s
# Should be `less than`
\bless then\b
@@ -327,89 +170,24 @@
# Should be `on the other hand`
\b(?i)on another hand\b
# Reword to `on at runtime` or `enabled at launch`
# The former if you mean it can be changed dynamically.
# The latter if you mean that it can be changed without recompiling but not after the program starts.
\bswitched on runtime\b
# Should be `Of course,`
[?.!]\s+Of course\s(?=[-\w\s]+[.?;!,])
# Most people only have two hands. Reword.
\b(?i)on the third hand\b
# Should be `Open Graph`
# unless talking about a specific Open Graph implementation:
# - Java
# - Node
# - Py
# - Ruby
\bOpenGraph\b
# Should be `OpenShift`
\bOpenshift\b
# Should be `otherwise`
\bother[- ]wise\b
# Should be `; otherwise` or `. Otherwise`
# https://study.com/learn/lesson/otherwise-in-a-sentence.html
, [Oo]therwise\b
# Should probably be `Otherwise,`
(?<=\. )Otherwise\s
# Should be `or (more|less)`
\bore (?:more|less)\b
# Should be `or`
\b(?i)true of .*false\b
# Should be `pale`
\b(?<=beyond the )pail\b
# Should be reworded.
# `passthrough` is an adjective
# `pass-through` could be a noun
# `pass through` would be a verb phrase
\b(?i)passthrough(?= an?\b)
# Should be `rather than`
\brather then\b
# Should be `Red Hat`
\bRed[Hh]at\b
# Should be `regardless, ...` or `regardless of (whether)`
\b[Rr]egardless if you\b
# Should be `self-signed`
\bself signed\b
# Should be `SendGrid`
\bSendgrid\b
# Should be `set up` (`setup` is a noun / `set up` is a verb)
\b[Ss]etup(?= (?:an?|the)\b)
# Should be `state`
\bsate(?=\b|[A-Z])|(?<=[a-z])Sate(?=\b|[A-Z])|(?<=[A-Z]{2})Sate(?=\b|[A-Z])
# Should be `this`
\b[Tt]oday(?= morning\b)
# Should be `let's` or `let us`
\b[Ll]ets (?=throw\.)
# Should be `no longer needed`
\bno more needed\b(?! than\b)
# Should be `<see|look> below for the`
(?i)\bfind below the\b
# Should be `then any` unless there's a comparison before the `,`
, than any\b
# Should be `did not exist`
\bwere not existent\b
@@ -419,18 +197,9 @@
# Should be `nonexistent`
\b[Nn]o[nt][- ]existent\b
# Should be `our`
\bspending out time\b
# Should be `@brief` / `@details` / `@param` / `@return` / `@retval`
(?:^\s*|(?:\*|//|/*)\s+`)[\\@](?:breif|(?:detail|detials)|(?:params(?!\.)|prama?)|ret(?:uns?)|retvl)\b
# Should be `more than` or `more, then`
\bmore then\b
# Should be `Pipeline`/`pipeline`
(?:(?<=\b|[A-Z])p|P)ipeLine(?:\b|(?=[A-Z]))
# Should be `preexisting`
[Pp]re[- ]existing
@@ -446,9 +215,6 @@
# Should be `prerequisite`
[Pp]re[- ]requisite
# Should be `QuickTime`
\bQuicktime\b
# Should be `recently changed` or `recent changes`
[Rr]ecent changed
@@ -458,30 +224,14 @@
# Should be `reentrant`
[Rr]e[- ]entrant
# Should be `room for`
\brooms for (?!lease|rent|sale)
# Should be `socioeconomic`
# https://dictionary.cambridge.org/us/dictionary/english/socioeconomic
socio-economic
# Should be `strong suit`
\b(?:my|his|her|their) strong suite\b
# Should probably be `temperatures` unless actually talking about thermal drafts (things birds may fly on)
\bthermals\b
# Should be `there are` or `they are` (or `they're`)
(?i)\btheir are\b
# Should be `understand`
\bunder stand\b
# Should be `URI` or `uri` unless it refers to a person named `Uri` (or a flag)
#(?<![-\.])\bUri\b(?![(])
# Should be `true`
(?i)(?<![\[\]()])\brue(?:= or false)
# Should be `URI` or `uri` unless it refers to a person named `Uri`
#(?<!\.)\bUri\b(?![(])
# Should be `it uses is`
/\bis uses is\b/
@@ -495,43 +245,12 @@ socio-economic
# Should be `where`
\bwere they are\b
# Should be `why`
, way(?= is [^.]*\?)
# should be `vCenter`
\bV[Cc]enter\b
# Should be `VM`
\bVm\b
# Should be `walkthrough(s)`
\bwalk-throughs?\b
# Should be `want`
\bdon't ant\b
# Should be `we'll`
\bwe 'll\b
# Should be `week`
# unless you're really talking about people or pointers
\bevery weak[.,?!]
# Should be `well`
\b[Yy]ou(?:'re| are) doing good\b
# Should be `whereas`
\bwhere as\b
# Should be `WinGet`
\bWinget\b
# Should be `without` (unless `out` is a modifier of the next word)
\bwith out\b(?!-)
# Should be `work around`
\b[Ww]orkaround(?= an?\b)
# Should be `workarounds`
#\bwork[- ]arounds\b
@@ -548,15 +267,15 @@ socio-economic
\b(?:coarse|fine) grained\b
# Homoglyph (Cyrillic) should be `A`/`B`/`C`/`E`/`H`/`I`/`I`/`J`/`K`/`M`/`O`/`P`/`S`/`T`/`Y`
# It's possible that your content is intentionally mixing Cyrillic and Latin scripts, but if it isn't, you definitely want to correct this.
# It's possible that your content is intentionally mixing Cyrllic and Latin scripts, but if it isn't, you definitely want to correct this.
(?<=[A-Z]{2})[АВСЕНІӀЈКМОРЅТУ]|[АВСЕНІӀЈКМОРЅТУ](?=[A-Z]+(?:\b|[a-z]+)|[a-z]+(?:[^a-z]|$))
# Homoglyph (Cyrillic) should be `a`/`b`/`c`/`e`/`o`/`p`/`x`/`y`
# It's possible that your content is intentionally mixing Cyrillic and Latin scripts, but if it isn't, you definitely want to correct this.
[авсеорху](?=[A-Za-z]{2,})|(?<=[A-Za-z]{2})[авсеорху]|(?<=[A-Za-z])[авсеорху](?=[A-Za-z])
# Homoglyph (Cyrillic) should be `a`/`b`/`e`
# It's possible that your content is intentionally mixing Cyrllic and Latin scripts, but if it isn't, you definitely want to correct this.
[аве](?=[A-Za-z]{2,})|(?<=[A-Za-z]{2})[аве]|(?<=[A-Za-z])[аве](?=[A-Za-z])
# Should be `neither/nor` -- or reword
#(?<!do )\bnot\b([^.?!"/(](?!neither|,.*?,))+\bnor\b
#(?!<do )\bnot\b([^.?!"/(](?!neither|,.*?,))+\bnor\b
# Should be `neither/nor` (plus rewording the beginning)
# This is probably a double negative...

View File

@@ -1,36 +1,31 @@
# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns
# Gaelic
Gàidhlig
# #includes
^\s*#include\s*(?:<.*?>|".*?")
Ov_erwrite
# #pragma lib
^\s*#pragma comment\(lib, ".*?"\)
# languageHashTable
"\w+(?:-\w+|)"\s+=\s+@\(".*"\)
# Regular expression with `\b`
\\b(?=[a-z]\S*\{)
# wikipedia
\b\w\w\.wikipedia\.org/wiki/[-\w%.#]+
# long lorem
L"Lorem.*"
# css fonts
\bfont-family:[^;}]+
# .github/policies/resourceManagement.yml
pattern: '.*'
# tabs in c#
\$"\\t
# Hexadecimal character pattern in code
\\x[0-9a-fA-F]{4}
fontFamily": ".*"
D[23]D(?=[A-Z][a-z])
(?<=[a-z])3D(?=[A-Z])
\.monitorId = \{ .*\}
json::value\(L"\S+"
\\x[0-9a-fA-F][0-9a-fA-F]
# windows line breaks in strings
\\r\\n(?=[A-Za-z])
\\r\\n
# power shell gallery website
\bpowershellgallery.com/[-_a-zA-Z0-9()=./%]*
@@ -40,22 +35,9 @@ L?(["']|[-<({>]|\b)[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{10,12}(?:\g{
(?:L"[abAB]+", ){3}L"[abAB]+"
\. (?: @[-A-Za-z\d]+\b(?!\.[A-Z]),?)+
auto deviceId = L".*"
deviceId(?:\.id|) = L".*"
StringComparer.OrdinalIgnoreCase\) \{.*\}
# namespaces
\b[a-z]+::
"Author": ".+"
(?:Include|Link)=".*?"
# You could ignore `xmlns`, but it's probably better to enforce rules about them...
#\s(?:xmlns:[a-z]+(?:[A-Z][a-z]+|)=|[a-z]+(?:[A-Z][a-z]+):(?=[a-z]+=))
# hit-count: 1 file-count: 1
# marker to ignore all code on line
^.*/\* #no-spell-check-line \*/.*$
# UnitTests
\[DataRow\(.*\)\]
@@ -68,135 +50,142 @@ StringComparer.OrdinalIgnoreCase\) \{.*\}
# Automatically suggested patterns
# hit-count: 5402 file-count: 1339
# hit-count: 3715 file-count: 992
# IServiceProvider / isAThing
(?:(?:\b|_|(?<=[a-z]))[IT]|(?:\b|_)(?:nsI|isA))(?=(?:[A-Z][a-z]{2,})+(?:[A-Z\d]|\b))
(?:\b|_)(?:(?:ns|)I|isA)(?=(?:[A-Z][a-z]{2,})+(?:[A-Z\d]|\b))
# hit-count: 2073 file-count: 842
# #includes
^\s*#include\s*(?:<.*?>|".*?")
# hit-count: 404 file-count: 42
# base64 encoded content, possibly wrapped in mime
(?:^|[\s=;:?])[-a-zA-Z=;:/0-9+]{50,}(?:[\s=;:?]|$)
# hit-count: 1639 file-count: 855
# C# includes
^\s*using [^;]+;
# hit-count: 1491 file-count: 693
# microsoft
\b(?:https?://|)(?:(?:(?:blogs|download\.visualstudio|docs|msdn2?|research)\.|)microsoft|blogs\.msdn)\.co(?:m|\.\w\w)/[-_a-zA-Z0-9()=./%]*
# hit-count: 398 file-count: 133
# hex digits including css/html color classes:
(?:[\\0][xX]|\\u\{?|[uU]\+|#x?|%23|&H)[0-9_a-fA-FgGrR]*?[a-fA-FgGrR]{2,}[0-9_a-fA-FgGrR]*(?:[uUlL]{0,3}|[iu]\d+)\b
# hit-count: 339 file-count: 146
# hit-count: 402 file-count: 160
# hex runs
\b[0-9a-fA-F]{16,}\b
# hit-count: 253 file-count: 100
# hit-count: 337 file-count: 110
# hex digits including css/html color classes:
(?:[\\0][xX]|\\u|[uU]\+|#x?|%23)[0-9_a-fA-FgGrR]*?[a-fA-FgGrR]{2,}[0-9_a-fA-FgGrR]*(?:[uUlL]{0,3}|[iu]\d+)\b
# hit-count: 311 file-count: 43
# D2D
D?2D(?!efault)
# hit-count: 272 file-count: 75
# GitHub SHAs (markdown)
(?:\[`?[0-9a-f]+`?\]\(https:/|)/(?:www\.|)github\.com(?:/[^/\s"]+){2,}(?:/[^/\s")]+)(?:[0-9a-f]+(?:[-0-9a-zA-Z/#.]*|)\b|)
# hit-count: 241 file-count: 37
# hit-count: 146 file-count: 27
# version suffix <word>v#
(?:(?<=[A-Z]{2})V|(?<=[a-z]{2}|[A-Z]{2})v)\d+(?:\b|(?=[a-zA-Z_]))
# hit-count: 141 file-count: 6
# Contributor / Project
\[[^\]\s]+\]\(https://github\.com/[^)]+\)(?: -(?: [A-Z]\S+)+|)|\[[^\]]+\]\(https://github\.com/(?:[^/\s"]+/?){1,2}\)
https://github.com/(?:[-\w]+/?){1,2}
# hit-count: 131 file-count: 125
# Repeated letters
\b([a-z])\g{-1}{2,}\b
# hit-count: 99 file-count: 97
# hit-count: 105 file-count: 103
# w3
\bw3\.org/[-0-9a-zA-Z/#.]+
# hit-count: 59 file-count: 11
# hit-count: 94 file-count: 6
# Contributor
\[[^\]]+\]\(https://github\.com/[^/\s"]+/?\)
RegExp\(([`'"]).*?\g{-1}\)|(?:escapes|regEx):\s*(?:/.*/|([`'"]).*?\g{-1})|return/.*?/
# hit-count: 65 file-count: 38
# regex choice
\(\?:[^)]+\|[^)]+\)
# hit-count: 37 file-count: 14
# Markdown anchor links
\(#\S*?[a-zA-Z]\S*?\)
# hit-count: 29 file-count: 23
# hit-count: 33 file-count: 5
# base64 encoded pkcs
\bMII[-a-zA-Z=;:/0-9+]+
# hit-count: 28 file-count: 22
# stackexchange -- https://stackexchange.com/feeds/sites
\b(?:askubuntu|serverfault|stack(?:exchange|overflow)|superuser).com/(?:questions/\w+/[-\w]+|a/)
# hit-count: 24 file-count: 11
# Library prefix
# e.g., `lib`+`archive`, `lib`+`raw`, `lib`+`unwind`
# (ignores some words that happen to start with `lib`)
(?:\b|_)[Ll]ib(?:re(?=office)|)(?!era[lt]|ero|erty|rar(?:i(?:an|es)|y))(?=[a-z])
# hit-count: 14 file-count: 3
# node packages
(["'])@[^/'" ]+/[^/'" ]+\g{-1}
# hit-count: 20 file-count: 2
# hit-count: 13 file-count: 1
# Intel intrinsics
_mm\d*_(?!dd)\w+
_mm_(?!dd)\w+
# hit-count: 15 file-count: 8
# hit-count: 11 file-count: 5
# URL escaped characters
%[0-9A-F][A-F](?=[A-Za-z])
# hit-count: 9 file-count: 5
# Wikipedia
\ben\.wikipedia\.org/wiki/[-\w%.#]+
# hit-count: 14 file-count: 10
# hit-count: 5 file-count: 4
# vs devops
\bvisualstudio.com(?::443|)/[-\w/?=%&.]*
# hit-count: 8 file-count: 2
# copyright
Copyright (?:\([Cc]\)|)(?:[-\d, ]|and)+(?: [A-Z][a-z]+ [A-Z][a-z]+,?)+
# hit-count: 5 file-count: 4
# Alternatively, if you're using check-spelling v0.0.25+, and you would like to _check_ the Non-English content for spelling errors, you can. For information on how to do so, see:
# https://docs.check-spelling.dev/Feature:-Configurable-word-characters.html#unicode
[a-zA-Z]*[ÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź][a-zA-Z]{3}[a-zA-ZÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź]*|[a-zA-Z]{3,}[ÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź]|[ÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź][a-zA-Z]{3,}
# hit-count: 8 file-count: 1
# css fonts
\bfont(?:-family|):[^;}]+
# hit-count: 4 file-count: 4
# microsoft
\b(?:https?://|)(?:(?:(?:blogs|download\.visualstudio|developer|docs|learn|msdn2?|research)\.|)microsoft|blogs\.msdn)\.co(?:m|\.\w\w)/[-_a-zA-Z0-9()=./%#]*
aka\.ms/[a-zA-Z0-9]+
# hit-count: 8 file-count: 1
# kubernetes crd patterns
^\s*pattern: .*$
# hit-count: 5 file-count: 3
# URL escaped characters
%[0-9A-F][A-F](?=[A-Za-z])
# hit-count: 3 file-count: 3
# githubusercontent
/[-a-z0-9]+\.githubusercontent\.com/[-a-zA-Z0-9?&=_\/.]*
# hit-count: 2 file-count: 2
# medium
\bmedium\.com/@?[^/\s"]+/[-\w:/*.]+
# hit-count: 3 file-count: 2
# css url wrappings
\burl\([^)]+\)
# hit-count: 3 file-count: 1
# kubernetes crd patterns
^\s*pattern: .*$
# hit-count: 3 file-count: 1
# Lorem
# Update Lorem based on your content (requires `ge` and `w` from https://github.com/jsoref/spelling; and `review` from https://github.com/check-spelling/check-spelling/wiki/Looking-for-items-locally )
# grep '^[^#].*lorem' .github/actions/spelling/patterns.txt|perl -pne 's/.*i..\?://;s/\).*//' |tr '|' "\n"|sort -f |xargs -n1 ge|perl -pne 's/^[^:]*://'|sort -u|w|sed -e 's/ .*//'|w|review -
# Warning, while `(?i)` is very neat and fancy, if you have some binary files that aren't proper unicode, you might run into:
# ... Operation "substitution (s///)" returns its argument for non-Unicode code point 0x1C19AE (the code point will vary).
# ... You could manually change `(?i)X...` to use `[Xx]...`
# ... or you could add the files to your `excludes` file (a version after 0.0.19 should identify the file path)
(?:(?:\w|\s|[,.])*\b(?i)(?:amet|consectetur|cursus|dolor|eros|ipsum|lacus|libero|ligula|lorem|magna|neque|nulla|suscipit|tempus)\b(?:\w|\s|[,.])*)
# hit-count: 3 file-count: 1
# libraries
(?:\b|_)lib(?:re(?=office)|)(?!era[lt]|ero|erty|rar(?:i(?:an|es)|y))(?=[a-z])
# hit-count: 2 file-count: 1
# While you could try to match `http://` and `https://` by using `s?` in `https?://`, sometimes there
# YouTube url
\b(?:(?:www\.|)youtube\.com|youtu.be)/(?:channel/|embed/|user/|playlist\?list=|watch\?v=|v/|)[-a-zA-Z0-9?&=_%]*
# hit-count: 2 file-count: 1
# hit-count: 1 file-count: 1
# GHSA
GHSA(?:-[0-9a-z]{4}){3}
# hit-count: 1 file-count: 1
# GitHub actions
\buses:\s+[-\w.]+/[-\w./]+@[-\w.]+
# hit-count: 1 file-count: 1
# curl arguments
\b(?:\\n|)curl(?:\.exe|)(?:\s+-[a-zA-Z]{1,2}\b)*(?:\s+-[a-zA-Z]{3,})(?:\s+-[a-zA-Z]+)*
# medium
\bmedium\.com/@?[^/\s"]+/[-\w]+
# hit-count: 1 file-count: 1
# sha-... -- uses a fancy capture
(\\?['"]|&quot;)[0-9a-f]{40,}\g{-1}
# hit-count: 1 file-count: 1
# tar arguments
\b(?:\\n|)g?tar(?:\.exe|)(?:(?:\s+--[-a-zA-Z]+|\s+-[a-zA-Z]+|\s[ABGJMOPRSUWZacdfh-pr-xz]+\b)(?:=[^ ]*|))+
# #pragma lib
^\s*#pragma comment\(lib, ".*?"\)
# UnitTests
\[DataRow\(.*\)\]
# AdditionalDependencies
<AdditionalDependencies>.*<
# the last line of mimetype="application/x-microsoft.net.object.bytearray.base64" things in .resx files
^\s*[-a-zA-Z=;:/0-9+]*[-a-zA-Z;:/0-9+][-a-zA-Z=;:/0-9+]*=$
RegExp\(@?([`'"]).*?\g{-1}\)|(?:escapes|regEx):\s*(?:/.*/|([`'"]).*?\g{-1})|return/.*?/
# Questionably acceptable forms of `in to`
# Personally, I prefer `log into`, but people object
# https://www.tprteaching.com/log-into-log-in-to-login/
@@ -205,16 +194,13 @@ RegExp\(@?([`'"]).*?\g{-1}\)|(?:escapes|regEx):\s*(?:/.*/|([`'"]).*?\g{-1})|retu
# to opt in
\bto opt in\b
# pass(ed|ing) in
\bpass(?:ed|ing) in\b
# acceptable duplicates
# ls directory listings
[-bcdlpsw](?:[-r][-w][-SsTtx]){3}[\.+*]?\s+\d+\s+\S+\s+\S+\s+[.\d]+(?:[KMGT]|)\s+
# mount
\bmount\s+-t\s+(\w+)\s+\g{-1}\b
# C types and repeated CSS values
\s(auto|buffalo|center|div|inherit|long|LONG|none|normal|solid|thin|transparent|very)(?:\s\g{-1})+\s
\s(auto|buffalo|center|div|inherit|long|LONG|none|normal|solid|thin|transparent|very)(?: \g{-1})+\s
# C enum and struct
\b(?:enum|struct)\s+(\w+)\s+\g{-1}\b
# go templates
@@ -246,11 +232,9 @@ _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING
# ignore long runs of a single character:
\b([A-Za-z])\g{-1}{3,}\b
# hit-count: 1 file-count: 1
# Amazon
\bamazon\.com/[-\w]+/(?:dp/[0-9A-Z]+|)[^"'\s]+
\bamazon\.com/[-\w]+/(?:dp/[0-9A-Z]+|)
# hit-count: 3 file-count: 3
# imgur
\bimgur\.com/[^.]+

View File

@@ -1,17 +1,8 @@
^attache$
^bellows?$
^bellow$
benefitting
occurences?
^dependan.*
^develope$
^developement$
^developpe
^Devers?$
^devex
^devide
^Devinn?[ae]
^devisal
^devisor
^diables?$
^oer$
Sorce
@@ -19,5 +10,4 @@ Sorce
^Teh$
^untill$
^untilling$
^venders?$
^wether.*

View File

@@ -105,7 +105,7 @@ jobs:
report-timing: 1
warnings: bad-regex,binary-file,deprecated-feature,ignored-expect-variant,large-file,limited-references,no-newline-at-eof,noisy-file,non-alpha-in-dictionary,token-is-substring,unexpected-line-ending,whitespace-in-dictionary,minified-file,unsupported-configuration,no-files-to-check,unclosed-block-ignore-begin,unclosed-block-ignore-end
experimental_apply_changes_via_bot: 1
use_sarif: 1
use_sarif: ${{ (!github.event.pull_request || (github.event.pull_request.head.repo.full_name == github.repository)) && 1 }}
check_extra_dictionaries: ""
dictionary_source_prefixes: >
{
@@ -113,28 +113,37 @@ jobs:
}
extra_dictionaries: |
cspell:software-terms/softwareTerms.txt
cspell:cpp/stdlib-c.txt
cspell:cpp/stdlib-cpp.txt
cspell:filetypes/filetypes.txt
cspell:php/php.txt
cspell:dart/dart.txt
cspell:dotnet/dotnet.txt
cspell:powershell/powershell.txt
cspell:csharp/csharp.txt
cspell:cpp/stdlib-c.txt
cspell:lorem-ipsum/dictionary.txt
cspell:python/python/python-lib.txt
cspell:node/node.txt
cspell:golang/go.txt
cspell:npm/npm.txt
cspell:php/php.txt
cspell:fullstack/fullstack.txt
cspell:css/css.txt
cspell:java/java.txt
cspell:typescript/typescript.txt
cspell:html/html.txt
cspell:r/r.txt
cspell:aws/aws.txt
cspell:dotnet/dotnet.txt
cspell:swift/swift.txt
cspell:node/node.txt
cspell:dart/dart.txt
cspell:django/django.txt
cspell:python/python/python.txt
cspell:powershell/powershell.txt
cspell:npm/npm.txt
cspell:golang/go.txt
cspell:cpp/compiler-msvc.txt
cspell:csharp/csharp.txt
cspell:html/html.txt
cspell:java/java.txt
cspell:aws/aws.txt
cspell:typescript/typescript.txt
cspell:cpp/lang-keywords.txt
cspell:python/common/extra.txt
cspell:scala/scala.txt
cspell:shell/shell-all-words.txt
cspell:css/css.txt
cspell:r/r.txt
cspell:java/java-terms.txt
cspell:cpp/stdlib-cerrno.txt
cspell:k8s/k8s.txt
comment-push:
name: Report (Push)

4
.gitignore vendored
View File

@@ -350,6 +350,10 @@ src/common/Telemetry/*.etl
# Generated installer file for Monaco source files.
/installer/PowerToysSetup/MonacoSRC.wxs
/installer/PowerToysSetupVNext/MonacoSRC.wxs
# MSBuildCache
/MSBuildCacheLogs/
# PowerToysInstaller Build Temp Files
installer/*/*.wxs.bk

View File

@@ -11,13 +11,14 @@
"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",
@@ -32,7 +33,7 @@
"PowerToys.AlwaysOnTopModuleInterface.dll",
"PowerToys.CmdNotFoundModuleInterface.dll",
"PowerToys.CmdNotFound.dll",
"PowerToys.ColorPicker.dll",
"PowerToys.ColorPickerUI.dll",
@@ -53,7 +54,7 @@
"PowerToys.Awake.exe",
"PowerToys.Awake.dll",
"fancyzones.dll",
"PowerToys.FancyZonesEditor.exe",
"PowerToys.FancyZonesEditor.dll",
"PowerToys.FancyZonesEditorCommon.dll",
@@ -135,7 +136,7 @@
"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",
@@ -274,16 +275,16 @@
"Mono.Cecil.Pdb.dll",
"Mono.Cecil.Rocks.dll",
"Newtonsoft.Json.dll",
"Newtonsoft.Json.Bson.dll",
"NLog.dll",
"HtmlAgilityPack.dll",
"Markdig.Signed.dll",
"HelixToolkit.dll",
"HelixToolkit.Core.Wpf.dll",
"Mages.Core.dll",
"JetBrains.Annotations.dll",
"NLog.Extensions.Logging.dll",
"getfilesiginforedist.dll",
"concrt140_app.dll",
"msvcp140_1_app.dll",
"msvcp140_2_app.dll",
@@ -293,8 +294,22 @@
"vcomp140_app.dll",
"vcruntime140_1_app.dll",
"vcruntime140_app.dll",
"WinUI3Apps\\CommunityToolkit.Labs.WinUI.SettingsControls.dll",
"UnicodeInformation.dll",
"Vanara.Core.dll",
"Vanara.PInvoke.ComCtl32.dll",
"Vanara.PInvoke.Cryptography.dll",
"Vanara.PInvoke.Gdi32.dll",
"Vanara.PInvoke.Kernel32.dll",
"Vanara.PInvoke.Ole.dll",
"Vanara.PInvoke.Rpc.dll",
"Vanara.PInvoke.Security.dll",
"Vanara.PInvoke.Shared.dll",
"Vanara.PInvoke.Shell32.dll",
"Vanara.PInvoke.ShlwApi.dll",
"Vanara.PInvoke.User32.dll",
"WinUI3Apps\\clrcompression.dll",
"WinUI3Apps\\Microsoft.Graphics.Canvas.Interop.dll",
"Microsoft.Web.WebView2.Core.dll",
"Microsoft.Web.WebView2.WinForms.dll",
"Microsoft.Web.WebView2.Wpf.dll",
@@ -321,7 +336,7 @@
"Testably.Abstractions.FileSystem.Interface.dll",
"WinUI3Apps\\Testably.Abstractions.FileSystem.Interface.dll",
"ColorCode.Core.dll",
"ColorCode.UWP.dll",
"UnitsNet.dll",
"UtfUnknown.dll",
"Wpf.Ui.dll"

View File

@@ -5,8 +5,12 @@
{
"MatchedPath": [
"PowerToysSetupCustomActions.dll",
"PowerToysSetupCustomActionsVNext.dll",
"PowerToys*Setup-*.exe",
"PowerToys*Setup-*.msi"
"PowerToys*Setup-*.msi",
"PowerToys*Setup-*.msi",
"PowerToys*SetupVNext-*.exe",
"PowerToys*SetupVNext-*.msi"
],
"SigningInfo": {
"Operations": [

View File

@@ -1,46 +0,0 @@
param(
[Parameter()]
[ValidateSet("Machine", "PerUser")]
[string]$InstallMode = "Machine"
)
$ProgressPreference = 'SilentlyContinue'
# Get artifact path
$ArtifactPath = $ENV:BUILD_ARTIFACTSTAGINGDIRECTORY
if (-not $ArtifactPath) {
throw "BUILD_ARTIFACTSTAGINGDIRECTORY environment variable not set"
}
# Since we only download PowerToysSetup-*.exe files, we can directly find it
$Installer = Get-ChildItem -Path $ArtifactPath -Filter 'PowerToys*.exe' | Select-Object -First 1
if (-not $Installer) {
throw "PowerToys installer not found"
}
Write-Host "Installing PowerToys: $($Installer.Name)"
# Install PowerToys
$Process = Start-Process -Wait -FilePath $Installer.FullName -ArgumentList "/passive", "/norestart" -PassThru -NoNewWindow
if ($Process.ExitCode -eq 0 -or $Process.ExitCode -eq 3010) {
Write-Host "✅ PowerToys installation completed successfully"
} else {
throw "PowerToys installation failed with exit code: $($Process.ExitCode)"
}
# Verify installation
if ($InstallMode -eq "PerUser") {
if (Test-Path "${env:LOCALAPPDATA}\PowerToys\PowerToys.exe") {
Write-Host "✅ PowerToys verified at: ${env:LOCALAPPDATA}\PowerToys\PowerToys.exe"
} else {
throw "PowerToys installation verification failed"
}
} else {
if (Test-Path "${env:ProgramFiles}\PowerToys\PowerToys.exe") {
Write-Host "✅ PowerToys verified at: ${env:ProgramFiles}\PowerToys\PowerToys.exe"
} else {
throw "PowerToys installation verification failed"
}
}

View File

@@ -43,7 +43,6 @@ stages:
enableMsBuildCaching: ${{ parameters.enableMsBuildCaching }}
runTests: true
useVSPreview: ${{ parameters.useVSPreview }}
timeoutInMinutes: 90
- stage: OneFuzz
displayName: Fuzz ${{ parameters.platform }}

View File

@@ -81,12 +81,6 @@ parameters:
- 'src/modules/previewpane/SvgPreviewHandler/SvgPreviewHandler.csproj'
- 'src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.csproj'
- 'src/modules/FileLocksmith/FileLocksmithUI/FileLocksmithUI.csproj'
- name: timeoutInMinutes
type: number
default: 240
- name: cancelTimeoutInMinutes
type: number
default: 1
jobs:
- job: ${{ parameters.jobName }}
@@ -129,8 +123,8 @@ jobs:
${{ else }}:
RestoreAdditionalProjectSourcesArg: ''
displayName: Build
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
cancelTimeoutInMinutes: ${{ parameters.cancelTimeoutInMinutes }}
timeoutInMinutes: 240
cancelTimeoutInMinutes: 1
templateContext: # Required when this template is hosted in 1ES PT
outputs:
- output: pipelineArtifact
@@ -476,9 +470,24 @@ jobs:
additionalBuildOptions: ${{ parameters.additionalBuildOptions }}
buildUserInstaller: true # NOTE: This is the distinction between the above and below rules
- template: steps-build-installer-vnext.yml
parameters:
codeSign: ${{ parameters.codeSign }}
signingIdentity: ${{ parameters.signingIdentity }}
versionNumber: ${{ parameters.versionNumber }}
additionalBuildOptions: ${{ parameters.additionalBuildOptions }}
- template: steps-build-installer-vnext.yml
parameters:
codeSign: ${{ parameters.codeSign }}
signingIdentity: ${{ parameters.signingIdentity }}
versionNumber: ${{ parameters.versionNumber }}
additionalBuildOptions: ${{ parameters.additionalBuildOptions }}
buildUserInstaller: true # NOTE: This is the distinction between the above and below rules
# This saves ~1GiB per architecture. We won't need these later.
# Removes:
# - All .pdb files from any static libs .libs (which were only used during linking)
# - All .pdbs from any static libs .libs (which were only used during linking)
- pwsh: |-
$binDir = '$(Build.SourcesDirectory)'
$ImportLibs = Get-ChildItem $binDir -Recurse -File -Filter '*.exp' | ForEach-Object { $_.FullName -Replace "exp$","lib" }
@@ -498,6 +507,13 @@ jobs:
flattenFolders: True
targetFolder: $(JobOutputDirectory)
- task: CopyFiles@2
displayName: Stage Installers
inputs:
contents: "**/PowerToys*SetupVNext-*.exe"
flattenFolders: True
targetFolder: $(JobOutputDirectory)
- task: CopyFiles@2
displayName: Stage Symbols
inputs:
@@ -531,6 +547,28 @@ jobs:
$machineHash | out-file -filepath $combinedMachinePath
displayName: Calculate file hashes
# Output config for installer vnext
- pwsh: |-
$p = "$(JobOutputDirectory)\"
$userHash = ((Get-Item $p\PowerToysUserSetupVNext*.exe | Get-FileHash).Hash);
$machineHash = ((Get-Item $p\PowerToysSetupVNext*.exe | Get-FileHash).Hash);
$userPlat = "hash_user_$(BuildPlatform).txt";
$machinePlat = "hash_machine_$(BuildPlatform).txt";
$combinedUserPath = $p + $userPlat;
$combinedMachinePath = $p + $machinePlat;
echo $p
echo $userPlat
echo $userHash
echo $combinedUserPath
echo $machinePlat
echo $machineHash
echo $combinedMachinePath
$userHash | out-file -filepath $combinedUserPath
$machineHash | out-file -filepath $combinedMachinePath
displayName: Calculate file hashes
# Publishing the GPO files
- pwsh: |-
New-Item "$(JobOutputDirectory)/gpo" -Type Directory

View File

@@ -1,132 +0,0 @@
# Minimal UI Tests Build Template
# This template only builds UI test projects and stages their test DLLs for consumption by test pipelines
parameters:
- name: buildConfigurations
type: object
default:
- Release
- name: buildPlatforms
type: object
default:
- x64
- name: condition
type: string
default: ''
- name: dependsOn
type: object
default: []
- name: pool
type: object
default: []
- name: variables
type: object
default: {}
- name: uiTestModules
type: object
default: []
jobs:
- job: BuildUITests
${{ if ne(length(parameters.pool), 0) }}:
pool: ${{ parameters.pool }}
dependsOn: ${{ parameters.dependsOn }}
condition: ${{ parameters.condition }}
strategy:
matrix:
${{ each config in parameters.buildConfigurations }}:
${{ each platform in parameters.buildPlatforms }}:
${{ config }}_${{ platform }}:
BuildConfiguration: ${{ config }}
BuildPlatform: ${{ platform }}
variables:
JobOutputDirectory: $(Build.ArtifactStagingDirectory)
LogOutputDirectory: $(Build.ArtifactStagingDirectory)\logs
JobOutputArtifactName: build-$(BuildPlatform)-$(BuildConfiguration)
NUGET_RESTORE_MSBUILD_ARGS: /p:Platform=$(BuildPlatform)
${{ insert }}: ${{ parameters.variables }}
displayName: Build UI Tests Only
timeoutInMinutes: 60
cancelTimeoutInMinutes: 1
templateContext:
outputs:
- output: pipelineArtifact
artifactName: $(JobOutputArtifactName)
targetPath: $(Build.ArtifactStagingDirectory)
steps:
- checkout: self
clean: true
submodules: true
persistCredentials: True
fetchTags: false
fetchDepth: 1
- template: steps-ensure-dotnet-version.yml
parameters:
sdk: true
version: '9.0'
- template: .\steps-restore-nuget.yml
- task: NuGetCommand@2
displayName: Restore solution-level NuGet packages
inputs:
command: restore
feedsToUse: config
configPath: nuget.config
restoreSolution: PowerToys.sln
restoreDirectory: '$(Build.SourcesDirectory)\packages'
# Build all UI test projects if no specific modules are specified
- ${{ if eq(length(parameters.uiTestModules), 0) }}:
- task: VSBuild@1
displayName: Build UI Test Projects
inputs:
solution: '**/*UITest*.csproj'
vsVersion: 17.0
msbuildArgs: >-
-restore
-graph
/p:RestorePackagesConfig=true
/p:BuildProjectReferences=true
/p:CIBuild=true
/bl:$(LogOutputDirectory)\build-all-uitests.binlog
$(NUGET_RESTORE_MSBUILD_ARGS)
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
msbuildArchitecture: x64
maximumCpuCount: true
# Build specific UI test modules
- ${{ if ne(length(parameters.uiTestModules), 0) }}:
- ${{ each module in parameters.uiTestModules }}:
- task: VSBuild@1
displayName: 'Build UI Test Module: ${{ module }}'
inputs:
solution: '**/*${{ module }}*.csproj'
vsVersion: 17.0
msbuildArgs: >-
-restore
-graph
/p:RestorePackagesConfig=true
/p:BuildProjectReferences=true
/p:CIBuild=true
/bl:$(LogOutputDirectory)\build-${{ module }}.binlog
$(NUGET_RESTORE_MSBUILD_ARGS)
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
msbuildArchitecture: x64
maximumCpuCount: true
# Stage test project outputs with directory structure
- task: CopyFiles@2
displayName: Stage UI Test Build Outputs
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
contents: '$(BuildPlatform)/$(BuildConfiguration)/**/*'
targetFolder: '$(JobOutputDirectory)\$(BuildPlatform)\$(BuildConfiguration)'
- publish: $(JobOutputDirectory)
artifact: $(JobOutputArtifactName)
displayName: Publish UI Test artifacts
condition: always()

View File

@@ -11,28 +11,10 @@ parameters:
- name: useLatestWebView2
type: boolean
default: false
- name: useLatestOfficialBuild
type: boolean
default: true
- name: useCurrentBranchBuild
type: boolean
default: false
- name: uiTestModules
type: object
default: []
- name: installMode
type: string
default: 'machine'
values:
- 'machine'
- 'peruser'
- name: jobSuffix
type: string
default: ''
jobs:
- job: Test${{ parameters.platform }}${{ parameters.configuration }}${{ parameters.jobSuffix }}
displayName: Test ${{ parameters.platform }} ${{ parameters.configuration }}${{ parameters.jobSuffix }}
- job: Test${{ parameters.platform }}${{ parameters.configuration }}
displayName: Test ${{ parameters.platform }} ${{ parameters.configuration }}
timeoutInMinutes: 300
variables:
${{ if or(eq(parameters.platform, 'x64Win10'), eq(parameters.platform, 'x64Win11')) }}:
@@ -113,80 +95,28 @@ jobs:
& '$(build.sourcesdirectory)\.pipelines\InstallWinAppDriver.ps1'
displayName: Download and install WinAppDriver
- ${{ if eq(parameters.useLatestOfficialBuild, true) }}:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'specific'
project: 'Dart'
definition: '76541'
buildVersionToDownload: 'latestFromBranch'
${{ if eq(parameters.useCurrentBranchBuild, true) }}:
branchName: '$(Build.SourceBranch)'
${{ else }}:
branchName: 'refs/heads/main'
artifactName: 'build-$(BuildPlatform)-Release'
targetPath: '$(Build.ArtifactStagingDirectory)'
${{ if eq(parameters.installMode, 'peruser') }}:
patterns: |
**/PowerToysUserSetup*.exe
${{ else }}:
patterns: |
**/PowerToysSetup*.exe
- ${{ if eq(parameters.useLatestOfficialBuild, true) }}:
- ${{ if eq(parameters.installMode, 'peruser') }}:
- pwsh: |-
& "$(build.sourcesdirectory)\.pipelines\installPowerToys.ps1" -InstallMode "PerUser"
displayName: Install PowerToys (Per-User)
- ${{ if eq(parameters.installMode, 'machine') }}:
- pwsh: |-
& "$(build.sourcesdirectory)\.pipelines\installPowerToys.ps1" -InstallMode "Machine"
displayName: Install PowerToys (Machine-Level)
- ${{ if ne(parameters.platform, 'arm64') }}:
- task: ScreenResolutionUtility@1
inputs:
displaySettings: 'optimal'
- ${{ if eq(length(parameters.uiTestModules), 0) }}:
- task: VSTest@3
displayName: Run UI Tests
inputs:
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
testSelector: 'testAssemblies'
searchFolder: '$(Pipeline.Workspace)\$(TestArtifactsName)'
vsTestVersion: 'toolsInstaller'
uiTests: true
rerunFailedTests: true
# Since UITests-FancyZonesEditor.dll is generated in both UITests-FancyZonesEditor and UITests-FancyZones, removed one to avoid duplicate test runs
testAssemblyVer2: |
**\*UITest*.dll
!**\obj\**
!**\ref\**
!**\UITests-FancyZones\**\UITests-FancyZonesEditor.dll
env:
platform: '$(TestPlatform)'
useInstallerForTest: ${{ parameters.useLatestOfficialBuild }}
- task: VSTest@3
displayName: Run UI Tests
inputs:
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
testSelector: 'testAssemblies'
searchFolder: '$(Pipeline.Workspace)\$(TestArtifactsName)'
vsTestVersion: 'toolsInstaller'
uiTests: true
rerunFailedTests: true
# Since UITests-FancyZonesEditor.dll is generated in both UITests-FancyZonesEditor and UITests-FancyZones, removed one to avoid duplicate test runs
testAssemblyVer2: |
**\*UITest*.dll
!**\obj\**
!**\ref\**
!**\UITests-FancyZones\**\UITests-FancyZonesEditor.dll
- ${{ if ne(length(parameters.uiTestModules), 0) }}:
- ${{ each module in parameters.uiTestModules }}:
- task: VSTest@3
displayName: Run UI Test - ${{ module }}
inputs:
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
testSelector: 'testAssemblies'
searchFolder: '$(Pipeline.Workspace)\$(TestArtifactsName)'
vsTestVersion: 'toolsInstaller'
uiTests: true
rerunFailedTests: true
testAssemblyVer2: |
**\*${{ module }}*.dll
!**\obj\**
!**\ref\**
!**\UITests-FancyZones\**\UITests-FancyZonesEditor.dll
env:
platform: '$(TestPlatform)'
useInstallerForTest: ${{ parameters.useLatestOfficialBuild }}
env:
platform: '$(TestPlatform)'

View File

@@ -60,5 +60,4 @@ stages:
useLatestWinAppSDK: ${{ parameters.useLatestWinAppSDK }}
${{ if eq(parameters.useLatestWinAppSDK, true) }}:
winAppSDKVersionNumber: ${{ parameters.winAppSDKVersionNumber }}
useExperimentalVersion: ${{ parameters.useExperimentalVersion }}
timeoutInMinutes: 90
useExperimentalVersion: ${{ parameters.useExperimentalVersion }}

View File

@@ -22,155 +22,63 @@ parameters:
- name: useLatestWebView2
type: boolean
default: false
- name: useLatestOfficialBuild
type: boolean
default: true
- name: testBothInstallModes
type: boolean
default: true
- name: useCurrentBranchBuild
type: boolean
default: false
- name: uiTestModules
type: object
default: []
stages:
- ${{ each platform in parameters.buildPlatforms }}:
- ${{ if eq(parameters.useLatestOfficialBuild, false) }}:
- stage: Build_${{ platform }}
displayName: Build ${{ platform }}
dependsOn: []
jobs:
- template: job-build-project.yml
parameters:
pool:
${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}:
name: SHINE-INT-L
${{ else }}:
name: SHINE-OSS-L
${{ if eq(parameters.useVSPreview, true) }}:
demands: ImageOverride -equals SHINE-VS17-Preview
buildPlatforms:
- ${{ platform }}
buildConfigurations: [Release]
enablePackageCaching: true
enableMsBuildCaching: ${{ parameters.enableMsBuildCaching }}
runTests: false
buildTests: true
useVSPreview: ${{ parameters.useVSPreview }}
timeoutInMinutes: 90
- ${{ if eq(parameters.useLatestOfficialBuild, true) }}:
- stage: BuildUITests_${{ platform }}
displayName: Build UI Tests Only
dependsOn: []
jobs:
- template: job-build-ui-tests.yml
parameters:
pool:
${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}:
name: SHINE-INT-L
${{ else }}:
name: SHINE-OSS-L
${{ if eq(parameters.useVSPreview, true) }}:
demands: ImageOverride -equals SHINE-VS17-Preview
buildPlatforms:
- ${{ platform }}
uiTestModules: ${{ parameters.uiTestModules }}
- stage: Build_${{ platform }}
displayName: Build ${{ platform }}
dependsOn: []
jobs:
- template: job-build-project.yml
parameters:
pool:
${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}:
name: SHINE-INT-L
${{ else }}:
name: SHINE-OSS-L
${{ if eq(parameters.useVSPreview, true) }}:
demands: ImageOverride -equals SHINE-VS17-Preview
buildPlatforms:
- ${{ platform }}
buildConfigurations: [Release]
enablePackageCaching: true
enableMsBuildCaching: ${{ parameters.enableMsBuildCaching }}
runTests: false
buildTests: true
useVSPreview: ${{ parameters.useVSPreview }}
- ${{ if eq(platform, 'x64') }}:
- stage: Test_x64Win10
displayName: Test x64Win10
${{ if eq(parameters.useLatestOfficialBuild, true) }}:
dependsOn:
- BuildUITests_${{ platform }}
${{ else }}:
dependsOn:
- Build_${{ platform }}
dependsOn:
- Build_${{platform}}
jobs:
- template: job-test-project.yml
parameters:
platform: x64Win10
configuration: Release
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
useLatestOfficialBuild: ${{ parameters.useLatestOfficialBuild }}
useCurrentBranchBuild: ${{ parameters.useCurrentBranchBuild }}
uiTestModules: ${{ parameters.uiTestModules }}
# Additional per-user installation test (when both modes are enabled)
- ${{ if and(eq(parameters.useLatestOfficialBuild, true), eq(parameters.testBothInstallModes, true)) }}:
- template: job-test-project.yml
parameters:
platform: x64Win10
configuration: Release
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
useLatestOfficialBuild: ${{ parameters.useLatestOfficialBuild }}
useCurrentBranchBuild: ${{ parameters.useCurrentBranchBuild }}
uiTestModules: ${{ parameters.uiTestModules }}
installMode: 'peruser'
jobSuffix: '_PerUser'
- ${{ if eq(platform, 'x64') }}:
- stage: Test_x64Win11
displayName: Test x64Win11
${{ if eq(parameters.useLatestOfficialBuild, true) }}:
dependsOn:
- BuildUITests_${{ platform }}
${{ else }}:
dependsOn:
- Build_${{ platform }}
dependsOn:
- Build_${{platform}}
jobs:
- template: job-test-project.yml
parameters:
platform: x64Win11
configuration: Release
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
useLatestOfficialBuild: ${{ parameters.useLatestOfficialBuild }}
useCurrentBranchBuild: ${{ parameters.useCurrentBranchBuild }}
uiTestModules: ${{ parameters.uiTestModules }}
# Additional per-user installation test (when both modes are enabled)
- ${{ if and(eq(parameters.useLatestOfficialBuild, true), eq(parameters.testBothInstallModes, true)) }}:
- template: job-test-project.yml
parameters:
platform: x64Win11
configuration: Release
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
useLatestOfficialBuild: ${{ parameters.useLatestOfficialBuild }}
useCurrentBranchBuild: ${{ parameters.useCurrentBranchBuild }}
uiTestModules: ${{ parameters.uiTestModules }}
installMode: 'peruser'
jobSuffix: '_PerUser'
- ${{ if ne(platform, 'x64') }}:
- stage: Test_${{ platform }}
displayName: Test ${{ platform }}
${{ if eq(parameters.useLatestOfficialBuild, true) }}:
dependsOn:
- BuildUITests_${{ platform }}
${{ else }}:
dependsOn:
- Build_${{ platform }}
dependsOn:
- Build_${{platform}}
jobs:
- template: job-test-project.yml
parameters:
platform: ${{ platform }}
configuration: Release
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
useLatestOfficialBuild: ${{ parameters.useLatestOfficialBuild }}
useCurrentBranchBuild: ${{ parameters.useCurrentBranchBuild }}
uiTestModules: ${{ parameters.uiTestModules }}
# Additional per-user installation test (when both modes are enabled)
- ${{ if and(eq(parameters.useLatestOfficialBuild, true), eq(parameters.testBothInstallModes, true)) }}:
- template: job-test-project.yml
parameters:
platform: ${{ platform }}
configuration: Release
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
useLatestOfficialBuild: ${{ parameters.useLatestOfficialBuild }}
useCurrentBranchBuild: ${{ parameters.useCurrentBranchBuild }}
uiTestModules: ${{ parameters.uiTestModules }}
installMode: 'peruser'
jobSuffix: '_PerUser'

View File

@@ -0,0 +1,185 @@
parameters:
- name: versionNumber
type: string
default: "0.0.1"
- name: buildUserInstaller
type: boolean
default: false
- name: codeSign
type: boolean
default: false
- name: signingIdentity
type: object
default: {}
- name: additionalBuildOptions
type: string
default: ''
steps:
- pwsh: |-
& git clean -xfd -e *exe -- .\installer\
displayName: ${{replace(replace(parameters.buildUserInstaller,'True','👤'),'False','💻')}} Clean installer to reduce cross-contamination
- pwsh: |-
$IsPerUser = $${{ parameters.buildUserInstaller }}
$InstallerBuildSlug = "MachineSetup"
$InstallerBasename = "PowerToysSetupVNext"
If($IsPerUser) {
$InstallerBuildSlug = "UserSetup"
$InstallerBasename = "PowerToysUserSetupVNext"
}
$InstallerBasename += "-${{ parameters.versionNumber }}-$(BuildPlatform)"
Write-Host "##vso[task.setvariable variable=InstallerBuildSlug]$InstallerBuildSlug"
Write-Host "##vso[task.setvariable variable=InstallerRelativePath]$(BuildPlatform)\$(BuildConfiguration)\$InstallerBuildSlug"
Write-Host "##vso[task.setvariable variable=InstallerBasename]$InstallerBasename"
displayName: ${{replace(replace(parameters.buildUserInstaller,'True','👤'),'False','💻')}} Prepare Installer variables
# This dll needs to be built and signed before building the MSI.
- task: VSBuild@1
displayName: ${{replace(replace(parameters.buildUserInstaller,'True','👤'),'False','💻')}} Build PowerToysSetupCustomActionsVNext
inputs:
solution: "**/installer/PowerToysSetup.sln"
vsVersion: 17.0
msbuildArgs: >-
/t:PowerToysSetupCustomActionsVNext
/p:RunBuildEvents=true;PerUser=${{parameters.buildUserInstaller}};RestorePackagesConfig=true;CIBuild=true
-restore -graph
/bl:$(LogOutputDirectory)\installer-$(InstallerBuildSlug)-actions.binlog
${{ parameters.additionalBuildOptions }}
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true
msbuildArchitecture: x64
maximumCpuCount: true
- ${{ if eq(parameters.codeSign, true) }}:
- template: steps-esrp-signing.yml
parameters:
displayName: ${{replace(replace(parameters.buildUserInstaller,'True','👤'),'False','💻')}} Sign PowerToysSetupCustomActionsVNext
signingIdentity: ${{ parameters.signingIdentity }}
inputs:
FolderPath: 'installer/PowerToysSetupCustomActionsVNext/$(InstallerRelativePath)'
signType: batchSigning
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_installer.json'
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
## INSTALLER START
#### MSI BUILDING AND SIGNING
- task: VSBuild@1
displayName: ${{replace(replace(parameters.buildUserInstaller,'True','👤'),'False','💻')}} Build VNext MSI
inputs:
solution: "**/installer/PowerToysSetup.sln"
vsVersion: 17.0
msbuildArgs: >-
-restore
/t:PowerToysInstallerVNext
/p:RunBuildEvents=false;PerUser=${{parameters.buildUserInstaller}};BuildProjectReferences=false;CIBuild=true
/bl:$(LogOutputDirectory)\installer-$(InstallerBuildSlug)-msi.binlog
${{ parameters.additionalBuildOptions }}
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: false # don't undo our hard work above by deleting the CustomActions dll
msbuildArchitecture: x64
maximumCpuCount: true
- script: |-
"C:\Program Files (x86)\WiX Toolset v3.14\bin\dark.exe" -x $(build.sourcesdirectory)\extractedMsi installer\PowerToysSetupVNext\$(InstallerRelativePath)\$(InstallerBasename).msi
dir $(build.sourcesdirectory)\extractedMsi
displayName: "${{replace(replace(parameters.buildUserInstaller,'True','👤'),'False','💻')}} Extract and verify MSI"
# Check if deps.json files don't reference different dll versions.
- pwsh: |-
& '.pipelines/verifyDepsJsonLibraryVersions.ps1' -targetDir '$(build.sourcesdirectory)\extractedMsi\File'
displayName: ${{replace(replace(parameters.buildUserInstaller,'True','👤'),'False','💻')}} Audit deps.json in MSI extracted files
- ${{ if eq(parameters.codeSign, true) }}:
- pwsh: |-
& .pipelines/versionAndSignCheck.ps1 -targetDir '$(build.sourcesdirectory)\extractedMsi\File'
& .pipelines/versionAndSignCheck.ps1 -targetDir '$(build.sourcesdirectory)\extractedMsi\Binary'
git clean -xfd ./extractedMsi
displayName: ${{replace(replace(parameters.buildUserInstaller,'True','👤'),'False','💻')}} Verify all binaries are signed and versioned
- template: steps-esrp-signing.yml
parameters:
displayName: ${{replace(replace(parameters.buildUserInstaller,'True','👤'),'False','💻')}} Sign VNext MSI
signingIdentity: ${{ parameters.signingIdentity }}
inputs:
FolderPath: 'installer/PowerToysSetupVNext/$(InstallerRelativePath)'
signType: batchSigning
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_installer.json'
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
#### END MSI
#### BOOTSTRAP BUILDING AND SIGNING
- task: VSBuild@1
displayName: ${{replace(replace(parameters.buildUserInstaller,'True','👤'),'False','💻')}} Build VNext Bootstrapper
inputs:
solution: "**/installer/PowerToysSetup.sln"
vsVersion: 17.0
msbuildArgs: >-
-restore
/t:PowerToysBootstrapperVNext
/p:PerUser=${{parameters.buildUserInstaller}};CIBuild=true
/bl:$(LogOutputDirectory)\installer-$(InstallerBuildSlug)-bootstrapper.binlog
-restore -graph
${{ parameters.additionalBuildOptions }}
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: false # don't undo our hard work above by deleting the MSI
msbuildArchitecture: x64
maximumCpuCount: true
# The entirety of bundle unpacking/re-packing is unnecessary if we are not code signing it.
- ${{ if eq(parameters.codeSign, true) }}:
- script: |-
"C:\Program Files (x86)\WiX Toolset v3.14\bin\insignia.exe" -ib installer\PowerToysSetupVNext\$(InstallerRelativePath)\$(InstallerBasename).exe -o installer\engine.exe
displayName: "${{replace(replace(parameters.buildUserInstaller,'True','👤'),'False','💻')}} Insignia: Extract Engine from Bundle"
- template: steps-esrp-signing.yml
parameters:
displayName: ${{replace(replace(parameters.buildUserInstaller,'True','👤'),'False','💻')}} Sign WiX Engine
signingIdentity: ${{ parameters.signingIdentity }}
inputs:
FolderPath: "installer"
Pattern: engine.exe
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode": "CP-230012",
"OperationCode": "SigntoolSign",
"Parameters": {
"OpusName": "Microsoft",
"OpusInfo": "http://www.microsoft.com",
"FileDigest": "/fd \"SHA256\"",
"PageHash": "/NPH",
"TimeStamp": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
},
"ToolName": "sign",
"ToolVersion": "1.0"
},
{
"KeyCode": "CP-230012",
"OperationCode": "SigntoolVerify",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
}
]
- script: |-
"C:\Program Files (x86)\WiX Toolset v3.14\bin\insignia.exe" -ab installer\engine.exe installer\PowerToysSetupVNext\$(InstallerRelativePath)\$(InstallerBasename).exe -o installer\PowerToysSetupVNext\$(InstallerRelativePath)\$(InstallerBasename).exe
displayName: "${{replace(replace(parameters.buildUserInstaller,'True','👤'),'False','💻')}} Insignia: Merge Engine into Bundle"
- template: steps-esrp-signing.yml
parameters:
displayName: ${{replace(replace(parameters.buildUserInstaller,'True','👤'),'False','💻')}} Sign Final Bootstrapper
signingIdentity: ${{ parameters.signingIdentity }}
inputs:
FolderPath: 'installer/PowerToysSetupVNext/$(InstallerRelativePath)'
signType: batchSigning
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_installer.json'
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
#### END BOOTSTRAP
## END INSTALLER

View File

@@ -183,9 +183,9 @@ ZoomIt source code was originally implemented by [Sysinternals](https://sysinter
- [@cinnamon-msft](https://github.com/cinnamon-msft) - Kayla Cinnamon - Lead
- [@craigloewen-msft](https://github.com/craigloewen-msft) - Craig Loewen - Product Manager
- [@niels9001](https://github.com/niels9001/) - Niels Laute - 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
- [@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
- [@lei9444](https://github.com/lei9444) - Leilei Zhang - Dev
- [@shuaiyuanxx](https://github.com/shuaiyuanxx) - Shawn Yuan - Dev
- [@moooyo](https://github.com/moooyo) - Yu Leng - Dev
@@ -225,4 +225,4 @@ ZoomIt source code was originally implemented by [Sysinternals](https://sysinter
- [@donlaci](https://github.com/donlaci) - Laszlo Nemeth - Dev
- [@SeraphimaZykova](https://github.com/SeraphimaZykova) - Seraphima Zykova - Dev
- [@stefansjfw](https://github.com/stefansjfw) - Stefan Markovic - Dev
- [@jaimecbernardo](https://github.com/jaimecbernardo) - Jaime Bernardo - Dev Lead
- [@jaimecbernardo](https://github.com/jaimecbernardo) - Jaime Bernardo - Dev lead

View File

@@ -47,7 +47,7 @@
<!-- Add ability to run tests via "msbuild /t:Test" -->
<!--
Work around an MSBuild bug where Microsoft.Common.Test.targets is missing from the Arm64 installation.
Workaround an MSBuild bug where Microsoft.Common.Test.targets is missing from the Arm64 installation.
See: https://github.com/dotnet/msbuild/pull/9984
NB 1: This means that using "/t:Test" is not supported for Arm64 builds and tests will need to be run in an alternate way,
eg running tests in VS or invoking vstest.console directly.

View File

@@ -32,22 +32,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.7" />
<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.7" />
<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.7" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.7" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.7" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.7" />
<PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="9.0.7" />
<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.7" />
<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.7" />
<PackageVersion Include="Microsoft.Windows.Compatibility" Version="9.0.6" />
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.3.183" />
<!-- 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. -->
<!--
@@ -75,28 +75,28 @@
<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.7" />
<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.7" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="9.0.7" />
<PackageVersion Include="System.Data.OleDb" Version="9.0.7" />
<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.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.7" />
<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.7" />
<PackageVersion Include="System.Drawing.Common" Version="9.0.7" />
<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.7" />
<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.7" />
<PackageVersion Include="System.ServiceProcess.ServiceController" Version="9.0.7" />
<PackageVersion Include="System.Text.Encoding.CodePages" Version="9.0.7" />
<PackageVersion Include="System.Text.Json" Version="9.0.7" />
<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" />
@@ -104,6 +104,15 @@
<PackageVersion Include="WinUIEx" Version="2.2.0" />
<PackageVersion Include="WPF-UI" Version="3.0.5" />
<PackageVersion Include="WyHash" Version="1.0.5" />
<PackageVersion Include="WixToolset.Heat" Version="5.0.2" />
<PackageVersion Include="WixToolset.Firewall.wixext" Version="5.0.2" />
<PackageVersion Include="WixToolset.Util.wixext" Version="5.0.2" />
<PackageVersion Include="WixToolset.UI.wixext" Version="5.0.2" />
<PackageVersion Include="WixToolset.NetFx.wixext" Version="5.0.2" />
<PackageVersion Include="WixToolset.Bal.wixext" Version="5.0.2" />
<PackageVersion Include="WixToolset.BootstrapperApplicationApi" Version="5.0.2" />
<PackageVersion Include="WixToolset.Dtf.WindowsInstaller" Version="5.0.2" />
<PackageVersion Include="FireGiant.HeatWave.BuildTools.wixext" Version="5.0.2" />
</ItemGroup>
<ItemGroup Condition="'$(IsExperimentationLive)'!=''">
<!-- Additional dependencies used by experimentation -->

View File

@@ -1517,23 +1517,23 @@ SOFTWARE.
- Mages 3.0.0
- Markdig.Signed 0.34.0
- MessagePack 3.1.3
- Microsoft.Bcl.AsyncInterfaces 9.0.7
- Microsoft.Bcl.AsyncInterfaces 9.0.6
- Microsoft.Bot.AdaptiveExpressions.Core 4.23.0
- Microsoft.CodeAnalysis.NetAnalyzers 9.0.0
- Microsoft.Data.Sqlite 9.0.7
- Microsoft.Data.Sqlite 9.0.6
- Microsoft.Diagnostics.Tracing.TraceEvent 3.1.16
- Microsoft.DotNet.ILCompiler (A)
- Microsoft.Extensions.DependencyInjection 9.0.7
- Microsoft.Extensions.Hosting 9.0.7
- Microsoft.Extensions.Hosting.WindowsServices 9.0.7
- Microsoft.Extensions.Logging 9.0.7
- Microsoft.Extensions.Logging.Abstractions 9.0.7
- 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.7
- Microsoft.Windows.Compatibility 9.0.7
- Microsoft.Win32.SystemEvents 9.0.6
- Microsoft.Windows.Compatibility 9.0.6
- Microsoft.Windows.CsWin32 0.3.183
- Microsoft.Windows.CsWinRT 2.2.0
- Microsoft.Windows.SDK.BuildTools 10.0.26100.4188
@@ -1553,25 +1553,25 @@ SOFTWARE.
- SkiaSharp.Views.WinUI 2.88.9
- StreamJsonRpc 2.21.69
- StyleCop.Analyzers 1.2.0-beta.556
- System.CodeDom 9.0.7
- System.CodeDom 9.0.6
- System.CommandLine 2.0.0-beta4.22272.1
- System.ComponentModel.Composition 9.0.7
- System.Configuration.ConfigurationManager 9.0.7
- System.Data.OleDb 9.0.7
- 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.7
- System.Diagnostics.PerformanceCounter 9.0.7
- System.Drawing.Common 9.0.7
- 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.7
- 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.7
- System.ServiceProcess.ServiceController 9.0.7
- System.Text.Encoding.CodePages 9.0.7
- System.Text.Json 9.0.7
- 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

@@ -605,6 +605,9 @@ 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
@@ -722,8 +725,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalculatorEngineCommon", "s
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ManagedCsWin32", "src\common\ManagedCsWin32\ManagedCsWin32.csproj", "{14AFD976-B4D2-49D0-9E6C-AA93CC061B8A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerRenameUITest", "src\modules\powerrename\PowerRenameUITest\PowerRenameUITest.csproj", "{9D3F3793-EFE3-4525-8782-238015DABA62}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
@@ -2604,6 +2605,22 @@ 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
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Debug|ARM64.ActiveCfg = Debug|ARM64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Debug|ARM64.Build.0 = Debug|ARM64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Debug|x64.ActiveCfg = Debug|x64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Debug|x64.Build.0 = Debug|x64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Release|ARM64.ActiveCfg = Release|ARM64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Release|ARM64.Build.0 = Release|ARM64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Release|x64.ActiveCfg = Release|x64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Release|x64.Build.0 = Release|x64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Debug|ARM64.ActiveCfg = Debug|ARM64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Debug|ARM64.Build.0 = Debug|ARM64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Debug|x64.ActiveCfg = Debug|x64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Debug|x64.Build.0 = Debug|x64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Release|ARM64.ActiveCfg = Release|ARM64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Release|ARM64.Build.0 = Release|ARM64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Release|x64.ActiveCfg = Release|x64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.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
@@ -2626,22 +2643,6 @@ 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
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Debug|ARM64.ActiveCfg = Debug|ARM64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Debug|ARM64.Build.0 = Debug|ARM64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Debug|x64.ActiveCfg = Debug|x64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Debug|x64.Build.0 = Debug|x64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Release|ARM64.ActiveCfg = Release|ARM64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Release|ARM64.Build.0 = Release|ARM64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Release|x64.ActiveCfg = Release|x64
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Release|x64.Build.0 = Release|x64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Debug|ARM64.ActiveCfg = Debug|ARM64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Debug|ARM64.Build.0 = Debug|ARM64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Debug|x64.ActiveCfg = Debug|x64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Debug|x64.Build.0 = Debug|x64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Release|ARM64.ActiveCfg = Release|ARM64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Release|ARM64.Build.0 = Release|ARM64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Release|x64.ActiveCfg = Release|x64
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.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
@@ -2658,14 +2659,6 @@ Global
{14AFD976-B4D2-49D0-9E6C-AA93CC061B8A}.Release|ARM64.Build.0 = Release|ARM64
{14AFD976-B4D2-49D0-9E6C-AA93CC061B8A}.Release|x64.ActiveCfg = Release|x64
{14AFD976-B4D2-49D0-9E6C-AA93CC061B8A}.Release|x64.Build.0 = Release|x64
{9D3F3793-EFE3-4525-8782-238015DABA62}.Debug|ARM64.ActiveCfg = Debug|ARM64
{9D3F3793-EFE3-4525-8782-238015DABA62}.Debug|ARM64.Build.0 = Debug|ARM64
{9D3F3793-EFE3-4525-8782-238015DABA62}.Debug|x64.ActiveCfg = Debug|x64
{9D3F3793-EFE3-4525-8782-238015DABA62}.Debug|x64.Build.0 = Debug|x64
{9D3F3793-EFE3-4525-8782-238015DABA62}.Release|ARM64.ActiveCfg = Release|ARM64
{9D3F3793-EFE3-4525-8782-238015DABA62}.Release|ARM64.Build.0 = Release|ARM64
{9D3F3793-EFE3-4525-8782-238015DABA62}.Release|x64.ActiveCfg = Release|x64
{9D3F3793-EFE3-4525-8782-238015DABA62}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -2805,7 +2798,7 @@ Global
{25C91A4E-BA4E-467A-85CD-8B62545BF674} = {A50C70A6-2DA0-4027-B90E-B1A40755A8A5}
{6AB6A2D6-F859-4A82-9184-0BD29C9F07D1} = {A50C70A6-2DA0-4027-B90E-B1A40755A8A5}
{212AD910-8488-4036-BE20-326931B75FB2} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
{7AC943C9-52E8-44CF-9083-744D8049667B} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
{7AC943C9-52E8-44CF-9083-744D8049667B} = {322566EF-20DC-43A6-B9F8-616AF942579A}
{54A93AF7-60C7-4F6C-99D2-FBB1F75F853A} = {7AC943C9-52E8-44CF-9083-744D8049667B}
{92C39820-9F84-4529-BC7D-22AAE514D63B} = {7AC943C9-52E8-44CF-9083-744D8049667B}
{515554D1-D004-4F7F-A107-2211FC0F6B2C} = {7AC943C9-52E8-44CF-9083-744D8049667B}
@@ -2937,14 +2930,13 @@ Global
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A0} = {F05E590D-AD46-42BE-9C25-6A63ADD2E3EA}
{5702B3CC-8575-48D5-83D8-15BB42269CD3} = {929C1324-22E8-4412-A9A8-80E85F3985A5}
{64B88F02-CD88-4ED8-9624-989A800230F9} = {ECB8E0D1-7603-4E5C-AB10-D1E545E6F8E2}
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1} = {322566EF-20DC-43A6-B9F8-616AF942579A}
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
{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}
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1} = {322566EF-20DC-43A6-B9F8-616AF942579A}
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6} = {1AFB6476-670D-4E80-A464-657E01DFF482}
{14AFD976-B4D2-49D0-9E6C-AA93CC061B8A} = {1AFB6476-670D-4E80-A464-657E01DFF482}
{9D3F3793-EFE3-4525-8782-238015DABA62} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}

View File

@@ -16,56 +16,6 @@
- Run tests in the Test Explorer (`Test > Test Explorer` or `Ctrl+E, T`).
## Running tests in pipeline
The PowerToys UI test pipeline provides flexible options for building and testing:
### Pipeline Options
- **useLatestOfficialBuild**: When checked, downloads the latest official PowerToys build and installs it for testing. This skips the full solution build and only builds UI test projects.
- **useCurrentBranchBuild**: When checked along with `useLatestOfficialBuild`, downloads the official build from the current branch instead of main.
**Default value**: `false` (downloads from main branch)
**When to use this**:
- **Default scenario**: The pipeline tests against the latest signed PowerToys build from the `main` branch, regardless of which branch your test code changes are from
- **Custom branch testing**: Only specify `true` when:
- Your branch has produced its own signed PowerToys build via the official build pipeline
- You want to test against that specific branch's PowerToys build instead of main
- You are testing PowerToys functionality changes that are only available in your branch's build
**Important notes**:
- The test pipeline itself runs from your specified branch, but by default tests against the main branch's PowerToys build
- Not all branches have signed builds available - only use this if you're certain your branch has a signed build
- If enabled but no build exists for your branch, the pipeline may fail or fall back to main
- **uiTestModules**: Specify which UI test modules to build and run. This parameter controls both the `.csproj` projects to build and the `.dll` test assemblies to execute. Examples:
- `['UITests-FancyZones']` - Only FancyZones UI tests
- `['MouseUtils.UITests']` - Only MouseUtils UI tests
- `['UITests-FancyZones', 'MouseUtils.UITests']` - Multiple specific modules
- Leave empty to build and run all UI test modules
**Important**: The `uiTestModules` parameter values must match both the test project names (for `.csproj` selection during build) and the test assembly names (for `.dll` execution during testing).
### Build Modes
1. **Official Build + Selective Testing** (`useLatestOfficialBuild = true`)
- Downloads and installs official PowerToys build
- Builds only specified UI test projects
- Runs specified UI tests against installed PowerToys
- Controlled by `uiTestModules` parameter
2. **Full Build + Testing** (`useLatestOfficialBuild = false`)
- Builds entire PowerToys solution
- Builds UI test projects (all or specific based on `uiTestModules`)
- Runs UI tests (all or specific based on `uiTestModules`)
- Uses freshly built PowerToys for testing
> **Note**: Both modes support the `uiTestModules` parameter to control which specific UI test modules to build and run.
### Pipeline Access
- Pipeline: https://microsoft.visualstudio.com/Dart/_build?definitionId=161438&_a=summary
## How to add the first UI tests for your modules

View File

@@ -9,4 +9,4 @@ The following must be kept in mind regarding compatibility with settings v1 and
- The status of each of the modules is communicated with the runner in the form of a json object. The names of all the powerToys is set in the [`EnableModules.cs`](src/settings-ui/Settings.UI.Library/EnabledModules.cs) file. The `JsonPropertyName` must not be changed to ensure that the information is dispatched properly to all the modules by the runner.
### ImageResizer anomaly
All the powertoys have the same folder name as well as JsonPropertyName to communicate information with the runner. However that is not the case with ImageResizer. The folder name is `ImageResizer` whereas the JsonPropertyName has an additional space: `Image Resizer`. This should not be changed to ensure backward compatibility as well as proper functioning of the module.
All the powertoys have the same folder name as well as JsonPropertyName to communicate information with the runner. However that is not the case with ImageResizer. The folder name is `ImageResizer` whereas the JsonPropertyName is `Image Resizer`(Note the additional space). This should not be changed to ensure backward compatibility as well as proper functioning of the module.

View File

@@ -1,6 +1,6 @@
# What is it
We would like to enable our users to use [`winget configure`](https://learn.microsoft.com/en-us/windows/package-manager/winget/configure) command to install PowerToys and configure its settings with a [WinGet configuration file](https://learn.microsoft.com/en-us/windows/package-manager/configuration/create). For example:
We would like to enable our users to use [`winget configure`](https://learn.microsoft.com/en-us/windows/package-manager/winget/configure) command to install PowerToys and configure its settings with a [Winget configuration file](https://learn.microsoft.com/en-us/windows/package-manager/configuration/create). For example:
```yaml
properties:
@@ -35,7 +35,7 @@ This should install PowerToys and make `PowerToysConfigure` resource available.
PowerToys.Settings.exe set <ModuleName>.<SettingName> <SettingValue>
```
So for example the config above should perform 3 following invocations:
So for the example the config above should perform 3 following invocations:
```
PowerToys.Settings.exe set ShortcutGuide.Enabled false
PowerToys.Settings.exe set FancyZones.Enabled true

View File

@@ -1,25 +1,25 @@
# View Models
The view models are located within the [`Settings.UI.Library`](/src/settings-ui/Settings.UI.Library) project.
# Viewmodels
The viewmodels are located within the [`Settings.UI.Library`](/src/settings-ui/Settings.UI.Library) project.
## Components
- Each view model takes in the general `settingsRepository`, the `moduleSettingsRepository` if it exists and the delegates for IPC communication.
- Each viewmodel takes in the general `settingsRepository`, the `moduleSettingsRepository` if it exists and the delegates for IPC communication.
- The general `settingsRepository` contains the general configurations of all powertoys whereas the `moduleSettingsRepository` is specific to the module. This is to ensure that the configuration details are shared amongst the viewmodels without having to re-open the `settings.json` file.
- Whenever there is a change in the UI, the `OnPropertyChanged` event is invoked and the view model sends a corresponding IPC message to the runner which would perform the designated action such as dispatching the change to the modules or enabling/disabling the powertoy, etc.
- Whenever there is a change in the UI, the `OnPropertyChanged` event is invoked and the viewmodel sends a corresponding IPC message to the runner which would perform the designated action such as dispatching the change to the modules or enabling/disabling the powertoy etc.
#### Difference between view models
#### Difference between viewmodels
- The [`GeneralViewModel`](/src/settings-ui/Settings.UI.Library/ViewModels/GeneralViewModel.cs) is different from the rest of the view models with regard to the IPC communication wherein it sends special IPC messages to the runner to check for updates and to restart as admin.
- Each of the powerToy view models have two types of IPC communications, one for the general status of the powerToy and the other for communication powerToy specific change in properties to the runner.
- Each of the powerToy viewmodels have two types of IPC communications, one for the general status of the powerToy and the other for communication powerToy specific change in properties to the runner.
## [`SettingsRepository`](src/settings-ui/Settings.UI.Library/SettingsRepository`1.cs)
- The [`SettingsRepository`](src/settings-ui/Settings.UI.Library/SettingsRepository`1.cs) is a generic singleton which contains the configurations for each view model.
- As it is a generic singleton, there can only be one instance of the settings repository of a particular type. This ensures that all the view models are modifying a common object and a change made in one locations reflects everywhere.
- The [`SettingsRepository`](src/settings-ui/Settings.UI.Library/SettingsRepository`1.cs) is a generic singleton which contains the configurations for each viewmodel.
- As it is a generic singleton, there can only be one instance of the settings repository of a particular type. This ensures that all the viewmodels are modifying a common object and a change made in one locations reflects everywhere.
- The singleton implementation is thread-safe. Unit tests have been added for the same.
### Settings view model anomalies
- The reason behind using the `SettingsRepository` is to ensure that the settings process does not try to access the `settings.json` files directly but rather does it through this class which encapsulates all the file operations from the view models.
- However, this could not be expanded to all the view models directly for the following reasons. Some refactoring must be done to unify these cases and to bring them under the same model:
- The PowerRename view model does not save the settings configurations in the same format as the rest of the powertoys, i.e. {name, version, properties}. However, it only stores the properties directly.
- Some view models expect the runner to create the file instead of creating the file themselves, like in keyboard manager.
### Settings viewmodel anomalies
- The reason behind using the `SettingsRepository` is to ensure that the settings process does not try to access the `settings.json` files directly but rather does it through this class which encapsulates all the file operations from the viewmodels.
- However, this could not be expanded to all the viewmodels directly for the following reasons. Some refactoring must be done to unify these cases and to bring them under the same model:
- The PowerRename viewmodel does not save the settings configurations in the same format as the rest of the powertoys, ie. {name, version, properties}. However, it only stores the properties directly.
- Some viewmodels expect the runner to create the file instead of creating the file themselves, like in keyboard manager.
- The colorpicker powertoy creates the `settings.json` within the module. This must be taken care of when encapsulated within the settingsRepository.
- Currently, all modules use the `SettingsRepository` to access the General Settings config.
- However, only FancyZones, ShortcutGuide and PowerPreview use the `SettingsRepository` to access the module properties.

View File

@@ -14,7 +14,7 @@
## Localization on the pipeline (CDPX)
[The localization step](https://github.com/microsoft/PowerToys/blob/86d77103e9c69686c297490acb04775d43ef8b76/.pipelines/pipeline.user.windows.yml#L45-L52) is run on the pipeline before the solution is built. This step runs the [build-localization](https://github.com/microsoft/PowerToys/blob/main/.pipelines/build-localization.cmd) script, which generates resx files for all the projects with localization enabled using the `Localization.XLoc` package.
The [`Localization.XLoc`](https://github.com/microsoft/PowerToys/blob/86d77103e9c69686c297490acb04775d43ef8b76/.pipelines/build-localization.cmd#L24-L25) tool is run on the repo root, and it checks for all occurrences of `LocProject.json`. Each localized project has a `LocProject.json` file in the project root, which contains the location of the English resx file, list of languages for localization, and the output path where the localized resx files are to be copied to. In addition to this, some other parameters can be set, such as whether the language ID should be added as a folder in the file path or in the file name. When the CDPX pipeline is run, the localization team is notified of changes in the English resx files. For each project with localization enabled, a `loc` folder (see [the loc folder in the Microsoft.Launcher module](https://github.com/microsoft/PowerToys/tree/main/src/modules/launcher/Microsoft.Launcher/loc) for example) is created in the same directory as the `LocProject.json` file. The folder contains language specific folders which in turn have a nested folder path equivalent to `OutputPath` in the `LocProject.json`. Each of these folders contain one `lcl` file. The `lcl` files contain the English resources along with their translation for that language. These are described in more detail in the [Lcl files section](#lcl-files). Once the `.resx` files are generated, they will be used during the `Build PowerToys` step for localized versions of the modules.
The [`Localization.XLoc`](https://github.com/microsoft/PowerToys/blob/86d77103e9c69686c297490acb04775d43ef8b76/.pipelines/build-localization.cmd#L24-L25) tool is run on the repo root, and it checks for all occurrences of `LocProject.json`. Each localized project has a `LocProject.json` file in the project root, which contains the location of the English resx file, list of languages for localization, and the output path where the localized resx files are to be copied to. In addition to this, some other parameters can be set, such as whether the language ID should be added as a folder in the file path or in the file name. When the CDPX pipeline is run, the localization team is notified of changes in the English resx files. For each project with localization enabled, a `loc` folder (see [this](https://github.com/microsoft/PowerToys/tree/main/src/modules/launcher/Microsoft.Launcher/loc) for example) is created in the same directory as the `LocProject.json` file. The folder contains language specific folders which in turn have a nested folder path equivalent to `OutputPath` in the `LocProject.json`. Each of these folders contain one `lcl` file. The `lcl` files contain the English resources along with their translation for that language. These are described in more detail in the [Lcl files section](#lcl-files). Once the `.resx` files are generated, they will be used during the `Build PowerToys` step for localized versions of the modules.
Since the localization script requires certain nuget packages, the [`restore-localization`](https://github.com/microsoft/PowerToys/blob/main/.pipelines/restore-localization.cmd) script is run before running `build-localization` to install all the required packages. This script must [run in the `restore` step](https://github.com/microsoft/PowerToys/blob/86d77103e9c69686c297490acb04775d43ef8b76/.pipelines/pipeline.user.windows.yml#L37-L39) of pipeline because [the host is network isolated](https://onebranch.visualstudio.com/Pipeline/_wiki/wikis/Pipeline.wiki/2066/Consuming-Packages-in-a-CDPx-Pipeline?anchor=overview) at the `build` step. The [Toolset package source](https://github.com/microsoft/PowerToys/blob/86d77103e9c69686c297490acb04775d43ef8b76/.pipelines/pipeline.user.windows.yml#L23) is used for this.
@@ -159,7 +159,7 @@ This can be done by adding the directory name of the project to [Product.wxs nea
We should also ensure the new dlls are signed by the pipeline. Currently all dlls of the form [`*.resources.dll` are signed](https://github.com/microsoft/PowerToys/blob/f92bd6ffd38014c228544bb8d68d0937ce4c2b6d/.pipelines/pipeline.user.windows.yml#L68).
**Note:** The resource dlls should be added to the MSI project only after the initial commit with the lcl files has been done by the Localization team. Otherwise, the pipeline will fail as there wouldn't be any resx files to generate the dlls.
**Note:** The resource dlls should be added to the MSI project only after the initial commit with the lcl files has been done by the Localization team. Otherwise the pipeline will fail as there wouldn't be any resx files to generate the dlls.
## Working With Strings

View File

@@ -56,7 +56,7 @@ string validUIDisplayString = Resources.ValidUIDisplayString;
```
## More On Coding Guidance
Please review these brief docs below relating to our coding standards, etc.
Please review these brief docs below relating to our coding standards etc.
* [Coding Style](./style.md)
* [Code Organization](./readme.md)

View File

@@ -162,4 +162,4 @@ This can be done by adding the directory name of the project to [Product.wxs nea
We should also ensure the new dlls are signed by the pipeline. Currently all dlls of the form [`*.resources.dll` are signed](https://github.com/microsoft/PowerToys/blob/f92bd6ffd38014c228544bb8d68d0937ce4c2b6d/.pipelines/pipeline.user.windows.yml#L68).
**Note:** The resource dlls should be added to the MSI project only after the initial commit with the lcl files has been done by the Localization team. Otherwise, the pipeline will fail as there wouldn't be any resx files to generate the dlls.
**Note:** The resource dlls should be added to the MSI project only after the initial commit with the lcl files has been done by the Localization team. Otherwise the pipeline will fail as there wouldn't be any resx files to generate the dlls.

View File

@@ -55,7 +55,7 @@ The module is initialized in the AlwaysOnTop class. During initialization, the f
The AlwaysOnTop class handles the pinning and unpinning of windows. Key methods include:
- **PinTopmostWindow**: Pins the specified window on top of others and applies visual indicators
- **UnpinTopmostWindows**: Removes the pinning status and visual indicators from the specified window
- **UnpinTopmostWindowss**: Removes the pinning status and visual indicators from the specified window
- **AssignBorder**: Applies a colored border around the pinned window based on user settings
### Settings Management

View File

@@ -68,4 +68,4 @@ EnvironmentVariableUILib # Abstracted UI methods and implementations
- The module reads and writes variables directly to the registry instead of using the Environment API
- This direct registry access approach is used because the Environment API automatically expands variables and has a timeout for notifications
- When a profile variable has the same name as an existing User variable, a backup is created with the naming pattern: `VARIABLE_NAME_powertoys_PROFILE_NAME`
- When a profile variable has the same name as an existing User variable, a backup is created with a naming pattern: `VARIABLE_NAME_powertoys_PROFILE_NAME`

View File

@@ -444,12 +444,10 @@ PowerToys/doc/releases/tests-checklist-template.md at releaseChecklist · micros
- ### First Run FancyZones error
![Debug Step Image](../images/fancyzones/16.png)
If you encounter this situation, you need to launch the FancyZones Editor once in the powertoys settings UI:
If you encounter this situation, you need to launch the FancyZones Editor once in the powertoys settings UI (Refer to the image below). The reason is that running the Editor directly within the project will not initialize various configuration files.
![Debug Step Image](../images/fancyzones/17.png)
The reason is that running the Editor directly within the project will not initialize various configuration files.
- ### How are layouts stored and loaded? Is there a central configuration handler?
There is no central configuration handler.
@@ -473,7 +471,7 @@ When the Editor starts, it will load the config data, and when FancyZones starts
About monitor detection you can find "FancyZones::MoveSizeUpdate" function.
I believe that in the case without DPI scaling, FancyZones retrieves the window's position and does not need to know what the mouse's DPI scaling is like. If you are referring to window scaling, it is called through the system interface, and you can see the detailed code in "WindowMouseSnap::MoveSizeEnd()" function.
I believe that in the case without DPI scaling, FancyZones retrieves the window's position and does not need to know what the mouse's DPI scaling is like. If you are referring to window scaling, it is called through the system interface, and you can see the detailed code in "WindowMouseSnap::MoveSizeEnd()" fucntion.
- ### How does FancyZones track which windows belong to which zones?

View File

@@ -50,7 +50,7 @@ For more details on the implementation approach, see the [Dual Registration sect
Image Resizer dynamically determines when to show the context menu option:
- `AppxManifest.xml` registers the extension for all file types (`Type="*"`)
- The shell extension checks if the selected files are images using `AssocGetPerceivedType()`
- The menu appears only for image files (returns `ECS_ENABLED`); otherwise, it remains hidden (returns `ECS_HIDDEN`)
- The menu appears only for image files (returns `ECS_ENABLED`), otherwise it remains hidden (returns `ECS_HIDDEN`)
This approach provides flexibility to support additional file types by modifying only the detection logic without changing the system-level registration.

View File

@@ -86,7 +86,7 @@ Returns true if successful.
virtual void set_config(const wchar_t* config)
```
After the user has changed the module settings in the Settings editor, the runner calls this method to pass the updated values to the module. It's a good place to save the settings as well.
After the user has changed the module settings in the Settings editor, the runner calls this method to pass to the module the updated values. It's a good place to save the settings as well.
## call_custom_action

View File

@@ -58,7 +58,7 @@ This file contains documentation for all the methods involved in key/shortcut re
[This method](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L754-L809) is used for handling app-specific shortcut to shortcut and shortcut to key remaps. The general logic is as follows:
- Check if the `dwExtraInfo` field is set to `KEYBOARDMANAGER_SHORTCUT_FLAG`. This indicates that the key event was generated by the KBM shortcut remap method using `SendInput`. This ensures that we don't read events generated by the shortcut remap method, but we still read events which are generated by the key remap method.
- Get the name of the process in the foreground. This is done using `GetCurrentApplication` which uses `GetForegroundWindow` to get the window handle and `get_process_path` from the common lib. This approach can fail for UWP apps in full screen, so for that scenario we use the `GetGUIThreadInfo` approach to find the correct window handle, and hence the correct process name. This method is [described in more detail](keyboardmanagercommon.md#Foreground-app-detection)
- By checking `KeyboardManagerState.GetActivatedApp` we check if an app-specific shortcut is currently invoked. If so, we consider this application to be the activated app. This is required because some shortcut remaps could cause the current app to lose focus and hence until the shortcut is completely released we should allow that remap to continue; otherwise, the user could end up in a state where some keys do not get released. For example: remap <kbd>Ctrl+A</kbd> to <kbd>Alt+Tab</kbd> for Edge, when a user presses <kbd>Ctrl+A</kbd> the window loses focus as <kbd>Alt+Tab</kbd> gets executed.
- By checking `KeyboardManagerState.GetActivatedApp` we check if an app-specific shortcut is currently invoked. If so, we consider this application to be the activated app. This is required because some shortcut remaps could cause the current app to lose focus and hence until the shortcut is completely released we should allow that remap to continue, otherwise the user could end up in a state where some keys do not get released. For example: remap <kbd>Ctrl+A</kbd> to <kbd>Alt+Tab</kbd> for Edge, when a user presses <kbd>Ctrl+A</kbd> the window loses focus as <kbd>Alt+Tab</kbd> gets executed.
- If there is no app-specific shortcut currently invoked, we check if the foreground process is present in the list of app-specific remaps, either with or without the file extension and case-insensitive. If it is, this is considered to be the activated app.
- Call `HandleShortcutRemapEvent` with the `activatedApp` argument so that app-specific shortcut remapping takes place if it applies for the current key event.
@@ -73,8 +73,8 @@ The [`MockedInput`](https://github.com/microsoft/PowerToys/blob/main/src/modules
[To mock the `SendInput` method](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/test/MockedInput.cpp#L10-L110), the steps for processing the input are as follows. This implementation is based on public documentation for SendInput and the behavior of key messages and keyboard hooks:
- Iterate over all the inputs in the `INPUT` vector argument.
- If the event is a key up event, then it is considered [`WM_SYSKEYUP`](https://learn.microsoft.com/windows/win32/inputdev/wm-syskeyup) if Alt is held down; otherwise, it is `WM_KEYUP`.
- If the event is a key down event, then it is considered [`WM_SYSKEYDOWN`](https://learn.microsoft.com/windows/win32/inputdev/wm-syskeydown) if either Alt is held down or if it is F10; otherwise, it is `WM_KEYDOWN`.
- If the event is a key up event, then it is considered [`WM_SYSKEYUP`](https://learn.microsoft.com/windows/win32/inputdev/wm-syskeyup) if Alt is held down, otherwise it is `WM_KEYUP`.
- If the event is a key down event, then it is considered [`WM_SYSKEYDOWN`](https://learn.microsoft.com/windows/win32/inputdev/wm-syskeydown) if either Alt is held down or if it is F10, otherwise it is `WM_KEYDOWN`.
- An optional function which can be set on the `MockedInput` handler can be used to test for the number of times a key event is received by the system with a particular condition using [`sendVirtualInputCallCondition`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/test/MockedInput.cpp#L48-L52).
- The hook logic for a low level hook which returns 0 or 1 can be set on the `MockedInput` handler such that it behaves like a low level hook would behave with actual keyboard input. If the method returns 1, then the keyboard state is not updated, and if it returns 0 the corresponding key event is used to update the key state. This works in the recursive way as well similar to low level hooks, as `SendVirtualInput` can be called from within the hook, thus simulating identical behavior to calling `SendInput` in a low level hook (as soon as SendInput is called, the low level hook is called for the new input event, and only after those are processed it returns back to the current event, check this [blog](https://devblogs.microsoft.com/oldnewthing/20140213-00/?p=1773) for more details).
- For updating the keyboard state, KEYUP messages result in the state for that key code being set to false, and KEYDOWN result in the state for that key code being set to true.

View File

@@ -127,12 +127,12 @@ The [`HandleKeyboardHookEvent`](https://github.com/microsoft/PowerToys/blob/b805
**Note:** Single key remaps need to be executed before shortcut remaps, because otherwise there can be several logical issues. For example if a user has Ctrl remapped to X and Ctrl+A remapped to Y, we can't detect Ctrl+A because the moment Ctrl is pressed it would be remapped to X before the system ever sees Ctrl+A. This is why the design decision was made to separate Remap keys and Remap shortcuts, and all key remaps are reflected in the shortcut remaps.
## Custom Action to launch KBM UI
KBM uses the [`call_custom_action`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L249-L280) method from the `PowertoyModuleIface` in order to launch the KBM UI when the user clicks "Remap a key" or "Remap a shortcut" from the KBM settings page. On clicking the button, we check if there is already any active KBM UI window, and if there is it is brought to the foreground. If not, the corresponding KBM UI window is launched on a separate detached thread. The UI is described in more detail in [Keyboard Manager UI](keyboardmanagerui.md).
KBM uses the [`call_custom_action`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L249-L280) method from the `PowertoyModuleIface` in order to launch the KBM UI when the user clicks the Remap a key or Remap a shortcut button from the KBM settings page. On clicking the button, we check if there is already any active KBM UI window, and if there is it is brought to the foreground. If not, the corresponding KBM UI window is launched on a separate detached thread. The UI is described in more detail in [Keyboard Manager UI](keyboardmanagerui.md).
## SendInput Special Scenarios
### Extended keys
Certain keys such as the arrow keys, <kbd>right Ctrl/Alt</kbd>, and <kbd>Del/Home/Ins</kbd>, etc. need to be sent with the `KEYEVENTF_EXTENDEDKEY` flag because otherwise the NumPad versions get sent, which can cause weird behavior when NumLock is on. The code can be found where [`SetKeyEvent` checks `IsExtendedKey(keyCode)`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L190-L194) and the list of extended keys in code can be found in [`IsExtendedKey`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L73-L98). Docs about extended keys can be found in [Keyboard Input Overview: Extended-Key Flag
Certain keys such as the arrow keys, <kbd>right Ctrl/Alt</kbd>, and <kbd>Del/Home/Ins</kbd>, etc need to be sent with the `KEYEVENTF_EXTENDEDKEY` flag because otherwise the NumPad versions get sent, which can cause weird behavior when NumLock is on. The code can be found where [`SetKeyEvent` checks `IsExtendedKey(keyCode)`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L190-L194) and the list of extended keys in code can be found in [`IsExtendedKey`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L73-L98). Docs about extended keys can be found in [Keyboard Input Overview: Extended-Key Flag
](https://learn.microsoft.com/windows/win32/inputdev/about-keyboard-input#extended-key-flag).
The weird behavior that is caused by this can be found at these issues:
@@ -177,13 +177,13 @@ For example, while [remapping <kbd>Ctrl</kbd> to <kbd>Caps Lock</kbd>](https://g
While the above work around fixes most of the cases, there are still some scenarios where the modifier can get stuck, mentioned at this [comment](https://github.com/microsoft/PowerToys/issues/3397#issuecomment-663729278), which is why the issue is still open. This occurs if a modifier is pressed after the remap has been invoked before releasing the remapped key and it is a harder scenario to solve which requires refactoring the single key remap code.
### UIPI Issues (not resolved)
`SendInput` does not work directly with certain key codes such as Play/Pause Media, Calculator key, etc. as it requires UAC privileges to be injected to the OS and accordingly play the active media app or launch the Calculator app. In order to resolve this the correct approach is that the executable which calls `SendInput` needs to have the [UIAccess flag](https://learn.microsoft.com/windows/win32/winauto/uiauto-securityoverview) set to true, which will also avoid the requirement of KBM having to run as administrator to intercept key events when an elevated window is in focus. The UIAccess flag has many constraints such as it must be a signed executable and must be located in a protected path like Program Files. Since KBM currently runs out of the runner process, it would make more sense to do this work after KBM is moved to a separate executable, and it could be enabled by a separate toggle in settings only if PowerToys is installed in Program Files. [This comment](https://github.com/microsoft/PowerToys/issues/3192#issuecomment-646323661) has more details on this approach and (this)[https://github.com/microsoft/PowerToys/issues/3255] is the tracking issue.
`SendInput` does not work directly with certain key codes such as Play/Pause Media, Calculator key, etc as it requires UAC privileges to be injected to the OS and accordingly play the active media app or launch the Calculator app. In order to resolve this the correct approach is that the executable which calls `SendInput` needs to have the [UIAccess flag](https://learn.microsoft.com/windows/win32/winauto/uiauto-securityoverview) set to true, which will also avoid the requirement of KBM having to run as administrator to intercept key events when an elevated window is in focus. The UIAccess flag has many constraints such as it must be a signed executable and must be located in a protected path like Program Files. Since KBM currently runs out of the runner process, it would make more sense to do this work after KBM is moved to a separate executable, and it could be enabled by a separate toggle in settings only if PowerToys is installed in Program Files. [This comment](https://github.com/microsoft/PowerToys/issues/3192#issuecomment-646323661) has more details on this approach and (this)[https://github.com/microsoft/PowerToys/issues/3255] is the tracking issue.
## Other remapping approaches
Other approaches for remapping which were deprioritized are:
### Registry approach
This method is used by [SharpKeys](https://github.com/randyrants/sharpkeys) and involves using the [Microsoft Keyboard Scancode mapper registry key](https://github.com/randyrants/sharpkeys) to remap keys based on their scan codes. This has the advantage of being applied in all scenarios and not facing any elevation or UAC issues, however the disadvantages are that for modifying the settings, the process must run elevated (as it modifies HKLM registry) and it requires a reboot to get applied. Another issue which is an advantage/disadvantage for users is that the process does not need to be running, so the remaps are applied all the time, including at the password prompt on logging into the user's Windows account, which could get a user stuck if they orphaned a key in their password. This registry doesn't have any support for remapping shortcuts either, so the hook approach was prioritized over this.
This method is used by [SharpKeys](https://github.com/randyrants/sharpkeys) and involves using the [Microsoft Keyboard Scancode mapper registry key](https://github.com/randyrants/sharpkeys) to remap keys based on their scan codes. This has the advantage of being applied in all scenarios and not facing any elevation or UAC issues, however the disadvantages are that for modifying the settings the process must run elevated (as it modifies HKLM registry) and it requires a reboot to get applied. Another issue which is an advantage/disadvantage for users is that the process does not need to be running, so the remaps are applied all the time, including at the password prompt on logging into the user's Windows account, which could get a user stuck if they orphaned a key in their password. This registry doesn't have any support for remapping shortcuts either, so the hook approach was prioritized over this.
### Driver approach
Using a driver approach has the benefit of not depending on precedence orders as KBM could always run before low level hooks, and it also has the benefit of differentiating between different keyboards, allowing [multi keyboard-specific remaps](https://github.com/microsoft/PowerToys/issues/1460). The disadvantages are however that any bug or crash could have system level consequences. [Interception](https://github.com/oblitum/Interception) is an open source driver that could be used for implementing this. The approach was deprioritized due to the potential side effects.
@@ -191,7 +191,7 @@ Using a driver approach has the benefit of not depending on precedence orders as
## Telemetry
Keyboard Manager emits the following telemetry events (implemented in [trace.h](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/common/trace.h) and [trace.cpp](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/common/trace.cpp)):
- **`KeyboardManager_EnableKeyboardManager`:** Logs a `boolean` value storing the KBM toggle state. It is logged whenever KBM is enabled or disabled (emitted in [`enable`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L305-L306) and [`disable`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L315-L316)).
- **`KeyboardManager_KeyRemapCount`:** Logs the number of key to key and key to shortcut remaps (i.e. all the remaps on the "Remap a key" window). This gets logged on saving new settings in the "Remap a key" window (emitted at [the end of `ApplySingleKeyRemappings`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L159-L163)).
- **`KeyboardManager_OSLevelShortcutRemapCount`:** Logs the number of global shortcut to shortcut and shortcut to key remaps. This gets logged on saving new settings in the "Remap a shortcut" window (emitted at [the end of `ApplyShortcutRemappings`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L220)).
- **`KeyboardManager_AppSpecificShortcutRemapCount`:** Logs the number of app-specific shortcut to shortcut and shortcut to key remaps. This gets logged on saving new settings in the "Remap a shortcut" window (emitted [after calling `OSLevelShortcutRemapCount` in `ApplyShortcutRemappings`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L221)).
- **`KeyboardManager_KeyRemapCount`:** Logs the number of key to key and key to shortcut remaps (i.e. all the remaps on the Remap a key window). This gets logged on saving new settings in the Remap a key window (emitted at [the end of `ApplySingleKeyRemappings`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L159-L163)).
- **`KeyboardManager_OSLevelShortcutRemapCount`:** Logs the number of global shortcut to shortcut and shortcut to key remaps. This gets logged on saving new settings in the Remap a shortcut window (emitted at [the end of `ApplyShortcutRemappings`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L220)).
- **`KeyboardManager_AppSpecificShortcutRemapCount`:** Logs the number of app-specific shortcut to shortcut and shortcut to key remaps. This gets logged on saving new settings in the Remap a shortcut window (emitted [after calling `OSLevelShortcutRemapCount` in `ApplyShortcutRemappings`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L221)).
- **`KeyboardManager_Error`:** Logs the occurrence of an error in KBM with the name of the method, error code and the corresponding error message. This is currently used only for logging `SetWindowsHookEx` failures (emitted [at the end of `start_lowlevel_keyboard_hook`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L364-L369)).

View File

@@ -32,7 +32,7 @@ The KBM UI consists of a [`Grid` with several columns](https://github.com/micros
When the UI windows are activated the `KeyboardManagerState` object [sets the `UIState` variable](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/EditKeyboardWindow.cpp#L251-L252) which is used for distinguishing if the UI is up from the keyboard hook thread. The [states are also updated](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/SingleKeyRemapControl.cpp#L53) on opening and closing the Type window.
Clicking the Type Button [opens a content dialog](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/SingleKeyRemapControl.cpp#L206-L380) which registers key delays using the [`KeyDelay` class](keyboardmanagercommon.md#KeyDelay) for Enter and Esc keys and sets the UI states such that when a key event occurs the TextBlocks on the ContentDialog are updated accordingly. On accepting the dialog, the selected keys are copied into the ComboBoxes from the TextBlocks, and on closing the window, the key delays are unregistered and UI states are reset.
Clicking the Type Button [opens a content dialog](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/SingleKeyRemapControl.cpp#L206-L380) which registers key delays using the [`KeyDelay` class](keyboardmanagercommon.md#KeyDelay) for Enter and Esc keys and sets the UI states such that when a key event occurs the TextBlocks on the ContentDialog are updated accordingly. On accepting the dialog the selected keys are copied into the ComboBoxes from the TextBlocks, and on closing the window the key delays are unregistered and UI states are reset.
Since ComboBoxes are added dynamically, handlers have been added which [update the accessible names for these controls](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/KeyDropDownControl.cpp#L69-L74), which get executed whenever a drop down is added or removed.

View File

@@ -38,7 +38,7 @@ The Value Generator plugin is used to generate hashes for strings, to calculate
- [`UuidCreateSequential`](https://learn.microsoft.com/en-us/windows/win32/api/rpcdce/nf-rpcdce-uuidcreatesequential) for version 1
- `System.Guid.NewGuid()` for version 4
- `System.Guid.CreateVersion7()` for version 7
- Versions 3 and 5 take two parameters: a namespace and a name
- Versions 3 and 5 take two parameters, a namespace and a name
- The namespace must be a valid GUID or one of the [predefined ones](https://datatracker.ietf.org/doc/html/rfc4122#appendix-C)
- The `PredefinedNamespaces` dictionary contains aliases for the predefined namespaces
- The name can be any string
@@ -72,10 +72,10 @@ The Value Generator plugin is used to generate hashes for strings, to calculate
### [`InputParser`](/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/InputParser.cs)
- It is responsible only for parsing the query from the user
- Based on the user query, the `ParseInput()` method must return an object that implements the `IComputeRequest` interface or it must throw one of `FormatException` or `ArgumentException`
- Throwing an `ArgumentException` should signal the fact that the query contains a mistake that the user can fix (e.g. an unsupported hash function, an invalid GUID version, an invalid namespace, etc.)
- Throwing an `ArgumentException` should signal the fact the query contains a mistake that the user can fix (eg. an unsupported hash function, an invalid GUID version, an invalid namespace, etc)
> The error message will be shown to the user and no log message will be created
- Throwing a `FormatException` should signal either:
- that the query may become valid, and so it does not make sense to show an error just yet (e.g. the query does not contain a request yet, a hash request without a string to hash)
- that the query may become valid, and so it does not make sense to show an error just yet (eg. the query does not contain a request yet, a hash request without a string to hash)
- that the query is completely invalid
> The error message will not be shown to the user but a log message will be created

View File

@@ -6,7 +6,7 @@ The History Plugin allows users to search or display results they have used (sel
The plugin uses data that was already being captured which is, what results were clicked, and how many times. We do add a little more data to this set now.
When this plugin is queried, it creates results based on this previously selected results data.
In order to make sure selected results in the history are still valid, we re-query the relevant plugin using the PluginManager. If there are no results,
In order to make sure selected results in the history are still valid, we re-query the plugin the relevant plug using the PluginManager. If there are no results,
this history item is not included. This usually means that the result is no longer valid. For instance, if a file was deleted, but it's still in the selected history
we don't want to show it as a selectable result.

View File

@@ -9,7 +9,7 @@ The code itself is very simple, basically just a call into OneNote interop via t
var pages = OneNoteProvider.FindPages(query.Search);
```
The query results will be cached for 1 day, and if cached results are found they'll be returned in the initial `Query()` call; otherwise, OneNote itself will be queried in the `delayedExecution:true` overload.
The query results will be cached for 1 day, and if cached results are found they'll be returned in the initial `Query()` call, otherwise OneNote itself will be queried in the `delayedExecution:true` overload.
If the user actions on a result, it'll open it in the OneNote app, and restore and/or focus the app as well if necessary.

View File

@@ -8,7 +8,7 @@ The user can switch to the found windows, close them or kill their process.
## Remarks
### UWP Apps
- The process of an UWP app can't be detected correctly for windows that are minimized while searching. At this time they are assigned to the generic process `ApplicationFrameHost.exe`. If the user searches for such a window while it is not minimized, then the process gets assigned correctly/updated.
- The process of an UWP app can't be detected correctly for windows that are minimized while searching. At this time they are assigned to the generic process `ApplicationFrameHost.exe`. If the user searches for such an window while it is not minimized, then the process gets assigned correctly/updated.
### Killing processes
- Killing the Explorer process is only allowed, if each folder window is running in its own process. (See section `File Explorer setting` below.)
@@ -17,7 +17,7 @@ The user can switch to the found windows, close them or kill their process.
- Windows of UWP apps don't know their process, until they are searched in non-minimized state.
### File Explorer setting
- To kill the Process of an Explorer window, each window has to run in a separate process. Otherwise, the process is the same one as the shell process and killing the shell process will crash the shell (Windows ui).
- To kill the Process of an Explorer window, each window has to run in a separate process. Otherwise the process is the same one as the shell process and killing the shell process will crash the shell (Windows ui).
- To enable this behavior the setting `Launch folder windows in a separate process` under `Folder Options > View` has to be enabled.
- From PowerToys Run you can open the `Folder options` dialog by clicking the information message in the search results. The information message is only shown when searching with action keyword for explorer windows and can be hidden in the plugin settings.
- Note: The folder option/process is evaluated in real time. After changing the setting it is enough to search again for the windows.

View File

@@ -31,7 +31,7 @@ This document outlines the process for preparing and publishing PowerToys releas
- Uses semantic versioning: `MAJOR.MINOR.PATCH`
- MINOR version increases with regular releases (e.g., 0.89.0)
- PATCH version increases for hotfixes (e.g., 0.87.0 → 0.87.1)
- Each release version must be greater than the previous one for proper updating
- Each release version must be higher than the previous one for proper updating
## Testing Process

View File

@@ -55,7 +55,7 @@ The `OneFuzzConfig.json` file provides critical information for deploying fuzzin
],
"adoTemplate": [
{
"AssignedTo": "leilzh@microsoft.com",
"AssignedTo": "PowerToys@microsoft.com",
"jobNotificationEmail": "PowerToys@microsoft.com"
}
],

View File

@@ -1,5 +1,4 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32414.318
MinimumVisualStudioVersion = 10.0.40219.1
@@ -17,6 +16,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Version", "..\src\common\ve
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EtwTrace", "..\src\common\Telemetry\EtwTrace\EtwTrace.vcxproj", "{8F021B46-362B-485C-BFBA-CCF83E820CBD}"
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "PowerToysInstallerVNext", "PowerToysSetupVNext\PowerToysInstallerVNext.wixproj", "{B6E94700-DF38-41F6-A3FD-18B69674AB1E}"
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "PowerToysBootstrapperVNext", "PowerToysSetupVNext\PowerToysBootstrapperVNext.wixproj", "{DA4E9744-80BE-424C-B0F5-AFD8757DB575}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerToysSetupCustomActionsVNext", "PowerToysSetupCustomActionsVNext\PowerToysSetupCustomActionsVNext.vcxproj", "{B3A354B0-1E54-4B55-A962-FB5AF9330C19}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
@@ -78,6 +83,29 @@ Global
{8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|ARM64.Build.0 = Release|ARM64
{8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|x64.ActiveCfg = Release|x64
{8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|x64.Build.0 = Release|x64
{B6E94700-DF38-41F6-A3FD-18B69674AB1E}.Debug|ARM64.ActiveCfg = Debug|ARM64
{B6E94700-DF38-41F6-A3FD-18B69674AB1E}.Debug|ARM64.Build.0 = Debug|ARM64
{B6E94700-DF38-41F6-A3FD-18B69674AB1E}.Debug|x64.ActiveCfg = Debug|x64
{B6E94700-DF38-41F6-A3FD-18B69674AB1E}.Debug|x64.Build.0 = Debug|x64
{B6E94700-DF38-41F6-A3FD-18B69674AB1E}.Release|ARM64.ActiveCfg = Release|ARM64
{B6E94700-DF38-41F6-A3FD-18B69674AB1E}.Release|ARM64.Build.0 = Release|ARM64
{B6E94700-DF38-41F6-A3FD-18B69674AB1E}.Release|x64.ActiveCfg = Release|x64
{B6E94700-DF38-41F6-A3FD-18B69674AB1E}.Release|x64.Build.0 = Release|x64
{DA4E9744-80BE-424C-B0F5-AFD8757DB575}.Debug|ARM64.ActiveCfg = Debug|ARM64
{DA4E9744-80BE-424C-B0F5-AFD8757DB575}.Debug|ARM64.Build.0 = Debug|ARM64
{DA4E9744-80BE-424C-B0F5-AFD8757DB575}.Debug|x64.ActiveCfg = Debug|x64
{DA4E9744-80BE-424C-B0F5-AFD8757DB575}.Debug|x64.Build.0 = Debug|x64
{DA4E9744-80BE-424C-B0F5-AFD8757DB575}.Release|ARM64.ActiveCfg = Release|ARM64
{DA4E9744-80BE-424C-B0F5-AFD8757DB575}.Release|ARM64.Build.0 = Release|ARM64
{DA4E9744-80BE-424C-B0F5-AFD8757DB575}.Release|x64.ActiveCfg = Release|x64
{DA4E9744-80BE-424C-B0F5-AFD8757DB575}.Release|x64.Build.0 = Release|x64
{B3A354B0-1E54-4B55-A962-FB5AF9330C19}.Debug|ARM64.ActiveCfg = Debug|ARM64
{B3A354B0-1E54-4B55-A962-FB5AF9330C19}.Debug|x64.ActiveCfg = Debug|x64
{B3A354B0-1E54-4B55-A962-FB5AF9330C19}.Debug|x64.Build.0 = Debug|x64
{B3A354B0-1E54-4B55-A962-FB5AF9330C19}.Release|ARM64.ActiveCfg = Release|ARM64
{B3A354B0-1E54-4B55-A962-FB5AF9330C19}.Release|ARM64.Build.0 = Release|ARM64
{B3A354B0-1E54-4B55-A962-FB5AF9330C19}.Release|x64.ActiveCfg = Release|x64
{B3A354B0-1E54-4B55-A962-FB5AF9330C19}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -85,4 +113,4 @@ Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B7A3DA30-D443-40FF-AC51-988AD41E3962}
EndGlobalSection
EndGlobal
EndGlobal

View File

@@ -5,10 +5,10 @@
<?include $(sys.CURRENTDIR)\Common.wxi?>
<?define ImageResizerAssetsFiles=?>
<?define ImageResizerAssetsFilesPath=$(var.BinDir)WinUI3Apps\Assets\ImageResizer\?>
<?define ImageResizerAssetsFilesPath=$(var.BinDir)Assets\ImageResizer\?>
<Fragment>
<DirectoryRef Id="WinUI3AppsAssetsFolder">
<DirectoryRef Id="BaseApplicationsAssetsFolder">
<Directory Id="ImageResizerAssetsFolder" Name="ImageResizer" />
</DirectoryRef>
@@ -18,7 +18,7 @@
<Component Id="Module_ImageResizer_Registry" Win64="yes">
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\CLSID\{51B4D7E5-7568-4234-B4BB-47FB3C016A69}\InprocServer32">
<RegistryValue Value="[WinUI3AppsInstallFolder]PowerToys.ImageResizerExt.dll" Type="string" />
<RegistryValue Value="[INSTALLFOLDER]PowerToys.ImageResizerExt.dll" Type="string" />
<RegistryValue Name="ThreadingModel" Value="Apartment" Type="string" />
</RegistryKey>

View File

@@ -57,7 +57,7 @@ call powershell.exe -NonInteractive -executionpolicy Unrestricted -File $(MSBuil
call move /Y ..\..\..\WinAppSDK.wxs.bk ..\..\..\WinAppSDK.wxs
call move /Y ..\..\..\WinUI3Applications.wxs.bk ..\..\..\WinUI3Applications.wxs
call move /Y ..\..\..\Workspaces.wxs.bk ..\..\..\Workspaces.wxs
</PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<Name>PowerToysInstaller</Name>

View File

@@ -186,7 +186,7 @@
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
<RegistryValue Type="string" Name="ImageResizer_$(var.IdSafeLanguage)_Component" Value="" KeyPath="yes"/>
</RegistryKey>
<File Id="ImageResizer_$(var.IdSafeLanguage)_File" Source="$(var.BinDir)\WinUI3Apps\$(var.Language)\PowerToys.ImageResizer.resources.dll" />
<File Id="ImageResizer_$(var.IdSafeLanguage)_File" Source="$(var.BinDir)\$(var.Language)\PowerToys.ImageResizer.resources.dll" />
</Component>
<Component
Id="ColorPicker_$(var.IdSafeLanguage)_Component"

View File

@@ -179,7 +179,7 @@ Generate-FileList -fileDepsJson "" -fileListName HostsAssetsFiles -wxsFilePath $
Generate-FileComponents -fileListName "HostsAssetsFiles" -wxsFilePath $PSScriptRoot\Hosts.wxs -regroot $registryroot
#ImageResizer
Generate-FileList -fileDepsJson "" -fileListName ImageResizerAssetsFiles -wxsFilePath $PSScriptRoot\ImageResizer.wxs -depsPath "$PSScriptRoot..\..\..\$platform\Release\WinUI3Apps\Assets\ImageResizer"
Generate-FileList -fileDepsJson "" -fileListName ImageResizerAssetsFiles -wxsFilePath $PSScriptRoot\ImageResizer.wxs -depsPath "$PSScriptRoot..\..\..\$platform\Release\Assets\ImageResizer"
Generate-FileComponents -fileListName "ImageResizerAssetsFiles" -wxsFilePath $PSScriptRoot\ImageResizer.wxs -regroot $registryroot
#New+

View File

@@ -14,4 +14,4 @@ msbuild !PTRoot!\src\modules\previewpane\MarkdownPreviewHandler\MarkdownPreviewH
msbuild !PTRoot!\src\modules\previewpane\SvgPreviewHandler\SvgPreviewHandler.csproj -t:Publish -p:Configuration="Release" -p:Platform="!PlatformArg!" -p:AppxBundle=Never -p:PowerToysRoot=!PTRoot! -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml -p:TargetFramework=net9.0-windows10.0.26100.0
msbuild !PTRoot!\src\modules\previewpane\SvgThumbnailProvider\SvgThumbnailProvider.csproj -t:Publish -p:Configuration="Release" -p:Platform="!PlatformArg!" -p:AppxBundle=Never -p:PowerToysRoot=!PTRoot! -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml -p:TargetFramework=net9.0-windows10.0.26100.0
msbuild !PTRoot!\src\modules\previewpane\SvgThumbnailProvider\SvgThumbnailProvider.csproj -t:Publish -p:Configuration="Release" -p:Platform="!PlatformArg!" -p:AppxBundle=Never -p:PowerToysRoot=!PTRoot! -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml -p:TargetFramework=net9.0-windows10.0.26100.0

View File

@@ -81,7 +81,7 @@
if not "$(NormalizedPerUserValue)" == "true" call powershell.exe -NonInteractive -executionpolicy Unrestricted -File ..\PowerToysSetup\generateAllFileComponents.ps1 -platform $(Platform)
if "$(NormalizedPerUserValue)" == "true" call powershell.exe -NonInteractive -executionpolicy Unrestricted -File ..\PowerToysSetup\generateAllFileComponents.ps1 -platform $(Platform) -installscopeperuser $(NormalizedPerUserValue)
</Command>
<Message>Backing up original files and populating .NET and WPF Runtime dependencies </Message>
<Message>Backing up original files and populating .NET and WPF Runtime dependencies for WiX3 based installer</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<PropertyGroup Condition="'$(RunBuildEvents)'=='false'">

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
LIBRARY "PowerToysSetupCustomActionsVNext"
EXPORTS
LaunchPowerToysCA
CheckGPOCA
CleanVideoConferenceRegistryCA
ApplyModulesRegistryChangeSetsCA
DetectPrevInstallPathCA
RemoveScheduledTasksCA
TelemetryLogInstallSuccessCA
TelemetryLogInstallCancelCA
TelemetryLogInstallFailCA
TelemetryLogUninstallSuccessCA
TelemetryLogUninstallCancelCA
TelemetryLogUninstallFailCA
TelemetryLogRepairCancelCA
TelemetryLogRepairFailCA
TerminateProcessesCA
InstallEmbeddedMSIXCA
InstallDSCModuleCA
InstallCmdPalPackageCA
UnApplyModulesRegistryChangeSetsCA
UnRegisterCmdPalPackageCA
UnRegisterContextMenuPackagesCA
UninstallEmbeddedMSIXCA
UninstallDSCModuleCA
UninstallServicesCA
UninstallCommandNotFoundModuleCA
UpgradeCommandNotFoundModuleCA
UnsetAdvancedPasteAPIKeyCA

View File

@@ -0,0 +1,183 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\WixToolset.WcaUtil.5.0.2\build\WixToolset.WcaUtil.props" Condition="Exists('..\packages\WixToolset.WcaUtil.5.0.2\build\WixToolset.WcaUtil.props')" />
<Import Project="..\packages\WixToolset.DUtil.5.0.2\build\WixToolset.DUtil.props" Condition="Exists('..\packages\WixToolset.DUtil.5.0.2\build\WixToolset.DUtil.props')" />
<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')" />
<Import Project="..\wix.props" Condition="Exists('..\wix.props')" />
<PropertyGroup Label="Globals">
<ProjectGuid>{B3A354B0-1E54-4B55-A962-FB5AF9330C19}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>PowerToysSetupCustomActionsVNext</RootNamespace>
<ProjectName>PowerToysSetupCustomActionsVNext</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" Condition="Exists('$(VCTargetsPath)\Microsoft.Cpp.Default.props')" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="..\..\deps\spdlog.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)'=='Debug'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)'=='Release'" 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 Condition=" '$(PerUser)' != 'true' ">$(Platform)\$(Configuration)\MachineSetup\</OutDir>
<OutDir Condition=" '$(PerUser)' == 'true' ">$(Platform)\$(Configuration)\UserSetup\</OutDir>
<IntDir Condition=" '$(PerUser)' != 'true' ">$(SolutionDir)$(ProjectName)\$(Platform)\$(Configuration)\MachineSetup\obj\</IntDir>
<IntDir Condition=" '$(PerUser)' == 'true' ">$(SolutionDir)$(ProjectName)\$(Platform)\$(Configuration)\UserSetup\obj\</IntDir>
<!-- The CMD script below checks this value, and it is **CASE SENSITIVE** -->
<NormalizedPerUserValue>false</NormalizedPerUserValue>
<NormalizedPerUserValue Condition=" '$(PerUser)' == 'true' ">true</NormalizedPerUserValue>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>..\..\src\common\Telemetry;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup>
<PreBuildEvent>
<Command>
call cmd /C "copy ""$(ProjectDir)DepsFilesLists.h"" ""$(ProjectDir)DepsFilesLists.h.bk"""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\AdvancedPaste.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\AdvancedPaste.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\Awake.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\Awake.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\BaseApplications.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\BaseApplications.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\CmdPal.wxs"" ""$(ProjectDir)..\PowerToysSetup\CmdPal.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\ColorPicker.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\ColorPicker.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\Core.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\Core.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\EnvironmentVariables.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\EnvironmentVariables.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\FileExplorerPreview.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\FileExplorerPreview.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\FileLocksmith.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\FileLocksmith.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\Hosts.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\Hosts.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\ImageResizer.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\ImageResizer.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\KeyboardManager.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\KeyboardManager.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\MouseWithoutBorders.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\MouseWithoutBorders.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\NewPlus.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\NewPlus.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\Peek.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\Peek.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\PowerRename.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\PowerRename.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\Product.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\Product.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\RegistryPreview.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\RegistryPreview.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\Resources.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\Resources.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\Run.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\Run.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\Settings.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\Settings.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\ShortcutGuide.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\ShortcutGuide.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\Tools.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\Tools.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\WinAppSDK.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\WinAppSDK.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\WinUI3Applications.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\WinUI3Applications.wxs.bk""""
call cmd /C "copy ""$(ProjectDir)..\PowerToysSetupVNext\Workspaces.wxs"" ""$(ProjectDir)..\PowerToysSetupVNext\Workspaces.wxs.bk""""
if not "$(NormalizedPerUserValue)" == "true" call powershell.exe -NonInteractive -executionpolicy Unrestricted -File ..\PowerToysSetupVNext\generateAllFileComponents.ps1 -platform $(Platform)
if "$(NormalizedPerUserValue)" == "true" call powershell.exe -NonInteractive -executionpolicy Unrestricted -File ..\PowerToysSetupVNext\generateAllFileComponents.ps1 -platform $(Platform) -installscopeperuser $(NormalizedPerUserValue)
</Command>
<Message>Backing up original files and populating .NET and WPF Runtime dependencies for WiX3 based installer</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<PropertyGroup Condition="'$(RunBuildEvents)'=='false'">
<PreBuildEventUseInBuild>false</PreBuildEventUseInBuild>
<PostBuildEventUseInBuild>false</PostBuildEventUseInBuild>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>inc;..\..\src\;..\..\src\common\Telemetry;telemetry;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/await /Zc:twoPhase- /Wv:18 %(AdditionalOptions)</AdditionalOptions>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>Userenv.lib;Wtsapi32.lib;WindowsApp.lib;Newdev.lib;Crypt32.lib;msi.lib;wcautil.lib;Psapi.lib;Pathcch.lib;comsupp.lib;taskschd.lib;Secur32.lib;msi.lib;dutil.lib;wcautil.lib;Version.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>CustomAction.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(NUGET_PACKAGES)\wixtoolset.wcautil\5.0.2\build\native\v14\$(Platform);$(NUGET_PACKAGES)\wixtoolset.dutil\5.0.2\build\native\v14\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;CUSTOMACTIONTEST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<UACExecutionLevel>HighestAvailable</UACExecutionLevel>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;CUSTOMACTIONTEST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<UACExecutionLevel>HighestAvailable</UACExecutionLevel>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="CustomAction.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(UsePrecompiledHeaders)' != 'false'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="CustomAction.def" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="DepsFilesLists.h" />
<ClInclude Include="RcResource.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="Telemetry\ProjectTelemetry.h" />
<ClInclude Include="Telemetry\TraceLoggingDefines.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Resource.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\common\logger\logger.vcxproj">
<Project>{d9b8fc84-322a-4f9f-bbb9-20915c47ddfd}</Project>
</ProjectReference>
<ProjectReference Include="..\..\src\common\Telemetry\EtwTrace\EtwTrace.vcxproj">
<Project>{8f021b46-362b-485c-bfba-ccf83e820cbd}</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'))" />
<Error Condition="!Exists('..\packages\WixToolset.DUtil.5.0.2\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WixToolset.DUtil.5.0.2\build\WixToolset.DUtil.props'))" />
<Error Condition="!Exists('..\packages\WixToolset.WcaUtil.5.0.2\build\WixToolset.WcaUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WixToolset.WcaUtil.5.0.2\build\WixToolset.WcaUtil.props'))" />
</Target>
</Project>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="CustomAction.cpp" />
<ClCompile Include="pch.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
<ClInclude Include="Telemetry\ProjectTelemetry.h">
<Filter>Telemetry</Filter>
</ClInclude>
<ClInclude Include="Telemetry\TraceLoggingDefines.h">
<Filter>Telemetry</Filter>
</ClInclude>
<ClInclude Include="resource.h" />
<ClInclude Include="RcResource.h" />
<ClInclude Include="DepsFilesLists.h" />
</ItemGroup>
<ItemGroup>
<None Include="CustomAction.def" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Filter Include="Telemetry">
<UniqueIdentifier>{6e73ce5d-e715-4e7e-b796-c5d180b07ff2}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Resource.rc" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,63 @@
#pragma once
#include <string_view>
#include <optional>
#include <filesystem>
#include <fstream>
#include <Windows.h>
class RcResource
{
public:
const std::byte* _memory = nullptr;
size_t _size = 0;
static inline std::optional<RcResource> create(int resource_id, const std::wstring_view resource_class, const HINSTANCE handle = nullptr)
{
const HRSRC resHandle = FindResourceW(handle, MAKEINTRESOURCEW(resource_id), resource_class.data());
if (!resHandle)
{
return std::nullopt;
}
const HGLOBAL memHandle = LoadResource(handle, resHandle);
if (!memHandle)
{
return std::nullopt;
}
const size_t resSize = SizeofResource(handle, resHandle);
if (!resSize)
{
return std::nullopt;
}
auto res = static_cast<const std::byte*>(LockResource(memHandle));
if (!res)
{
return std::nullopt;
}
return RcResource{ res, resSize };
}
inline bool saveAsFile(const std::filesystem::path destination)
{
std::fstream installerFile{ destination, std::ios_base::binary | std::ios_base::out | std::ios_base::trunc };
if (!installerFile.is_open())
{
return false;
}
installerFile.write(reinterpret_cast<const char*>(_memory), _size);
return true;
}
private:
RcResource() = delete;
RcResource(const std::byte* memory, size_t size) :
_memory{ memory }, _size{ size }
{
}
};

View File

@@ -0,0 +1,96 @@
// Microsoft Visual C++ generated resource script.
//
#include <windows.h>
#include "resource.h"
#include "../../src/common/version/version.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
1 VERSIONINFO
FILEVERSION FILE_VERSION
PRODUCTVERSION PRODUCT_VERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0" // US English (0x0409), Unicode (0x04B0) charset
BEGIN
VALUE "CompanyName", COMPANY_NAME
VALUE "FileDescription", FILE_DESCRIPTION
VALUE "FileVersion", FILE_VERSION_STRING
VALUE "InternalName", INTERNAL_NAME
VALUE "LegalCopyright", COPYRIGHT_NOTE
VALUE "OriginalFilename", ORIGINAL_FILENAME
VALUE "ProductName", PRODUCT_NAME
VALUE "ProductVersion", PRODUCT_VERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200 // US English (0x0409), Unicode (1200) charset
END
END
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
LANGUAGE 25, 1
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
// TODO: Use to activate embedded MSIX
//IDR_BIN_MSIX_HELLO_PACKAGE BIN "..\\..\..\\src\\modules\\HelloModule\\AppPackages\\HelloModule_1.0.0.0_x64_Test\\HelloModule_1.0.0.0_x64.msix"
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

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

View File

@@ -0,0 +1,5 @@
// pch.cpp: source file corresponding to the pre-compiled header
#include "pch.h"
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.

View File

@@ -0,0 +1,37 @@
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define DPSAPI_VERSION 1
// Windows Header Files:
#include <windows.h>
#include <newdev.h>
#include <strsafe.h>
#include <msiquery.h>
#include <Msi.h>
#include <shlobj_core.h>
// WiX Header Files:
#include <wcautil.h>
#define SECURITY_WIN32
#include <Security.h>
#include <Lmcons.h>
#include <comdef.h>
#include <taskschd.h>
#include <iostream>
#include <strutil.h>
#include <string>
#include <optional>
#include <pathcch.h>
#include <psapi.h>
#include <vector>
#include <array>
#include <mutex>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.ApplicationModel.h>
#include <winrt/Windows.Management.Deployment.h>
#include <winrt/Windows.System.h>

View File

@@ -0,0 +1,20 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Resource.rc
#define FILE_DESCRIPTION "PowerToys Setup Custom Actions"
#define INTERNAL_NAME "PowerToysSetupCustomActionsVNext"
#define ORIGINAL_FILENAME "PowerToysSetupCustomActionsVNext.dll"
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif
#define IDR_BIN_MSIX_HELLO_PACKAGE 101

View File

@@ -0,0 +1,27 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<?include $(sys.CURRENTDIR)\Common.wxi?>
<?define AdvancedPasteAssetsFiles=?>
<?define AdvancedPasteAssetsFilesPath=$(var.BinDir)WinUI3Apps\Assets\AdvancedPaste\?>
<Fragment>
<DirectoryRef Id="WinUI3AppsAssetsFolder">
<Directory Id="AdvancedPasteAssetsFolder" Name="AdvancedPaste" />
</DirectoryRef>
<DirectoryRef Id="AdvancedPasteAssetsFolder" FileSource="$(var.AdvancedPasteAssetsFilesPath)">
<!-- Generated by generateFileComponents.ps1 -->
<!--AdvancedPasteAssetsFiles_Component_Def-->
</DirectoryRef>
<ComponentGroup Id="AdvancedPasteComponentGroup">
<Component Id="RemoveAdvancedPasteFolder" Guid="55AFE81D-F6BD-439A-A229-66AF5C360AB0" Directory="AdvancedPasteAssetsFolder">
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
<RegistryValue Type="string" Name="RemoveAdvancedPasteFolder" Value="" KeyPath="yes" />
</RegistryKey>
<RemoveFolder Id="RemoveFolderAdvancedPasteAssetsFolder" Directory="AdvancedPasteAssetsFolder" On="uninstall" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>

View File

@@ -0,0 +1,30 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<?include $(sys.CURRENTDIR)\Common.wxi?>
<?define AwakeImagesFiles=?>
<?define AwakeImagesFilesPath=$(var.BinDir)\Assets\Awake\?>
<Fragment>
<!-- Awake images -->
<DirectoryRef Id="BaseApplicationsAssetsFolder">
<Directory Id="AwakeImagesFolder" Name="Awake" />
</DirectoryRef>
<DirectoryRef Id="AwakeImagesFolder" FileSource="$(var.AwakeImagesFilesPath)">
<!-- Generated by generateFileComponents.ps1 -->
<!--AwakeImagesFiles_Component_Def-->
</DirectoryRef>
<ComponentGroup Id="AwakeComponentGroup">
<Component Id="RemoveAwakeFolder" Guid="95D7774C-69A3-48A3-B417-1BD9664BE974" Directory="INSTALLFOLDER">
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
<RegistryValue Type="string" Name="RemoveAwakeFolder" Value="" KeyPath="yes" />
</RegistryKey>
<RemoveFolder Id="RemoveFolderAwakeImagesFolder" Directory="AwakeImagesFolder" On="uninstall" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>

View File

@@ -0,0 +1,18 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<?include $(sys.CURRENTDIR)\Common.wxi?>
<?define BaseApplicationsFiles=?>
<?define BaseApplicationsFilesPath=$(var.BinDir)\?>
<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<!-- Generated by generateFileComponents.ps1 -->
<!--BaseApplicationsFiles_Component_Def-->
</DirectoryRef>
<ComponentGroup Id="BaseApplicationsComponentGroup">
</ComponentGroup>
</Fragment>
</Wix>

View File

@@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 KiB

View File

@@ -0,0 +1,38 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<Platforms>x64</Platforms>
<ImplicitUsings>disable</ImplicitUsings>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<ApplicationIcon>Assets\Icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>
<Resource Include="Assets\Icon.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.BootstrapperApplicationApi" />
</ItemGroup>
<ItemGroup>
<Page Update="Views\ShellView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,62 @@
using Bootstrapper.Models;
using Bootstrapper.Models.Util;
using System;
using WixToolset.BootstrapperApplicationApi;
namespace Bootstrapper;
internal class BootstrapperApp : BootstrapperApplication
{
private Model _model;
public int ExitCode { get; private set; }
protected override void OnCreate(CreateEventArgs args)
{
base.OnCreate(args);
try
{
var factory = new WpfBaFactory();
_model = factory.Create(this, args.Engine, args.Command);
}
catch (Exception ex)
{
ExitCode = ErrorHelper.HResultToWin32(ex.HResult);
args.Engine.Log(LogLevel.Error, ex.ToString());
throw;
}
}
protected override void Run()
{
var hResult = 0;
try
{
_model.Log.Write("Running bootstrapper application.");
try
{
_model.UiFacade.Initialize(_model);
_model.Engine.Detect();
_model.UiFacade.RunMessageLoop();
}
finally
{
hResult = _model.State.PhaseResult;
}
}
catch (Exception ex)
{
hResult = ex.HResult;
_model.Log.Write(ex);
}
finally
{
// If the HRESULT is an error, convert it to a win32 error code
ExitCode = ErrorHelper.HResultToWin32(hResult);
_model.SaveEmbeddedLog(ExitCode);
_model.Engine.Quit(ExitCode);
}
}
}

View File

@@ -0,0 +1,215 @@
using Bootstrapper.Models.State;
using Bootstrapper.Models.Util;
using System;
using System.IO;
using System.Linq;
using System.Text;
using WixToolset.BootstrapperApplicationApi;
namespace Bootstrapper.Models;
internal class Log
{
private readonly IEngine _engine;
public Log(IEngine engine)
{
_engine = engine;
}
public void Write(string message, bool indent = false, LogLevel level = LogLevel.Verbose)
{
var txt = message;
if (indent)
txt = $"{new string(' ', 10)}{txt}";
_engine.Log(level, txt);
}
public void Write(Exception ex)
{
Write(ex.ToString(), false, LogLevel.Error);
}
public void RemoveEmbeddedLog()
{
try
{
// delete any previous embedded log
var fileName = EmbeddedLogFileName();
if (!string.IsNullOrEmpty(fileName) && File.Exists(fileName))
File.Delete(fileName);
}
catch
{
// ignore
}
}
public string EmbeddedLogFileName()
{
var folder = Path.GetDirectoryName(_engine.GetVariableString(Constants.BundleLogName));
if (string.IsNullOrEmpty(folder))
return string.Empty;
return Path.Combine(folder, $"{_engine.GetVariableString(Constants.BundleNameVariable)}_embedded.txt");
}
public void WriteLogFile(AppState state, string fileName)
{
try
{
if (string.IsNullOrEmpty(fileName))
return;
var log = Read(state);
if (string.IsNullOrEmpty(log))
throw new InvalidOperationException("Reading log produced an empty string");
var logSb = new StringBuilder();
if (fileName == EmbeddedLogFileName())
{
// indent embedded log
var logArr = log.Split('\n');
foreach (var line in logArr)
{
logSb.Append(new string(' ', 8));
logSb.AppendLine(line.Trim());
}
File.WriteAllText(fileName, logSb.ToString());
}
else
File.WriteAllText(fileName, log);
}
catch (Exception ex)
{
Write($"Unable to write to {fileName}");
Write(ex);
}
}
/// <summary>
/// Formats app state, bundle log and any package logs that have been written into a single log
/// </summary>
/// <exception cref="InstallerVariableNotFoundException">
/// Thrown when the log cannot be read because a variable is missing
/// </exception>
private string Read(AppState state)
{
if (!_engine.ContainsVariable(Constants.BundleLogName))
throw new InstallerVariableNotFoundException(Constants.BundleLogName);
var tocSb = new StringBuilder();
tocSb.AppendLine("Table of Contents");
// Caches log file text. Will be appended to TOC once all logs have been read.
var logSb = new StringBuilder();
var tocIndex = 1;
// Add state to TOC
tocSb.AppendLine($"{tocIndex}. State");
// Add state to log
logSb.AppendLine();
logSb.AppendLine();
logSb.AppendLine("1. State");
logSb.AppendLine(Constants.Line);
logSb.AppendLine(state.ToString());
// Add TOC entry for bundle
tocIndex++;
var bundleLogFile = Path.GetFullPath(_engine.GetVariableString(Constants.BundleLogName));
tocSb.AppendLine($"{tocIndex}. Bundle Log (original location = \"{bundleLogFile}\")");
// Add bundle log text
logSb.Append(ReadLogFile(bundleLogFile, "Bundle Log", tocIndex));
var packageIds = state.Bundle.Packages.Values.Select(i => i.Id).ToArray();
foreach (var packageId in packageIds)
{
try
{
var packageLogFile = PackageLogFile(packageId);
if (string.IsNullOrEmpty(packageLogFile))
continue;
// Add package to TOC
var logName = state.GetPackageName(packageId);
tocIndex++;
tocSb.AppendLine($"{tocIndex}. {logName} (original location = \"{packageLogFile}\")");
// Add package log
logSb.Append(ReadLogFile(packageLogFile, logName, tocIndex));
}
catch (Exception ex)
{
logSb.AppendLine();
logSb.AppendLine();
logSb.AppendLine(ex.ToString());
}
}
if (!string.IsNullOrEmpty(state.RelatedBundleId))
{
var fileName = EmbeddedLogFileName();
if (!string.IsNullOrEmpty(fileName) && File.Exists(fileName))
{
tocIndex++;
var productName = _engine.GetVariableString(Constants.BundleNameVariable);
tocSb.AppendLine($"{tocIndex}. {productName} bundle (original location = \"{fileName}\")");
logSb.Append(ReadLogFile(fileName, productName, tocIndex));
}
}
tocSb.Append(logSb);
return tocSb.ToString();
}
private string PackageLogFile(string packageId)
{
var logLocationVar = $"{Constants.BundleLogName}_{packageId}";
// Variable won't exist until package has been run
if (!_engine.ContainsVariable(logLocationVar))
return null;
var logLocation = _engine.GetVariableString(logLocationVar);
if (string.IsNullOrWhiteSpace(logLocation))
return null;
var logFile = Path.GetFullPath(logLocation);
if (string.IsNullOrEmpty(logFile) || !File.Exists(logFile))
return null;
return logFile;
}
private string ReadLogFile(string fileName, string logName, int tocIndex)
{
string logText;
var bakFile = Path.GetFullPath($"{fileName}.view.bak");
// Copy the log file to avoid file contention.
File.Copy(fileName, bakFile);
try
{
logText = File.ReadAllText(bakFile);
}
catch (Exception ex)
{
logText = $"Unable to read file {bakFile} ({ex.Message})";
}
finally
{
File.Delete(bakFile);
}
var sb = new StringBuilder();
sb.AppendLine();
sb.AppendLine();
sb.AppendLine($"{tocIndex}. {logName}");
sb.AppendLine(Constants.Line);
sb.AppendLine(logText);
return sb.ToString();
}
}

View File

@@ -0,0 +1,112 @@
using Bootstrapper.Models.State;
using Bootstrapper.Models.Util;
using System;
using System.Diagnostics;
using System.IO;
using System.Windows;
using WixToolset.BootstrapperApplicationApi;
namespace Bootstrapper.Models;
/// <summary>
/// A model that exposes all the functionality of the BA.
/// </summary>
internal class Model
{
public Model(IEngine engine, IBootstrapperCommand commandInfo, WpfFacade uiFacade)
{
Engine = engine;
CommandInfo = commandInfo;
UiFacade = uiFacade;
Log = new Log(Engine);
State = new AppState(Engine, CommandInfo);
}
/// <summary>
/// Contains shared state used by the BA. All members are thread safe unless noted otherwise.
/// </summary>
public AppState State { get; }
/// <summary>
/// Command line parameters and other command info passed from the engine.
/// </summary>
public IBootstrapperCommand CommandInfo { get; }
/// <summary>
/// Read from and write to the bundle's log.
/// </summary>
public Log Log { get; }
/// <summary>
/// A facade exposing the limited UI functionality needed by the BA.
/// </summary>
public WpfFacade UiFacade { get; }
/// <summary>
/// WiX engine
/// </summary>
public IEngine Engine { get; }
/// <summary>
/// Starts the plan and apply phases with the given action.
/// </summary>
/// <param name="action">Action to plan</param>
public void PlanAndApply(LaunchAction action)
{
State.PlannedAction = action;
State.BaStatus = BaStatus.Planning;
State.CancelRequested = false;
Engine.Plan(action);
}
/// <summary>
/// Reads the log file and displays it in the user's default text editor.
/// </summary>
public void ShowLog()
{
try
{
var fileName = Path.GetFullPath($"{Engine.GetVariableString(Constants.BundleLogName)}.view.txt");
Log.WriteLogFile(State, fileName);
if (File.Exists(fileName))
{
Process process = null;
try
{
process = new Process();
process.StartInfo.FileName = fileName;
process.StartInfo.UseShellExecute = true;
process.StartInfo.Verb = "open";
process.Start();
}
finally
{
process?.Dispose();
}
}
}
catch (Exception ex)
{
UiFacade.ShowMessageBox($"Unable to display log: {ex.Message}", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
}
}
/// <summary>
/// </summary>
public void SaveEmbeddedLog(int exitCode)
{
try
{
if (State.Display == Display.Embedded)
{
Log.Write($"Exit code: 0x{exitCode:X}");
Log.WriteLogFile(State, Log.EmbeddedLogFileName());
}
}
catch
{
// ignore
}
}
}

View File

@@ -0,0 +1,210 @@
using Bootstrapper.Models.Util;
using System;
using System.Text;
using System.Threading;
using WixToolset.BootstrapperApplicationApi;
namespace Bootstrapper.Models.State;
/// <summary>
/// Provides thread safe access to all state shared by the BA
/// </summary>
internal class AppState
{
private readonly IBootstrapperCommand _commandInfo;
private readonly object _lock = new();
private long _baStatus;
private long _plannedAction;
private long _relatedBundleStatus;
private string _relatedBundleId;
private string _relatedBundleVersion;
private long _phaseResult;
private string _errorMessage;
private long _cancelRequested;
private string _relatedBundleName;
public AppState(IEngine engine, IBootstrapperCommand commandInfo)
{
_commandInfo = commandInfo;
Bundle = new BootstrapperApplicationData().Bundle;
BundleVersion = engine.GetVariableVersion(Constants.VersionVariable);
_baStatus = (long)BaStatus.Initializing;
_relatedBundleStatus = (long)BundleStatus.Unknown;
_plannedAction = (long)LaunchAction.Unknown;
}
/// <summary>
/// Information about the packages included in the bundle.
/// </summary>
public IBundleInfo Bundle { get; }
/// <summary>
/// Version of the bundle that this BA will deploy.
/// </summary>
public string BundleVersion { get; }
/// <summary>
/// The display level of the BA.
/// </summary>
public Display Display => _commandInfo.Display;
/// <summary>
/// Whether a version of this bundle was previously installed, and if so, whether this bundle is newer or older than the
/// installed version.
/// </summary>
public BundleStatus RelatedBundleStatus
{
get => (BundleStatus)Interlocked.Read(ref _relatedBundleStatus);
set => Interlocked.Exchange(ref _relatedBundleStatus, (long)value);
}
/// <summary>
/// Package ID of the bundle that was discovered during the detection phase.
/// Will be <see langword="null" /> if not installed.
/// </summary>
public string RelatedBundleId
{
get
{
lock (_lock)
return _relatedBundleId;
}
set
{
lock (_lock)
_relatedBundleId = value;
}
}
public string RelatedBundleName
{
get
{
lock (_lock)
return _relatedBundleName;
}
set
{
lock (_lock)
_relatedBundleName = value;
}
}
/// <summary>
/// Version of the bundle that was discovered during the detection phase.
/// Will be <see langword="null" /> if not installed.
/// </summary>
public string RelatedBundleVersion
{
get
{
lock (_lock)
return _relatedBundleVersion;
}
set
{
lock (_lock)
_relatedBundleVersion = value;
}
}
/// <summary>
/// Current status of the BA.
/// </summary>
public BaStatus BaStatus
{
get => (BaStatus)Interlocked.Read(ref _baStatus);
set => Interlocked.Exchange(ref _baStatus, (long)value);
}
/// <summary>
/// Final result of the last phase that ran.
/// </summary>
public int PhaseResult
{
get => (int)Interlocked.Read(ref _phaseResult);
set => Interlocked.Exchange(ref _phaseResult, value);
}
/// <summary>
/// Action selected when beginning the plan phase.
/// </summary>
public LaunchAction PlannedAction
{
get => (LaunchAction)Interlocked.Read(ref _plannedAction);
set => Interlocked.Exchange(ref _plannedAction, (long)value);
}
/// <summary>
/// Can be set to <see langword="true" /> to cancel the plan and apply phases.
/// </summary>
public bool CancelRequested
{
get => Interlocked.Read(ref _cancelRequested) == 1L;
set => Interlocked.Exchange(ref _cancelRequested, Convert.ToInt32(value));
}
/// <summary>
/// Stores any error encountered during the apply phase.
/// </summary>
public string ErrorMessage
{
get
{
lock (_lock)
return _errorMessage;
}
set
{
lock (_lock)
_errorMessage = value;
}
}
/// <summary>
/// Gets the display name for a package if possible.
/// </summary>
/// <param name="packageId">Identity of the package.</param>
/// <returns>Display name of the package if found or the package id if not.</returns>
public string GetPackageName(string packageId)
{
var packageName = string.Empty;
if (packageId == RelatedBundleId)
packageName = RelatedBundleName;
else if (Bundle.Packages.TryGetValue(packageId, out var package) && !string.IsNullOrWhiteSpace(package.DisplayName))
packageName = package.DisplayName;
return packageName;
}
public override string ToString()
{
var tocSb = new StringBuilder();
string error;
if (string.IsNullOrWhiteSpace(ErrorMessage))
error = "None";
else
error = ErrorMessage;
string installedVersion;
if (string.IsNullOrWhiteSpace(RelatedBundleVersion))
installedVersion = "Not installed";
else
installedVersion = RelatedBundleVersion;
tocSb.AppendLine($"Bootstrapper status: {BaStatus}");
tocSb.AppendLine($"Bundle status: {RelatedBundleStatus}");
tocSb.AppendLine($"Bundle version: {BundleVersion}");
tocSb.AppendLine($"Installed version: {installedVersion}");
tocSb.AppendLine($"Planned action: {PlannedAction}");
tocSb.AppendLine($"Result of last phase: {PhaseResult}");
tocSb.AppendLine($"Bundle error message: {error}");
tocSb.AppendLine($"Display: {_commandInfo.Display}");
tocSb.AppendLine($"Command line: {_commandInfo.CommandLine}");
tocSb.AppendLine($"Command line action: {_commandInfo.Action}");
tocSb.AppendLine($"Command line resume: {_commandInfo.Resume}");
return tocSb.ToString();
}
}

View File

@@ -0,0 +1,9 @@
namespace Bootstrapper.Models.State
{
internal class ProgressReport
{
public string Message { get; set; }
public string PackageName { get; set; }
public int Progress { get; set; }
}
}

View File

@@ -0,0 +1,48 @@
namespace Bootstrapper.Models.Util
{
/// <summary>
/// The states of installation.
/// </summary>
internal enum BaStatus
{
/// <summary>
/// The BA is starting up.
/// </summary>
Initializing,
/// <summary>
/// The BA is busy running the detect phase.
/// </summary>
Detecting,
/// <summary>
/// The BA has completed the detect phase and is idle, waiting for the user to start the plan phase.
/// </summary>
Waiting,
/// <summary>
/// The BA is busy running the plan phase.
/// </summary>
Planning,
/// <summary>
/// The BA is busy running the apply phase.
/// </summary>
Applying,
/// <summary>
/// The apply phase has successfully completed and the BA is idle, waiting for the user to exit the app.
/// </summary>
Applied,
/// <summary>
/// The user cancelled a phase and the BA is idle, waiting for user input.
/// </summary>
Cancelled,
/// <summary>
/// A phase failed and the BA is idle, waiting for user input.
/// </summary>
Failed
}
}

View File

@@ -0,0 +1,30 @@
namespace Bootstrapper.Models.Util
{
/// <summary>
/// The states of bundle detection.
/// </summary>
internal enum BundleStatus
{
Unknown = 0,
/// <summary>
/// There are no upgrade related bundles installed.
/// </summary>
NotInstalled = 1,
/// <summary>
/// All upgrade related bundles that are installed are earlier versions than this bundle.
/// </summary>
OlderInstalled = 2,
/// <summary>
/// All upgrade related bundles that are installed are the same version as this bundle.
/// </summary>
Current = 3,
/// <summary>
/// At least one upgrade related bundle is installed that is a newer version than this bundle.
/// </summary>
NewerInstalled = 4
}
}

View File

@@ -0,0 +1,11 @@
namespace Bootstrapper.Models.Util
{
internal static class Constants
{
public const string BundleLogName = "WixBundleLog";
public const string VersionVariable = "WixBundleVersion";
public const string BundleNameVariable = "WixBundleName";
public const string RebootMessage = "This machine has other pending updates that require a reboot before the app can be installed. Please restart, then try installing again.";
public const string Line = "========================================================================================";
}
}

View File

@@ -0,0 +1,19 @@
using System;
using WixToolset.BootstrapperApplicationApi;
namespace Bootstrapper.Models.Util;
internal class DetectPhaseCompleteEventArgs : EventArgs
{
public DetectPhaseCompleteEventArgs(LaunchAction followupAction)
{
FollowupAction = followupAction;
}
/// <summary>
/// Indicates which action is being planned and executed after the detect phase has
/// completed. If <see cref="LaunchAction.Unknown" />, then no action is planned, and
/// the UI should prompt the user for the action (install, uninstall, updated, repair, etc.).
/// </summary>
public LaunchAction FollowupAction { get; }
}

View File

@@ -0,0 +1,12 @@
namespace Bootstrapper.Models.Util
{
/// <summary>
/// The states of detection.
/// </summary>
internal enum DetectionState
{
Unknown,
Absent,
Present
}
}

View File

@@ -0,0 +1,56 @@
using System.ComponentModel;
namespace Bootstrapper.Models.Util
{
public static class ErrorHelper
{
/// <summary>
/// WiX return code which indicates cancellation.
/// </summary>
public const int CancelCode = 1223;
/// <summary>
/// ERROR_INSTALL_USEREXIT (0x80070642)
/// </summary>
public const int CancelHResult = -2147023294;
public static bool HResultIsFailure(int hResult)
{
return hResult < 0;
}
/// <summary>
/// Converts an HRESULT to a win32 error.
/// </summary>
/// <param name="hResult"></param>
/// <returns></returns>
public static int HResultToWin32(int hResult)
{
var win32 = hResult;
if ((win32 & 0xFFFF0000) == 0x80070000)
win32 &= 0xFFFF;
return win32;
}
/// <summary>
/// Converts an HRESULT to a message.
/// </summary>
/// <param name="hResult"></param>
/// <returns></returns>
public static string HResultToMessage(int hResult)
{
if (hResult == 0)
return "OK";
if (HResultIsFailure(hResult))
{
var message = new Win32Exception(hResult).Message;
return $"0x{hResult:X} {message}";
}
return $"Result {hResult} (0x{hResult:X})";
}
}
}

View File

@@ -0,0 +1,15 @@
using System;
namespace Bootstrapper.Models.Util
{
internal class InstallerVariableNotFoundException : Exception
{
public InstallerVariableNotFoundException(string variableName)
: base($"The installer variable \"{variableName}\" could not be found.")
{ }
public InstallerVariableNotFoundException(string variableName, Exception innerException)
: base($"The installer variable \"{variableName}\" could not be found.", innerException)
{ }
}
}

View File

@@ -0,0 +1,16 @@
using System;
namespace Bootstrapper.Models.Util
{
/// <summary>
/// Exception raised when executing a phase
/// </summary>
internal class PhaseException : Exception
{
public PhaseException(Exception innerException)
: base(innerException.Message, innerException)
{
HResult = innerException.HResult;
}
}
}

View File

@@ -0,0 +1,201 @@
using Bootstrapper.Models.State;
using Bootstrapper.Models.Util;
using Bootstrapper.ViewModels;
using Bootstrapper.Views;
using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Threading;
using WixToolset.BootstrapperApplicationApi;
namespace Bootstrapper.Models;
internal class WpfFacade
{
private readonly Log _log;
private ShellViewModel _shellVm;
private Window _shell;
private Dispatcher _dispatcher;
public WpfFacade(Log log, Display display)
{
_log = log ?? throw new ArgumentNullException(nameof(log));
IsUiShown = display == Display.Full || display == Display.Passive;
}
/// <summary>
/// Dispatches progress reports to the UI. Will be <see langword="null" /> when there is no UI to receive these reports.
/// </summary>
public IProgress<ProgressReport> ProgressReporter { get; private set; }
/// <summary>
/// A valid window handle required for the apply phase.
/// </summary>
public IntPtr ShellWindowHandle { get; private set; }
/// <summary>
/// Returns <see langword="false" /> when the installer is running silently.
/// </summary>
public bool IsUiShown { get; }
/// <summary>
/// Builds out needed UI elements and displays the shell window if not running silently.
/// </summary>
/// <param name="model"></param>
public void Initialize(Model model)
{
_dispatcher = Dispatcher.CurrentDispatcher;
_dispatcher.UnhandledException += Dispatcher_UnhandledException;
_shell = new ShellView();
ShellWindowHandle = new WindowInteropHelper(_shell).EnsureHandle();
// Stop message loop when the window is closed.
_shell.Closed += (sender, e) => _dispatcher.InvokeShutdown();
if (!IsUiShown)
return;
_shellVm = new ShellViewModel(model);
_shell.DataContext = _shellVm;
ProgressReporter = new Progress<ProgressReport>(r => _shellVm.ProgressVm.ProcessProgressReport(r));
_log.Write("Displaying UI.");
_shell.Show();
}
/// <summary>
/// Starts the message loop for the UI framework. This is a blocking call that is exited by calling.
/// <see cref="ShutDown" />.
/// </summary>
/// <exception cref="InvalidOperationException"></exception>
public void RunMessageLoop()
{
if (_shell == null)
throw new InvalidOperationException($"{nameof(Initialize)} must be called before the message loop can be started");
Dispatcher.Run();
}
/// <summary>
/// Executes the given action on "the UI thread".
/// </summary>
/// <param name="action">Action to execute</param>
/// <param name="blockUntilComplete">
/// If <see langword="true" />, then this call will block until the action completes.
/// If <see langword="false" />, this call immediately returns after queuing the action
/// for processing by the message loop.
/// </param>
public void Dispatch(Action action, bool blockUntilComplete = true)
{
if (blockUntilComplete)
{
// No need to dispatch if already running on the UI thread
if (_dispatcher.CheckAccess())
action();
else
_dispatcher.Invoke(DispatcherPriority.Normal, action);
}
else
_dispatcher.BeginInvoke(DispatcherPriority.Normal, action);
}
/// <summary>
/// Closes any displayed windows and stops the message loop.
/// </summary>
public void ShutDown()
{
Dispatch(CloseShell);
}
/// <summary>
/// Submits a request to the UI to refresh all commands.
/// </summary>
public void Refresh()
{
if (IsUiShown)
Dispatch(CommandManager.InvalidateRequerySuggested);
}
/// <summary>
/// Displays a message box with the given criteria
/// </summary>
/// <param name="message"></param>
/// <param name="buttons"></param>
/// <param name="image"></param>
/// <param name="defaultResult"></param>
/// <returns></returns>
public MessageBoxResult ShowMessageBox(string message, MessageBoxButton buttons, MessageBoxImage image, MessageBoxResult defaultResult)
{
var result = defaultResult;
if (IsUiShown)
{
Dispatch(
() => result = MessageBox.Show(
_shell,
message,
"Installation",
buttons,
image,
defaultResult));
}
else
{
Dispatch(
() => result = MessageBox.Show(
message,
"Installation",
buttons,
image,
defaultResult));
}
return result;
}
/// <summary>
/// Informs the UI that the detect phase has completed.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void OnDetectPhaseComplete(object sender, DetectPhaseCompleteEventArgs e)
{
if (_shellVm != null)
{
_log.Write($"{nameof(WpfFacade)}: Notified that detect is complete. Dispatching UI refresh tasks.");
Dispatch(() => _shellVm.AfterDetect(e.FollowupAction), false);
}
}
/// <summary>
/// Informs the UI that the apply phase has completed
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void OnApplyPhaseComplete(object sender, EventArgs e)
{
if (_shellVm != null)
{
_log.Write($"{nameof(WpfFacade)}: Notified that installation has completed. Dispatching UI refresh tasks.");
Dispatch(_shellVm.AfterApply, false);
}
}
private void CloseShell()
{
if (IsUiShown)
_shell.Close();
_dispatcher.InvokeShutdown();
}
private void Dispatcher_UnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
e.Handled = true;
_log.Write(e.Exception);
if (IsUiShown)
ShowMessageBox($"An error occurred:\r\n{e.Exception.Message}", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
}
}

View File

@@ -0,0 +1,554 @@
using Bootstrapper.Models;
using Bootstrapper.Models.Util;
using System;
using System.Linq;
using System.Windows;
using WixToolset.BootstrapperApplicationApi;
namespace Bootstrapper.Phases;
internal class ApplyPhase
{
private readonly Model _model;
public ApplyPhase(Model model)
{
_model = model;
}
public event EventHandler<EventArgs> ApplyPhaseComplete;
/// <summary>
/// Fired when the engine has begun installing the bundle.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <exception cref="PhaseException"></exception>
public virtual void OnApplyBegin(object sender, ApplyBeginEventArgs e)
{
try
{
_model.State.PhaseResult = 0;
_model.State.ErrorMessage = string.Empty;
if (e.Cancel)
return;
_model.State.BaStatus = BaStatus.Applying;
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw new PhaseException(ex);
}
}
/// <summary>
/// Fired when the engine has completed installing the bundle.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <exception cref="PhaseException"></exception>
public virtual void OnApplyComplete(object sender, ApplyCompleteEventArgs e)
{
try
{
_model.State.PhaseResult = e.Status;
// Set the state to applied or failed unless the user cancelled.
if (_model.State.BaStatus == BaStatus.Cancelled || e.Status == ErrorHelper.CancelHResult)
{
_model.State.BaStatus = BaStatus.Cancelled;
_model.Log.Write("User cancelled");
}
else if (ErrorHelper.HResultIsFailure(e.Status))
{
_model.State.BaStatus = BaStatus.Failed;
var msg = $"Apply failed - {ErrorHelper.HResultToMessage(e.Status)}";
if (string.IsNullOrEmpty(_model.State.ErrorMessage))
_model.State.ErrorMessage = msg;
_model.Log.Write(msg);
if (e.Restart == ApplyRestart.RestartRequired && _model.UiFacade.IsUiShown)
_model.UiFacade.ShowMessageBox(Constants.RebootMessage, MessageBoxButton.OK, MessageBoxImage.Stop, MessageBoxResult.OK);
}
else
_model.State.BaStatus = BaStatus.Applied;
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw new PhaseException(ex);
}
finally
{
if (_model.State.Display == Display.Full)
ApplyPhaseComplete?.Invoke(this, EventArgs.Empty);
else
_model.UiFacade.ShutDown();
}
}
/// <summary>
/// Fired when the engine has encountered an error.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <exception cref="PhaseException"></exception>
public virtual void OnError(object sender, ErrorEventArgs e)
{
try
{
if (e.ErrorCode == ErrorHelper.CancelCode)
_model.State.BaStatus = BaStatus.Cancelled;
else
{
_model.State.ErrorMessage = e.ErrorMessage;
_model.Log.Write("Error encountered");
_model.Log.Write(e.ErrorMessage, true);
_model.Log.Write($"Type: {e.ErrorType}", true);
_model.Log.Write($"Code: {e.ErrorCode}", true);
if (!string.IsNullOrWhiteSpace(e.PackageId))
_model.Log.Write($"Package: {e.PackageId}", true);
var data = e.Data?.Where(d => !string.IsNullOrWhiteSpace(d)).ToArray() ?? Array.Empty<string>();
if (data.Length > 0)
{
_model.Log.Write("Data:", true);
foreach (var d in data)
_model.Log.Write($" {d}", true);
}
if (_model.UiFacade.IsUiShown)
{
// Show an error dialog.
var button = MessageBoxButton.OK;
var buttonHint = e.UIHint & 0xF;
if (buttonHint >= 0 && buttonHint <= 4)
button = (MessageBoxButton)buttonHint;
var response = _model.UiFacade.ShowMessageBox(e.ErrorMessage, button, MessageBoxImage.Error, MessageBoxResult.None);
if (buttonHint == (int)button)
{
// If WiX supplied a hint, return the result
e.Result = (Result)response;
_model.Log.Write($"User response: {response}");
}
}
}
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw new PhaseException(ex);
}
}
/// <summary>
/// Fired when the plan determined that nothing should happen to prevent downgrading.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnApplyDowngrade(object sender, ApplyDowngradeEventArgs e)
{ }
/// <summary>
/// Fired when the engine has begun installing packages.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnExecuteBegin(object sender, ExecuteBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed installing packages.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnExecuteComplete(object sender, ExecuteCompleteEventArgs e)
{ }
/// <summary>
/// Fired by the engine while executing a package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnExecuteProgress(object sender, ExecuteProgressEventArgs e)
{ }
///// <summary>
///// Fired when the engine has begun to set up the update package.
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//public virtual void OnSetUpdateBegin(object sender, SetUpdateBeginEventArgs e)
//{ }
///// <summary>
///// Fired when the engine has completed setting up the update package.
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
///// <exception cref="PhaseException"></exception>
//public virtual void OnSetUpdateComplete(object sender, SetUpdateCompleteEventArgs e)
//{ }
/// <summary>
/// Fired when the engine executes one or more patches targeting a product.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnExecutePatchTarget(object sender, ExecutePatchTargetEventArgs e)
{ }
/// <summary>
/// Fired when the engine is about to begin an MSI transaction.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnBeginMsiTransactionBegin(object sender, BeginMsiTransactionBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed beginning an MSI transaction.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnBeginMsiTransactionComplete(object sender, BeginMsiTransactionCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine is about to commit an MSI transaction.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCommitMsiTransactionBegin(object sender, CommitMsiTransactionBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed comitting an MSI transaction.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCommitMsiTransactionComplete(object sender, CommitMsiTransactionCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine is about to rollback an MSI transaction.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnRollbackMsiTransactionBegin(object sender, RollbackMsiTransactionBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed rolling back an MSI transaction.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnRollbackMsiTransactionComplete(object sender, RollbackMsiTransactionCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine has begun acquiring the payload or container.
/// The BA can change the source using
/// <see cref="M:WixToolset.Mba.Core.IEngine.SetLocalSource(System.String,System.String,System.String)" />
/// or
/// <see
/// cref="M:WixToolset.Mba.Core.IEngine.SetDownloadSource(System.String,System.String,System.String,System.String,System.String)" />
/// .
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCacheAcquireBegin(object sender, CacheAcquireBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed the acquisition of the payload or container.
/// The BA can change the source using
/// <see cref="M:WixToolset.Mba.Core.IEngine.SetLocalSource(System.String,System.String,System.String)" />
/// or
/// <see
/// cref="M:WixToolset.Mba.Core.IEngine.SetDownloadSource(System.String,System.String,System.String,System.String,System.String)" />
/// .
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCacheAcquireComplete(object sender, CacheAcquireCompleteEventArgs e)
{ }
/// <summary>
/// Fired by the engine to allow the BA to override the acquisition action.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCacheAcquireResolving(object sender, CacheAcquireResolvingEventArgs e)
{ }
/// <summary>
/// Fired when the engine has progress acquiring the payload or container.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCacheAcquireProgress(object sender, CacheAcquireProgressEventArgs e)
{ }
/// <summary>
/// Fired when the engine has begun caching the installation sources.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCacheBegin(object sender, CacheBeginEventArgs e)
{ }
/// <summary>
/// Fired after the engine has cached the installation sources.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCacheComplete(object sender, CacheCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine begins the verification of the payload or container that was already in the package cache.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCacheContainerOrPayloadVerifyBegin(object sender, CacheContainerOrPayloadVerifyBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed the verification of the payload or container that was already in the package
/// cache.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCacheContainerOrPayloadVerifyComplete(object sender, CacheContainerOrPayloadVerifyCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine has progress verifying the payload or container that was already in the package cache.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCacheContainerOrPayloadVerifyProgress(object sender, CacheContainerOrPayloadVerifyProgressEventArgs e)
{ }
/// <summary>
/// Fired when the engine has begun caching a specific package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCachePackageBegin(object sender, CachePackageBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed caching a specific package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCachePackageComplete(object sender, CachePackageCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine failed validating a package in the package cache that is non-vital to execution.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCachePackageNonVitalValidationFailure(object sender, CachePackageNonVitalValidationFailureEventArgs e)
{ }
/// <summary>
/// Fired when the engine begins the extraction of the payload from the container.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCachePayloadExtractBegin(object sender, CachePayloadExtractBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed the extraction of the payload from the container.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCachePayloadExtractComplete(object sender, CachePayloadExtractCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine has progress extracting the payload from the container.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCachePayloadExtractProgress(object sender, CachePayloadExtractProgressEventArgs e)
{ }
/// <summary>
/// Fired when the engine begins the verification of the acquired payload or container.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCacheVerifyBegin(object sender, CacheVerifyBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed the verification of the acquired payload or container.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCacheVerifyComplete(object sender, CacheVerifyCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine has progress verifying the payload or container.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnCacheVerifyProgress(object sender, CacheVerifyProgressEventArgs e)
{ }
/// <summary>
/// Fired when the engine has begun installing a specific package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnExecutePackageBegin(object sender, ExecutePackageBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed installing a specific package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnExecutePackageComplete(object sender, ExecutePackageCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine is about to pause Windows automatic updates.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPauseAutomaticUpdatesBegin(object sender, PauseAutomaticUpdatesBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed pausing Windows automatic updates.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPauseAutomaticUpdatesComplete(object sender, PauseAutomaticUpdatesCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine is about to take a system restore point.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnSystemRestorePointBegin(object sender, SystemRestorePointBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed taking a system restore point.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnSystemRestorePointComplete(object sender, SystemRestorePointCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine is about to start the elevated process.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnElevateBegin(object sender, ElevateBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed starting the elevated process.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnElevateComplete(object sender, ElevateCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine is about to launch the preapproved executable.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnLaunchApprovedExeBegin(object sender, LaunchApprovedExeBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed launching the preapproved executable.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnLaunchApprovedExeComplete(object sender, LaunchApprovedExeCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine has begun registering the location and visibility of the bundle.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnRegisterBegin(object sender, RegisterBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed registering the location and visibility of the bundle.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnRegisterComplete(object sender, RegisterCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine unregisters the bundle.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnUnregisterBegin(object sender, UnregisterBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine unregistration is complete.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnUnregisterComplete(object sender, UnregisterCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine has changed progress for the bundle installation.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnProgress(object sender, ProgressEventArgs e)
{ }
/// <summary>
/// Fired when Windows Installer sends an installation message.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnExecuteMsiMessage(object sender, ExecuteMsiMessageEventArgs e)
{ }
/// <summary>
/// Fired when a package that spawned a process is cancelled.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnExecuteProcessCancel(object sender, ExecuteProcessCancelEventArgs e)
{ }
/// <summary>
/// Fired when a package sends a files in use installation message.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnExecuteFilesInUse(object sender, ExecuteFilesInUseEventArgs e)
{ }
}

View File

@@ -0,0 +1,29 @@
using Bootstrapper.Models;
using WixToolset.BootstrapperApplicationApi;
namespace Bootstrapper.Phases;
/// <summary>
/// Manages cancellation
/// </summary>
internal class CancelHandler
{
private readonly Model _model;
public CancelHandler(Model model)
{
_model = model;
}
public void CheckForCancel(object sender, CancellableHResultEventArgs e)
{
if (!e.Cancel && _model.State.CancelRequested)
e.Cancel = true;
}
public void CheckResult(object sender, ResultEventArgs e)
{
if (e.Result != Result.Abort && e.Result != Result.Error && e.Result != Result.Cancel && _model.State.CancelRequested)
e.Result = Result.Cancel;
}
}

View File

@@ -0,0 +1,287 @@
using Bootstrapper.Models;
using Bootstrapper.Models.Util;
using System;
using WixToolset.BootstrapperApplicationApi;
namespace Bootstrapper.Phases;
internal class DetectPhase
{
private readonly Model _model;
private DetectionState _bundleDetectedState;
public DetectPhase(Model model)
{
_model = model;
_bundleDetectedState = DetectionState.Unknown;
}
public event EventHandler<DetectPhaseCompleteEventArgs> DetectPhaseComplete;
/// <summary>
/// Fired when the engine is starting up the bootstrapper application.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnStartup(object sender, StartupEventArgs e)
{ }
/// <summary>
/// Fired when the engine is shutting down the bootstrapper application.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnShutdown(object sender, ShutdownEventArgs e)
{ }
/// <summary>
/// Fired when the overall detection phase has begun.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <exception cref="PhaseException"></exception>
public virtual void OnDetectBegin(object sender, DetectBeginEventArgs e)
{
try
{
_model.State.BaStatus = BaStatus.Detecting;
if (e.RegistrationType == RegistrationType.Full)
_bundleDetectedState = DetectionState.Present;
else
_bundleDetectedState = DetectionState.Absent;
_model.Log.Write($"{nameof(_bundleDetectedState)} set to {_bundleDetectedState}");
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw new PhaseException(ex);
}
}
/// <summary>
/// Fired when a related bundle has been detected for a bundle.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <remarks>
/// Helpful when the detected bundle has the same upgrade code that this one does.
/// </remarks>
public virtual void OnDetectRelatedBundle(object sender, DetectRelatedBundleEventArgs e)
{
try
{
// If the detected bundle's upgrade code matches this bundle, but product code and version are different...
if (e.RelationType == RelationType.Upgrade)
{
_bundleDetectedState = DetectionState.Present;
if (string.IsNullOrWhiteSpace(_model.State.RelatedBundleVersion))
_model.State.RelatedBundleVersion = e.Version;
_model.Log.Write($"Detected version = {e.Version} / Bundle version = {_model.State.BundleVersion}");
if (_model.Engine.CompareVersions(_model.State.BundleVersion, e.Version) > 0)
{
if (_model.State.RelatedBundleStatus <= BundleStatus.Current)
_model.State.RelatedBundleStatus = BundleStatus.OlderInstalled;
}
else if (_model.Engine.CompareVersions(_model.State.BundleVersion, e.Version) == 0)
{
if (_model.State.RelatedBundleStatus == BundleStatus.NotInstalled)
_model.State.RelatedBundleStatus = BundleStatus.Current;
}
else
_model.State.RelatedBundleStatus = BundleStatus.NewerInstalled;
_model.Log.Write($"{nameof(_model.State.RelatedBundleStatus)} set to {_model.State.RelatedBundleStatus}");
}
if (!_model.State.Bundle.Packages.ContainsKey(e.ProductCode))
{
var package = _model.State.Bundle.AddRelatedBundleAsPackage(e.ProductCode, e.RelationType, e.PerMachine, e.Version);
_model.State.RelatedBundleId = package.Id;
if (_model.Engine.ContainsVariable(Constants.BundleNameVariable))
{
var name = _model.Engine.GetVariableString(Constants.BundleNameVariable);
_model.State.RelatedBundleName = $"{name} v{_model.State.RelatedBundleVersion}";
}
else
_model.State.RelatedBundleName = $"v{_model.State.RelatedBundleVersion}";
}
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw new PhaseException(ex);
}
}
/// <summary>
/// Fired when the detection phase has completed.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <exception cref="PhaseException"></exception>
public virtual void OnDetectComplete(object sender, DetectCompleteEventArgs e)
{
var followupAction = LaunchAction.Unknown;
try
{
_model.State.PhaseResult = e.Status;
if (ErrorHelper.HResultIsFailure(e.Status))
{
var msg = $"Detect failed - {ErrorHelper.HResultToMessage(e.Status)}";
_model.Log.Write(msg);
if (string.IsNullOrEmpty(_model.State.ErrorMessage))
_model.State.ErrorMessage = msg;
if (!_model.UiFacade.IsUiShown)
_model.UiFacade.ShutDown();
return;
}
if (_model.State.RelatedBundleStatus == BundleStatus.Unknown)
{
if (_bundleDetectedState == DetectionState.Present)
{
_model.State.RelatedBundleStatus = BundleStatus.Current;
if (string.IsNullOrWhiteSpace(_model.State.RelatedBundleVersion))
_model.State.RelatedBundleVersion = _model.State.BundleVersion;
}
else
_model.State.RelatedBundleStatus = BundleStatus.NotInstalled;
}
_model.State.BaStatus = BaStatus.Waiting;
if (_model.CommandInfo.Action == LaunchAction.Uninstall && _model.CommandInfo.Resume == ResumeType.Arp)
{
_model.Log.Write("Starting plan for automatic uninstall");
followupAction = _model.CommandInfo.Action;
}
else if (_model.State.Display != Display.Full)
{
_model.Log.Write("Starting plan for silent mode.");
followupAction = _model.CommandInfo.Action;
}
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw new PhaseException(ex);
}
finally
{
// Can't start plan until UI is notified
NotifyDetectComplete(followupAction);
}
try
{
if (followupAction != LaunchAction.Unknown)
_model.PlanAndApply(followupAction);
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw new PhaseException(ex);
}
}
/// <summary>
/// Fired when a related bundle has been detected for a bundle package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnDetectRelatedBundlePackage(object sender, DetectRelatedBundlePackageEventArgs e)
{ }
/// <summary>
/// Fired when a related MSI package has been detected for a package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnDetectRelatedMsiPackage(object sender, DetectRelatedMsiPackageEventArgs e)
{ }
/// <summary>
/// Fired when the update detection has found a potential update candidate.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnDetectUpdate(object sender, DetectUpdateEventArgs e)
{ }
/// <summary>
/// Fired when the update detection phase has begun.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnDetectUpdateBegin(object sender, DetectUpdateBeginEventArgs e)
{ }
/// <summary>
/// Fired when the update detection phase has completed.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnDetectUpdateComplete(object sender, DetectUpdateCompleteEventArgs e)
{ }
/// <summary>
/// Fired when a forward compatible bundle is detected.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnDetectForwardCompatibleBundle(object sender, DetectForwardCompatibleBundleEventArgs e)
{ }
/// <summary>
/// Fired when the detection for a specific package has begun.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnDetectPackageBegin(object sender, DetectPackageBeginEventArgs e)
{ }
/// <summary>
/// Fired when the detection for a specific package has completed.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnDetectPackageComplete(object sender, DetectPackageCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine detects a target product for an MSP package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnDetectPatchTarget(object sender, DetectPatchTargetEventArgs e)
{ }
/// <summary>
/// Fired when a package was not detected but a package using the same provider key was.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnDetectCompatibleMsiPackage(object sender, DetectCompatibleMsiPackageEventArgs e)
{ }
/// <summary>
/// Fired when a feature in an MSI package has been detected.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnDetectMsiFeature(object sender, DetectMsiFeatureEventArgs e)
{ }
private void NotifyDetectComplete(LaunchAction followupAction)
{
if (_model.UiFacade.IsUiShown)
DetectPhaseComplete?.Invoke(this, new DetectPhaseCompleteEventArgs(followupAction));
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,435 @@
using Bootstrapper.Models;
using Bootstrapper.Models.Util;
using System;
using WixToolset.BootstrapperApplicationApi;
namespace Bootstrapper.Phases;
internal class LoggingDetectPhase : DetectPhase
{
private readonly Log _logger;
public LoggingDetectPhase(Model model)
: base(model)
{
_logger = model.Log;
}
/// <inheritdoc />
public override void OnStartup(object sender, StartupEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnStartup)} -------v");
base.OnStartup(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnStartup)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnShutdown(object sender, ShutdownEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnShutdown)} -------v");
base.OnShutdown(sender, e);
_logger.Write($"{nameof(e.Action)} = {e.Action}", true);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnShutdown)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnDetectBegin(object sender, DetectBeginEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectBegin)} -------v");
_logger.Write($"{nameof(e.PackageCount)} = {e.PackageCount}", true);
_logger.Write($"{nameof(e.Cached)} = {e.Cached}", true);
_logger.Write($"{nameof(e.RegistrationType)} = {e.RegistrationType}", true);
base.OnDetectBegin(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectBegin)} -------^");
}
catch (PhaseException)
{ }
catch (Exception ex)
{
_logger.Write(ex);
e.HResult = ex.HResult;
}
}
/// <inheritdoc />
public override void OnDetectComplete(object sender, DetectCompleteEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectComplete)} -------v");
_logger.Write($"{nameof(e.Status)} = {ErrorHelper.HResultToMessage(e.Status)}", true);
_logger.Write($"{nameof(e.EligibleForCleanup)} = {e.EligibleForCleanup}", true);
base.OnDetectComplete(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectComplete)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnDetectRelatedBundle(object sender, DetectRelatedBundleEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectRelatedBundle)} -------v");
_logger.Write($"{nameof(e.ProductCode)} = {e.ProductCode}", true);
_logger.Write($"{nameof(e.Version)} = {e.Version}", true);
_logger.Write($"{nameof(e.BundleTag)} = {e.BundleTag}", true);
_logger.Write($"{nameof(e.PerMachine)} = {e.PerMachine}", true);
_logger.Write($"{nameof(e.RelationType)} = {e.RelationType}", true);
_logger.Write($"{nameof(e.MissingFromCache)} = {e.MissingFromCache}", true);
base.OnDetectRelatedBundle(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectRelatedBundle)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnDetectRelatedBundlePackage(object sender, DetectRelatedBundlePackageEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectRelatedBundlePackage)} -------v");
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
_logger.Write($"{nameof(e.ProductCode)} = {e.ProductCode}", true);
_logger.Write($"{nameof(e.Version)} = {e.Version}", true);
_logger.Write($"{nameof(e.RelationType)} = {e.RelationType}", true);
_logger.Write($"{nameof(e.PerMachine)} = {e.PerMachine}", true);
base.OnDetectRelatedBundlePackage(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectRelatedBundlePackage)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnDetectRelatedMsiPackage(object sender, DetectRelatedMsiPackageEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectRelatedMsiPackage)} -------v");
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
_logger.Write($"{nameof(e.UpgradeCode)} = {e.UpgradeCode}", true);
_logger.Write($"{nameof(e.ProductCode)} = {e.ProductCode}", true);
_logger.Write($"{nameof(e.Version)} = {e.Version}", true);
_logger.Write($"{nameof(e.PerMachine)} = {e.PerMachine}", true);
_logger.Write($"{nameof(e.Operation)} = {e.Operation}", true);
base.OnDetectRelatedMsiPackage(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectRelatedMsiPackage)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnDetectUpdate(object sender, DetectUpdateEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectUpdate)} -------v");
_logger.Write($"{nameof(e.Title)} = {e.Title}", true);
_logger.Write($"{nameof(e.Summary)} = {e.Summary}", true);
_logger.Write($"{nameof(e.Version)} = {e.Version}", true);
_logger.Write($"{nameof(e.UpdateLocation)} = {e.UpdateLocation}", true);
base.OnDetectUpdate(sender, e);
_logger.Write($"{nameof(e.StopProcessingUpdates)} = {e.StopProcessingUpdates}");
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectUpdate)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnDetectUpdateBegin(object sender, DetectUpdateBeginEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectUpdateBegin)} -------v");
_logger.Write($"{nameof(e.UpdateLocation)} = {e.UpdateLocation}", true);
base.OnDetectUpdateBegin(sender, e);
_logger.Write($"{nameof(e.Skip)} = {e.Skip}", true);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectUpdateBegin)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnDetectUpdateComplete(object sender, DetectUpdateCompleteEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectUpdateComplete)} -------v");
_logger.Write($"{nameof(e.Status)} = {ErrorHelper.HResultToMessage(e.Status)}", true);
base.OnDetectUpdateComplete(sender, e);
_logger.Write($"{nameof(e.IgnoreError)} = {e.IgnoreError}", true);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectUpdateComplete)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnDetectForwardCompatibleBundle(object sender, DetectForwardCompatibleBundleEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectForwardCompatibleBundle)} -------v");
_logger.Write($"{nameof(e.BundleId)} = {e.BundleId}", true);
_logger.Write($"{nameof(e.Version)} = {e.Version}", true);
_logger.Write($"{nameof(e.BundleTag)} = {e.BundleTag}", true);
_logger.Write($"{nameof(e.PerMachine)} = {e.PerMachine}", true);
_logger.Write($"{nameof(e.RelationType)} = {e.RelationType}", true);
base.OnDetectForwardCompatibleBundle(sender, e);
_logger.Write($"{nameof(e.MissingFromCache)} = {e.MissingFromCache}", true);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectForwardCompatibleBundle)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnDetectPackageBegin(object sender, DetectPackageBeginEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectPackageBegin)} -------v");
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
base.OnDetectPackageBegin(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectPackageBegin)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnDetectPackageComplete(object sender, DetectPackageCompleteEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectPackageComplete)} -------v");
_logger.Write($"{nameof(e.Status)} = {ErrorHelper.HResultToMessage(e.Status)}", true);
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
_logger.Write($"{nameof(e.State)} = {e.State}", true);
_logger.Write($"{nameof(e.Cached)} = {e.Cached}", true);
base.OnDetectPackageComplete(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectPackageComplete)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnDetectPatchTarget(object sender, DetectPatchTargetEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectPatchTarget)} -------v");
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
_logger.Write($"{nameof(e.ProductCode)} = {e.ProductCode}", true);
_logger.Write($"{nameof(e.State)} = {e.State}", true);
base.OnDetectPatchTarget(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectPatchTarget)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnDetectCompatibleMsiPackage(object sender, DetectCompatibleMsiPackageEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectCompatibleMsiPackage)} -------v");
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
_logger.Write($"{nameof(e.CompatiblePackageId)} = {e.CompatiblePackageId}", true);
_logger.Write($"{nameof(e.CompatiblePackageVersion)} = {e.CompatiblePackageVersion}", true);
base.OnDetectCompatibleMsiPackage(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectCompatibleMsiPackage)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnDetectMsiFeature(object sender, DetectMsiFeatureEventArgs e)
{
try
{
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectMsiFeature)} -------v");
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
_logger.Write($"{nameof(e.FeatureId)} = {e.FeatureId}", true);
_logger.Write($"{nameof(e.State)} = {e.State}", true);
base.OnDetectMsiFeature(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(DetectPhase)}: {nameof(OnDetectMsiFeature)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
}

View File

@@ -0,0 +1,451 @@
using Bootstrapper.Models;
using Bootstrapper.Models.Util;
using System;
using WixToolset.BootstrapperApplicationApi;
namespace Bootstrapper.Phases;
internal class LoggingPlanPhase : PlanPhase
{
private readonly Log _logger;
public LoggingPlanPhase(Model model)
: base(model)
{
_logger = model.Log;
}
/// <inheritdoc />
public override void OnPlanBegin(object sender, PlanBeginEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanBegin)} -------v");
_logger.Write($"{nameof(e.PackageCount)} = {e.PackageCount}", true);
base.OnPlanBegin(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanBegin)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnPlanComplete(object sender, PlanCompleteEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanComplete)} -------v");
_logger.Write($"{nameof(e.Status)} = {ErrorHelper.HResultToMessage(e.Status)}", true);
base.OnPlanComplete(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanComplete)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnPlanPackageBegin(object sender, PlanPackageBeginEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanPackageBegin)} -------v");
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
_logger.Write($"{nameof(e.CurrentState)} = {e.CurrentState}", true);
_logger.Write($"{nameof(e.RecommendedState)} = {e.RecommendedState}", true);
_logger.Write($"{nameof(e.RepairCondition)} = {e.RepairCondition}", true);
_logger.Write($"{nameof(e.Cached)} = {e.Cached}", true);
_logger.Write($"{nameof(e.RecommendedCacheType)} = {e.RecommendedCacheType}", true);
_logger.Write($"{nameof(e.InstallCondition)} = {e.InstallCondition}", true);
base.OnPlanPackageBegin(sender, e);
_logger.Write($"{nameof(e.State)} = {e.State}", true);
_logger.Write($"{nameof(e.CacheType)} = {e.CacheType}", true);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanPackageBegin)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnPlanPackageComplete(object sender, PlanPackageCompleteEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanPackageComplete)} -------v");
_logger.Write($"{nameof(e.Status)} = {ErrorHelper.HResultToMessage(e.Status)}", true);
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
_logger.Write($"{nameof(e.Requested)} = {e.Requested}", true);
base.OnPlanPackageComplete(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanPackageComplete)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnPlanCompatibleMsiPackageBegin(object sender, PlanCompatibleMsiPackageBeginEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanCompatibleMsiPackageBegin)} -------v");
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
_logger.Write($"{nameof(e.CompatiblePackageId)} = {e.CompatiblePackageId}", true);
_logger.Write($"{nameof(e.CompatiblePackageVersion)} = {e.CompatiblePackageVersion}", true);
_logger.Write($"{nameof(e.RecommendedRemove)} = {e.RecommendedRemove}", true);
base.OnPlanCompatibleMsiPackageBegin(sender, e);
_logger.Write($"{nameof(e.RequestRemove)} = {e.RequestRemove}", true);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanCompatibleMsiPackageBegin)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnPlanCompatibleMsiPackageComplete(object sender, PlanCompatibleMsiPackageCompleteEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanCompatibleMsiPackageComplete)} -------v");
_logger.Write($"{nameof(e.Status)} = {ErrorHelper.HResultToMessage(e.Status)}", true);
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
_logger.Write($"{nameof(e.CompatiblePackageId)} = {e.CompatiblePackageId}", true);
_logger.Write($"{nameof(e.RequestedRemove)} = {e.RequestedRemove}", true);
base.OnPlanCompatibleMsiPackageComplete(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanCompatibleMsiPackageComplete)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnPlanRollbackBoundary(object sender, PlanRollbackBoundaryEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanRollbackBoundary)} -------v");
_logger.Write($"{nameof(e.RollbackBoundaryId)} = {e.RollbackBoundaryId}", true);
_logger.Write($"{nameof(e.RecommendedTransaction)} = {e.RecommendedTransaction}", true);
base.OnPlanRollbackBoundary(sender, e);
_logger.Write($"{nameof(e.Transaction)} = {e.Transaction}", true);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanRollbackBoundary)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnPlanRelatedBundle(object sender, PlanRelatedBundleEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanRelatedBundle)} -------v");
_logger.Write($"{nameof(e.BundleId)} = {e.BundleId}", true);
_logger.Write($"{nameof(e.RecommendedState)} = {e.RecommendedState}", true);
base.OnPlanRelatedBundle(sender, e);
_logger.Write($"{nameof(e.State)} = {e.State}", true);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanRelatedBundle)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnPlanRelatedBundleType(object sender, PlanRelatedBundleTypeEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanRelatedBundleType)} -------v");
_logger.Write($"{nameof(e.BundleId)} = {e.BundleId}", true);
_logger.Write($"{nameof(e.RecommendedType)} = {e.RecommendedType}", true);
base.OnPlanRelatedBundleType(sender, e);
_logger.Write($"{nameof(e.Type)} = {e.Type}", true);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanRelatedBundleType)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnPlanRestoreRelatedBundle(object sender, PlanRestoreRelatedBundleEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanRestoreRelatedBundle)} -------v");
_logger.Write($"{nameof(e.BundleId)} = {e.BundleId}", true);
_logger.Write($"{nameof(e.RecommendedState)} = {e.RecommendedState}", true);
base.OnPlanRestoreRelatedBundle(sender, e);
_logger.Write($"{nameof(e.State)} = {e.State}", true);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanRestoreRelatedBundle)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnPlanForwardCompatibleBundle(object sender, PlanForwardCompatibleBundleEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanForwardCompatibleBundle)} -------v");
_logger.Write($"{nameof(e.BundleId)} = {e.BundleId}", true);
_logger.Write($"{nameof(e.Version)} = {e.Version}", true);
_logger.Write($"{nameof(e.PerMachine)} = {e.PerMachine}", true);
_logger.Write($"{nameof(e.RelationType)} = {e.RelationType}", true);
_logger.Write($"{nameof(e.BundleTag)} = {e.BundleTag}", true);
_logger.Write($"{nameof(e.RecommendedIgnoreBundle)} = {e.RecommendedIgnoreBundle}", true);
base.OnPlanForwardCompatibleBundle(sender, e);
_logger.Write($"{nameof(e.IgnoreBundle)} = {e.IgnoreBundle}", true);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanForwardCompatibleBundle)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnPlanMsiPackage(object sender, PlanMsiPackageEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanMsiPackage)} -------v");
_logger.Write($"{nameof(e.Action)} = {e.Action}", true);
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
_logger.Write($"{nameof(e.RecommendedFileVersioning)} = {e.RecommendedFileVersioning}", true);
_logger.Write($"{nameof(e.ShouldExecute)} = {e.ShouldExecute}", true);
base.OnPlanMsiPackage(sender, e);
_logger.Write($"{nameof(e.ActionMsiProperty)} = {e.ActionMsiProperty}", true);
_logger.Write($"{nameof(e.FileVersioning)} = {e.FileVersioning}", true);
_logger.Write($"{nameof(e.DisableExternalUiHandler)} = {e.DisableExternalUiHandler}", true);
_logger.Write($"{nameof(e.UiLevel)} = {e.UiLevel}", true);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanMsiPackage)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnPlanMsiFeature(object sender, PlanMsiFeatureEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanMsiFeature)} -------v");
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
_logger.Write($"{nameof(e.FeatureId)} = {e.FeatureId}", true);
_logger.Write($"{nameof(e.RecommendedState)} = {e.RecommendedState}", true);
base.OnPlanMsiFeature(sender, e);
_logger.Write($"{nameof(e.State)} = {e.State}", true);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanMsiFeature)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnPlanPatchTarget(object sender, PlanPatchTargetEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanPatchTarget)} -------v");
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
_logger.Write($"{nameof(e.ProductCode)} = {e.ProductCode}", true);
_logger.Write($"{nameof(e.RecommendedState)} = {e.RecommendedState}", true);
base.OnPlanPatchTarget(sender, e);
_logger.Write($"{nameof(e.State)} = {e.State}", true);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlanPatchTarget)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnPlannedPackage(object sender, PlannedPackageEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlannedPackage)} -------v");
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
_logger.Write($"{nameof(e.Execute)} = {e.Execute}", true);
_logger.Write($"{nameof(e.Rollback)} = {e.Rollback}", true);
_logger.Write($"{nameof(e.Cache)} = {e.Cache}", true);
_logger.Write($"{nameof(e.Uncache)} = {e.Uncache}", true);
base.OnPlannedPackage(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlannedPackage)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
/// <inheritdoc />
public override void OnPlannedCompatiblePackage(object sender, PlannedCompatiblePackageEventArgs e)
{
try
{
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlannedCompatiblePackage)} -------v");
_logger.Write($"{nameof(e.PackageId)} = {e.PackageId}", true);
_logger.Write($"{nameof(e.CompatiblePackageId)} = {e.CompatiblePackageId}", true);
_logger.Write($"{nameof(e.Remove)} = {e.Remove}", true);
base.OnPlannedCompatiblePackage(sender, e);
_logger.Write($"{nameof(e.HResult)} = {ErrorHelper.HResultToMessage(e.HResult)}", true);
_logger.Write($"{nameof(PlanPhase)}: {nameof(OnPlannedCompatiblePackage)} -------^");
}
catch (PhaseException)
{
throw;
}
catch (Exception ex)
{
_logger.Write(ex);
throw new PhaseException(ex);
}
}
}

View File

@@ -0,0 +1,199 @@
using Bootstrapper.Models;
using Bootstrapper.Models.Util;
using System;
using WixToolset.BootstrapperApplicationApi;
namespace Bootstrapper.Phases;
internal class PlanPhase
{
private readonly Model _model;
public PlanPhase(Model model)
{
_model = model;
}
public event EventHandler<EventArgs> PlanPhaseFailed;
/// <summary>
/// Fired when the engine has begun planning the installation.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <exception cref="PhaseException"></exception>
public virtual void OnPlanBegin(object sender, PlanBeginEventArgs e)
{
try
{
_model.State.PhaseResult = 0;
_model.State.ErrorMessage = string.Empty;
if (e.Cancel)
return;
_model.State.BaStatus = BaStatus.Planning;
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw new PhaseException(ex);
}
}
/// <summary>
/// Fired when the engine has completed planning the installation.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <exception cref="PhaseException"></exception>
public virtual void OnPlanComplete(object sender, PlanCompleteEventArgs e)
{
try
{
_model.State.PhaseResult = e.Status;
if (_model.State.BaStatus == BaStatus.Cancelled || e.Status == ErrorHelper.CancelHResult)
{
_model.State.BaStatus = BaStatus.Cancelled;
_model.Log.Write("User cancelled");
}
else if (ErrorHelper.HResultIsFailure(e.Status))
{
_model.State.BaStatus = BaStatus.Failed;
var msg = $"Plan failed - {ErrorHelper.HResultToMessage(e.Status)}";
if (string.IsNullOrEmpty(_model.State.ErrorMessage))
_model.State.ErrorMessage = msg;
_model.Log.Write(msg);
if (_model.UiFacade.IsUiShown)
PlanPhaseFailed?.Invoke(this, EventArgs.Empty);
else
_model.UiFacade.ShutDown();
}
else
{
_model.Log.Write("Plan succeeded, starting apply phase");
_model.Engine.Apply(_model.UiFacade.ShellWindowHandle);
}
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw new PhaseException(ex);
}
}
/// <summary>
/// Fired when the engine has begun getting the BA's input for planning a package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPlanPackageBegin(object sender, PlanPackageBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed getting the BA's input for planning a package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPlanPackageComplete(object sender, PlanPackageCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine plans a new, compatible package using the same provider key.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPlanCompatibleMsiPackageBegin(object sender, PlanCompatibleMsiPackageBeginEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed planning the installation of a specific package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPlanCompatibleMsiPackageComplete(object sender, PlanCompatibleMsiPackageCompleteEventArgs e)
{ }
/// <summary>
/// Fired when the engine is planning a rollback boundary.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPlanRollbackBoundary(object sender, PlanRollbackBoundaryEventArgs e)
{ }
/// <summary>
/// Fired when the engine has begun planning for a related bundle.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPlanRelatedBundle(object sender, PlanRelatedBundleEventArgs e)
{ }
/// <summary>
/// Fired when the engine has begun planning the related bundle relation type.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPlanRelatedBundleType(object sender, PlanRelatedBundleTypeEventArgs e)
{ }
/// <summary>
/// Fired when the engine has begun planning an upgrade related bundle for restoring in case of failure.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPlanRestoreRelatedBundle(object sender, PlanRestoreRelatedBundleEventArgs e)
{ }
/// <summary>
/// Fired when the engine is about to plan a forward compatible bundle.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPlanForwardCompatibleBundle(object sender, PlanForwardCompatibleBundleEventArgs e)
{ }
/// <summary>
/// Fired when the engine is planning an MSI or MSP package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPlanMsiPackage(object sender, PlanMsiPackageEventArgs e)
{ }
/// <summary>
/// Fired when the engine is about to plan a feature in an MSI package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPlanMsiFeature(object sender, PlanMsiFeatureEventArgs e)
{ }
/// <summary>
/// Fired when the engine is about to plan a target of an MSP package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPlanPatchTarget(object sender, PlanPatchTargetEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed planning a package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPlannedPackage(object sender, PlannedPackageEventArgs e)
{ }
/// <summary>
/// Fired when the engine has completed planning a compatible package.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public virtual void OnPlannedCompatiblePackage(object sender, PlannedCompatiblePackageEventArgs e)
{ }
}

View File

@@ -0,0 +1,194 @@
using Bootstrapper.Models;
using Bootstrapper.Models.State;
using System;
using WixToolset.BootstrapperApplicationApi;
namespace Bootstrapper.Phases;
internal class ProgressHandler
{
private readonly Model _model;
private readonly object _progressLock = new();
private int _progressStages;
private int _cacheProgress;
private int _executeProgress;
public ProgressHandler(Model model)
{
_model = model;
}
public void OnPlanBegin(object sender, PlanBeginEventArgs e)
{
try
{
var action = _model.State.PlannedAction.ToString().ToLower();
ReportProgress($"Planning {action}");
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw;
}
}
public void OnApplyBegin(object sender, ApplyBeginEventArgs e)
{
try
{
lock (_progressLock)
_progressStages = e.PhaseCount;
ReportProgress("Applying changes");
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw;
}
}
public void OnCacheAcquireProgress(object sender, CacheAcquireProgressEventArgs e)
{
try
{
lock (_progressLock)
_cacheProgress = e.OverallPercentage;
ReportProgress("Retrieving", e.PackageOrContainerId);
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw;
}
}
public void OnCachePayloadExtractProgress(object sender, CachePayloadExtractProgressEventArgs e)
{
try
{
lock (_progressLock)
_cacheProgress = e.OverallPercentage;
ReportProgress("Extracting", e.PackageOrContainerId);
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw;
}
}
public void OnCacheVerifyProgress(object sender, CacheVerifyProgressEventArgs e)
{
try
{
lock (_progressLock)
_cacheProgress = e.OverallPercentage;
ReportProgress("Verifying", e.PackageOrContainerId);
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw;
}
}
public void OnCacheContainerOrPayloadVerifyProgress(object sender, CacheContainerOrPayloadVerifyProgressEventArgs e)
{
try
{
lock (_progressLock)
_cacheProgress = e.OverallPercentage;
ReportProgress("Verifying", e.PackageOrContainerId);
}
catch (Exception ex)
{
_model.Log.Write(ex);
}
}
public void OnCacheComplete(object sender, CacheCompleteEventArgs e)
{
try
{
lock (_progressLock)
_cacheProgress = 100;
ReportProgress();
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw;
}
}
public void OnApplyExecuteProgress(object sender, ExecuteProgressEventArgs e)
{
try
{
int overallProgress;
lock (_progressLock)
{
_executeProgress = e.OverallPercentage;
overallProgress = CalculateProgress();
}
ReportProgress(null, e.PackageId);
if (_model.State.Display == Display.Embedded)
_model.Engine.SendEmbeddedProgress(e.ProgressPercentage, overallProgress);
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw;
}
}
public void OnExecutePackageComplete(object sender, ExecutePackageCompleteEventArgs e)
{
try
{
// clear display
ReportProgress(string.Empty, string.Empty);
}
catch (Exception ex)
{
_model.Log.Write(ex);
throw;
}
}
private void ReportProgress(string message = null, string packageId = null)
{
if (_model.UiFacade.ProgressReporter != null)
{
var report = new ProgressReport
{
Message = message,
Progress = CalculateProgress()
};
if (packageId != null)
report.PackageName = _model.State.GetPackageName(packageId);
_model.UiFacade.ProgressReporter.Report(report);
}
}
private int CalculateProgress()
{
lock (_progressLock)
{
if (_progressStages > 0)
return (_cacheProgress + _executeProgress) / _progressStages;
return 0;
}
}
}

View File

@@ -0,0 +1,25 @@
using Bootstrapper.Models.Util;
using System;
using WixToolset.BootstrapperApplicationApi;
namespace Bootstrapper;
internal class Program
{
private static int Main()
{
int exitCode;
try
{
var application = new BootstrapperApp();
ManagedBootstrapperApplication.Run(application);
exitCode = application.ExitCode;
}
catch (Exception ex)
{
exitCode = ErrorHelper.HResultToWin32(ex.HResult);
}
return exitCode;
}
}

View File

@@ -0,0 +1,29 @@
using Bootstrapper.Models;
using Bootstrapper.Models.Util;
using Bootstrapper.ViewModels.Util;
namespace Bootstrapper.ViewModels
{
internal class CancelViewModel : ViewModelBase
{
private readonly Model _model;
public CancelViewModel(Model model)
{
_model = model;
CancelCommand = new DelegateCommand(Cancel, CanCancel);
}
public IDelegateCommand CancelCommand { get; }
private void Cancel()
{
_model.State.CancelRequested = true;
}
private bool CanCancel()
{
return !_model.State.CancelRequested && (_model.State.BaStatus == BaStatus.Planning || _model.State.BaStatus == BaStatus.Applying);
}
}
}

View File

@@ -0,0 +1,41 @@
using Bootstrapper.Models;
using Bootstrapper.Models.Util;
using Bootstrapper.ViewModels.Util;
namespace Bootstrapper.ViewModels
{
internal class ConfigViewModel : ViewModelBase
{
private readonly Model _model;
public ConfigViewModel(Model model)
{
_model = model;
}
/// <summary>
/// An example exposing a bundle variable to the UI.
/// </summary>
public string SampleOption
{
get
{
if (_model.Engine.ContainsVariable("SampleOption"))
return _model.Engine.GetVariableString("SampleOption");
return string.Empty;
}
set
{
_model.Engine.SetVariableString("SampleOption", value, false);
OnPropertyChanged();
}
}
public void AfterDetect()
{
if (_model.State.RelatedBundleStatus != BundleStatus.NotInstalled)
SampleOption = "Installed";
}
}
}

View File

@@ -0,0 +1,74 @@
using Bootstrapper.Models.State;
using Bootstrapper.ViewModels.Util;
using System;
namespace Bootstrapper.ViewModels
{
internal class ProgressViewModel : ViewModelBase
{
private string _message;
private string _package;
private int _progress;
public string Message
{
get => _message;
set
{
if (_message == value)
return;
_message = value;
base.OnPropertyChanged();
}
}
public string Package
{
get => _package;
set
{
if (_package == value)
return;
_package = value;
base.OnPropertyChanged();
if (string.IsNullOrWhiteSpace(_package))
Message = string.Empty;
else
Message = $"Processing: {_package}";
}
}
public int Progress
{
get => _progress;
set
{
if (Math.Abs(_progress - value) < 0.0001)
return;
_progress = value;
base.OnPropertyChanged();
}
}
public void ProcessProgressReport(ProgressReport report)
{
Progress = report.Progress;
if (report.Message != null)
Message = report.Message;
if (report.PackageName != null)
Package = report.PackageName;
}
public void Reset()
{
Message = string.Empty;
Package = string.Empty;
Progress = 0;
}
}
}

View File

@@ -0,0 +1,375 @@
using Bootstrapper.Models;
using Bootstrapper.Models.Util;
using Bootstrapper.ViewModels.Util;
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using WixToolset.BootstrapperApplicationApi;
namespace Bootstrapper.ViewModels;
internal class ShellViewModel : ViewModelBase
{
private readonly Model _model;
private readonly CancelViewModel _cancelVm;
private readonly IDelegateCommand _installCommand;
private readonly IDelegateCommand _updateCommand;
private readonly IDelegateCommand _uninstallCommand;
private bool _isRepairAvailable;
private IDelegateCommand _executeCommand;
private string _executeDescription;
private string _message;
public ShellViewModel(Model model)
{
_model = model;
_cancelVm = new CancelViewModel(model);
_installCommand = new DelegateCommand(Install, CanInstall);
_uninstallCommand = new DelegateCommand(Uninstall, CanUninstall);
_updateCommand = new DelegateCommand(Update, CanUpdate);
RepairCommand = new DelegateCommand(Repair, CanRepair);
ExitCommand = new DelegateCommand(Exit, CanExit);
ShowLogCommand = new DelegateCommand(ShowLog, CanShowLog);
ConfigVm = new ConfigViewModel(model);
ConfigVm.PropertyChanged += ConfigVm_PropertyChanged;
ProgressVm = new ProgressViewModel();
}
public ConfigViewModel ConfigVm { get; }
public ProgressViewModel ProgressVm { get; }
public IDelegateCommand ShowLogCommand { get; }
public IDelegateCommand ExitCommand { get; }
public IDelegateCommand RepairCommand { get; }
public IDelegateCommand CancelCommand => _cancelVm.CancelCommand;
/// <summary>
/// Is installer waiting for user input?
/// </summary>
public bool IsWaiting => _model.State.BaStatus == BaStatus.Waiting;
/// <summary>
/// Is the UI running in passive mode, only displaying a progress bar?
/// </summary>
public bool IsPassive => _model.State.Display == Display.Passive;
/// <summary>
/// The command that will install or uninstall the software
/// </summary>
public IDelegateCommand ExecuteCommand
{
get => _executeCommand;
set
{
if (_executeCommand == value)
return;
_executeCommand = value;
OnPropertyChanged();
}
}
/// <summary>
/// A brief, one-word description of what will happen when the <see cref="ExecuteCommand" /> is run.
/// Should be appropriate for button text.
/// </summary>
public string ExecuteDescription
{
get => _executeDescription;
set
{
if (_executeDescription == value)
return;
_executeDescription = value;
OnPropertyChanged();
}
}
/// <summary>
/// Display the Repair button?
/// </summary>
public bool IsRepairAvailable
{
get => _isRepairAvailable;
set
{
if (_isRepairAvailable == value)
return;
_isRepairAvailable = value;
OnPropertyChanged();
}
}
/// <summary>
/// A message to display to the user.
/// </summary>
public string Message
{
get => _message;
set
{
if (_message == value)
return;
_message = value;
OnPropertyChanged();
}
}
/// <summary>
/// Call after the detect phase completes to refresh the UI.
/// </summary>
/// <param name="followupAction">
/// Indicates which action will be planned when the BA is running silently or in passive mode.
/// Pass <see cref="LaunchAction.Unknown" /> for full UI mode.
/// </param>
public void AfterDetect(LaunchAction followupAction)
{
try
{
OnPropertyChanged(nameof(IsWaiting));
if (_model.State.RelatedBundleStatus == BundleStatus.OlderInstalled || followupAction == LaunchAction.UpdateReplace || followupAction == LaunchAction.UpdateReplaceEmbedded)
{
ExecuteCommand = _updateCommand;
ExecuteDescription = "Update";
}
else if (_model.State.RelatedBundleStatus == BundleStatus.Current || followupAction == LaunchAction.Uninstall || followupAction == LaunchAction.UnsafeUninstall)
{
ExecuteCommand = _uninstallCommand;
ExecuteDescription = "Uninstall";
}
else
{
ExecuteCommand = _installCommand;
ExecuteDescription = "Install";
}
IsRepairAvailable = _model.State.RelatedBundleStatus == BundleStatus.Current;
AssignMessage();
ConfigVm.AfterDetect();
}
catch (Exception ex)
{
_model.Log.Write(ex);
Message = $"Error: {ex.Message}";
_model.UiFacade.ShowMessageBox($"Error: {ex.Message}", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
}
finally
{
CommandManager.InvalidateRequerySuggested();
}
}
/// <summary>
/// Call after the apply phase completes to refresh the UI.
/// </summary>
public void AfterApply()
{
try
{
ProgressVm.Reset();
AssignMessage();
}
catch (Exception ex)
{
_model.Log.Write(ex);
Message = $"Error: {ex.Message}";
_model.UiFacade.ShowMessageBox($"Error: {ex.Message}", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
}
finally
{
CommandManager.InvalidateRequerySuggested();
}
}
private void Install()
{
_model.PlanAndApply(LaunchAction.Install);
OnPropertyChanged(nameof(IsWaiting));
CommandManager.InvalidateRequerySuggested();
}
private bool CanInstall()
{
return _model.State.RelatedBundleStatus == BundleStatus.NotInstalled && CanPlanAndApply();
}
private void Update()
{
// Any older bundles that were discovered have already been scheduled for uninstall, so an "upgrade" will be a fresh installation.
_model.PlanAndApply(LaunchAction.Install);
OnPropertyChanged(nameof(IsWaiting));
CommandManager.InvalidateRequerySuggested();
}
private bool CanUpdate()
{
return _model.State.RelatedBundleStatus == BundleStatus.OlderInstalled && CanPlanAndApply();
}
private void Uninstall()
{
_model.PlanAndApply(LaunchAction.Uninstall);
OnPropertyChanged(nameof(IsWaiting));
CommandManager.InvalidateRequerySuggested();
}
private bool CanUninstall()
{
return _model.State.RelatedBundleStatus == BundleStatus.Current && CanPlanAndApply();
}
private void Repair()
{
_model.PlanAndApply(LaunchAction.Repair);
OnPropertyChanged(nameof(IsWaiting));
CommandManager.InvalidateRequerySuggested();
}
private bool CanRepair()
{
return _model.State.RelatedBundleStatus == BundleStatus.Current && CanPlanAndApply();
}
private void Exit()
{
_model.UiFacade.ShutDown();
}
private bool CanExit()
{
return _model.State.BaStatus == BaStatus.Failed || _model.State.BaStatus == BaStatus.Cancelled || _model.State.BaStatus == BaStatus.Applied || _model.State.BaStatus == BaStatus.Waiting;
;
}
private void ShowLog()
{
_model.ShowLog();
}
private bool CanShowLog()
{
return _model.State.BaStatus == BaStatus.Failed || _model.State.BaStatus == BaStatus.Cancelled || _model.State.BaStatus == BaStatus.Applied || _model.State.BaStatus == BaStatus.Waiting;
;
}
private void ConfigVm_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
RepairCommand.RaiseCanExecuteChanged();
ExecuteCommand?.RaiseCanExecuteChanged();
}
private bool CanPlanAndApply()
{
// Ensure ConfigVm is not displaying any data validation errors.
return _model.State.BaStatus == BaStatus.Waiting && string.IsNullOrEmpty(ConfigVm.Error);
}
/// <summary>
/// Will assign a value to <see cref="Message" /> based on the current state.
/// This should be called after Detect, and again after Apply.
/// </summary>
/// <exception cref="ArgumentOutOfRangeException"></exception>
private void AssignMessage()
{
switch (_model.State.BaStatus)
{
case BaStatus.Cancelled:
Message = "User cancelled";
break;
case BaStatus.Failed:
if (!string.IsNullOrWhiteSpace(_model.State.ErrorMessage))
Message = $"Failed: {_model.State.ErrorMessage}";
else if (_model.State.CancelRequested)
Message = "User cancelled";
else
Message = "An error occurred. See log for details.";
break;
case BaStatus.Planning:
case BaStatus.Applying:
case BaStatus.Waiting:
// BA will be in one of these states after successfully completing the detect phase.
if (string.IsNullOrEmpty(_model.State.RelatedBundleVersion))
Message = $"Installing v{_model.State.BundleVersion}";
else
{
switch (_model.State.RelatedBundleStatus)
{
case BundleStatus.Unknown:
case BundleStatus.NotInstalled:
Message = $"Installing v{_model.State.BundleVersion}";
break;
case BundleStatus.OlderInstalled:
Message = $"Updating v{_model.State.RelatedBundleVersion} to {_model.State.BundleVersion}";
break;
case BundleStatus.Current:
Message = $"v{_model.State.BundleVersion} is currently installed";
break;
case BundleStatus.NewerInstalled:
Message = $"There is already a newer version (v{_model.State.RelatedBundleVersion}) installed on this machine.";
break;
default:
throw new ArgumentOutOfRangeException(nameof(_model.State.RelatedBundleStatus));
}
}
break;
case BaStatus.Applied:
switch (_model.State.PlannedAction)
{
case LaunchAction.Layout:
Message = $"v{_model.State.BundleVersion} successfully laid out";
break;
case LaunchAction.UnsafeUninstall:
case LaunchAction.Uninstall:
Message = $"v{_model.State.BundleVersion} successfully removed";
break;
case LaunchAction.Modify:
Message = $"v{_model.State.BundleVersion} successfully modified";
break;
case LaunchAction.Repair:
Message = $"v{_model.State.BundleVersion} successfully repaired";
break;
case LaunchAction.UpdateReplace:
case LaunchAction.UpdateReplaceEmbedded:
Message = $"v{_model.State.RelatedBundleVersion} successfully updated to {_model.State.BundleVersion}";
break;
case LaunchAction.Unknown:
case LaunchAction.Help:
case LaunchAction.Cache:
case LaunchAction.Install:
default:
Message = $"v{_model.State.BundleVersion} successfully installed";
break;
}
break;
case BaStatus.Initializing:
case BaStatus.Detecting:
// No reason to display a message
break;
default:
throw new ArgumentOutOfRangeException(nameof(_model.State.BaStatus));
}
}
}

View File

@@ -0,0 +1,69 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Markup;
namespace Bootstrapper.ViewModels.Util
{
/// <summary>
/// Converts a <see cref="bool" /> to a <see cref="Visibility" />. If the <see cref="Negate" /> property
/// is <see langword="false" />, then <see langword="true" /> converts to <see cref="Visibility.Visible" />
/// while <see langword="false" /> converts to <see cref="Visibility.Collapsed" />. If <see cref="Negate" />
/// is <see langword="true" />, then the negated bound value is used for the conversion.
/// </summary>
[ValueConversion(typeof(bool), typeof(Visibility))]
public class BooleanVisibilityConverter : MarkupExtension, IValueConverter
{
/// <summary>
/// If <see langword="true" />, will use the negated value of the bound property to perform the conversion. So,
/// <see langword="true" /> will convert to <see cref="Visibility.Collapsed" /> while <see langword="false" />
/// will convert to <see cref="Visibility.Visible" />.
/// </summary>
public bool Negate { get; set; }
/// <inheritdoc />
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (targetType != typeof(Visibility) && targetType != typeof(Visibility?))
return Visibility.Collapsed;
var b = value as bool?;
if (b == null)
return Visibility.Collapsed;
if (Negate)
{
if (b.Value)
return Visibility.Collapsed;
return Visibility.Visible;
}
if (b.Value)
return Visibility.Visible;
return Visibility.Collapsed;
}
/// <inheritdoc />
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((targetType == typeof(bool) || targetType == typeof(bool?)) && value is Visibility vis)
{
if (Negate)
return vis != Visibility.Visible;
return vis == Visibility.Visible;
}
return false;
}
/// <inheritdoc />
public override object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}
}
}

View File

@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Windows.Input;
namespace Bootstrapper.ViewModels.Util
{
/// <summary>
/// This class contains methods for the CommandManager that help avoid memory leaks by
/// using weak references.
/// </summary>
internal static class CommandManagerHelper
{
internal static void CallWeakReferenceHandlers(List<WeakReference> handlers)
{
if (handlers == null)
return;
// Take a snapshot of the handlers before we call out to them since the handlers
// could cause the array to me modified while we are reading it.
var callees = new EventHandler[handlers.Count];
var count = 0;
for (var i = handlers.Count - 1; i >= 0; i--)
{
var reference = handlers[i];
if (!(reference.Target is EventHandler handler))
{
// Clean up old handlers that have been collected
handlers.RemoveAt(i);
}
else
{
callees[count] = handler;
count++;
}
}
// Call the handlers that we snapshot
for (var i = 0; i < count; i++)
{
var handler = callees[i];
handler(null, EventArgs.Empty);
}
}
internal static void AddHandlersToRequerySuggested(IEnumerable<WeakReference> handlers)
{
if (handlers == null)
return;
foreach (var handlerRef in handlers)
{
if (handlerRef.Target is EventHandler handler)
CommandManager.RequerySuggested += handler;
}
}
internal static void RemoveHandlersFromRequerySuggested(IEnumerable<WeakReference> handlers)
{
if (handlers == null)
return;
foreach (var handlerRef in handlers)
{
if (handlerRef.Target is EventHandler handler)
CommandManager.RequerySuggested -= handler;
}
}
internal static void AddWeakReferenceHandler(ref List<WeakReference> handlers, EventHandler handler, int defaultListSize)
{
if (handlers == null)
{
if (defaultListSize > 0)
handlers = new List<WeakReference>(defaultListSize);
else
handlers = new List<WeakReference>();
}
handlers.Add(new WeakReference(handler));
}
internal static void RemoveWeakReferenceHandler(List<WeakReference> handlers, EventHandler handler)
{
if (handlers == null)
return;
for (var i = handlers.Count - 1; i >= 0; i--)
{
var reference = handlers[i];
if (!(reference.Target is EventHandler existingHandler) || existingHandler == handler)
{
// Clean up old handlers that have been collected
// in addition to the handler that is to be removed.
handlers.RemoveAt(i);
}
}
}
}
}

View File

@@ -0,0 +1,280 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq.Expressions;
using System.Windows.Input;
namespace Bootstrapper.ViewModels.Util
{
/// <summary>
/// An implementation of <see cref="IDelegateCommand" /> which allows delegating the commanding
/// logic to methods passed as parameters, and enables a View to bind commands to objects that
/// are not part of the element tree.
/// </summary>
public sealed class DelegateCommand : BaseCommand, IDelegateCommand
{
private readonly Action _executeMethod;
private readonly Func<bool> _canExecuteMethod;
/// <summary>
/// Initializes a DelegateCommand with methods for execution, verification, and allows specifying
/// if the CommandManager's automatic re-query is disabled for this command.
/// </summary>
/// <param name="executeMethod">
/// Method which is called when the command is executed.
/// </param>
/// <param name="canExecuteMethod">
/// Method which is called to determine if the Execute method may be run.
/// </param>
/// <param name="isAutomaticRequeryDisabled">
/// If true then the framework will not automatically query <see cref="ICommand.CanExecute" />.
/// Queries can be triggered manually by calling <see cref="BaseCommand.RaiseCanExecuteChanged" />.
/// </param>
public DelegateCommand(Action executeMethod, Func<bool> canExecuteMethod = null, bool isAutomaticRequeryDisabled = false)
: base(isAutomaticRequeryDisabled)
{
_executeMethod = executeMethod ?? throw new ArgumentNullException(nameof(executeMethod));
_canExecuteMethod = canExecuteMethod;
}
/// <summary>
/// Method to determine if the command can be executed.
/// </summary>
[DebuggerStepThrough]
public bool CanExecute()
{
return _canExecuteMethod == null || _canExecuteMethod();
}
/// <summary>
/// Executes the command.
/// </summary>
public void Execute()
{
_executeMethod();
}
[DebuggerStepThrough]
bool ICommand.CanExecute(object obj)
{
return CanExecute();
}
void ICommand.Execute(object obj)
{
Execute();
}
public DelegateCommand ListenOn<TObservedType, TPropertyType>(TObservedType viewModel, Expression<Func<TObservedType, TPropertyType>> propertyExpression) where TObservedType : INotifyPropertyChanged
{
AddListenOn(viewModel, nameof(propertyExpression));
return this;
}
public DelegateCommand ListenOn<TObservedType>(TObservedType viewModel, string propertyName) where TObservedType : INotifyPropertyChanged
{
AddListenOn(viewModel, propertyName);
return this;
}
}
/// <summary>
/// A strongly typed implementation of <see cref="IDelegateCommand{T}" /> which allows delegating the commanding
/// logic to methods passed as parameters, and enables a View to bind commands to objects that
/// are not part of the element tree.
/// </summary>
/// <typeparam name="T">Type of the parameter passed to the delegates</typeparam>
public sealed class DelegateCommand<T> : BaseCommand, IDelegateCommand<T>
{
private readonly Action<T> _executeMethod;
private readonly Func<T, bool> _canExecuteMethod;
/// <summary>
/// Initializes a DelegateCommand with methods for execution, verification, and allows specifying
/// if the CommandManager's automatic re-query is disabled for this command.
/// </summary>
/// <param name="executeMethod">
/// Method which is called when the command is executed.
/// </param>
/// <param name="canExecuteMethod">
/// Method which is called to determine if the Execute method may be run.
/// </param>
/// <param name="isAutomaticRequeryDisabled">
/// If true then the framework will not automatically query <see cref="ICommand.CanExecute" />.
/// Queries can be triggered manually by calling <see cref="BaseCommand.RaiseCanExecuteChanged" />.
/// </param>
/// <typeparamref name="T">
/// The type of the data passed to the <see cref="Execute" /> and <see cref="CanExecute" /> methods.
/// </typeparamref>
public DelegateCommand(Action<T> executeMethod, Func<T, bool> canExecuteMethod = null, bool isAutomaticRequeryDisabled = false)
: base(isAutomaticRequeryDisabled)
{
_executeMethod = executeMethod ?? throw new ArgumentNullException(nameof(executeMethod));
_canExecuteMethod = canExecuteMethod;
}
/// <summary>
/// Method to determine if the command can be executed.
/// </summary>
/// <typeparamref name="T">
/// Type of the data passed.
/// </typeparamref>
[DebuggerStepThrough]
public bool CanExecute(T parameter)
{
return _canExecuteMethod == null || _canExecuteMethod(parameter);
}
/// <summary>
/// Execution of the command.
/// </summary>
/// <typeparamref name="T">
/// Type of the data passed.
/// </typeparamref>
public void Execute(T parameter)
{
_executeMethod(parameter);
}
/// <summary>
/// Defines the method that determines whether the command can execute in its current state.
/// </summary>
/// <returns>
/// true if this command can be executed; otherwise, false.
/// </returns>
/// <param name="parameter">
/// Data used by the command. If the command does not require data to be passed, this object can
/// be set to null.
/// </param>
[DebuggerStepThrough]
bool ICommand.CanExecute(object parameter)
{
// if T is of value type and the parameter is not
// set yet, then return false if CanExecute delegate
// exists, else return true
if (parameter == null && typeof(T).IsValueType)
return _canExecuteMethod == null;
return CanExecute((T)parameter);
}
/// <summary>
/// Defines the method to be called when the command is invoked.
/// </summary>
/// <param name="parameter">
/// Data used by the command. If the command does not require data to be passed, this object can
/// be set to null.
/// </param>
void ICommand.Execute(object parameter)
{
Execute((T)parameter);
}
public DelegateCommand<T> ListenOn<TObservedType, TPropertyType>(TObservedType viewModel, Expression<Func<TObservedType, TPropertyType>> propertyExpression) where TObservedType : INotifyPropertyChanged
{
AddListenOn(viewModel, nameof(propertyExpression));
return this;
}
public DelegateCommand<T> ListenOn<TObservedType>(TObservedType viewModel, string propertyName) where TObservedType : INotifyPropertyChanged
{
AddListenOn(viewModel, propertyName);
return this;
}
}
public abstract class BaseCommand
{
private bool _isAutomaticRequeryDisabled;
private List<WeakReference> _canExecuteChangedHandlers;
/// <summary>
/// Initializes a DelegateCommand with methods for execution, verification, and allows specifying
/// if the CommandManager's automatic re-query is disabled for this command.
/// </summary>
/// <param name="isAutomaticRequeryDisabled">
/// If true then the framework will not automatically query <see cref="ICommand.CanExecute" />.
/// Queries can be triggered manually by calling <see cref="RaiseCanExecuteChanged" />.
/// </param>
protected BaseCommand(bool isAutomaticRequeryDisabled = false)
{
_isAutomaticRequeryDisabled = isAutomaticRequeryDisabled;
}
/// <summary>
/// Occurs when changes occur that affect whether the command should execute.
/// </summary>
public event EventHandler CanExecuteChanged
{
add
{
if (!_isAutomaticRequeryDisabled)
CommandManager.RequerySuggested += value;
CommandManagerHelper.AddWeakReferenceHandler(ref _canExecuteChangedHandlers, value, 2);
}
remove
{
if (!_isAutomaticRequeryDisabled)
CommandManager.RequerySuggested -= value;
CommandManagerHelper.RemoveWeakReferenceHandler(_canExecuteChangedHandlers, value);
}
}
/// <summary>
/// If true then the framework will not automatically query <see cref="ICommand.CanExecute" />.
/// Queries can be triggered manually by calling <see cref="RaiseCanExecuteChanged" />.
/// </summary>
public bool IsAutomaticRequeryDisabled
{
get => _isAutomaticRequeryDisabled;
set
{
if (_isAutomaticRequeryDisabled == value)
return;
if (value)
CommandManagerHelper.RemoveHandlersFromRequerySuggested(_canExecuteChangedHandlers);
else
CommandManagerHelper.AddHandlersToRequerySuggested(_canExecuteChangedHandlers);
_isAutomaticRequeryDisabled = value;
}
}
/// <summary>
/// Raises the <see cref="ICommand.CanExecuteChanged" /> event.
/// </summary>
public void RaiseCanExecuteChanged()
{
CommandManagerHelper.CallWeakReferenceHandlers(_canExecuteChangedHandlers);
}
public void ListenForNotificationFrom<TObservedType>(TObservedType viewModel) where TObservedType : INotifyPropertyChanged
{
viewModel.PropertyChanged += OnObservedPropertyChanged;
}
protected void AddListenOn<TObservedType, TPropertyType>(TObservedType viewModel, Expression<Func<TObservedType, TPropertyType>> propertyExpression) where TObservedType : INotifyPropertyChanged
{
AddListenOn(viewModel, nameof(propertyExpression));
}
protected void AddListenOn<TObservedType>(TObservedType viewModel, string propertyName) where TObservedType : INotifyPropertyChanged
{
viewModel.PropertyChanged += (sender, e) =>
{
if (e.PropertyName == propertyName)
RaiseCanExecuteChanged();
};
}
private void OnObservedPropertyChanged(object sender, PropertyChangedEventArgs e)
{
RaiseCanExecuteChanged();
}
}
}

View File

@@ -0,0 +1,73 @@
using System.Windows.Input;
namespace Bootstrapper.ViewModels.Util
{
/// <summary>
/// An <see cref="ICommand" /> which does not require data passed to the Execute and CanExecute methods.
/// </summary>
public interface IDelegateCommand : ICommand
{
/// <summary>
/// If true then the framework will not automatically query <see cref="ICommand.CanExecute" />.
/// Queries can be triggered manually by calling <see cref="RaiseCanExecuteChanged" />.
/// </summary>
bool IsAutomaticRequeryDisabled { get; set; }
/// <summary>
/// Method to determine if the command can be executed.
/// </summary>
bool CanExecute();
/// <summary>
/// Execution of the command.
/// </summary>
void Execute();
/// <summary>
/// Raises the <see cref="ICommand.CanExecuteChanged" /> event.
/// </summary>
void RaiseCanExecuteChanged();
}
/// <summary>
/// A strongly typed <see cref="ICommand" />.
/// </summary>
/// <typeparamref name="T">
/// Type of data passed to the <see cref="ICommand.Execute" /> and <see cref="ICommand.CanExecute" /> methods.
/// </typeparamref>
public interface IDelegateCommand<T> : ICommand
{
/// <summary>
/// If true then the framework will not automatically query <see cref="ICommand.CanExecute" />.
/// Queries can be triggered manually by calling <see cref="RaiseCanExecuteChanged" />.
/// </summary>
bool IsAutomaticRequeryDisabled { get; set; }
/// <summary>
/// Method to determine if the command can be executed.
/// </summary>
/// <param name="parameter">
/// Data to help determine if the command can execute.
/// </param>
/// <typeparamref name="T">
/// Type of the data passed.
/// </typeparamref>
bool CanExecute(T parameter);
/// <summary>
/// Execution of the command.
/// </summary>
/// <param name="parameter">
/// Data required to execute the command.
/// </param>
/// <typeparamref name="T">
/// Type of the data passed.
/// </typeparamref>
void Execute(T parameter);
/// <summary>
/// Raises the <see cref="ICommand.CanExecuteChanged" /> event.
/// </summary>
void RaiseCanExecuteChanged();
}
}

View File

@@ -0,0 +1,28 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace Bootstrapper.ViewModels.Util
{
/// <summary>
/// A <see cref="INotifyPropertyChanged" /> implementation that provides strongly typed OnPropertyChanged
/// implementations.
/// </summary>
public abstract class PropertyChanger : INotifyPropertyChanged
{
/// <summary>
/// Occurs when a property value changes.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Triggers the <see cref="PropertyChanged" /> event when passed the name of a property.
/// </summary>
/// <param name="propertyName">
/// Name of the property whose value changed.
/// </param>
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

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