Merge remote-tracking branch 'origin/main' into dev/snickler/net8-upgrade

This commit is contained in:
Jeremy Sinclair 2023-10-10 12:48:18 -04:00
commit 09f15f3c4a
105 changed files with 9639 additions and 989 deletions

View File

@ -7,6 +7,12 @@
"commands": [
"dotnet-consolidate"
]
}
},
"xamlstyler.console": {
"version": "3.2206.4",
"commands": [
"xstyler"
]
}
}
}
}

View File

@ -1,8 +1,11 @@
cloudai
bkmeneguello
FWest
gdnbaselines
github
https
obairka
sdl
ssh
ubuntu
unuing

View File

@ -1079,7 +1079,7 @@ mic
microsoft
MIDDLEDOWN
MIDDLEUP
Midl
midl
mii
MIIM
millis
@ -1369,7 +1369,6 @@ pef
PElems
Pels
PERCEIVEDFLAG
Percision
perfmon
pesi
petabyte
@ -1430,6 +1429,7 @@ ppsi
ppsid
ppsrm
ppsrree
ppstm
ppsz
pptal
ppv
@ -1472,6 +1472,8 @@ psfi
Psr
psrm
psrree
pstatstg
pstm
pstr
pstream
pstrm
@ -1677,7 +1679,6 @@ Sekan
SENDCHANGE
sendinput
sendvirtualinput
Seperate
Seraphima
serverside
SETCONTEXT
@ -1782,7 +1783,6 @@ spam
spdisp
spdlog
spdo
spec'ing
spesi
splitwstring
spsi
@ -1826,6 +1826,7 @@ STDMETHODCALLTYPE
STDMETHODIMP
stefan
Stereolithography
STGC
STGM
STGMEDIUM
sticpl
@ -1836,7 +1837,6 @@ stringtable
stringval
Strm
Strmiids
Stroe
Strret
strsafe
strutil
@ -2083,6 +2083,7 @@ vscdb
vsconfig
VSCROLL
vsetq
VSM
vsonline
vstemplate
VSTHRD
@ -2191,6 +2192,7 @@ wnd
WNDCLASS
WNDCLASSEX
WNDCLASSEXW
WNDCLASSW
WNDPROC
wordpad
workaround
@ -2229,6 +2231,8 @@ Wubi
WVC
Wwan
Wwanpp
xamlstyler
Xavalon
XAxis
xbf
Xbox
@ -2249,6 +2253,7 @@ XPels
XPixel
XResource
xsi
xstyler
XStr
XUP
XVIRTUALSCREEN

View File

@ -0,0 +1,128 @@
<#
.SYNOPSIS
Modify XAML files to adhere to XAML Styler settings.
.DESCRIPTION
The Apply XAML Stying Script can be used to check or modify XAML files with the repo's XAML Styler settings.
Learn more about XAML Styler at https://github.com/Xavalon/XamlStyler
By default, uses git status to check all new or modified files.
Use "PS> Help .\applyXamlStyling.ps1 -Full" for more details on parameters.
.PARAMETER LastCommit
Runs against last commit vs. current changes
.PARAMETER Unstaged
Runs against unstaged changed files
.PARAMETER Staged
Runs against staged files vs. current changes
.PARAMETER Main
Runs against main vs. current branch
.PARAMETER Passive
Runs a passive check against all files in the repo for the CI
.EXAMPLE
PS> .\applyXamlStyling.ps1 -Main
#>
param(
[switch]$LastCommit = $false,
[switch]$Unstaged = $false,
[switch]$Staged = $false,
[switch]$Main = $false,
[switch]$Passive = $false
)
Write-Output "Use 'Help .\applyXamlStyling.ps1' for more info or '-Main' to run against all files."
Write-Output ""
Write-Output "Restoring dotnet tools..."
dotnet tool restore
if (-not $Passive)
{
# Look for unstaged changed files by default
$gitDiffCommand = "git status -s --porcelain"
if ($Main)
{
Write-Output 'Checking Current Branch against `main` Files Only'
$branch = git status | Select-String -Pattern "On branch (?<branch>.*)$"
if ($null -eq $branch.Matches)
{
$branch = git status | Select-String -Pattern "HEAD detached at (?<branch>.*)$"
if ($null -eq $branch.Matches)
{
Write-Error 'Don''t know how to fetch branch from `git status`:'
git status | Write-Error
exit 1
}
}
$branch = $branch.Matches.groups[1].Value
$gitDiffCommand = "git diff origin/main $branch --name-only --diff-filter=ACM"
}
elseif ($Unstaged)
{
# Look for unstaged files
Write-Output "Checking Unstaged Files"
$gitDiffCommand = "git diff --name-only --diff-filter=ACM"
}
elseif ($Staged)
{
# Look for staged files
Write-Output "Checking Staged Files Only"
$gitDiffCommand = "git diff --cached --name-only --diff-filter=ACM"
}
elseif ($LastCommit)
{
# Look at last commit files
Write-Output "Checking the Last Commit's Files Only"
$gitDiffCommand = "git diff HEAD^ HEAD --name-only --diff-filter=ACM"
}
else
{
Write-Output "Checking Git Status Files Only"
}
Write-Output "Running Git Diff: $gitDiffCommand"
$files = Invoke-Expression $gitDiffCommand | Select-String -Pattern "\.xaml$"
if (-not $Passive -and -not $Main -and -not $Unstaged -and -not $Staged -and -not $LastCommit)
{
# Remove 'status' column of 3 characters at beginning of lines
$files = $files | ForEach-Object { $_.ToString().Substring(3) }
}
if ($files.count -gt 0)
{
dotnet tool run xstyler -c "$PSScriptRoot\..\Settings.XamlStyler" -f $files
}
else
{
Write-Output "No XAML Files found to style..."
}
}
else
{
Write-Output "Checking all files (passively)"
$files = Get-ChildItem -Path "$PSScriptRoot\..\src\*.xaml" -Recurse | Select-Object -ExpandProperty FullName | Where-Object { $_ -notmatch "(\\obj\\)|(\\bin\\)|(\\x64\\)|(\\launcher\\PowerLauncher\\)|(\\launcher\\Wox.Plugin\\)|(\\colorPicker\\ColorPickerUI\\)|(\\editor\\FancyZonesEditor\\)|(\\settings-ui\\Settings.UI\\)" }
if ($files.count -gt 0)
{
dotnet tool run xstyler -p -c "$PSScriptRoot\..\Settings.XamlStyler" -f $files
if ($lastExitCode -eq 1)
{
Write-Error 'XAML Styling is incorrect, please run `.\.pipelines\applyXamlStyling.ps1 -Main` locally.'
}
# Return XAML Styler Status
exit $lastExitCode
}
else
{
exit 0
}
}

View File

@ -8,7 +8,14 @@ steps:
clean: true
- task: PowerShell@2
displayName: Verifying Nuget package versions for PowerToys.sln
displayName: Verify XAML formatting
inputs:
filePath: '$(build.sourcesdirectory)\.pipelines\applyXamlStyling.ps1'
arguments: -Passive
pwsh: true
- task: PowerShell@2
displayName: Verify Nuget package versions for PowerToys.sln
inputs:
filePath: '$(build.sourcesdirectory)\.pipelines\verifyNugetPackages.ps1'
arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln'
@ -241,7 +248,7 @@ steps:
dotnet list $(build.sourcesdirectory)\src\common\Common.UI\Common.UI.csproj package
- task: PowerShell@2
displayName: Verifying Notice.md and Nuget packages match
displayName: Verify Notice.md and Nuget packages match
inputs:
filePath: '$(build.sourcesdirectory)\.pipelines\verifyNoticeMdAgainstNugetPackages.ps1'
arguments: -path '$(build.sourcesdirectory)\'

View File

@ -24,7 +24,7 @@ steps:
clean: true
maximumCpuCount: true
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
displayName: Sign PowerToysSetupCustomActions DLL
inputs:
ConnectedServiceName: "Terminal/Console/WinAppDriver Team Code Signing Connection"
@ -74,7 +74,7 @@ steps:
scriptName: .pipelines/versionAndSignCheck.ps1
arguments: -targetDir '$(build.sourcesdirectory)\extractedMsi\Binary'
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
displayName: Sign MSI
inputs:
ConnectedServiceName: "Terminal/Console/WinAppDriver Team Code Signing Connection"
@ -101,7 +101,7 @@ steps:
inputs:
script: '"C:\Program Files (x86)\WiX Toolset v3.14\bin\insignia.exe" -ib installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-${{ parameters.versionNumber }}-$(BuildPlatform).exe -o installer\engine.exe'
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
displayName: "ESRP CodeSigning (Engine)"
inputs:
ConnectedServiceName: "Terminal/Console/WinAppDriver Team Code Signing Connection"
@ -137,7 +137,7 @@ steps:
inputs:
script: '"C:\Program Files (x86)\WiX Toolset v3.14\bin\insignia.exe" -ab installer\engine.exe installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-${{ parameters.versionNumber }}-$(BuildPlatform).exe -o installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-${{ parameters.versionNumber }}-$(BuildPlatform).exe'
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
displayName: Sign Bootstrapper
inputs:
ConnectedServiceName: "Terminal/Console/WinAppDriver Team Code Signing Connection"

View File

@ -1,10 +1,14 @@
# This build should never run as CI or against a pull request.
name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr)
trigger: none
pr: none
pool:
name: SHINE-INT-L
demands: ImageOverride -equals SHINE-VS17-Preview
resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
parameters:
- name: buildConfigurations
@ -20,430 +24,424 @@ parameters:
type: string
default: '0.0.1'
variables:
IsPipeline: 1 # The installer uses this to detect whether it should pick up localizations
SkipCppCodeAnalysis: 1 # Skip the code analysis to speed up release CI. It runs on PR CI, anyway
IsExperimentationLive: 1 # The build and installer use this to turn on experimentation
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
customBuildTags:
- 1ES.PT.ViaStartRight
pool:
name: SHINE-INT-S
image: SHINE-VS17-Latest
os: windows
name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr)
resources:
repositories:
- repository: self
type: git
ref: main
jobs:
- job: Build
strategy:
matrix:
${{ each config in parameters.buildConfigurations }}:
${{ each platform in parameters.buildPlatforms }}:
${{ config }}_${{ platform }}:
BuildConfiguration: ${{ config }}
BuildPlatform: ${{ platform }}
NUGET_RESTORE_MSBUILD_ARGS: /p:Platform=${{ platform }} # Required for nuget to work due to self contained
NODE_OPTIONS: --max_old_space_size=16384
displayName: Build
timeoutInMinutes: 120 # Some of the loc stuff adds quite a bit of time.
cancelTimeoutInMinutes: 1
steps:
- checkout: self
clean: true
submodules: true
persistCredentials: True
stages:
- stage: build
displayName: Build (Complete)
pool:
name: SHINE-INT-L
image: SHINE-VS17-Latest
os: windows
jobs:
- job: Build
strategy:
matrix:
${{ each config in parameters.buildConfigurations }}:
${{ each platform in parameters.buildPlatforms }}:
${{ config }}_${{ platform }}:
BuildConfiguration: ${{ config }}
BuildPlatform: ${{ platform }}
templateContext:
outputs:
- output: pipelineArtifact
artifactName: setup-$(BuildPlatform)
targetPath: $(Build.ArtifactStagingDirectory)
sdl:
baseline:
baselineFile: $(Build.SourcesDirectory)\.pipelines\sdl.gdnbaselines
displayName: Build
timeoutInMinutes: 240 # Some of the 1ES Pipeline stuff and Loc take a very long time
cancelTimeoutInMinutes: 1
variables:
NUGET_RESTORE_MSBUILD_ARGS: /p:Platform=$(BuildPlatform) # Required for nuget to work due to self contained
NODE_OPTIONS: --max_old_space_size=16384
IsPipeline: 1 # The installer uses this to detect whether it should pick up localizations
SkipCppCodeAnalysis: 1 # Skip the code analysis to speed up release CI. It runs on PR CI, anyway
IsExperimentationLive: 1 # The build and installer use this to turn on experimentation
steps:
- checkout: self
clean: true
submodules: true
persistCredentials: True
# Sets versions for all PowerToy created DLLs
- task: PowerShell@1
displayName: Set Versions.Prop
inputs:
scriptName: .pipelines/versionSetting.ps1
arguments: -versionNumber '${{ parameters.versionNumber }}' -DevEnvironment ''
# Sets versions for all PowerToy created DLLs
- task: PowerShell@1
displayName: Set Versions.Prop
inputs:
scriptName: .pipelines/versionSetting.ps1
arguments: -versionNumber '${{ parameters.versionNumber }}' -DevEnvironment ''
# Guardian tool needs 'Microsoft.NETCore.App', version '2.1.0' (x64)
- task: UseDotNet@2
displayName: 'Use .NET Core 2.1 SDK'
inputs:
packageType: sdk
version: '2.1.x'
# ESRP needs 'Microsoft.NETCore.App', version '6.0.0' (x64)
- task: UseDotNet@2
displayName: 'Use .NET 6 SDK'
inputs:
packageType: sdk
version: '6.x'
- task: UseDotNet@2
displayName: 'Use .NET 8 SDK'
inputs:
packageType: sdk
version: '8.x'
includePreviewVersions: true
- task: UseDotNet@2
displayName: 'Use .NET 8 SDK'
inputs:
packageType: sdk
version: '8.x'
includePreviewVersions: true
- task: NuGetAuthenticate@1
- task: NuGetToolInstaller@1
displayName: Use NuGet Installer latest
- task: NuGetAuthenticate@1
- task: NuGetToolInstaller@1
displayName: Use NuGet Installer latest
# this will restore the following nugets:
# - main solution
# - Bug report tool
# - Webcam report tool
# - Installer
# - Bootstrapper Installer
- task: PowerShell@2
displayName: Download and install WiX 3.14 development build
inputs:
targetType: filePath
filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1'
# this will restore the following nugets:
# - main solution
# - Bug report tool
# - Webcam report tool
# - Installer
# - Bootstrapper Installer
- task: PowerShell@2
displayName: Download and install WiX 3.14 development build
inputs:
targetType: filePath
filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1'
- task: MicrosoftTDBuild.tdbuild-task.tdbuild-task.TouchdownBuildTask@1
displayName: 'Download Localization Files -- PowerToys 37400'
inputs:
teamId: 37400
authId: '$(TouchdownApplicationID)'
authKey: '$(TouchdownApplicationKey)'
resourceFilePath: |
**\Resources.resx
**\Resource.resx
**\Resources.resw
appendRelativeDir: true
localizationTarget: false
# pseudoSetting: Included
- task: MicrosoftTDBuild.tdbuild-task.tdbuild-task.TouchdownBuildTask@1
displayName: 'Download Localization Files -- PowerToys 37400'
inputs:
teamId: 37400
authId: '$(TouchdownApplicationID)'
authKey: '$(TouchdownApplicationKey)'
resourceFilePath: |
**\Resources.resx
**\Resource.resx
**\Resources.resw
appendRelativeDir: true
localizationTarget: false
# pseudoSetting: Included
- task: PowerShell@2
displayName: Move Loc files into correct locations
inputs:
targetType: inline
script: >-
$VerbosePreference = "Continue"
- task: PowerShell@2
displayName: Move Loc files into correct locations
inputs:
targetType: inline
script: >-
$VerbosePreference = "Continue"
./tools/build/move-and-rename-resx.ps1
./tools/build/move-and-rename-resx.ps1
./tools/build/move-uwp-resw.ps1
pwsh: true
- task: CmdLine@2
displayName: Moving telem files
inputs:
script: |
call nuget.exe restore -configFile .pipelines/release-nuget.config -PackagesDirectory . .pipelines/packages.config || exit /b 1
move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TraceLoggingDefines.h" "src\common\Telemetry\TraceLoggingDefines.h" || exit /b 1
move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TelemetryBase.cs" "src\common\Telemetry\TelemetryBase.cs" || exit /b 1
./tools/build/move-uwp-resw.ps1
pwsh: true
- task: CmdLine@2
displayName: Moving telem files
inputs:
script: |
call nuget.exe restore -configFile .pipelines/release-nuget.config -PackagesDirectory . .pipelines/packages.config || exit /b 1
move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TraceLoggingDefines.h" "src\common\Telemetry\TraceLoggingDefines.h" || exit /b 1
move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TelemetryBase.cs" "src\common\Telemetry\TelemetryBase.cs" || exit /b 1
## ALL BUT INSTALLER BUILDING
- task: VSBuild@1
displayName: Build PowerToys main project
inputs:
solution: '**\PowerToys.sln'
vsVersion: 17.0
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true
maximumCpuCount: true
## ALL BUT INSTALLER BUILDING
- task: VSBuild@1
displayName: Build PowerToys main project
inputs:
solution: '**\PowerToys.sln'
vsVersion: 17.0
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true
maximumCpuCount: true
- task: VSBuild@1
displayName: Build BugReportTool
inputs:
solution: '**/tools/BugReportTool/BugReportTool.sln'
vsVersion: 17.0
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true
maximumCpuCount: true
- task: VSBuild@1
displayName: Build BugReportTool
inputs:
solution: '**/tools/BugReportTool/BugReportTool.sln'
vsVersion: 17.0
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true
maximumCpuCount: true
- task: VSBuild@1
displayName: Build WebcamReportTool
inputs:
solution: '**/tools/WebcamReportTool/WebcamReportTool.sln'
vsVersion: 17.0
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true
maximumCpuCount: true
- task: VSBuild@1
displayName: Build WebcamReportTool
inputs:
solution: '**/tools/WebcamReportTool/WebcamReportTool.sln'
vsVersion: 17.0
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true
maximumCpuCount: true
- task: VSBuild@1
displayName: Build StylesReportTool
inputs:
solution: '**/tools/StylesReportTool/StylesReportTool.sln'
vsVersion: 17.0
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true
maximumCpuCount: true
- task: VSBuild@1
displayName: Build StylesReportTool
inputs:
solution: '**/tools/StylesReportTool/StylesReportTool.sln'
vsVersion: 17.0
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true
maximumCpuCount: true
- task: VSBuild@1
displayName: Publish Settings for Packaging
inputs:
solution: 'src/settings-ui/Settings.UI/PowerToys.Settings.csproj'
vsVersion: 17.0
msbuildArgs: >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: VSBuild@1
displayName: Publish Settings for Packaging
inputs:
solution: 'src/settings-ui/Settings.UI/PowerToys.Settings.csproj'
vsVersion: 17.0
msbuildArgs: >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: VSBuild@1
displayName: Publish Launcher for Packaging
inputs:
solution: 'src/modules/launcher/PowerLauncher/PowerLauncher.csproj'
vsVersion: 17.0
# The arguments should be the same as the ones for Settings; make sure they are.
msbuildArgs: >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: VSBuild@1
displayName: Publish Launcher for Packaging
inputs:
solution: 'src/modules/launcher/PowerLauncher/PowerLauncher.csproj'
vsVersion: 17.0
# The arguments should be the same as the ones for Settings; make sure they are.
msbuildArgs: >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: VSBuild@1
displayName: Publish Monaco Preview Handler for Packaging
inputs:
solution: 'src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj'
vsVersion: 17.0
# The arguments should be the same as the ones for Settings; make sure they are.
msbuildArgs: >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: VSBuild@1
displayName: Publish Monaco Preview Handler for Packaging
inputs:
solution: 'src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj'
vsVersion: 17.0
# The arguments should be the same as the ones for Settings; make sure they are.
msbuildArgs: >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: VSBuild@1
displayName: Publish Markdown Preview Handler for Packaging
inputs:
solution: 'src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj'
vsVersion: 17.0
# The arguments should be the same as the ones for Settings; make sure they are.
msbuildArgs: >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: VSBuild@1
displayName: Publish Markdown Preview Handler for Packaging
inputs:
solution: 'src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandler.csproj'
vsVersion: 17.0
# The arguments should be the same as the ones for Settings; make sure they are.
msbuildArgs: >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: VSBuild@1
displayName: Publish Svg Preview Handler for Packaging
inputs:
solution: 'src/modules/previewpane/SvgPreviewHandler/SvgPreviewHandler.csproj'
vsVersion: 17.0
# The arguments should be the same as the ones for Settings; make sure they are.
msbuildArgs: >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: VSBuild@1
displayName: Publish Svg Preview Handler for Packaging
inputs:
solution: 'src/modules/previewpane/SvgPreviewHandler/SvgPreviewHandler.csproj'
vsVersion: 17.0
# The arguments should be the same as the ones for Settings; make sure they are.
msbuildArgs: >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: VSBuild@1
displayName: Publish Svg Thumbnail Provider for Packaging
inputs:
solution: 'src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.csproj'
vsVersion: 17.0
# The arguments should be the same as the ones for Settings; make sure they are.
msbuildArgs: >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: VSBuild@1
displayName: Publish Svg Thumbnail Provider for Packaging
inputs:
solution: 'src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.csproj'
vsVersion: 17.0
# The arguments should be the same as the ones for Settings; make sure they are.
msbuildArgs: >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: VSBuild@1
displayName: Publish File Locksmith UI for Packaging
inputs:
solution: 'src/modules/FileLocksmith/FileLocksmithUI/FileLocksmithUI.csproj'
vsVersion: 17.0
# The arguments should be the same as the ones for Settings; make sure they are.
msbuildArgs: >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: VSBuild@1
displayName: Publish File Locksmith UI for Packaging
inputs:
solution: 'src/modules/FileLocksmith/FileLocksmithUI/FileLocksmithUI.csproj'
vsVersion: 17.0
# The arguments should be the same as the ones for Settings; make sure they are.
msbuildArgs: >-
/target:Publish
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
/p:VCRTForwarders-IncludeDebugCRT=false
/p:PowerToysRoot=$(Build.SourcesDirectory)
/p:PublishProfile=InstallationPublishProfile.pubxml
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
# Check if deps.json files don't reference different dll versions.
- task: PowerShell@2
displayName: Audit deps.json files for all applications
inputs:
filePath: '.pipelines/verifyDepsJsonLibraryVersions.ps1'
arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)'
pwsh: true
# Check if deps.json files don't reference different dll versions.
- task: PowerShell@2
displayName: Audit deps.json files for all applications
inputs:
filePath: '.pipelines/verifyDepsJsonLibraryVersions.ps1'
arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)'
pwsh: true
# Check if asset files on the main application paths are playing nice and avoiding basic conflicts.
- task: PowerShell@2
displayName: Audit base applications path asset conflicts
inputs:
filePath: '.pipelines/verifyPossibleAssetConflicts.ps1'
arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)'
pwsh: true
# Check if asset files on the main application paths are playing nice and avoiding basic conflicts.
- task: PowerShell@2
displayName: Audit base applications path asset conflicts
inputs:
filePath: '.pipelines/verifyPossibleAssetConflicts.ps1'
arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)'
pwsh: true
- task: PowerShell@2
displayName: Audit WinAppSDK applications path asset conflicts
inputs:
filePath: '.pipelines/verifyPossibleAssetConflicts.ps1'
arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps'
pwsh: true
- task: PowerShell@2
displayName: Audit WinAppSDK applications path asset conflicts
inputs:
filePath: '.pipelines/verifyPossibleAssetConflicts.ps1'
arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps'
pwsh: true
#### MAIN SIGNING AREA
# reference https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/ESRPSigning.json&version=GBarm64-netcore&_a=contents for winappdriver
# https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/CIPolicy.xml&version=GBarm64-netcore&_a=contents
#### MAIN SIGNING AREA
# reference https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/ESRPSigning.json&version=GBarm64-netcore&_a=contents for winappdriver
# https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/CIPolicy.xml&version=GBarm64-netcore&_a=contents
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
displayName: Sign Core PT
inputs:
ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection'
FolderPath: '$(BuildPlatform)/$(BuildConfiguration)' # Video conf uses x86 and x64.
signType: batchSigning
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_core.json'
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
displayName: Sign Core PT
inputs:
ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection'
FolderPath: '$(BuildPlatform)/$(BuildConfiguration)' # Video conf uses x86 and x64.
signType: batchSigning
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_core.json'
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
displayName: Sign x86 directshow VCM
inputs:
ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection'
FolderPath: 'x86/$(BuildConfiguration)' # Video conf uses x86 and x64.
signType: batchSigning
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_vcm.json'
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
#### END SIGNING
## END MAIN
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
displayName: Sign x86 directshow VCM
inputs:
ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection'
FolderPath: 'x86/$(BuildConfiguration)' # Video conf uses x86 and x64.
signType: batchSigning
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_vcm.json'
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
#### END SIGNING
## END MAIN
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: binlog'
condition: failed()
continueOnError: True
inputs:
PathtoPublish: $(Build.SourcesDirectory)\msbuild.binlog
ArtifactName: binlog-$(BuildPlatform)
- pwsh: |-
Move-Item msbuild.binlog "$(Build.ArtifactStagingDirectory)/"
displayName: Stage binlog into artifact directory
condition: always()
- task: ComponentGovernanceComponentDetection@0
displayName: Component Detection
- task: ComponentGovernanceComponentDetection@0
displayName: Component Detection
- task: CopyFiles@2
displayName: Copying files for symbols
inputs:
contents: >-
**/*.pdb
flattenFolders: True
targetFolder: $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/
- task: PowerShell@2
displayName: 'Remove unneeded files from ArtifactStagingDirectory'
inputs:
targetType: 'inline'
script: |
cd $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/
Remove-Item vc143.pdb
Remove-Item *test*
- task: CopyFiles@2
displayName: Copying files for symbols
inputs:
contents: >-
**/*.pdb
flattenFolders: True
targetFolder: $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/
- task: PowerShell@2
displayName: 'Remove unneeded files from ArtifactStagingDirectory'
inputs:
targetType: 'inline'
script: |
cd $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/
Remove-Item vc143.pdb
Remove-Item *test*
- task: PublishSymbols@2
displayName: Publish symbols path
continueOnError: True
inputs:
SearchPattern: |
$(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/**/*.*
IndexSources: false
SymbolServerType: TeamServices
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Symbols'
inputs:
PathtoPublish: $(System.ArtifactsDirectory)/Symbols-$(BuildPlatform)/
ArtifactName: Symbols-${{ parameters.versionNumber }}-$(BuildPlatform)
- task: PublishSymbols@2
displayName: Publish symbols path
continueOnError: True
inputs:
SearchPattern: |
$(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/**/*.*
IndexSources: false
SymbolServerType: TeamServices
- template: .pipelines/installer-steps.yml@self
parameters:
versionNumber: ${{ parameters.versionNumber }}
perUserArg: "false"
buildSubDir: "MachineSetup"
installerPrefix: "PowerToysSetup"
- task: DeleteFiles@1
displayName: 'Remove symbols from ArtifactStagingDirectory'
inputs:
Contents: '*'
SourceFolder: $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/
RemoveSourceFolder: True
- task: PowerShell@2
displayName: Clean installer dir before building per-user installer
inputs:
targetType: inline
script: git clean -xfd -e *exe -- .\installer\
pwsh: true
- template: installer-steps.yml
parameters:
versionNumber: ${{ parameters.versionNumber }}
perUserArg: "false"
buildSubDir: "MachineSetup"
installerPrefix: "PowerToysSetup"
- template: .pipelines/installer-steps.yml@self
parameters:
versionNumber: ${{ parameters.versionNumber }}
perUserArg: "true"
buildSubDir: "UserSetup"
installerPrefix: "PowerToysUserSetup"
- task: PowerShell@2
displayName: Clean installer dir before building per-user installer
inputs:
targetType: inline
script: git clean -xfd -e *exe -- .\installer\
pwsh: true
- task: CopyFiles@2
displayName: Copying setup file over
inputs:
contents: "**/PowerToys*Setup-*.exe"
flattenFolders: True
targetFolder: $(Build.ArtifactStagingDirectory)
- template: installer-steps.yml
parameters:
versionNumber: ${{ parameters.versionNumber }}
perUserArg: "true"
buildSubDir: "UserSetup"
installerPrefix: "PowerToysUserSetup"
- task: PowerShell@2
displayName: 'Calculating SHA256 hash'
inputs:
targetType: 'inline'
script: |
$p = "$(System.ArtifactsDirectory)\";
$staging = "$(Build.ArtifactStagingDirectory)\"
$userHash = ((get-item $p\PowerToysUserSetup*.exe | Get-FileHash).Hash);
$machineHash = ((get-item $p\PowerToysSetup*.exe | Get-FileHash).Hash);
$userPlat = "hash_user_$(BuildPlatform).txt";
$machinePlat = "hash_machine_$(BuildPlatform).txt";
$combinedUserPath = $staging + $userPlat;
$combinedMachinePath = $staging + $machinePlat;
echo $p
- task: CopyFiles@2
displayName: Copying setup file over
inputs:
contents: "**/PowerToys*Setup-*.exe"
flattenFolders: True
targetFolder: $(Build.ArtifactStagingDirectory)
echo $userPlat
echo $userHash
echo $combinedUserPath
- task: PowerShell@2
displayName: 'Calculating SHA256 hash'
inputs:
targetType: 'inline'
script: |
$p = "$(System.ArtifactsDirectory)\";
$staging = "$(Build.ArtifactStagingDirectory)\"
$userHash = ((get-item $p\PowerToysUserSetup*.exe | Get-FileHash).Hash);
$machineHash = ((get-item $p\PowerToysSetup*.exe | Get-FileHash).Hash);
$userPlat = "hash_user_$(BuildPlatform).txt";
$machinePlat = "hash_machine_$(BuildPlatform).txt";
$combinedUserPath = $staging + $userPlat;
$combinedMachinePath = $staging + $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
pwsh: true
- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: PowerToySetup"
inputs:
PathtoPublish: $(System.ArtifactsDirectory)
ArtifactName: setup-$(BuildPlatform)
# Publishing the GPO files with a version number
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: GPO Files'
inputs:
PathtoPublish: src\gpo\assets
ArtifactName: GroupPolicyObjectsFiles-${{ parameters.versionNumber }}
echo $machinePlat
echo $machineHash
echo $combinedMachinePath
$userHash | out-file -filepath $combinedUserPath
$machineHash | out-file -filepath $combinedMachinePath
pwsh: true
# Publishing the GPO files
- pwsh: |-
New-Item "$(Build.ArtifactStagingDirectory)/gpo" -Type Directory
Copy-Item src\gpo\assets\* "$(Build.ArtifactStagingDirectory)/gpo" -Recurse
displayName: Stage the GPO files
...

7457
.pipelines/sdl.gdnbaselines Normal file

File diff suppressed because it is too large Load Diff

View File

@ -42,6 +42,9 @@
<PreferredToolArchitecture Condition="'$(PROCESSOR_ARCHITECTURE)' == 'ARM64' or '$(PROCESSOR_ARCHITEW6432)' == 'ARM64'">arm64</PreferredToolArchitecture>
<VcpkgEnabled>false</VcpkgEnabled>
<ExternalIncludePath>$(MSBuildThisFileFullPath)\..\deps\;$(MSBuildThisFileFullPath)\..\packages\;$(ExternalIncludePath)</ExternalIncludePath>
<!-- Enable control flow guard for C++ projects that don't consume any C++ files -->
<!-- This covers the case where a .dll exports a .lib, but doesn't have any ClCompile entries. -->
<LinkControlFlowGuard>Guard</LinkControlFlowGuard>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
@ -53,9 +56,12 @@
<ConformanceMode>false</ConformanceMode>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpplatest</LanguageStandard>
<BuildStlModules>false</BuildStlModules>
<BuildStlModules>false</BuildStlModules>
<AdditionalOptions>/await %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<!-- CLR + CFG are not compatible >:{ -->
<ControlFlowGuard Condition="'$(CLRSupport)' == ''">Guard</ControlFlowGuard>
<DebugInformationFormat Condition="'%(ControlFlowGuard)' == 'Guard'">ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@ -41,17 +41,17 @@ Go to the [Microsoft PowerToys GitHub releases page][github-release-link] and cl
<!-- items that need to be updated release to release -->
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F48
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F47
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysUserSetup-0.74.0-x64.exe
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysUserSetup-0.74.0-arm64.exe
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysSetup-0.74.0-x64.exe
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysSetup-0.74.0-arm64.exe
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.1/PowerToysUserSetup-0.74.1-x64.exe
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.1/PowerToysUserSetup-0.74.1-arm64.exe
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.1/PowerToysSetup-0.74.1-x64.exe
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.1/PowerToysSetup-0.74.1-arm64.exe
| Description | Filename | sha256 hash |
|----------------|----------|-------------|
| Per user - x64 | [PowerToysUserSetup-0.74.0-x64.exe][ptUserX64] | 1C4ECE9F11488BAFFAE6B76D2B0504FA18BFFEA11EBC38BCC87F5D86AEA87C7C |
| Per user - ARM64 | [PowerToysUserSetup-0.74.0-arm64.exe][ptUserArm64] | 4F3842FAB0839A361A15A06B7720BA8A0FE7F9AF98EA94245C08DEF37678CA4A |
| Machine wide - x64 | [PowerToysSetup-0.74.0-x64.exe][ptMachineX64] | 648992E8CEA08F3C63C7CCBD554ADDF500ECBC4560187310BC12E6CB9C2F38E3 |
| Machine wide - ARM64 | [PowerToysSetup-0.74.0-arm64.exe][ptMachineArm64] | 2B6D92F1A0EA688C7EE882050AC9B030C8B3A18765163FB6D67E5E694A4D4FE3 |
| Per user - x64 | [PowerToysUserSetup-0.74.1-x64.exe][ptUserX64] | 748BF7BA33913237D36D6F48E3839D0C8035967305137A17DEFF39D775735C81 |
| Per user - ARM64 | [PowerToysUserSetup-0.74.1-arm64.exe][ptUserArm64] | F5DAA89A9CF3A2805E121085AFD056A890F241A170FAB5007AA58E2755C88C54 |
| Machine wide - x64 | [PowerToysSetup-0.74.1-x64.exe][ptMachineX64] | 298C6F4E4391BDC06E128BED86A303C3300A68EAF754B4630AF7542C78C0944A |
| Machine wide - ARM64 | [PowerToysSetup-0.74.1-arm64.exe][ptMachineArm64] | A65F3C300A48F9F81312B7FC7B306382CB87F591612D0CEC7E5C0E47E868904B |
This is our preferred method.

42
Settings.XamlStyler Normal file
View File

@ -0,0 +1,42 @@
{
"AttributesTolerance": 2,
"KeepFirstAttributeOnSameLine": false,
"MaxAttributeCharactersPerLine": 0,
"MaxAttributesPerLine": 1,
"NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter",
"SeparateByGroups": false,
"AttributeIndentation": 0,
"AttributeIndentationStyle": 1,
"RemoveDesignTimeReferences": false,
"IgnoreDesignTimeReferencePrefix": false,
"EnableAttributeReordering": true,
"AttributeOrderingRuleGroups": [
"x:Class",
"xmlns, xmlns:x",
"xmlns:*",
"x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
"Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
"Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
"Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex",
"*:*, *",
"PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint",
"mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText",
"Storyboard.*, From, To, Duration"
],
"FirstLineAttributes": "",
"OrderAttributesByName": true,
"PutEndingBracketOnNewLine": false,
"RemoveEndingTagOfEmptyElement": true,
"SpaceBeforeClosingSlash": true,
"RootElementLineBreakRule": 0,
"ReorderVSM": 2,
"ReorderGridChildren": false,
"ReorderCanvasChildren": false,
"ReorderSetters": 0,
"FormatMarkupExtension": true,
"NoNewLineMarkupExtensions": "x:Bind, Binding",
"ThicknessSeparator": 2,
"ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
"FormatOnSave": true,
"CommentPadding": 2,
}

View File

@ -15,7 +15,7 @@ Available commands:
* Hibernate
* Open / Empty Recycle Bin
* UEFI Firmware Settings (Only available on systems, that boot in UEFI mode.)
* IP / MAC / Address => Show informations about network connections.
* IP / MAC / Address => Show information about network connections.
## Optional plugin settings
@ -46,7 +46,7 @@ Available commands:
### [`NetworkConnectionProperties.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/NetworkConnectionProperties.cs)
- The [`NetworkConnectionProperties`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/NetworkConnectionProperties.cs) class contains methods to get the properties of a network interface/connection.
- An instance of this class collects/provides all required informations about one connection/adapter.
- An instance of this class collects/provides all required information about one connection/adapter.
### [`SystemPluginContext.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/SystemPluginContext.cs)
- An instance of the class [`SystemPluginContext`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/SystemPluginContext.cs) contains/defines the context data of a system plugin result. We select the context menu based on the defined properties.

View File

@ -6,6 +6,7 @@
## Formatting
- We use [XamlStyler](https://github.com/Xavalon/XamlStyler/) to format XAML files. You can use the [Visual Studio Extension](https://marketplace.visualstudio.com/items?itemName=TeamXavalon.XAMLStyler2022) or apply formatting executing `.\.pipelines\applyXamlStyling.ps1 -Main`.
- We use [`.clang-format`](https://github.com/microsoft/PowerToys/blob/main/src/.clang-format) style file to enable automatic code formatting. You can [easily format source files from Visual Studio](https://devblogs.microsoft.com/cppblog/clangformat-support-in-visual-studio-2017-15-7-preview-1/). For example, `CTRL+K CTRL+D` formats the current document.
- If you prefer another text editor or have ClangFormat disabled in Visual Studio, you could invoke [`format_sources`](https://github.com/microsoft/PowerToys/blob/main/src/codeAnalysis/format_sources.ps1) powershell script from command line. It gets a list of all currently modified files from `git` and invokes clang-format on them.
Please note that you should also have `clang-format.exe` in `%PATH%` for it to work. The script can infer the path of `clang-format.exe` version which is shipped with Visual Studio at `%VCINSTALLDIR%\Tools\Llvm\bin\`, if you launch it from the *Native Tools Command Prompt for VS*.

View File

@ -22,7 +22,19 @@ You will find the policies under "Administrative Templates/Microsoft PowerToys"
## Policies
### Configure enabled state
### Configure global utility enabled state
This policy configures the enabled state for all PowerToys utilities.
If you enable this setting, all utilities will be always enabled and the user won't be able to disable it.
If you disable this setting, all utilities will be always disabled and the user won't be able to enable it.
If you don't configure this setting, users are able to disable or enable the utilities.
The individual enabled state policies for the utilities will override this policy.
### Configure enabled state for individual utilities
For each utility shipped with PowerToys, there's a "Configure enabled state" policy, which forces and Enabled state for the utility.
@ -32,6 +44,8 @@ If you disable this setting, the utility will be always disabled and the user wo
If you don't configure this setting, users are able to disable or enable the utility.
This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it.
### Allow experimentation
This policy configures whether PowerToys experimentation is allowed. With experimentation allowed the user sees the new features being experimented if it gets selected as part of the test group. (Experimentation will only happen on Windows Insider builds.)

View File

@ -111,6 +111,11 @@
<ItemGroup>
<ResourceCompile Include="GPOWrapper.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\common\version\version.vcxproj">
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />

View File

@ -43,6 +43,11 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\common\version\version.vcxproj">
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />

View File

@ -48,9 +48,6 @@
<ProjectReference Include="..\SettingsAPI\SettingsAPI.vcxproj">
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
</ProjectReference>
<ProjectReference Include="..\version\version.vcxproj">
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="UnitTests-CommonLib.rc" />

View File

@ -238,6 +238,7 @@ void LayoutMap::LayoutMapImpl::UpdateLayout()
keyboardLayoutMap[VK_NONCONVERT] = L"IME Non-Convert";
keyboardLayoutMap[VK_ACCEPT] = L"IME Kana";
keyboardLayoutMap[VK_MODECHANGE] = L"IME Mode Change";
keyboardLayoutMap[VK_DECIMAL] = L". (Numpad)";
keyboardLayoutMap[CommonSharedConstants::VK_DISABLED] = L"Disable";
}

View File

@ -74,6 +74,9 @@
<ProjectReference Include="..\..\logging\logging.vcxproj">
<Project>{7e1e3f13-2bd6-3f75-a6a7-873a2b55c60f}</Project>
</ProjectReference>
<ProjectReference Include="..\version\version.vcxproj">
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View File

@ -67,6 +67,9 @@
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\common\version\version.vcxproj">
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
</ProjectReference>
<ProjectReference Include="..\BackgroundActivator\BackgroundActivator.vcxproj">
<Project>{031AC72E-FA28-4AB7-B690-6F7B9C28AA73}</Project>
</ProjectReference>

View File

@ -51,9 +51,6 @@
<ProjectReference Include="..\SettingsAPI\SettingsAPI.vcxproj">
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
</ProjectReference>
<ProjectReference Include="..\version\version.vcxproj">
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View File

@ -19,6 +19,7 @@ namespace powertoys_gpo {
const HKEY POLICIES_SCOPE_USER = HKEY_CURRENT_USER;
// The registry value names for PowerToys utilities enabled and disabled policies.
const std::wstring POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES = L"ConfigureGlobalUtilityEnabledState";
const std::wstring POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP = L"ConfigureEnabledUtilityAlwaysOnTop";
const std::wstring POLICY_CONFIGURE_ENABLED_AWAKE = L"ConfigureEnabledUtilityAwake";
const std::wstring POLICY_CONFIGURE_ENABLED_COLOR_PICKER = L"ConfigureEnabledUtilityColorPicker";
@ -116,168 +117,183 @@ namespace powertoys_gpo {
}
}
inline gpo_rule_configured_t getConfiguredAlwaysOnTopEnabledValue() {
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP);
inline gpo_rule_configured_t getUtilityEnabledValue(const std::wstring& utility_name)
{
auto individual_value = getConfiguredValue(utility_name);
if (individual_value == gpo_rule_configured_disabled || individual_value == gpo_rule_configured_enabled)
{
return individual_value;
}
else
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES);
}
}
inline gpo_rule_configured_t getConfiguredAlwaysOnTopEnabledValue()
{
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP);
}
inline gpo_rule_configured_t getConfiguredAwakeEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_AWAKE);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_AWAKE);
}
inline gpo_rule_configured_t getConfiguredColorPickerEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_COLOR_PICKER);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_COLOR_PICKER);
}
inline gpo_rule_configured_t getConfiguredCropAndLockEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK);
}
inline gpo_rule_configured_t getConfiguredFancyZonesEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_FANCYZONES);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FANCYZONES);
}
inline gpo_rule_configured_t getConfiguredFileLocksmithEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH);
}
inline gpo_rule_configured_t getConfiguredSvgPreviewEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_SVG_PREVIEW);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_PREVIEW);
}
inline gpo_rule_configured_t getConfiguredMarkdownPreviewEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW);
}
inline gpo_rule_configured_t getConfiguredMonacoPreviewEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW);
}
inline gpo_rule_configured_t getConfiguredPdfPreviewEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_PDF_PREVIEW);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_PREVIEW);
}
inline gpo_rule_configured_t getConfiguredGcodePreviewEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW);
}
inline gpo_rule_configured_t getConfiguredSvgThumbnailsEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS);
}
inline gpo_rule_configured_t getConfiguredPdfThumbnailsEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS);
}
inline gpo_rule_configured_t getConfiguredGcodeThumbnailsEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS);
}
inline gpo_rule_configured_t getConfiguredStlThumbnailsEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS);
}
inline gpo_rule_configured_t getConfiguredHostsFileEditorEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR);
}
inline gpo_rule_configured_t getConfiguredImageResizerEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER);
}
inline gpo_rule_configured_t getConfiguredKeyboardManagerEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER);
}
inline gpo_rule_configured_t getConfiguredFindMyMouseEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE);
}
inline gpo_rule_configured_t getConfiguredMouseHighlighterEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER);
}
inline gpo_rule_configured_t getConfiguredMouseJumpEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_MOUSE_JUMP);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_JUMP);
}
inline gpo_rule_configured_t getConfiguredMousePointerCrosshairsEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS);
}
inline gpo_rule_configured_t getConfiguredPowerRenameEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_POWER_RENAME);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_RENAME);
}
inline gpo_rule_configured_t getConfiguredPowerLauncherEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER);
}
inline gpo_rule_configured_t getConfiguredQuickAccentEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_QUICK_ACCENT);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QUICK_ACCENT);
}
inline gpo_rule_configured_t getConfiguredScreenRulerEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_SCREEN_RULER);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SCREEN_RULER);
}
inline gpo_rule_configured_t getConfiguredShortcutGuideEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE);
}
inline gpo_rule_configured_t getConfiguredTextExtractorEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR);
}
inline gpo_rule_configured_t getConfiguredPastePlainEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_PASTE_PLAIN);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PASTE_PLAIN);
}
inline gpo_rule_configured_t getConfiguredVideoConferenceMuteEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE);
}
inline gpo_rule_configured_t getConfiguredMouseWithoutBordersEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS);
}
inline gpo_rule_configured_t getConfiguredPeekEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_PEEK);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PEEK);
}
inline gpo_rule_configured_t getConfiguredRegistryPreviewEnabledValue()
{
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW);
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW);
}
inline gpo_rule_configured_t getDisablePerUserInstallationValue()

View File

@ -10,6 +10,25 @@
</ItemGroup>
<WriteLinesToFile File="Generated Files\version_gen.h" Lines="@(HeaderLines)" Overwrite="true" Encoding="Unicode" WriteOnlyWhenDifferent="true" />
</Target>
<!-- Needed for .\src\modules\videoconference\VideoConferenceProxyFilter\build_vcm_x86.cmd -->
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}</ProjectGuid>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation.
Licensed under the MIT License. -->
<policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.3" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.4" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<policyNamespaces>
<target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" />
</policyNamespaces>
<resources minRequiredRevision="1.3"/><!-- Last changed with PowerToys v0.73.0 -->
<resources minRequiredRevision="1.4"/><!-- Last changed with PowerToys v0.75.0 -->
<supportedOn>
<definitions>
<definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/>
@ -13,6 +13,7 @@
<definition name="SUPPORTED_POWERTOYS_0_69_0" displayName="$(string.SUPPORTED_POWERTOYS_0_69_0)"/>
<definition name="SUPPORTED_POWERTOYS_0_70_0" displayName="$(string.SUPPORTED_POWERTOYS_0_70_0)"/>
<definition name="SUPPORTED_POWERTOYS_0_73_0" displayName="$(string.SUPPORTED_POWERTOYS_0_73_0)"/>
<definition name="SUPPORTED_POWERTOYS_0_75_0" displayName="$(string.SUPPORTED_POWERTOYS_0_75_0)"/>
</definitions>
</supportedOn>
<categories>
@ -22,6 +23,18 @@
</category>
</categories>
<policies>
<policy name="ConfigureGlobalUtilityEnabledState" class="Both" displayName="$(string.ConfigureGlobalUtilityEnabledState)" explainText="$(string.ConfigureGlobalUtilityEnabledStateDescription)" key="Software\Policies\PowerToys" valueName="ConfigureGlobalUtilityEnabledState">
<parentCategory ref="PowerToys" />
<supportedOn ref="SUPPORTED_POWERTOYS_0_75_0" />
<enabledValue>
<decimal value="1" />
</enabledValue>
<disabledValue>
<decimal value="0" />
</disabledValue>
</policy>
<policy name="ConfigureEnabledUtilityAlwaysOnTop" class="Both" displayName="$(string.ConfigureEnabledUtilityAlwaysOnTop)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAlwaysOnTop">
<parentCategory ref="PowerToys" />
<supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" />

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation.
Licensed under the MIT License. -->
<policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.3" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.4" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<displayName>PowerToys</displayName>
<description>PowerToys</description>
<resources>
@ -14,14 +14,28 @@
<string id="SUPPORTED_POWERTOYS_0_69_0">PowerToys version 0.69.0 or later</string>
<string id="SUPPORTED_POWERTOYS_0_70_0">PowerToys version 0.70.0 or later</string>
<string id="SUPPORTED_POWERTOYS_0_73_0">PowerToys version 0.73.0 or later</string>
<string id="SUPPORTED_POWERTOYS_0_75_0">PowerToys version 0.75.0 or later</string>
<string id="ConfigureEnabledUtilityDescription">This policy configures the enabled state for a PowerToys utility.
<string id="ConfigureGlobalUtilityEnabledStateDescription">This policy configures the enabled state for all PowerToys utilities.
If you enable this setting, all utilities will be always enabled and the user won't be able to disable it.
If you disable this setting, all utilities will be always disabled and the user won't be able to enable it.
If you don't configure this setting, users are able to disable or enable the utilities.
The individual enabled state policies for the utilities will override this policy.
</string>
<string id="ConfigureEnabledUtilityDescription">This policy configures the enabled state for a PowerToys utility.
If you enable this setting, the utility will be always enabled and the user won't be able to disable it.
If you disable this setting, the utility will be always disabled and the user won't be able to enable it.
If you don't configure this setting, users are able to disable or enable the utility.
This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it.
</string>
<string id="ConfigureEnabledUtilityDescriptionPDFPreviewHandler">(Note: There have been reports of incompatibility between the PDF Preview Handler and Outlook)
@ -32,6 +46,8 @@ If you enable this setting, the utility will be always enabled and the user won'
If you disable this setting, the utility will be always disabled and the user won't be able to enable it.
If you don't configure this setting, users are able to disable or enable the utility.
This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it.
</string>
<string id="DisablePerUserInstallationDescription">This policy configures whether per-user PowerToys installation is allowed or not.
@ -65,6 +81,7 @@ If this setting is not configured or enabled, the user can control experimentati
If this setting is disabled, experimentation is not allowed.
</string>
<string id="ConfigureGlobalUtilityEnabledState">Configure global utility enabled state</string>
<string id="ConfigureEnabledUtilityAlwaysOnTop">Always On Top: Configure enabled state</string>
<string id="ConfigureEnabledUtilityAwake">Awake: Configure enabled state</string>
<string id="ConfigureEnabledUtilityColorPicker">Color Picker: Configure enabled state</string>

View File

@ -260,9 +260,6 @@
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\common\version\version.vcxproj">
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="..\..\..\..\deps\spdlog.props" />

View File

@ -20,29 +20,30 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid x:Name="AppTitleBar"
Height="32"
ColumnSpacing="16">
<Grid
x:Name="AppTitleBar"
Height="32"
ColumnSpacing="16">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="LeftPaddingColumn" Width="0"/>
<ColumnDefinition x:Name="IconColumn" Width="Auto"/>
<ColumnDefinition x:Name="TitleColumn" Width="Auto"/>
<ColumnDefinition x:Name="RightDragColumn" Width="*"/>
<ColumnDefinition x:Name="RightPaddingColumn" Width="0"/>
<ColumnDefinition x:Name="LeftPaddingColumn" Width="0" />
<ColumnDefinition x:Name="IconColumn" Width="Auto" />
<ColumnDefinition x:Name="TitleColumn" Width="Auto" />
<ColumnDefinition x:Name="RightDragColumn" Width="*" />
<ColumnDefinition x:Name="RightPaddingColumn" Width="0" />
</Grid.ColumnDefinitions>
<Image
Grid.Column="1"
Source="../Assets/FileLocksmith/Icon.ico"
VerticalAlignment="Center"
Width="16"
Height="16"/>
Height="16"
VerticalAlignment="Center"
Source="../Assets/FileLocksmith/Icon.ico" />
<TextBlock
x:Name="AppTitleTextBlock"
Grid.Column="2"
VerticalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}" />
</Grid>
<views:MainPage x:Name="mainPage" Grid.Row="1" />
</Grid>
</winuiex:WindowEx>

View File

@ -1,4 +1,4 @@
<winuiex:WindowEx
<winuiex:WindowEx
x:Class="Hosts.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@ -20,26 +20,29 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid x:Name="titleBar" Height="32" ColumnSpacing="16">
<Grid
x:Name="titleBar"
Height="32"
ColumnSpacing="16">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="LeftPaddingColumn" Width="0"/>
<ColumnDefinition x:Name="IconColumn" Width="Auto"/>
<ColumnDefinition x:Name="TitleColumn" Width="Auto"/>
<ColumnDefinition x:Name="RightPaddingColumn" Width="0"/>
<ColumnDefinition x:Name="LeftPaddingColumn" Width="0" />
<ColumnDefinition x:Name="IconColumn" Width="Auto" />
<ColumnDefinition x:Name="TitleColumn" Width="Auto" />
<ColumnDefinition x:Name="RightPaddingColumn" Width="0" />
</Grid.ColumnDefinitions>
<Image
Grid.Column="1"
Source="../Assets/Hosts/Hosts.ico"
VerticalAlignment="Center"
Width="16"
Height="16"/>
Height="16"
VerticalAlignment="Center"
Source="../Assets/Hosts/Hosts.ico" />
<TextBlock
x:Name="AppTitleTextBlock"
Grid.Column="2"
Style="{StaticResource CaptionTextBlockStyle}"
VerticalAlignment="Center" />
VerticalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}" />
</Grid>
<views:MainPage Grid.Row="1" />
</Grid>
</winuiex:WindowEx>

View File

@ -1,4 +1,4 @@
<Page
<Page
x:Class="Hosts.Views.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@ -169,8 +169,8 @@
GotFocus="Entries_GotFocus"
IsItemClickEnabled="True"
ItemClick="Entries_ItemClick"
RightTapped="Entries_RightTapped"
ItemsSource="{x:Bind ViewModel.Entries, Mode=TwoWay}"
RightTapped="Entries_RightTapped"
SelectedItem="{x:Bind ViewModel.Selected, Mode=TwoWay}">
<ListView.ContextFlyout>
<MenuFlyout>
@ -180,8 +180,8 @@
Icon="Edit">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator
Modifiers="Control"
Key="E"
Modifiers="Control"
ScopeOwner="{x:Bind Entries}" />
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
@ -191,8 +191,8 @@
Icon="TwoBars">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator
Modifiers="Control"
Key="P"
Modifiers="Control"
ScopeOwner="{x:Bind Entries}" />
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
@ -218,9 +218,7 @@
Click="Delete_Click"
Icon="Delete">
<MenuFlyoutItem.KeyboardAccelerators>
<KeyboardAccelerator
Key="Delete"
ScopeOwner="{x:Bind Entries}" />
<KeyboardAccelerator Key="Delete" ScopeOwner="{x:Bind Entries}" />
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
</MenuFlyout>
@ -232,11 +230,16 @@
Background="Transparent"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="256"/> <!-- Address -->
<ColumnDefinition Width="*"/> <!-- Comment -->
<ColumnDefinition Width="Auto"/> <!-- Status -->
<ColumnDefinition Width="Auto"/> <!-- Duplicate -->
<ColumnDefinition Width="Auto"/> <!-- ToggleSwitch -->
<ColumnDefinition Width="256" />
<!-- Address -->
<ColumnDefinition Width="*" />
<!-- Comment -->
<ColumnDefinition Width="Auto" />
<!-- Status -->
<ColumnDefinition Width="Auto" />
<!-- Duplicate -->
<ColumnDefinition Width="Auto" />
<!-- ToggleSwitch -->
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
@ -371,9 +374,9 @@
<InfoBar
x:Uid="FileSaveError"
Margin="0,8,0,0"
Severity="Error"
Message="{x:Bind ViewModel.ErrorMessage, Mode=TwoWay}"
IsOpen="{x:Bind ViewModel.Error, Mode=TwoWay}"
Message="{x:Bind ViewModel.ErrorMessage, Mode=TwoWay}"
Severity="Error"
Visibility="{x:Bind ViewModel.Error, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}}" />
<InfoBar
x:Uid="FileChanged"
@ -397,8 +400,8 @@
<ContentDialog
x:Name="EntryDialog"
x:Uid="EntryDialog"
Loaded="ContentDialog_Loaded_ApplyMargin"
IsPrimaryButtonEnabled="{Binding Valid, Mode=OneWay}"
Loaded="ContentDialog_Loaded_ApplyMargin"
PrimaryButtonStyle="{StaticResource AccentButtonStyle}">
<ContentDialog.DataContext>
<models:Entry />

View File

@ -239,7 +239,7 @@
<comment>"Hosts" refers to the system hosts file, do not loc</comment>
</data>
<data name="Hosts.[using:Microsoft.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Seperate multiple hosts by space (e.g. server server.local). Maximum 9 hosts per entry.</value>
<value>Separate multiple hosts by space (e.g. server server.local). Maximum 9 hosts per entry.</value>
<comment>Do not localize "server" and "server.local"</comment>
</data>
<data name="HostsFilter.Header" xml:space="preserve">

View File

@ -7,9 +7,9 @@
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@ -73,7 +73,7 @@ namespace
result.hwnd = active_window;
// In reality, Windows Snap works if even one of those styles is set
// for a window, it is just limited. If there is no WS_MAXIMIZEBOX using
// WinKey + Up just won't maximize the window. Similary, without
// WinKey + Up just won't maximize the window. Similarly, without
// WS_MINIMIZEBOX the window will not get minimized. A "Save As..." dialog
// is a example of such window - it can be snapped to both sides and to
// all screen corners, but will not get maximized nor minimized.

View File

@ -29,6 +29,7 @@
#include <FancyZonesLib/VirtualDesktop.h>
#include <FancyZonesLib/WindowKeyboardSnap.h>
#include <FancyZonesLib/WindowMouseSnap.h>
#include <FancyZonesLib/WindowUtils.h>
#include <FancyZonesLib/WorkArea.h>
#include <FancyZonesLib/WorkAreaConfiguration.h>
@ -394,6 +395,15 @@ void FancyZones::WindowCreated(HWND window) noexcept
return;
}
// Hotfix
// Avoid automatically moving popup windows, as they can be just popup menus.
bool isPopup = FancyZonesWindowUtils::IsPopupWindow(window);
bool hasThickFrame = FancyZonesWindowUtils::HasThickFrame(window);
if (isPopup && !hasThickFrame)
{
return;
}
// Avoid already stamped (zoned) windows
const bool isZoned = !FancyZonesWindowProperties::RetrieveZoneIndexProperty(window).empty();
if (isZoned)

View File

@ -192,6 +192,12 @@ bool FancyZonesWindowUtils::IsPopupWindow(HWND window) noexcept
return ((style & WS_POPUP) == WS_POPUP);
}
bool FancyZonesWindowUtils::HasThickFrame(HWND window) noexcept
{
auto style = GetWindowLong(window, GWL_STYLE);
return ((style & WS_THICKFRAME) == WS_THICKFRAME);
}
bool FancyZonesWindowUtils::HasThickFrameAndMinimizeMaximizeButtons(HWND window) noexcept
{
auto style = GetWindowLong(window, GWL_STYLE);

View File

@ -20,6 +20,7 @@ namespace FancyZonesWindowUtils
bool HasVisibleOwner(HWND window) noexcept;
bool IsStandardWindow(HWND window);
bool IsPopupWindow(HWND window) noexcept;
bool HasThickFrame(HWND window) noexcept;
bool HasThickFrameAndMinimizeMaximizeButtons(HWND window) noexcept;
bool IsProcessOfWindowElevated(HWND window); // If HWND is already dead, we assume it wasn't elevated

View File

@ -13,10 +13,10 @@ using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:PrefixLocalCallsWithThis", Justification = "We follow the C# Core Coding Style which avoids using `this` unless absolutely necessary.")]
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1200:UsingDirectivesMustBePlacedWithinNamespace", Justification = "We follow the C# Core Coding Style which puts using statements outside the namespace.")]
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1201:ElementsMustAppearInTheCorrectOrder", Justification = "It is not a priority and have hight impact in code changes.")]
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1202:ElementsMustBeOrderedByAccess", Justification = "It is not a priority and have hight impact in code changes.")]
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1203:ConstantsMustAppearBeforeFields", Justification = "It is not a priority and have hight impact in code changes.")]
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1204:StaticElementsMustAppearBeforeInstanceElements", Justification = "It is not a priority and have hight impact in code changes.")]
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1201:ElementsMustAppearInTheCorrectOrder", Justification = "It is not a priority and has a high impact in code changes.")]
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1202:ElementsMustBeOrderedByAccess", Justification = "It is not a priority and has a high impact in code changes.")]
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1203:ConstantsMustAppearBeforeFields", Justification = "It is not a priority and has a high impact in code changes.")]
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1204:StaticElementsMustAppearBeforeInstanceElements", Justification = "It is not a priority and has a high impact in code changes.")]
[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1309:FieldNamesMustNotBeginWithUnderscore", Justification = "We follow the C# Core Coding Style which uses underscores as prefixes rather than using `this.`.")]

View File

@ -1,10 +1,11 @@
<Application x:Class="ImageResizer.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:ImageResizer.Models"
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
xmlns:v="clr-namespace:ImageResizer.Views"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
<Application
x:Class="ImageResizer.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:ImageResizer.Models"
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:v="clr-namespace:ImageResizer.Views">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
@ -12,27 +13,29 @@
<ui:ControlsDictionary />
</ResourceDictionary.MergedDictionaries>
<ObjectDataProvider x:Key="ResizeFitValues"
MethodName="GetValues"
ObjectType="sys:Enum">
<ObjectDataProvider
x:Key="ResizeFitValues"
MethodName="GetValues"
ObjectType="sys:Enum">
<ObjectDataProvider.MethodParameters>
<x:Type Type="{x:Type m:ResizeFit}"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider x:Key="ResizeUnitValues"
MethodName="GetValues"
ObjectType="sys:Enum">
<ObjectDataProvider.MethodParameters>
<x:Type Type="{x:Type m:ResizeUnit}"/>
<x:Type Type="{x:Type m:ResizeFit}" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<v:SizeTypeToVisibilityConverter x:Key="SizeTypeToVisibilityConverter"/>
<v:EnumValueConverter x:Key="EnumValueConverter"/>
<v:AutoDoubleConverter x:Key="AutoDoubleConverter"/>
<v:BoolValueConverter x:Key="BoolValueConverter"/>
<v:VisibilityBoolConverter x:Key="VisibilityBoolConverter"/>
<ObjectDataProvider
x:Key="ResizeUnitValues"
MethodName="GetValues"
ObjectType="sys:Enum">
<ObjectDataProvider.MethodParameters>
<x:Type Type="{x:Type m:ResizeUnit}" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<v:SizeTypeToVisibilityConverter x:Key="SizeTypeToVisibilityConverter" />
<v:EnumValueConverter x:Key="EnumValueConverter" />
<v:AutoDoubleConverter x:Key="AutoDoubleConverter" />
<v:BoolValueConverter x:Key="BoolValueConverter" />
<v:VisibilityBoolConverter x:Key="VisibilityBoolConverter" />
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@ -183,7 +183,7 @@ namespace ImageResizer.Extensions
/// Prints all metadata to debug console
/// </summary>
/// <remarks>
/// Intented for debug only!!!
/// Intended for debug only!!!
/// </remarks>
public static void PrintsAllMetadataToDebugOutput(this BitmapMetadata metadata)
{
@ -205,7 +205,7 @@ namespace ImageResizer.Extensions
/// Iterates recursively through all metadata
/// </summary>
/// <remarks>
/// Intented for debug only!!!
/// Intended for debug only!!!
/// </remarks>
public static List<(string MetadataPath, object Value)> GetListOfMetadataForDebug(this BitmapMetadata metadata)
{

View File

@ -25,7 +25,10 @@
SelectedIndex="{Binding Settings.SelectedSizeIndex}">
<ComboBox.Resources>
<DataTemplate DataType="{x:Type m:ResizeSize}">
<Grid Margin="2,0,0,0" VerticalAlignment="Center" AutomationProperties.Name="{Binding Name}">
<Grid
Margin="2,0,0,0"
VerticalAlignment="Center"
AutomationProperties.Name="{Binding Name}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
@ -67,9 +70,7 @@
<DataTemplate DataType="{x:Type m:CustomSize}">
<Grid VerticalAlignment="Center" AutomationProperties.Name="{Binding Name}">
<TextBlock
FontWeight="SemiBold"
Text="{Binding Name}" />
<TextBlock FontWeight="SemiBold" Text="{Binding Name}" />
</Grid>
</DataTemplate>
</ComboBox.Resources>

View File

@ -43,7 +43,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
return true;
},
// For debugging you can set the second parameter to true to see more informations.
// For debugging you can set the second parameter to true to see more information.
ToolTipData = GetToolTip(x.Result, false),
});
}

View File

@ -79,7 +79,7 @@ namespace Microsoft.Plugin.WindowWalker.Properties {
}
/// <summary>
/// Looks up a localized string similar to Folder windows doesn&apos;t run in separate processes. (Klick to open Explorer properties.).
/// Looks up a localized string similar to Folder windows doesn&apos;t run in separate processes. (Click to open Explorer properties.).
/// </summary>
public static string wox_plugin_windowwalker_ExplorerInfoSubTitle {
get {

View File

@ -22,7 +22,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
/// Return a list with all context menu entries for the given <see cref="Result"/>
/// <para>Symbols taken from <see href="https://learn.microsoft.com/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
/// </summary>
/// <param name="result">The result for the context menu entires</param>
/// <param name="result">The result for the context menu entries</param>
/// <param name="assemblyName">The name of the this assembly</param>
/// <returns>A list with context menu entries</returns>
internal static List<ContextMenuResult> GetContextMenu(Result result, string assemblyName)

View File

@ -15,7 +15,7 @@ using Microsoft.PowerToys.Run.Plugin.System.Properties;
namespace Microsoft.PowerToys.Run.Plugin.System.Components
{
/// <summary>
/// This class represents the informations for a network connection/interface
/// This class represents the information for a network connection/interface
/// </summary>
internal sealed class NetworkConnectionProperties
{

View File

@ -124,7 +124,7 @@ namespace Microsoft.PowerToys.Run.Plugin.System
// {
// results.Add(new Result()
// {
// Title = "Getting network informations. Please wait ...",
// Title = "Getting network information. Please wait ...",
// IcoPath = $"Images\\networkAdapter.{IconTheme}.png",
// Score = StringMatcher.FuzzySearch("address", "ip address").Score,
// });

View File

@ -59,7 +59,7 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.Components
if (isKeywordSearch || !TimeDateSettings.Instance.OnlyDateTimeNowGlobal)
{
// We use long instead of int for unix time stamp because int ist to small after 03:14:07 UTC 2038-01-19
// We use long instead of int for unix time stamp because int is too small after 03:14:07 UTC 2038-01-19
long unixTimestamp = (long)dateTimeNowUtc.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
int weekOfYear = calendar.GetWeekOfYear(dateTimeNow, DateTimeFormatInfo.CurrentInfo.CalendarWeekRule, DateTimeFormatInfo.CurrentInfo.FirstDayOfWeek);
string era = DateTimeFormatInfo.CurrentInfo.GetEraName(calendar.GetEra(dateTimeNow));

View File

@ -99,7 +99,7 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.Components
else if (Regex.IsMatch(input, @"^u\d+") && input.Length <= 12 && long.TryParse(input.TrimStart('u'), out long secondsInt))
{
// unix time stamp
// we use long instead of int because int ist to small after 03:14:07 UTC 2038-01-19
// we use long instead of int because int is too small after 03:14:07 UTC 2038-01-19
timestamp = new DateTime(1970, 1, 1).AddSeconds(secondsInt).ToLocalTime();
return true;
}

View File

@ -21,7 +21,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
/// Return a list with all context menu entries for the given <see cref="Result"/>
/// <para>Symbols taken from <see href="https://learn.microsoft.com/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
/// </summary>
/// <param name="result">The result for the context menu entires</param>
/// <param name="result">The result for the context menu entries</param>
/// <param name="assemblyName">The name of the this assembly</param>
/// <returns>A list with context menu entries</returns>
internal static List<ContextMenuResult> GetContextMenu(in Result result, in string assemblyName)

View File

@ -67,7 +67,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
/// <summary>
/// Add a tool-tip to the given <see cref="Result"/>, based o the given <see cref="IWindowsSetting"/>.
/// </summary>
/// <param name="entry">The <see cref="WindowsSetting"/> that contain informations for the tool-tip.</param>
/// <param name="entry">The <see cref="WindowsSetting"/> that contains information for the tool-tip.</param>
/// <param name="result">The <see cref="Result"/> that need a tool-tip.</param>
private static void AddOptionalToolTip(WindowsSetting entry, Result result)
{

View File

@ -214,7 +214,7 @@ namespace PowerLauncher.Helper
}
/// <summary>
/// Returns the variables for the specified target. Errors that occurs will be catched and logged.
/// Returns the variables for the specified target. Errors that occurs will be caught and logged.
/// </summary>
/// <param name="target">The target variable source of the type <see cref="EnvironmentVariableTarget"/> </param>
/// <returns>A dictionary with the variable or an empty dictionary on errors.</returns>

View File

@ -39,7 +39,7 @@ namespace PowerLauncher.Plugin
private static void ParsePluginConfigs(IEnumerable<string> directories)
{
// todo use linq when diable plugin is implemented since parallel.foreach + list is not thread saft
// todo use linq when disable plugin is implemented since parallel.foreach + list is not thread saft
foreach (var directory in directories)
{
if (File.Exists(Path.Combine(directory, "NeedDelete.txt")))

View File

@ -1059,7 +1059,6 @@ namespace PowerLauncher.ViewModel
{
if (contextMenuItems.AcceleratorKey == acceleratorKey && contextMenuItems.AcceleratorModifiers == acceleratorModifiers)
{
MainWindowVisibility = Visibility.Collapsed;
contextMenuItems.Command.Execute(null);
}
}

View File

@ -16,7 +16,7 @@ namespace Wox.Plugin.Common.VirtualDesktop.Helper
{
/// <summary>
/// Helper class to work with Virtual Desktops.
/// This helper uses only public available and documented COM-Interfaces or informations from registry.
/// This helper uses only public available and documented COM-Interfaces or information from registry.
/// </summary>
/// <remarks>
/// To use this helper you have to create an instance of it and access the method via the helper instance.

View File

@ -1077,7 +1077,7 @@ namespace Wox.Plugin.Common.Win32
/// <summary>
/// The window itself contains child windows that should take part in dialog box, navigation. If this
/// style is specified, the dialog manager recurses into children of this window when performing
/// navigation operations such as handling tha TAB key, an arrow key, or a keyboard mnemonic.
/// navigation operations such as handling the TAB key, an arrow key, or a keyboard mnemonic.
/// </summary>
WS_EX_CONTROLPARENT = 0x10000,

View File

@ -2,6 +2,9 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Globalization;
namespace Peek.Common.Helpers
{
public static class MathHelper
@ -10,5 +13,10 @@ namespace Peek.Common.Helpers
{
return a < 0 ? ((a % b) + b) % b : a % b;
}
public static int NumberOfDigits(int num)
{
return Math.Abs(num).ToString(CultureInfo.InvariantCulture).Length;
}
}
}

View File

@ -65,7 +65,7 @@ namespace Peek.Common.Helpers
/// </summary>
/// <param name="path">The file/folder path</param>
/// <param name="flags">The property store flags</param>
/// <returns>an IPropertyStroe interface</returns>
/// <returns>an IPropertyStore interface</returns>
private static DisposablePropertyStore GetPropertyStoreFromPath(string path, GETPROPERTYSTOREFLAGS flags = GETPROPERTYSTOREFLAGS.GPS_EXTRINSICPROPERTIES | GETPROPERTYSTOREFLAGS.GPS_BESTEFFORT)
{
IShellItem2? shellItem2 = null;

View File

@ -10,34 +10,40 @@ namespace Peek.Common.Helpers
{
public static class ReadableStringHelper
{
private const int DecimalPercision = 10;
private const int MaxDigitsToDisplay = 3;
private const int PowerFactor = 1024;
public static string BytesToReadableString(ulong bytes)
{
var resourceLoader = ResourceLoaderInstance.ResourceLoader;
List<string> format = new List<string>
{
(bytes == 1) ?
resourceLoader.GetString("ReadableString_ByteAbbreviationFormat") : // "byte"
resourceLoader.GetString("ReadableString_BytesAbbreviationFormat"), // "bytes"
resourceLoader.GetString("ReadableString_KiloByteAbbreviationFormat"), // "KB"
resourceLoader.GetString("ReadableString_MegaByteAbbreviationFormat"), // "MB"
resourceLoader.GetString("ReadableString_GigaByteAbbreviationFormat"), // "GB"
resourceLoader.GetString("ReadableString_TeraByteAbbreviationFormat"), // "TB"
resourceLoader.GetString("ReadableString_PetaByteAbbreviationFormat"), // "PB"
resourceLoader.GetString("ReadableString_ExaByteAbbreviationFormat"), // "EB"
};
string totalBytesDisplays = (bytes == 1) ?
ResourceLoaderInstance.ResourceLoader.GetString("ReadableString_ByteString") :
ResourceLoaderInstance.ResourceLoader.GetString("ReadableString_BytesString");
int index = 0;
double number = 0.0;
if (bytes > 0)
{
index = (int)Math.Floor(Math.Log(bytes) / Math.Log(1024));
number = Math.Round((bytes / Math.Pow(1024, index)) * DecimalPercision) / DecimalPercision;
index = (int)Math.Floor(Math.Log(bytes) / Math.Log(PowerFactor));
number = bytes / Math.Pow(PowerFactor, index);
}
return string.Format(CultureInfo.InvariantCulture, format[index], number);
if (index > 0 && number >= Math.Pow(10, MaxDigitsToDisplay))
{
index++;
number = bytes / Math.Pow(PowerFactor, index);
}
int precision = GetPrecision(index, number);
int decimalPrecision = (int)Math.Pow(10, precision);
number = Math.Truncate(number * decimalPrecision) / decimalPrecision;
string formatSpecifier = GetFormatSpecifierString(index, number, bytes, precision);
return bytes == 0
? string.Format(CultureInfo.CurrentCulture, formatSpecifier, number)
: string.Format(CultureInfo.CurrentCulture, formatSpecifier + totalBytesDisplays, number, bytes);
}
public static string FormatResourceString(string resourceId, object? args)
@ -55,5 +61,32 @@ namespace Peek.Common.Helpers
return formattedString;
}
public static int GetPrecision(int index, double number)
{
int numberOfDigits = MathHelper.NumberOfDigits((int)number);
return index == 0 ?
0 :
MaxDigitsToDisplay - numberOfDigits;
}
public static string GetFormatSpecifierString(int index, double number, ulong bytes, int precision)
{
var resourceLoader = ResourceLoaderInstance.ResourceLoader;
List<string> format = new List<string>
{
(bytes == 1) ?
resourceLoader.GetString("ReadableString_ByteAbbreviationFormat") : // "byte"
resourceLoader.GetString("ReadableString_BytesAbbreviationFormat"), // "bytes"
resourceLoader.GetString("ReadableString_KiloByteAbbreviationFormat"), // "KB"
resourceLoader.GetString("ReadableString_MegaByteAbbreviationFormat"), // "MB"
resourceLoader.GetString("ReadableString_GigaByteAbbreviationFormat"), // "GB"
resourceLoader.GetString("ReadableString_TeraByteAbbreviationFormat"), // "TB"
resourceLoader.GetString("ReadableString_PetaByteAbbreviationFormat"), // "PB"
resourceLoader.GetString("ReadableString_ExaByteAbbreviationFormat"), // "EB"
};
return "{0:F" + precision + "} " + format[index];
}
}
}

View File

@ -2,4 +2,9 @@
_SHCONTF
SIGDN
SHGDNF
SIATTRIBFLAGS
SIATTRIBFLAGS
IInitializeWithFile
IInitializeWithItem
IInitializeWithStream
IPreviewHandler
IPreviewHandlerVisuals

View File

@ -1,72 +1,63 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<!-- Licensed under the MIT License. See LICENSE in the project root for license information. -->
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<!-- Licensed under the MIT License. See LICENSE in the project root for license information. -->
<UserControl
x:Class="Peek.FilePreviewer.Controls.ArchiveControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Peek.FilePreviewer.Controls"
xmlns:converters="using:Peek.Common.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Peek.FilePreviewer.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="using:Peek.FilePreviewer.Previewers.Archives.Models"
xmlns:converters="using:Peek.Common.Converters"
mc:Ignorable="d">
<UserControl.Resources>
<DataTemplate
x:Key="DirectoryTemplate"
x:DataType="models:ArchiveItem">
<DataTemplate x:Key="DirectoryTemplate" x:DataType="models:ArchiveItem">
<TreeViewItem
AutomationProperties.Name="{x:Bind Name}"
ItemsSource="{x:Bind Children}"
IsExpanded="{x:Bind IsExpanded}">
IsExpanded="{x:Bind IsExpanded}"
ItemsSource="{x:Bind Children}">
<Grid ColumnSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Image
Grid.Column="0"
Width="16"
Height="16"
Grid.Column="0"
Source="{x:Bind Icon}" />
<TextBlock
Grid.Column="1"
Text="{x:Bind Name}" />
<TextBlock Grid.Column="1" Text="{x:Bind Name}" />
</Grid>
</TreeViewItem>
</DataTemplate>
<DataTemplate
x:Key="FileTemplate"
x:DataType="models:ArchiveItem">
<TreeViewItem
AutomationProperties.Name="{x:Bind Name}">
<Grid ColumnSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Image
Width="16"
Height="16"
Grid.Column="0"
Source="{x:Bind Icon}" />
<TextBlock
Grid.Column="1"
Text="{x:Bind Name}" />
<TextBlock
Grid.Column="2"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="{Binding Size, Converter={StaticResource BytesToStringConverter}}" />
</Grid>
</TreeViewItem>
</DataTemplate>
<models:ArchiveItemTemplateSelector
x:Key="ArchiveItemTemplateSelector"
DirectoryTemplate="{StaticResource DirectoryTemplate}"
FileTemplate="{StaticResource FileTemplate}" />
<DataTemplate x:Key="FileTemplate" x:DataType="models:ArchiveItem">
<TreeViewItem AutomationProperties.Name="{x:Bind Name}">
<Grid ColumnSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Image
Grid.Column="0"
Width="16"
Height="16"
Source="{x:Bind Icon}" />
<TextBlock Grid.Column="1" Text="{x:Bind Name}" />
<TextBlock
Grid.Column="2"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="{Binding Size, Converter={StaticResource BytesToStringConverter}}" />
</Grid>
</TreeViewItem>
</DataTemplate>
<models:ArchiveItemTemplateSelector
x:Key="ArchiveItemTemplateSelector"
DirectoryTemplate="{StaticResource DirectoryTemplate}"
FileTemplate="{StaticResource FileTemplate}" />
<converters:BytesToStringConverter x:Key="BytesToStringConverter" />
</UserControl.Resources>
@ -75,29 +66,25 @@
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<ScrollViewer
Grid.Row="0"
HorizontalScrollBarVisibility="Auto">
<ScrollViewer Grid.Row="0" HorizontalScrollBarVisibility="Auto">
<TreeView
x:Name="ArchivePreview"
ItemsSource="{x:Bind Source, Mode=OneWay}"
ItemTemplateSelector="{StaticResource ArchiveItemTemplateSelector}"
SelectionMode="None"
CanDragItems="False"
CanReorderItems="False"
CanDragItems="False" />
ItemTemplateSelector="{StaticResource ArchiveItemTemplateSelector}"
ItemsSource="{x:Bind Source, Mode=OneWay}"
SelectionMode="None" />
</ScrollViewer>
<Border
Grid.Row="1"
MinWidth="300"
Margin="16"
HorizontalAlignment="Center"
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="8"
Margin="16"
HorizontalAlignment="Center">
<Grid
ColumnSpacing="16"
Padding="16">
CornerRadius="8">
<Grid Padding="16" ColumnSpacing="16">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
@ -107,29 +94,29 @@
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
Text="{x:Bind DirectoryCount, Mode=OneWay}"
IsTextSelectionEnabled="True"
VerticalAlignment="Center"
IsTextSelectionEnabled="True"
Text="{x:Bind DirectoryCount, Mode=OneWay}"
TextWrapping="Wrap" />
<Border
Grid.Column="1"
BorderBrush="{ThemeResource TextFillColorPrimaryBrush}"
BorderThickness="0 0 1 0" />
BorderThickness="0,0,1,0" />
<TextBlock
Grid.Column="2"
Text="{x:Bind FileCount, Mode=OneWay}"
IsTextSelectionEnabled="True"
VerticalAlignment="Center"
IsTextSelectionEnabled="True"
Text="{x:Bind FileCount, Mode=OneWay}"
TextWrapping="Wrap" />
<Border
Grid.Column="3"
BorderBrush="{ThemeResource TextFillColorPrimaryBrush}"
BorderThickness="0 0 1 0" />
BorderThickness="0,0,1,0" />
<TextBlock
Grid.Column="4"
Text="{x:Bind Size, Mode=OneWay}"
IsTextSelectionEnabled="True"
VerticalAlignment="Center"
IsTextSelectionEnabled="True"
Text="{x:Bind Size, Mode=OneWay}"
TextWrapping="Wrap" />
</Grid>
</Border>

View File

@ -1,22 +1,22 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<!-- Licensed under the MIT License. See LICENSE in the project root for license information. -->
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<!-- Licensed under the MIT License. See LICENSE in the project root for license information. -->
<UserControl
x:Class="Peek.FilePreviewer.Controls.BrowserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Peek.FilePreviewer.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Peek.FilePreviewer.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
<controls:WebView2
x:Name="PreviewBrowser"
Loaded="PreviewWV2_Loaded"
NavigationStarting="PreviewBrowser_NavigationStarting"
NavigationCompleted="PreviewWV2_NavigationCompleted" />
NavigationCompleted="PreviewWV2_NavigationCompleted"
NavigationStarting="PreviewBrowser_NavigationStarting" />
<ContentDialog
x:Name="OpenUriDialog"
x:Uid="OpenUriDialog"

View File

@ -0,0 +1,17 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<!-- Licensed under the MIT License. See LICENSE in the project root for license information. -->
<UserControl
x:Class="Peek.FilePreviewer.Controls.ShellPreviewHandlerControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Peek.FilePreviewer.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Loaded="UserControl_Loaded"
EffectiveViewportChanged="UserControl_EffectiveViewportChanged"
IsEnabled="False" IsTabStop="True" GotFocus="UserControl_GotFocus"
ActualThemeChanged="{x:Bind UpdatePreviewerTheme}">
</UserControl>

View File

@ -0,0 +1,209 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.CompilerServices;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.UI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.Graphics.Gdi;
using Windows.Win32.UI.Shell;
using Windows.Win32.UI.WindowsAndMessaging;
namespace Peek.FilePreviewer.Controls
{
[INotifyPropertyChanged]
public unsafe sealed partial class ShellPreviewHandlerControl : UserControl
{
// Mica fallback colors
private static readonly COLORREF LightThemeBgColor = new(0x00f3f3f3);
private static readonly COLORREF DarkThemeBgColor = new(0x00202020);
private static readonly HBRUSH LightThemeBgBrush = PInvoke.CreateSolidBrush(LightThemeBgColor);
private static readonly HBRUSH DarkThemeBgBrush = PInvoke.CreateSolidBrush(DarkThemeBgColor);
[ObservableProperty]
private IPreviewHandler? source;
private HWND containerHwnd;
private WNDPROC containerWndProc;
private HBRUSH containerBgBrush;
private RECT controlRect;
public event EventHandler? HandlerLoaded;
public event EventHandler? HandlerError;
public static readonly DependencyProperty HandlerVisibilityProperty = DependencyProperty.Register(
nameof(HandlerVisibility),
typeof(Visibility),
typeof(ShellPreviewHandlerControl),
new PropertyMetadata(Visibility.Collapsed, new PropertyChangedCallback((d, e) => ((ShellPreviewHandlerControl)d).OnHandlerVisibilityChanged())));
// Must have its own visibility property so resize events can still fire
public Visibility HandlerVisibility
{
get { return (Visibility)GetValue(HandlerVisibilityProperty); }
set { SetValue(HandlerVisibilityProperty, value); }
}
public ShellPreviewHandlerControl()
{
InitializeComponent();
containerWndProc = ContainerWndProc;
}
partial void OnSourceChanged(IPreviewHandler? value)
{
if (Source != null)
{
UpdatePreviewerTheme();
try
{
// Attach the preview handler to the container window
Source.SetWindow(containerHwnd, (RECT*)Unsafe.AsPointer(ref controlRect));
Source.DoPreview();
HandlerLoaded?.Invoke(this, EventArgs.Empty);
}
catch
{
HandlerError?.Invoke(this, EventArgs.Empty);
}
}
}
private void OnHandlerVisibilityChanged()
{
if (HandlerVisibility == Visibility.Visible)
{
PInvoke.ShowWindow(containerHwnd, SHOW_WINDOW_CMD.SW_SHOW);
IsEnabled = true;
// Clears the background from the last previewer
// The brush can only be drawn here because flashes will occur during resize
PInvoke.SetClassLongPtr(containerHwnd, GET_CLASS_LONG_INDEX.GCLP_HBRBACKGROUND, containerBgBrush);
PInvoke.UpdateWindow(containerHwnd);
PInvoke.SetClassLongPtr(containerHwnd, GET_CLASS_LONG_INDEX.GCLP_HBRBACKGROUND, IntPtr.Zero);
PInvoke.InvalidateRect(containerHwnd, (RECT*)null, true);
}
else
{
PInvoke.ShowWindow(containerHwnd, SHOW_WINDOW_CMD.SW_HIDE);
IsEnabled = false;
}
}
private void UpdatePreviewerTheme()
{
COLORREF bgColor, fgColor;
switch (ActualTheme)
{
case ElementTheme.Light:
bgColor = LightThemeBgColor;
fgColor = new COLORREF(0x00000000); // Black
containerBgBrush = LightThemeBgBrush;
break;
case ElementTheme.Dark:
default:
bgColor = DarkThemeBgColor;
fgColor = new COLORREF(0x00FFFFFF); // White
containerBgBrush = DarkThemeBgBrush;
break;
}
if (Source is IPreviewHandlerVisuals visuals)
{
visuals.SetBackgroundColor(bgColor);
visuals.SetTextColor(fgColor);
// Changing the previewer colors might not always redraw itself
PInvoke.InvalidateRect(containerHwnd, (RECT*)null, true);
}
}
private LRESULT ContainerWndProc(HWND hWnd, uint msg, WPARAM wParam, LPARAM lParam)
{
// Here for future use :)
return PInvoke.DefWindowProc(hWnd, msg, wParam, lParam);
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
fixed (char* pContainerClassName = "PeekShellPreviewHandlerContainer")
{
PInvoke.RegisterClass(new WNDCLASSW()
{
lpfnWndProc = containerWndProc,
lpszClassName = pContainerClassName,
});
// Create the container window to host the preview handler
containerHwnd = PInvoke.CreateWindowEx(
WINDOW_EX_STYLE.WS_EX_LAYERED,
pContainerClassName,
null,
WINDOW_STYLE.WS_CHILD,
0, // X
0, // Y
0, // Width
0, // Height
(HWND)Win32Interop.GetWindowFromWindowId(XamlRoot.ContentIslandEnvironment.AppWindowId), // Peek UI window
HMENU.Null,
HINSTANCE.Null);
// Allows the preview handlers to display properly
PInvoke.SetLayeredWindowAttributes(containerHwnd, default, byte.MaxValue, LAYERED_WINDOW_ATTRIBUTES_FLAGS.LWA_ALPHA);
}
}
private void UserControl_EffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
{
var dpi = (float)PInvoke.GetDpiForWindow(containerHwnd) / 96;
// Resize the container window
PInvoke.SetWindowPos(
containerHwnd,
(HWND)0, // HWND_TOP
(int)(Math.Abs(args.EffectiveViewport.X) * dpi),
(int)(Math.Abs(args.EffectiveViewport.Y) * dpi),
(int)(ActualWidth * dpi),
(int)(ActualHeight * dpi),
SET_WINDOW_POS_FLAGS.SWP_NOACTIVATE);
// Resize the preview handler window
controlRect.right = (int)(ActualWidth * dpi);
controlRect.bottom = (int)(ActualHeight * dpi);
try
{
Source?.SetRect((RECT*)Unsafe.AsPointer(ref controlRect));
}
catch
{
}
// Resizing the previewer might not always redraw itself
PInvoke.InvalidateRect(containerHwnd, (RECT*)null, false);
}
private void UserControl_GotFocus(object sender, RoutedEventArgs e)
{
try
{
Source?.SetFocus();
}
catch
{
}
}
}
}

View File

@ -1,4 +1,4 @@
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
<!-- Licensed under the MIT License. -->
<UserControl
@ -34,18 +34,18 @@
Text="{x:Bind Source.FileName, Mode=OneWay}"
TextTrimming="CharacterEllipsis">
<ToolTipService.ToolTip>
<ToolTip Content="{x:Bind Source.FileName, Mode=OneWay}"/>
<ToolTip Content="{x:Bind Source.FileName, Mode=OneWay}" />
</ToolTipService.ToolTip>
</TextBlock>
<TextBlock Text="{x:Bind FormatFileType(Source.FileType), Mode=OneWay}">
<ToolTipService.ToolTip>
<ToolTip Content="{x:Bind FormatFileType(Source.FileType), Mode=OneWay}"/>
<ToolTip Content="{x:Bind FormatFileType(Source.FileType), Mode=OneWay}" />
</ToolTipService.ToolTip>
</TextBlock>
<TextBlock Text="{x:Bind FormatFileSize(Source.FileSize), Mode=OneWay}"/>
<TextBlock Text="{x:Bind FormatFileSize(Source.FileSize), Mode=OneWay}" />
<TextBlock Text="{x:Bind FormatFileDateModified(Source.DateModified), Mode=OneWay}">
<ToolTipService.ToolTip>
<ToolTip Content="{x:Bind FormatFileDateModified(Source.DateModified), Mode=OneWay}"/>
<ToolTip Content="{x:Bind FormatFileDateModified(Source.DateModified), Mode=OneWay}" />
</ToolTipService.ToolTip>
</TextBlock>
</StackPanel>

View File

@ -18,6 +18,13 @@
VerticalAlignment="Center"
IsActive="{x:Bind MatchPreviewState(Previewer.State, previewers:PreviewState.Loading), Mode=OneWay}" />
<controls:ShellPreviewHandlerControl
x:Name="ShellPreviewHandlerPreview"
Source="{x:Bind ShellPreviewHandlerPreviewer.Preview, Mode=OneWay}"
HandlerVisibility="{x:Bind IsPreviewVisible(ShellPreviewHandlerPreviewer, Previewer.State), Mode=OneWay}"
HandlerLoaded="ShellPreviewHandlerPreview_HandlerLoaded"
HandlerError="ShellPreviewHandlerPreview_HandlerError" />
<Image
x:Name="ImagePreview"
MaxWidth="{x:Bind ImagePreviewer.MaxImageSize.Width, Mode=OneWay}"
@ -53,13 +60,13 @@
<controls:ArchiveControl
x:Name="ArchivePreview"
LoadingState="{x:Bind ArchivePreviewer.State, Mode=OneWay}"
Source="{x:Bind ArchivePreviewer.Tree, Mode=OneWay}"
FileCount="{x:Bind ArchivePreviewer.FileCountText, Mode=OneWay}"
DirectoryCount="{x:Bind ArchivePreviewer.DirectoryCountText, Mode=OneWay}"
FileCount="{x:Bind ArchivePreviewer.FileCountText, Mode=OneWay}"
LoadingState="{x:Bind ArchivePreviewer.State, Mode=OneWay}"
Size="{x:Bind ArchivePreviewer.SizeText, Mode=OneWay}"
Source="{x:Bind ArchivePreviewer.Tree, Mode=OneWay}"
Visibility="{x:Bind IsPreviewVisible(ArchivePreviewer, Previewer.State), Mode=OneWay}" />
<controls:UnsupportedFilePreview
x:Name="UnsupportedFilePreview"
LoadingState="{x:Bind UnsupportedFilePreviewer.State, Mode=OneWay}"

View File

@ -49,6 +49,7 @@ namespace Peek.FilePreviewer
[NotifyPropertyChangedFor(nameof(VideoPreviewer))]
[NotifyPropertyChangedFor(nameof(BrowserPreviewer))]
[NotifyPropertyChangedFor(nameof(ArchivePreviewer))]
[NotifyPropertyChangedFor(nameof(ShellPreviewHandlerPreviewer))]
[NotifyPropertyChangedFor(nameof(UnsupportedFilePreviewer))]
private IPreviewer? previewer;
@ -96,6 +97,8 @@ namespace Peek.FilePreviewer
public IArchivePreviewer? ArchivePreviewer => Previewer as IArchivePreviewer;
public IShellPreviewHandlerPreviewer? ShellPreviewHandlerPreviewer => Previewer as IShellPreviewHandlerPreviewer;
public IUnsupportedFilePreviewer? UnsupportedFilePreviewer => Previewer as IUnsupportedFilePreviewer;
public IFileSystemItem Item
@ -220,6 +223,9 @@ namespace Peek.FilePreviewer
ArchivePreview.Source = null;
BrowserPreview.Source = null;
ShellPreviewHandlerPreviewer?.Clear();
ShellPreviewHandlerPreview.Source = null;
if (Previewer != null)
{
Previewer.PropertyChanged -= Previewer_PropertyChanged;
@ -268,6 +274,22 @@ namespace Peek.FilePreviewer
}
}
private void ShellPreviewHandlerPreview_HandlerLoaded(object sender, EventArgs e)
{
if (ShellPreviewHandlerPreviewer != null)
{
ShellPreviewHandlerPreviewer.State = PreviewState.Loaded;
}
}
private void ShellPreviewHandlerPreview_HandlerError(object sender, EventArgs e)
{
if (ShellPreviewHandlerPreviewer != null)
{
ShellPreviewHandlerPreviewer.State = PreviewState.Error;
}
}
private async void KeyboardAccelerator_CtrlC_Invoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
{
if (Previewer != null)

View File

@ -0,0 +1,4 @@
{
"$schema": "https://aka.ms/CsWin32.schema.json",
"public": false
}

View File

@ -0,0 +1,14 @@
IClassFactory
CoGetClassObject
CreateSolidBrush
CreateWindowEx
DefWindowProc
GetDpiForWindow
InvalidateRect
RegisterClass
SetClassLongPtr
SetLayeredWindowAttributes
SetWindowPos
ShowWindow
UpdateWindow
SHCreateItemFromParsingName

View File

@ -8,6 +8,7 @@
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<UseWinUI>true</UseWinUI>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<PRIResource Include="..\Peek.UI\Strings\en-US\Resources.resw" Link="Strings\en-US\Resources.resw">
@ -17,6 +18,7 @@
<ItemGroup>
<None Remove="Controls\ArchiveControl.xaml" />
<None Remove="Controls\BrowserControl.xaml" />
<None Remove="Controls\ShellPreviewHandlerControl.xaml" />
<None Remove="Controls\UnsupportedFilePreview\FailedFallbackPreviewControl.xaml" />
<None Remove="Controls\UnsupportedFilePreview\InformationalPreviewControl.xaml" />
<None Remove="FilePreview.xaml" />
@ -29,6 +31,10 @@
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
<PackageReference Include="SharpCompress" />
<PackageReference Include="System.Drawing.Common" />
<PackageReference Include="Microsoft.Windows.CsWin32">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
@ -38,6 +44,12 @@
<ProjectReference Include="..\Peek.Common\Peek.Common.csproj" />
</ItemGroup>
<ItemGroup>
<Page Update="Controls\ShellPreviewHandlerControl.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Controls\ArchiveControl.xaml">
<Generator>MSBuild:Compile</Generator>

View File

@ -0,0 +1,15 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Windows.Win32.UI.Shell;
namespace Peek.FilePreviewer.Previewers
{
public interface IShellPreviewHandlerPreviewer : IPreviewer
{
public IPreviewHandler? Preview { get; }
public void Clear();
}
}

View File

@ -29,6 +29,10 @@ namespace Peek.FilePreviewer.Previewers
{
return new ArchivePreviewer(file);
}
else if (ShellPreviewHandlerPreviewer.IsFileTypeSupported(file.Extension))
{
return new ShellPreviewHandlerPreviewer(file);
}
// Other previewer types check their supported file types here
return CreateDefaultPreviewer(file);

View File

@ -0,0 +1,104 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
using System.Runtime.InteropServices;
using Windows.Win32.Foundation;
using Windows.Win32.System.Com;
namespace Peek.FilePreviewer.Previewers.Helpers
{
public unsafe class IStreamWrapper : IStream
{
public Stream Stream { get; }
public IStreamWrapper(Stream stream) => Stream = stream;
public HRESULT Read(void* pv, uint cb, [Optional] uint* pcbRead)
{
try
{
int read = Stream.Read(new Span<byte>(pv, (int)cb));
if (pcbRead != null)
{
*pcbRead = (uint)read;
}
return (HRESULT)0;
}
catch (Exception ex)
{
return (HRESULT)Marshal.GetHRForException(ex);
}
}
public HRESULT Write(void* pv, uint cb, [Optional] uint* pcbWritten)
{
try
{
Stream.Write(new ReadOnlySpan<byte>(pv, (int)cb));
if (pcbWritten != null)
{
*pcbWritten = cb;
}
return (HRESULT)0;
}
catch (Exception ex)
{
return (HRESULT)Marshal.GetHRForException(ex);
}
}
public void Seek(long dlibMove, STREAM_SEEK dwOrigin, [Optional] ulong* plibNewPosition)
{
long position = Stream.Seek(dlibMove, (SeekOrigin)dwOrigin);
if (plibNewPosition != null)
{
*plibNewPosition = (ulong)position;
}
}
public void SetSize(ulong libNewSize)
{
Stream.SetLength((long)libNewSize);
}
public void CopyTo(IStream pstm, ulong cb, [Optional] ulong* pcbRead, [Optional] ulong* pcbWritten)
{
throw new NotSupportedException();
}
public void Commit(STGC grfCommitFlags)
{
throw new NotSupportedException();
}
public void Revert()
{
throw new NotSupportedException();
}
public void LockRegion(ulong libOffset, ulong cb, uint dwLockType)
{
throw new NotSupportedException();
}
public void UnlockRegion(ulong libOffset, ulong cb, uint dwLockType)
{
throw new NotSupportedException();
}
public void Stat(STATSTG* pstatstg, uint grfStatFlag)
{
throw new NotSupportedException();
}
public void Clone(out IStream ppstm)
{
throw new NotSupportedException();
}
}
}

View File

@ -0,0 +1,237 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.UI.Dispatching;
using Microsoft.Win32;
using Peek.Common.Extensions;
using Peek.Common.Helpers;
using Peek.Common.Models;
using Peek.FilePreviewer.Models;
using Peek.FilePreviewer.Previewers.Helpers;
using Windows.Win32;
using Windows.Win32.System.Com;
using Windows.Win32.UI.Shell;
using Windows.Win32.UI.Shell.PropertiesSystem;
using IShellItem = Windows.Win32.UI.Shell.IShellItem;
namespace Peek.FilePreviewer.Previewers
{
public partial class ShellPreviewHandlerPreviewer : ObservableObject, IShellPreviewHandlerPreviewer, IDisposable
{
private static readonly ConcurrentDictionary<Guid, IClassFactory> HandlerFactories = new();
[ObservableProperty]
private IPreviewHandler? preview;
[ObservableProperty]
private PreviewState state;
private Stream? fileStream;
public ShellPreviewHandlerPreviewer(IFileSystemItem file)
{
FileItem = file;
Dispatcher = DispatcherQueue.GetForCurrentThread();
}
private IFileSystemItem FileItem { get; }
private DispatcherQueue Dispatcher { get; }
public void Dispose()
{
Clear();
GC.SuppressFinalize(this);
}
public async Task CopyAsync()
{
await Dispatcher.RunOnUiThread(async () =>
{
var storageItem = await FileItem.GetStorageItemAsync();
ClipboardHelper.SaveToClipboard(storageItem);
});
}
public Task<PreviewSize> GetPreviewSizeAsync(CancellationToken cancellationToken)
{
return Task.FromResult(new PreviewSize { MonitorSize = null });
}
public async Task LoadPreviewAsync(CancellationToken cancellationToken)
{
Clear();
State = PreviewState.Loading;
cancellationToken.ThrowIfCancellationRequested();
// Create the preview handler
var previewHandler = await Task.Run(() =>
{
var previewHandlerGuid = GetPreviewHandlerGuid(FileItem.Extension);
if (!string.IsNullOrEmpty(previewHandlerGuid))
{
var clsid = Guid.Parse(previewHandlerGuid);
bool retry = false;
do
{
unsafe
{
// This runs the preview handler in a separate process (prevhost.exe)
// TODO: Figure out how to get it to run in a low integrity level
if (!HandlerFactories.TryGetValue(clsid, out var factory))
{
var hr = PInvoke.CoGetClassObject(clsid, CLSCTX.CLSCTX_LOCAL_SERVER, null, typeof(IClassFactory).GUID, out var pFactory);
Marshal.ThrowExceptionForHR(hr);
// Storing the factory in memory helps makes the handlers load faster
// TODO: Maybe free them after some inactivity or when Peek quits?
factory = (IClassFactory)Marshal.GetObjectForIUnknown((IntPtr)pFactory);
factory.LockServer(true);
HandlerFactories.AddOrUpdate(clsid, factory, (_, _) => factory);
}
try
{
var iid = typeof(IPreviewHandler).GUID;
factory.CreateInstance(null, &iid, out var instance);
return instance as IPreviewHandler;
}
catch
{
if (!retry)
{
// Process is probably dead, attempt to get the factory again (once)
HandlerFactories.TryRemove(new(clsid, factory));
retry = true;
}
else
{
break;
}
}
}
}
while (retry);
}
return null;
});
if (previewHandler == null)
{
State = PreviewState.Error;
return;
}
cancellationToken.ThrowIfCancellationRequested();
// Initialize the preview handler with the selected file
bool success = await Task.Run(() =>
{
const uint STGM_READ = 0x00000000;
if (previewHandler is IInitializeWithStream initWithStream)
{
fileStream = File.OpenRead(FileItem.Path);
initWithStream.Initialize(new IStreamWrapper(fileStream), STGM_READ);
}
else if (previewHandler is IInitializeWithItem initWithItem)
{
var hr = PInvoke.SHCreateItemFromParsingName(FileItem.Path, null, typeof(IShellItem).GUID, out var item);
Marshal.ThrowExceptionForHR(hr);
initWithItem.Initialize((IShellItem)item, STGM_READ);
}
else if (previewHandler is IInitializeWithFile initWithFile)
{
unsafe
{
fixed (char* pPath = FileItem.Path)
{
initWithFile.Initialize(pPath, STGM_READ);
}
}
}
else
{
// Handler is missing the required interfaces
return false;
}
return true;
});
if (!success)
{
State = PreviewState.Error;
return;
}
cancellationToken.ThrowIfCancellationRequested();
// Preview.SetWindow() needs to be set in the control
Preview = previewHandler;
}
public void Clear()
{
if (Preview != null)
{
try
{
Preview.Unload();
Marshal.FinalReleaseComObject(Preview);
}
catch
{
}
Preview = null;
}
if (fileStream != null)
{
fileStream.Dispose();
fileStream = null;
}
}
public static bool IsFileTypeSupported(string fileExt)
{
return !string.IsNullOrEmpty(GetPreviewHandlerGuid(fileExt));
}
private static string? GetPreviewHandlerGuid(string fileExt)
{
const string PreviewHandlerKeyPath = "shellex\\{8895b1c6-b41f-4c1c-a562-0d564250836f}";
// Search by file extension
using var classExtensionKey = Registry.ClassesRoot.OpenSubKey(fileExt);
using var classExtensionPreviewHandlerKey = classExtensionKey?.OpenSubKey(PreviewHandlerKeyPath);
if (classExtensionKey != null && classExtensionPreviewHandlerKey == null)
{
// Search by file class
var className = classExtensionKey.GetValue(null) as string;
if (!string.IsNullOrEmpty(className))
{
using var classKey = Registry.ClassesRoot.OpenSubKey(className);
using var classPreviewHandlerKey = classKey?.OpenSubKey(PreviewHandlerKeyPath);
return classPreviewHandlerKey?.GetValue(null) as string;
}
}
return classExtensionPreviewHandlerKey?.GetValue(null) as string;
}
}
}

View File

@ -1,5 +1,5 @@
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
<!-- Licensed under the MIT License. -->
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
<!-- Licensed under the MIT License. -->
<Application
x:Class="Peek.UI.App"
@ -10,9 +10,9 @@
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@ -1,4 +1,4 @@
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
<!-- Licensed under the MIT License. -->
<UserControl
@ -7,8 +7,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Peek.UI.Views"
FlowDirection="{x:Bind TitleBarFlowDirection, Mode=OneWay}"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FlowDirection="{x:Bind TitleBarFlowDirection, Mode=OneWay}"
mc:Ignorable="d">
<Grid x:Name="TitleBarRootContainer" Height="48">

View File

@ -154,31 +154,31 @@
<comment>Date Modified label for the unsupported files view. {0} is the date.</comment>
</data>
<data name="ReadableString_ByteAbbreviationFormat" xml:space="preserve">
<value>{0} byte</value>
<value>byte</value>
<comment>Abbreviation for the size unit byte.</comment>
</data>
<data name="ReadableString_KiloByteAbbreviationFormat" xml:space="preserve">
<value>{0} KB</value>
<value>KB</value>
<comment>Abbreviation for the size unit kilobyte.</comment>
</data>
<data name="ReadableString_MegaByteAbbreviationFormat" xml:space="preserve">
<value>{0} MB</value>
<value>MB</value>
<comment>Abbreviation for the size unit megabyte.</comment>
</data>
<data name="ReadableString_GigaByteAbbreviationFormat" xml:space="preserve">
<value>{0} GB</value>
<value>GB</value>
<comment>Abbreviation for the size unit gigabyte.</comment>
</data>
<data name="ReadableString_TeraByteAbbreviationFormat" xml:space="preserve">
<value>{0} TB</value>
<value>TB</value>
<comment>Abbreviation for the size unit terabyte.</comment>
</data>
<data name="ReadableString_PetaByteAbbreviationFormat" xml:space="preserve">
<value>{0} PB</value>
<value>PB</value>
<comment>Abbreviation for the size unit petabyte.</comment>
</data>
<data name="ReadableString_ExaByteAbbreviationFormat" xml:space="preserve">
<value>{0} EB</value>
<value>EB</value>
<comment>Abbreviation for the size unit exabyte.</comment>
</data>
<data name="PreviewTooltip_FileName" xml:space="preserve">
@ -234,7 +234,7 @@
<comment>{0} is the size of the archive, {1} is the extracted size</comment>
</data>
<data name="ReadableString_BytesAbbreviationFormat" xml:space="preserve">
<value>{0} bytes</value>
<value>bytes</value>
<comment>Abbreviation for the size bytes</comment>
</data>
<data name="OpenUriDialog.CloseButtonText" xml:space="preserve">
@ -253,4 +253,12 @@
<value>Do you want Peek to open the external application?</value>
<comment>Title of the dialog showed when an URI is clicked,"Peek" is the name of the utility. </comment>
</data>
<data name="ReadableString_BytesString" xml:space="preserve">
<value> ({1:N0} bytes)</value>
<comment>Displays total number of bytes. Don't localize the "{1:N0}" part.</comment>
</data>
<data name="ReadableString_ByteString" xml:space="preserve">
<value> ({1:N0} byte)</value>
<comment>Displays unit byte. Don't localize the "{1:N0}" part.</comment>
</data>
</root>

View File

@ -77,7 +77,7 @@ namespace PowerAccent.Core
Language.SR => GetDefaultLetterKeySR(letter), // Serbian
Language.SV => GetDefaultLetterKeySV(letter), // Swedish
Language.TK => GetDefaultLetterKeyTK(letter), // Turkish
_ => throw new ArgumentException("The language {0} is not know in this context", lang.ToString()),
_ => throw new ArgumentException("The language {0} is not known in this context", lang.ToString()),
};
}
@ -131,27 +131,27 @@ namespace PowerAccent.Core
{
return letter switch
{
LetterKey.VK_A => new[] { "α", "ȧ" },
LetterKey.VK_A => new[] { "α", "ά", "ȧ" },
LetterKey.VK_B => new[] { "ḃ", "β" },
LetterKey.VK_C => new[] { "ċ", "χ", "°C", "©", "" },
LetterKey.VK_D => new[] { "ḍ", "ḋ", "δ" },
LetterKey.VK_E => new[] { "ε", "η", "∈" },
LetterKey.VK_E => new[] { "ε", "έ", "η", ", "∈" },
LetterKey.VK_F => new[] { "ḟ", "°F" },
LetterKey.VK_G => new[] { "ģ", "ǧ", "ġ", "ĝ", "ǥ", "γ" },
LetterKey.VK_H => new[] { "ḣ", "ĥ", "ħ" },
LetterKey.VK_I => new[] { "ι" },
LetterKey.VK_I => new[] { "ι", "ί" },
LetterKey.VK_J => new[] { "ĵ" },
LetterKey.VK_K => new[] { "ķ", "ǩ", "κ" },
LetterKey.VK_L => new[] { "ļ", "₺", "λ" }, // ₺ is in VK_T for other languages, but not VK_L, so we add it here.
LetterKey.VK_M => new[] { "ṁ", "μ" },
LetterKey.VK_N => new[] { "ņ", "ṅ", "ⁿ", "ν", "" },
LetterKey.VK_O => new[] { "ȯ", "ω", "ο" },
LetterKey.VK_O => new[] { "ȯ", "ω", "ώ", "ο", " },
LetterKey.VK_P => new[] { "ṗ", "φ", "ψ", "℗" },
LetterKey.VK_Q => new[] { "" },
LetterKey.VK_R => new[] { "ṙ", "ρ", "®", "" },
LetterKey.VK_S => new[] { "ṡ", "σ", "\u00A7" },
LetterKey.VK_T => new[] { "ţ", "ṫ", "ŧ", "θ", "τ", "™" },
LetterKey.VK_U => new[] { "ŭ", "υ" },
LetterKey.VK_U => new[] { "ŭ", "υ", "ύ" },
LetterKey.VK_V => new[] { "V̇" },
LetterKey.VK_W => new[] { "ẇ" },
LetterKey.VK_X => new[] { "ẋ", "ξ", "×" },
@ -260,7 +260,9 @@ namespace PowerAccent.Core
{
LetterKey.VK_A => new[] { "á" },
LetterKey.VK_E => new[] { "é", "€" },
LetterKey.VK_H => new[] { "ḥ" },
LetterKey.VK_I => new[] { "í" },
LetterKey.VK_L => new[] { "ḷ" },
LetterKey.VK_N => new[] { "ñ" },
LetterKey.VK_O => new[] { "ó" },
LetterKey.VK_U => new[] { "ú", "ü" },

View File

@ -113,9 +113,6 @@
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\common\version\version.vcxproj">
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="PowerAccentKeyboardService.rc" />

View File

@ -1,3 +1,6 @@
// IVectorView and IObservableVector define members with the same name, and we must support both interfaces
midl_pragma warning(disable : 4066)
namespace PowerRenameUI
{
[default_interface] runtimeclass ExplorerItemsSource :

View File

@ -193,9 +193,6 @@
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\common\version\version.vcxproj">
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
</ProjectReference>
<ProjectReference Include="..\lib\PowerRenameLib.vcxproj">
<Project>{51920f1f-c28c-4adf-8660-4238766796c2}</Project>
</ProjectReference>

View File

@ -34,7 +34,6 @@
x:Name="RootGrid"
Background="{ThemeResource AccentButtonBackground}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid.Resources>
<!-- Override the style of the inner buttons so that they don't affect background/foreground/border colors -->
<Style TargetType="Button">
@ -52,6 +51,18 @@
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="RootGrid" Background="Transparent">
<ContentPresenter
x:Name="ContentPresenter"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
AnimatedIcon.State="Normal"
AutomationProperties.AccessibilityView="Raw"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTransitions="{TemplateBinding ContentTransitions}" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
@ -75,19 +86,6 @@
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter
x:Name="ContentPresenter"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
AnimatedIcon.State="Normal"
AutomationProperties.AccessibilityView="Raw"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTransitions="{TemplateBinding ContentTransitions}" />
</Grid>
</ControlTemplate>
</Setter.Value>
@ -104,6 +102,85 @@
<ColumnDefinition x:Name="SecondaryButtonColumn" Width="{ThemeResource SplitButtonSecondaryButtonSize}" />
</Grid.ColumnDefinitions>
<Grid
x:Name="PrimaryBackgroundGrid"
Grid.ColumnSpan="2"
Background="{TemplateBinding Background}" />
<Grid
x:Name="DividerBackgroundGrid"
Grid.Column="1"
Width="1"
Background="{ThemeResource AccentButtonBorderBrush}" />
<Grid
x:Name="SecondaryBackgroundGrid"
Grid.Column="2"
Background="{TemplateBinding Background}" />
<Grid
x:Name="Border"
Grid.ColumnSpan="3"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" />
<Button
x:Name="PrimaryButton"
Grid.Column="0"
Padding="{TemplateBinding Padding}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
AutomationProperties.AccessibilityView="Raw"
Background="{TemplateBinding Background}"
BorderBrush="Transparent"
BorderThickness="0"
Command="{TemplateBinding Command}"
CommandParameter="{TemplateBinding CommandParameter}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTransitions="{TemplateBinding ContentTransitions}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
IsTabStop="False" />
<Button
x:Name="SecondaryButton"
Grid.Column="2"
Padding="0,0,12,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
AutomationProperties.AccessibilityView="Raw"
Background="{TemplateBinding Background}"
BorderBrush="Transparent"
BorderThickness="0"
Foreground="{ThemeResource AccentButtonForeground}"
IsTabStop="False">
<Button.Content>
<AnimatedIcon
Width="12"
Height="12"
HorizontalAlignment="Right"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw">
<animatedVisuals:AnimatedChevronDownSmallVisualSource />
<AnimatedIcon.FallbackIconSource>
<FontIconSource
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="8"
Glyph="&#xE96E;"
IsTextScaleFactorEnabled="False" />
</AnimatedIcon.FallbackIconSource>
</AnimatedIcon>
</Button.Content>
</Button>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
@ -251,85 +328,6 @@
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid
x:Name="PrimaryBackgroundGrid"
Grid.ColumnSpan="2"
Background="{TemplateBinding Background}" />
<Grid
x:Name="DividerBackgroundGrid"
Grid.Column="1"
Width="1"
Background="{ThemeResource AccentButtonBorderBrush}" />
<Grid
x:Name="SecondaryBackgroundGrid"
Grid.Column="2"
Background="{TemplateBinding Background}" />
<Grid
x:Name="Border"
Grid.ColumnSpan="3"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" />
<Button
x:Name="PrimaryButton"
Grid.Column="0"
Padding="{TemplateBinding Padding}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
AutomationProperties.AccessibilityView="Raw"
Background="{TemplateBinding Background}"
BorderBrush="Transparent"
BorderThickness="0"
Command="{TemplateBinding Command}"
CommandParameter="{TemplateBinding CommandParameter}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTransitions="{TemplateBinding ContentTransitions}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
IsTabStop="False" />
<Button
x:Name="SecondaryButton"
Grid.Column="2"
Padding="0,0,12,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
AutomationProperties.AccessibilityView="Raw"
Background="{TemplateBinding Background}"
BorderBrush="Transparent"
BorderThickness="0"
Foreground="{ThemeResource AccentButtonForeground}"
IsTabStop="False">
<Button.Content>
<AnimatedIcon
Width="12"
Height="12"
HorizontalAlignment="Right"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw">
<animatedVisuals:AnimatedChevronDownSmallVisualSource />
<AnimatedIcon.FallbackIconSource>
<FontIconSource
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="8"
Glyph="&#xE96E;"
IsTextScaleFactorEnabled="False" />
</AnimatedIcon.FallbackIconSource>
</AnimatedIcon>
</Button.Content>
</Button>
</Grid>
</ControlTemplate>
</Setter.Value>
@ -371,6 +369,16 @@
BorderBrush="{ThemeResource TextControlButtonBorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{ThemeResource ControlCornerRadius}">
<TextBlock
x:Name="GlyphElement"
HorizontalAlignment="Center"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="{ThemeResource AutoSuggestBoxIconFontSize}"
FontStyle="Normal"
Foreground="{ThemeResource TextControlButtonForeground}"
Text="&#xe894;" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
@ -414,16 +422,6 @@
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<TextBlock
x:Name="GlyphElement"
HorizontalAlignment="Center"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="{ThemeResource AutoSuggestBoxIconFontSize}"
FontStyle="Normal"
Foreground="{ThemeResource TextControlButtonForeground}"
Text="&#xe894;" />
</Grid>
</ControlTemplate>
</Setter.Value>
@ -518,92 +516,6 @@
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlHeaderForegroundDisabled}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundDisabled}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushDisabled}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundDisabled}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundDisabled}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Focused">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundFocused}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundFocused}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushFocused}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderThickness">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderThemeThicknessFocused}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundFocused}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="QueryButton" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForeground}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="ButtonStates">
<VisualState x:Name="ButtonVisible">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="ButtonCollapsed" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border
x:Name="BorderElement"
Grid.Row="1"
@ -692,6 +604,91 @@
Content="{TemplateBinding Description}"
Foreground="{ThemeResource SystemControlDescriptionTextForegroundBrush}" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlHeaderForegroundDisabled}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundDisabled}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushDisabled}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundDisabled}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundDisabled}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Focused">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundFocused}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundFocused}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushFocused}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderThickness">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderThemeThicknessFocused}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundFocused}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="QueryButton" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForeground}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="ButtonStates">
<VisualState x:Name="ButtonVisible">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="ButtonCollapsed" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
@ -719,7 +716,6 @@
<Setter.Value>
<ControlTemplate TargetType="AutoSuggestBox">
<Grid x:Name="LayoutRoot">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
@ -728,14 +724,6 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="Orientation">
<VisualState x:Name="Landscape" />
<VisualState x:Name="Portrait" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<TextBox
x:Name="TextBox"
Width="{TemplateBinding Width}"
@ -781,6 +769,13 @@
</Border>
</Popup>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="Orientation">
<VisualState x:Name="Landscape" />
<VisualState x:Name="Portrait" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>

View File

@ -17,27 +17,6 @@
<!-- Error tooltip -->
</Grid.ColumnDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Highlight">
<VisualState.Setters>
<Setter Target="HighlightBorder.Opacity" Value="0.1" />
<Setter Target="HighlightBorder.BorderBrush" Value="{ThemeResource AccentTextFillColorPrimaryBrush}" />
<Setter Target="HighlightBorder.Background" Value="{ThemeResource AccentTextFillColorPrimaryBrush}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Error">
<VisualState.Setters>
<Setter Target="HighlightBorder.Opacity" Value="1" />
<Setter Target="HighlightBorder.BorderBrush" Value="{ThemeResource SystemFillColorCriticalBackgroundBrush}" />
<Setter Target="HighlightBorder.Background" Value="{ThemeResource SystemFillColorCriticalBackgroundBrush}" />
<Setter Target="ErrorIcon.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border
Name="HighlightBorder"
Grid.ColumnSpan="4"
@ -121,5 +100,26 @@
TextWrapping="Wrap" />
</ToolTipService.ToolTip>
</Border>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Highlight">
<VisualState.Setters>
<Setter Target="HighlightBorder.Opacity" Value="0.1" />
<Setter Target="HighlightBorder.BorderBrush" Value="{ThemeResource AccentTextFillColorPrimaryBrush}" />
<Setter Target="HighlightBorder.Background" Value="{ThemeResource AccentTextFillColorPrimaryBrush}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Error">
<VisualState.Setters>
<Setter Target="HighlightBorder.Opacity" Value="1" />
<Setter Target="HighlightBorder.BorderBrush" Value="{ThemeResource SystemFillColorCriticalBackgroundBrush}" />
<Setter Target="HighlightBorder.Background" Value="{ThemeResource SystemFillColorCriticalBackgroundBrush}" />
<Setter Target="ErrorIcon.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</UserControl>

View File

@ -366,41 +366,43 @@
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<TextBlock x:Uid="CounterCheatSheet_Title"
Margin="0,10,0,0"
FontWeight="SemiBold" Grid.Row="2" />
<ListView Margin="-4,12,0,0"
IsItemClickEnabled="True"
ItemClick="DateTimeItemClick"
ItemsSource="{x:Bind CounterShortcuts}"
SelectionMode="None" Grid.Row="3">
<TextBlock
x:Uid="CounterCheatSheet_Title"
Grid.Row="2"
Margin="0,10,0,0"
FontWeight="SemiBold" />
<ListView
Grid.Row="3"
Margin="-4,12,0,0"
IsItemClickEnabled="True"
ItemClick="DateTimeItemClick"
ItemsSource="{x:Bind CounterShortcuts}"
SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate
x:DataType="local:PatternSnippet">
<Grid Margin="-10,0,0,0"
ColumnSpacing="8">
<DataTemplate x:DataType="local:PatternSnippet">
<Grid Margin="-10,0,0,0" ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="Auto" />
<ColumnDefinition
Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Padding="8"
HorizontalAlignment="Left"
Background="{ThemeResource ButtonBackground}"
BorderBrush="{ThemeResource ButtonBorderBrush}"
BorderThickness="1"
CornerRadius="4">
<Border
Padding="8"
HorizontalAlignment="Left"
Background="{ThemeResource ButtonBackground}"
BorderBrush="{ThemeResource ButtonBorderBrush}"
BorderThickness="1"
CornerRadius="4">
<TextBlock
FontFamily="Consolas"
Foreground="{ThemeResource ButtonForeground}"
Text="{x:Bind Code}" />
FontFamily="Consolas"
Foreground="{ThemeResource ButtonForeground}"
Text="{x:Bind Code}" />
</Border>
<TextBlock Grid.Column="1"
VerticalAlignment="Center"
FontSize="12"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="{x:Bind Description}" />
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
FontSize="12"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="{x:Bind Description}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>

View File

@ -63,9 +63,6 @@
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\common\version\version.vcxproj">
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
</ProjectReference>
<ProjectReference Include="..\lib\PowerRenameLib.vcxproj">
<Project>{51920f1f-c28c-4adf-8660-4238766796c2}</Project>
</ProjectReference>

View File

@ -165,7 +165,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Monaco
}
catch (NullReferenceException e)
{
Logger.LogError("NullReferenceException catched. Skipping exception.", e);
Logger.LogError("NullReferenceException caught. Skipping exception.", e);
}
}
catch (WebView2RuntimeNotFoundException e)

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 27.5.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!-- Generator: Adobe Illustrator 27.5.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg viewBox="0 0 100 100"
xmlns="http://www.w3.org/2000/svg">
<circle cx="50"
cy="50"
fill="rgba(0, 0, 255, 1)"
r="50">
<script>alert("valid-message")</script>
</circle>
</svg>
<!-- Generator: Adobe Illustrator 27.5.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->

After

Width:  |  Height:  |  Size: 552 B

View File

@ -4,14 +4,12 @@
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using Common.ComInterlop;
using Microsoft.PowerToys.STATestExtension;
using Microsoft.PowerToys.ThumbnailHandler.Svg;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
namespace SvgThumbnailProviderUnitTests
{
@ -211,5 +209,17 @@ namespace SvgThumbnailProviderUnitTests
Assert.IsTrue(bitmap != null);
}
[TestMethod]
public void SvgCommentsAreHandledCorrectly()
{
var filePath = "HelperFiles/WithComments.svg";
SvgThumbnailProvider svgThumbnailProvider = new SvgThumbnailProvider(filePath);
Bitmap bitmap = svgThumbnailProvider.GetThumbnail(8);
Assert.IsTrue(bitmap != null);
}
}
}

View File

@ -38,15 +38,19 @@
<ProjectReference Include="..\SvgThumbnailProvider\SvgThumbnailProvider.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\STATestClassAttribute.cs" Link="STATestClassAttribute.cs" />
<Compile Include="..\STATestMethodAttribute.cs" Link="STATestMethodAttribute.cs" />
<Compile Include="..\STATestClassAttribute.cs"
Link="STATestClassAttribute.cs" />
<Compile Include="..\STATestMethodAttribute.cs"
Link="STATestMethodAttribute.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="HelperFiles\file1.svg">
<Content Include="HelperFiles\*.svg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="HelperFiles\file2.svg">
<Content Include="HelperFiles\*.bmp">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@ -119,7 +119,7 @@ namespace Common.Utilities
while ((index = s.IndexOf('<', index)) != -1)
{
if (index < s.Length - 1 && s[index + 1] != '?')
if (index < s.Length - 1 && s[index + 1] != '?' && s[index + 1] != '!')
{
return index;
}
@ -130,11 +130,11 @@ namespace Common.Utilities
return -1;
}
private static int FindFirstXmlCloseTagIndex(string s)
private static int FindFirstXmlCloseTagIndex(string s, int openTagIndex)
{
int index = 1;
while ((index = s.IndexOf('>', index)) != -1)
while ((index = s.IndexOf('>', openTagIndex)) != -1)
{
if (index > 0 && s[index - 1] != '?')
{
@ -160,7 +160,7 @@ namespace Common.Utilities
return stringSvgData;
}
int firstXmlCloseTagIndex = FindFirstXmlCloseTagIndex(stringSvgData);
int firstXmlCloseTagIndex = FindFirstXmlCloseTagIndex(stringSvgData, firstXmlOpenTagIndex);
if (firstXmlCloseTagIndex == -1)
{
return stringSvgData;
@ -192,13 +192,18 @@ namespace Common.Utilities
styleIndex -= numRemoved;
}
firstXmlCloseTagIndex -= numRemoved;
stringSvgData = RemoveAttribute(stringSvgData, heightIndex, HeightAttribute, out numRemoved);
if (styleIndex != -1 && styleIndex > heightIndex)
{
styleIndex -= numRemoved;
}
firstXmlCloseTagIndex -= numRemoved;
stringSvgData = RemoveAttribute(stringSvgData, styleIndex, StyleAttribute, out numRemoved);
firstXmlCloseTagIndex -= numRemoved;
width = CheckUnit(width);
height = CheckUnit(height);
@ -213,7 +218,7 @@ namespace Common.Utilities
scaling += $" _height:expression(this.scrollHeight &gt; {heightR} ? &quot; {height}&quot; : &quot;auto&quot;); _width:expression(this.scrollWidth &gt; {widthR} ? &quot;{width}&quot; : &quot;auto&quot;);";
string newStyle = $"style=\"{scaling}{centering}{oldStyle}\"";
int insertAt = stringSvgData.IndexOf(">", StringComparison.InvariantCultureIgnoreCase);
int insertAt = firstXmlCloseTagIndex;
stringSvgData = stringSvgData.Insert(insertAt, " " + newStyle);

View File

@ -55,6 +55,12 @@ namespace RegistryPreview
resourceLoader.GetString("YesNoCancelDialogCloseButtonText"));
}
// Check to see if the textbox's context menu is open
if (textBox.ContextFlyout != null && textBox.ContextFlyout.IsOpen)
{
textBox.ContextFlyout.Hide();
}
// Save window placement
SaveWindowPlacementFile(settingsFolder, windowPlacementFile);
}

View File

@ -292,13 +292,20 @@ namespace RegistryPreview
// set the name and the value
string name = registryLine.Substring(0, equal);
// trim the whitespace and quotes from the name
name = name.Trim();
name = StripFirstAndLast(name);
// Clean out any escaped characters in the value, only for the preview
name = StripEscapedCharacters(name);
// set the value
string value = registryLine.Substring(equal + 1);
// trim the whitespace from the value
value = value.Trim();
// Create a new listview item that will be used to display the value
registryValue = new RegistryValue(name, "REG_SZ", string.Empty);
@ -1028,8 +1035,11 @@ namespace RegistryPreview
try
{
fileContents = jsonWindowPlacement.Stringify();
await Windows.Storage.FileIO.WriteTextAsync(storageFile, fileContents);
if (jsonWindowPlacement != null)
{
fileContents = jsonWindowPlacement.Stringify();
await Windows.Storage.FileIO.WriteTextAsync(storageFile, fileContents);
}
}
catch (Exception ex)
{

View File

@ -5,6 +5,7 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Web;
using Microsoft.UI.Xaml;
using Microsoft.Windows.AppLifecycle;
using Windows.ApplicationModel.Activation;
@ -52,6 +53,20 @@ namespace RegistryPreview
}
}
}
else if (activatedArgs.Kind == ExtendedActivationKind.Protocol)
{
// When the app is the default handler for REG files and the filename has non-ASCII characters, the app gets activated by Protocol
AppFilename = string.Empty;
if (activatedArgs.Data != null)
{
IProtocolActivatedEventArgs eventArgs = (IProtocolActivatedEventArgs)activatedArgs.Data;
if (eventArgs.Uri.AbsoluteUri.Length > 0)
{
AppFilename = eventArgs.Uri.Query.Replace("?ContractId=Windows.File&Verb=open&File=", string.Empty);
AppFilename = HttpUtility.UrlDecode(AppFilename);
}
}
}
else
{
// Right click on a REG file and selected Preview

View File

@ -50,12 +50,12 @@ bool VideoConferenceModule::isHotkeyPressed(DWORD code, PowerToysSettings::Hotke
void VideoConferenceModule::reverseMicrophoneMute()
{
bool muted = false;
// All controlled mic should same state with _microphoneTrackedInUI
// Avoid manually change in Control Panel make controlled mic has different state
bool muted = !getMicrophoneMuteState();
for (auto& controlledMic : instance->_controlledMicrophones)
{
const bool was_muted = controlledMic->muted();
controlledMic->toggle_muted();
muted = muted || !was_muted;
controlledMic->set_muted(muted);
}
if (muted)
{
@ -283,6 +283,10 @@ void VideoConferenceModule::onModuleSettingsChanged()
{
toolbar.setToolbarHide(val.value());
}
if (const auto val = values.get_string_value(L"startup_action"))
{
settings.startupAction = val.value();
}
const auto selectedMic = values.get_string_value(L"selected_mic");
if (selectedMic && selectedMic != settings.selectedMicrophone)
@ -308,7 +312,7 @@ void VideoConferenceModule::onMicrophoneConfigurationChanged()
return;
}
const bool mutedStateForNewMics = _microphoneTrackedInUI ? _microphoneTrackedInUI->muted() : _mic_muted_state_during_disconnect;
const bool mutedStateForNewMics = getMicrophoneMuteState();
std::unordered_set<std::wstring_view> currentlyTrackedMicsIds;
for (const auto& controlledMic : _controlledMicrophones)
{
@ -338,6 +342,7 @@ void VideoConferenceModule::onMicrophoneConfigurationChanged()
toolbar.setMicrophoneMute(muted);
});
}
setMuteChangedCallback();
}
VideoConferenceModule::VideoConferenceModule()
@ -401,6 +406,25 @@ void VideoConferenceModule::set_config(const wchar_t* config)
}
}
void VideoConferenceModule::setMuteChangedCallback()
{
// Keep all controlledMic mute state same _microphoneTrackedInUI
// Should not change manually in Control Panel
for (const auto& controlledMic : _controlledMicrophones)
{
if (controlledMic->id() != _microphoneTrackedInUI->id())
{
controlledMic->set_mute_changed_callback([&](const bool muted) {
auto muteState = getMicrophoneMuteState();
if (muted != muteState)
{
controlledMic->set_muted(muteState);
}
});
}
}
}
void VideoConferenceModule::init_settings()
{
try
@ -447,6 +471,10 @@ void VideoConferenceModule::init_settings()
{
toolbar.setToolbarHide(val.value());
}
if (const auto val = powerToysSettings.get_string_value(L"startup_action"))
{
settings.startupAction = val.value();
}
if (const auto val = powerToysSettings.get_string_value(L"selected_mic"); val && *val != settings.selectedMicrophone)
{
settings.selectedMicrophone = *val;
@ -509,6 +537,22 @@ void VideoConferenceModule::updateControlledMicrophones(const std::wstring_view
});
toolbar.setMicrophoneMute(_microphoneTrackedInUI->muted());
}
if (settings.startupAction == L"Unmute")
{
for (auto& controlledMic : _controlledMicrophones)
{
controlledMic->set_muted(false);
}
}
else if (settings.startupAction == L"Mute")
{
for (auto& controlledMic : _controlledMicrophones)
{
controlledMic->set_muted(true);
}
}
setMuteChangedCallback();
}
MicrophoneDevice* VideoConferenceModule::controlledDefaultMic()
@ -669,6 +713,14 @@ void VideoConferenceModule::sendSourceCameraNameUpdate()
auto updatesChannel = reinterpret_cast<CameraSettingsUpdateChannel*>(memory._data);
updatesChannel->sourceCameraName.emplace();
std::copy(begin(settings.selectedCamera), end(settings.selectedCamera), begin(*updatesChannel->sourceCameraName));
if (settings.startupAction == L"Unmute")
{
updatesChannel->useOverlayImage = false;
}
else if (settings.startupAction == L"Mute")
{
updatesChannel->useOverlayImage = true;
}
});
}

View File

@ -30,6 +30,8 @@ struct VideoConferenceSettings
std::wstring imageOverlayPath;
std::wstring selectedMicrophone;
std::wstring startupAction;
bool pushToReverseEnabled = false;
};
@ -71,6 +73,7 @@ public:
private:
void setMuteChangedCallback();
void init_settings();
void updateControlledMicrophones(const std::wstring_view new_mic);
MicrophoneDevice* controlledDefaultMic();

View File

@ -140,6 +140,9 @@
<ProjectReference Include="..\VideoConferenceShared\VideoConferenceShared.vcxproj">
<Project>{459e0768-7ebd-4c41-bba1-6db3b3815e0a}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\common\version\version.vcxproj">
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -53,11 +53,6 @@ bool MicrophoneDevice::muted() const noexcept
return muted;
}
void MicrophoneDevice::toggle_muted() noexcept
{
set_muted(!muted());
}
std::wstring_view MicrophoneDevice::id() const noexcept
{
return _id ? _id.get() : FALLBACK_ID;
@ -70,6 +65,10 @@ std::wstring_view MicrophoneDevice::name() const noexcept
void MicrophoneDevice::set_mute_changed_callback(mute_changed_cb_t callback) noexcept
{
if (_notifier)
{
_endpoint->UnregisterControlChangeNotify(_notifier.get());
}
_mute_changed_callback = std::move(callback);
_notifier = winrt::make<VolumeNotifier>(this);

View File

@ -54,7 +54,6 @@ public:
bool active() const noexcept;
void set_muted(const bool muted) noexcept;
bool muted() const noexcept;
void toggle_muted() noexcept;
std::wstring_view id() const noexcept;
std::wstring_view name() const noexcept;

View File

@ -51,7 +51,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("activationaction")]
public ColorPickerActivationAction ActivationAction { get; set; }
// Property ColorHistory is not used, the color history is saved separatedly in the colorHistory.json file
// Property ColorHistory is not used, the color history is saved separately in the colorHistory.json file
[JsonPropertyName("colorhistory")]
public List<string> ColorHistory { get; set; }

View File

@ -4,7 +4,7 @@
namespace Microsoft.PowerToys.Settings.UI.Library.Enumerations
{
// NOTE: don't change the order (numbers) of the enumeration entires
// NOTE: don't change the order (numbers) of the enumeration entries
/// <summary>
/// The type of the color representation

View File

@ -292,9 +292,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
}
// get data needed for process
var backupRetoreSettings = JsonNode.Parse(GetBackupRestoreSettingsJson());
var currentSettingsFiles = GetSettingsFiles(backupRetoreSettings, appBasePath).ToList().ToDictionary(x => x.Substring(appBasePath.Length));
var backupSettingsFiles = GetSettingsFiles(backupRetoreSettings, latestSettingsFolder).ToList().ToDictionary(x => x.Substring(latestSettingsFolder.Length));
var backupRestoreSettings = JsonNode.Parse(GetBackupRestoreSettingsJson());
var currentSettingsFiles = GetSettingsFiles(backupRestoreSettings, appBasePath).ToList().ToDictionary(x => x.Substring(appBasePath.Length));
var backupSettingsFiles = GetSettingsFiles(backupRestoreSettings, latestSettingsFolder).ToList().ToDictionary(x => x.Substring(latestSettingsFolder.Length));
if (backupSettingsFiles.Count == 0)
{
@ -306,13 +306,13 @@ namespace Microsoft.PowerToys.Settings.UI.Library
foreach (var currentFile in backupSettingsFiles)
{
var relativePath = currentFile.Value.Substring(latestSettingsFolder.Length + 1);
var retoreFullPath = Path.Combine(appBasePath, relativePath);
var settingsToRestoreJson = GetExportVersion(backupRetoreSettings, currentFile.Key, currentFile.Value);
var restoreFullPath = Path.Combine(appBasePath, relativePath);
var settingsToRestoreJson = GetExportVersion(backupRestoreSettings, currentFile.Key, currentFile.Value);
if (currentSettingsFiles.TryGetValue(currentFile.Key, out string value))
{
// we have a setting file to restore to
var currentSettingsFileJson = GetExportVersion(backupRetoreSettings, currentFile.Key, value);
var currentSettingsFileJson = GetExportVersion(backupRestoreSettings, currentFile.Key, value);
if (JsonNormalizer.Normalize(settingsToRestoreJson) != JsonNormalizer.Normalize(currentSettingsFileJson))
{
@ -339,7 +339,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
if (anyFilesUpdated)
{
// something was changed do we need to return true to indicate a restart is needed.
var restartAfterRestore = (bool?)backupRetoreSettings!["RestartAfterRestore"];
var restartAfterRestore = (bool?)backupRestoreSettings!["RestartAfterRestore"];
if (!restartAfterRestore.HasValue || restartAfterRestore.Value)
{
return (true, $"RESTART APP", "Success");
@ -639,11 +639,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
}
// get data needed for process
var backupRetoreSettings = JsonNode.Parse(GetBackupRestoreSettingsJson());
var currentSettingsFiles = GetSettingsFiles(backupRetoreSettings, appBasePath).ToList().ToDictionary(x => x.Substring(appBasePath.Length));
var backupRestoreSettings = JsonNode.Parse(GetBackupRestoreSettingsJson());
var currentSettingsFiles = GetSettingsFiles(backupRestoreSettings, appBasePath).ToList().ToDictionary(x => x.Substring(appBasePath.Length));
var fullBackupDir = Path.Combine(Path.GetTempPath(), $"settings_{DateTime.UtcNow.ToFileTimeUtc().ToString(CultureInfo.InvariantCulture)}");
var latestSettingsFolder = GetLatestSettingsFolder();
var lastBackupSettingsFiles = GetSettingsFiles(backupRetoreSettings, latestSettingsFolder).ToList().ToDictionary(x => x.Substring(latestSettingsFolder.Length));
var lastBackupSettingsFiles = GetSettingsFiles(backupRestoreSettings, latestSettingsFolder).ToList().ToDictionary(x => x.Substring(latestSettingsFolder.Length));
lastBackupExists = lastBackupSettingsFiles.Count > 0;
@ -661,13 +661,13 @@ namespace Microsoft.PowerToys.Settings.UI.Library
tempFile = currentFile;
// need to check and back this up;
var currentSettingsFileToBackup = GetExportVersion(backupRetoreSettings, currentFile.Key, currentFile.Value);
var currentSettingsFileToBackup = GetExportVersion(backupRestoreSettings, currentFile.Key, currentFile.Value);
var doBackup = false;
if (lastBackupSettingsFiles.TryGetValue(currentFile.Key, out string value))
{
// there is a previous backup for this, get an export version of it.
var lastSettingsFileDoc = GetExportVersion(backupRetoreSettings, currentFile.Key, value);
var lastSettingsFileDoc = GetExportVersion(backupRestoreSettings, currentFile.Key, value);
// check to see if the new export version would be same as last export version.
if (JsonNormalizer.Normalize(currentSettingsFileToBackup) != JsonNormalizer.Normalize(lastSettingsFileDoc))
@ -804,9 +804,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
/// Method <c>GetExportVersion</c> gets the version of the settings file that we want to backup.
/// It will be formatted and all problematic settings removed from it.
/// </summary>
public static string GetExportVersion(JsonNode backupRetoreSettings, string settingFileKey, string settingsFileName)
public static string GetExportVersion(JsonNode backupRestoreSettings, string settingFileKey, string settingsFileName)
{
var ignoredSettings = GetIgnoredSettings(backupRetoreSettings, settingFileKey);
var ignoredSettings = GetIgnoredSettings(backupRestoreSettings, settingFileKey);
var settingsFile = JsonDocument.Parse(File.ReadAllText(settingsFileName));
var outputBuffer = new ArrayBufferWriter<byte>();
@ -828,7 +828,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
if (settingFileKey.Equals("\\PowerToys Run\\settings.json", StringComparison.OrdinalIgnoreCase))
{
// PowerToys Run hack fix-up
var ptRunIgnoredSettings = GetPTRunIgnoredSettings(backupRetoreSettings);
var ptRunIgnoredSettings = GetPTRunIgnoredSettings(backupRestoreSettings);
var ptrSettings = JsonNode.Parse(Encoding.UTF8.GetString(outputBuffer.WrittenSpan));
foreach (JsonObject pluginToChange in ptRunIgnoredSettings)
@ -856,13 +856,13 @@ namespace Microsoft.PowerToys.Settings.UI.Library
/// <summary>
/// Method <c>GetPTRunIgnoredSettings</c> gets the 'Run-Plugin-level' settings we should ignore because they are problematic to backup/restore.
/// </summary>
private static JsonArray GetPTRunIgnoredSettings(JsonNode backupRetoreSettings)
private static JsonArray GetPTRunIgnoredSettings(JsonNode backupRestoreSettings)
{
ArgumentNullException.ThrowIfNull(backupRetoreSettings);
ArgumentNullException.ThrowIfNull(backupRestoreSettings);
if (backupRetoreSettings["IgnoredPTRunSettings"] != null)
if (backupRestoreSettings["IgnoredPTRunSettings"] != null)
{
return (JsonArray)backupRetoreSettings["IgnoredPTRunSettings"];
return (JsonArray)backupRestoreSettings["IgnoredPTRunSettings"];
}
return new JsonArray();
@ -871,20 +871,20 @@ namespace Microsoft.PowerToys.Settings.UI.Library
/// <summary>
/// Method <c>GetIgnoredSettings</c> gets the 'top-level' settings we should ignore because they are problematic to backup/restore.
/// </summary>
private static string[] GetIgnoredSettings(JsonNode backupRetoreSettings, string settingFileKey)
private static string[] GetIgnoredSettings(JsonNode backupRestoreSettings, string settingFileKey)
{
ArgumentNullException.ThrowIfNull(backupRetoreSettings);
ArgumentNullException.ThrowIfNull(backupRestoreSettings);
if (settingFileKey.StartsWith("\\", StringComparison.OrdinalIgnoreCase))
{
settingFileKey = settingFileKey.Substring(1);
}
if (backupRetoreSettings["IgnoredSettings"] != null)
if (backupRestoreSettings["IgnoredSettings"] != null)
{
if (backupRetoreSettings["IgnoredSettings"][settingFileKey] != null)
if (backupRestoreSettings["IgnoredSettings"][settingFileKey] != null)
{
var settingsArray = (JsonArray)backupRetoreSettings["IgnoredSettings"][settingFileKey];
var settingsArray = (JsonArray)backupRestoreSettings["IgnoredSettings"][settingFileKey];
Console.WriteLine("settingsArray " + settingsArray.GetType().FullName);

View File

@ -95,6 +95,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("toolbar_hide")]
public StringProperty ToolbarHide { get; set; } = "When both camera and microphone are unmuted";
[JsonPropertyName("startup_action")]
public StringProperty StartupAction { get; set; } = "Nothing";
// converts the current to a json string.
public string ToJsonString()
{

View File

@ -37,6 +37,7 @@
"selected_camera": { "value": "USB Video Device" },
"theme": { "value": "light" },
"toolbar_monitor": { "value": "All monitors" },
"toolbar_position": { "value": "Bottom center" }
"toolbar_position": { "value": "Bottom center" },
"startup_action": { "value": "Nothing" }
}
}

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