mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-30 00:46:20 +01:00
Compare commits
1 Commits
leilzh/ver
...
dev/vanzue
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9fe2bb6dc1 |
4
.github/actions/spell-check/allow/names.txt
vendored
4
.github/actions/spell-check/allow/names.txt
vendored
@@ -91,7 +91,6 @@ Hemmerlein
|
||||
hlaueriksson
|
||||
Horvalds
|
||||
Howett
|
||||
hotkidfamily
|
||||
htcfreek
|
||||
Huynh
|
||||
Ionut
|
||||
@@ -99,7 +98,6 @@ jamrobot
|
||||
Jaswal
|
||||
Jaylyn
|
||||
jefflord
|
||||
Jeremic
|
||||
Jordi
|
||||
jyuwono
|
||||
kai
|
||||
@@ -175,7 +173,6 @@ Tadele
|
||||
talynone
|
||||
Taras
|
||||
TBM
|
||||
Teutsch
|
||||
tilovell
|
||||
Triet
|
||||
urnotdfs
|
||||
@@ -224,7 +221,6 @@ openai
|
||||
Quickime
|
||||
regedit
|
||||
roslyn
|
||||
Skia
|
||||
Spotify
|
||||
Vanara
|
||||
wangyi
|
||||
|
||||
3
.github/actions/spell-check/excludes.txt
vendored
3
.github/actions/spell-check/excludes.txt
vendored
@@ -92,7 +92,6 @@
|
||||
^\.github/actions/spell-check/
|
||||
^\.gitmodules$
|
||||
^\Q.github/workflows/spelling2.yml\E$
|
||||
^\Q.pipelines/272MSSharedLibSN2048.snk\E$
|
||||
^\Q.pipelines/ESRPSigning_core.json\E$
|
||||
^\Qdoc/devdocs/localization.md\E$
|
||||
^\Qsrc/common/ManagedCommon/ColorFormatHelper.cs\E$
|
||||
@@ -121,9 +120,7 @@
|
||||
^src/modules/MouseWithoutBorders/App/Form/.*\.resx$
|
||||
^src/modules/MouseWithoutBorders/App/Helper/.*\.resx$
|
||||
^src/modules/previewpane/UnitTests-MarkdownPreviewHandler/HelperFiles/MarkdownWithHTMLImageTag\.txt$
|
||||
^src/modules/ZoomIt/ZoomIt/ZoomIt\.idc$
|
||||
^src/Monaco/
|
||||
^src/common/sysinternals/Eula/
|
||||
^tools/Verification scripts/Check preview handler registration\.ps1$
|
||||
ignore$
|
||||
^src/modules/registrypreview/RegistryPreviewUILib/Controls/HexBox/.*$
|
||||
|
||||
29
.github/actions/spell-check/expect.txt
vendored
29
.github/actions/spell-check/expect.txt
vendored
@@ -69,7 +69,6 @@ appwiz
|
||||
APSTUDIO
|
||||
AQS
|
||||
ARandom
|
||||
Arash
|
||||
ARCHITEW
|
||||
ARemapped
|
||||
ARPINSTALLLOCATION
|
||||
@@ -329,6 +328,7 @@ DEFAULTTONULL
|
||||
DEFAULTTOPRIMARY
|
||||
DEFERERASE
|
||||
DEFPUSHBUTTON
|
||||
DEFT
|
||||
deinitialization
|
||||
DELA
|
||||
DELETEDKEYIMAGE
|
||||
@@ -470,7 +470,6 @@ EXPCMDFLAGS
|
||||
EXPCMDSTATE
|
||||
explr
|
||||
exppowertoys
|
||||
exprtk
|
||||
exptas
|
||||
exsb
|
||||
exstyle
|
||||
@@ -671,6 +670,7 @@ IBeam
|
||||
icf
|
||||
ICONERROR
|
||||
ICONLOCATION
|
||||
idc
|
||||
IDCANCEL
|
||||
IDD
|
||||
idk
|
||||
@@ -681,6 +681,7 @@ IDR
|
||||
IDXGI
|
||||
ietf
|
||||
IEXPLORE
|
||||
iextn
|
||||
IFACEMETHOD
|
||||
IFACEMETHODIMP
|
||||
IFile
|
||||
@@ -719,6 +720,7 @@ INPUTMOUSE
|
||||
INPUTSINK
|
||||
INPUTTYPE
|
||||
INSTALLDESKTOPSHORTCUT
|
||||
INSTALLDIR
|
||||
installdir
|
||||
INSTALLFOLDER
|
||||
INSTALLFOLDERTOBOOTSTRAPPERINSTALLFOLDER
|
||||
@@ -754,7 +756,6 @@ iwr
|
||||
jfif
|
||||
jgeosdfsdsgmkedfgdfgdfgbkmhcgcflmi
|
||||
jjw
|
||||
JLO
|
||||
jobject
|
||||
jpe
|
||||
jpnime
|
||||
@@ -811,6 +812,7 @@ LMENU
|
||||
lnks
|
||||
LOADFROMFILE
|
||||
LOBYTE
|
||||
localappdata
|
||||
LOCALDISPLAY
|
||||
localpackage
|
||||
LOCALSYSTEM
|
||||
@@ -910,7 +912,6 @@ metafile
|
||||
mfc
|
||||
Mgmt
|
||||
Microwaved
|
||||
middleclickaction
|
||||
midl
|
||||
mii
|
||||
mindaro
|
||||
@@ -976,6 +977,7 @@ msrc
|
||||
msstore
|
||||
mst
|
||||
msvcp
|
||||
msvsmon
|
||||
MTND
|
||||
MULTIPLEUSE
|
||||
multizone
|
||||
@@ -1153,7 +1155,6 @@ PARTIALCONFIRMATIONDIALOGTITLE
|
||||
PATCOPY
|
||||
PATHMUSTEXIST
|
||||
PATINVERT
|
||||
partow
|
||||
PATPAINT
|
||||
pbc
|
||||
pbi
|
||||
@@ -1252,7 +1253,6 @@ prg
|
||||
prgh
|
||||
prgms
|
||||
pri
|
||||
primaryclickaction
|
||||
PRINTCLIENT
|
||||
printmanagement
|
||||
prm
|
||||
@@ -1284,6 +1284,7 @@ pstm
|
||||
PStr
|
||||
pstream
|
||||
pstrm
|
||||
pswd
|
||||
PSYSTEM
|
||||
psz
|
||||
ptb
|
||||
@@ -1428,7 +1429,6 @@ SDKDDK
|
||||
sdns
|
||||
searchterm
|
||||
SEARCHUI
|
||||
secondaryclickaction
|
||||
SECONDARYDISPLAY
|
||||
secpol
|
||||
securestring
|
||||
@@ -1476,12 +1476,16 @@ SHELLDLL
|
||||
shellex
|
||||
SHELLEXECUTEINFO
|
||||
SHELLEXECUTEINFOW
|
||||
SHELLEXTENSION
|
||||
SHELLICONSIZE
|
||||
SHELLNEWVALUE
|
||||
SHFILEINFO
|
||||
SHFILEOPSTRUCT
|
||||
SHGDN
|
||||
SHGDNF
|
||||
SHGFI
|
||||
SHGFIICON
|
||||
SHGFILARGEICON
|
||||
SHIL
|
||||
shinfo
|
||||
shlwapi
|
||||
@@ -1513,9 +1517,9 @@ SICHINT
|
||||
SIDs
|
||||
siex
|
||||
sigdn
|
||||
Signedness
|
||||
SIGNINGSCENARIO
|
||||
signtool
|
||||
Signtool
|
||||
SINGLEKEY
|
||||
sipolicy
|
||||
SIZEBOX
|
||||
@@ -1691,6 +1695,7 @@ TLayout
|
||||
tlb
|
||||
tlbimp
|
||||
tlc
|
||||
TGM
|
||||
TNP
|
||||
Toolhelp
|
||||
toolkitconverters
|
||||
@@ -1778,6 +1783,7 @@ uxtheme
|
||||
vabdq
|
||||
validmodulename
|
||||
valuegenerator
|
||||
VARENUM
|
||||
variantassignment
|
||||
vcamp
|
||||
VCENTER
|
||||
@@ -1997,6 +2003,11 @@ CLSCTXINPROCALL
|
||||
IIDI
|
||||
irow
|
||||
lcid
|
||||
OTHERUNZOOM
|
||||
OTHERZOOM
|
||||
PARENTCLOSING
|
||||
PARENTOPENING
|
||||
ppwsz
|
||||
rguid
|
||||
VARTYPE
|
||||
SCROLLCHILDREN
|
||||
VARTYPE
|
||||
2
.github/actions/spell-check/patterns.txt
vendored
2
.github/actions/spell-check/patterns.txt
vendored
@@ -243,4 +243,4 @@ Process Process
|
||||
|
||||
# ZoomIt menu items with accelerator keys
|
||||
E&xit
|
||||
St&yle
|
||||
St&yle
|
||||
39
.github/workflows/package-submissions.yml
vendored
39
.github/workflows/package-submissions.yml
vendored
@@ -1,4 +1,5 @@
|
||||
name: WinGet submission on release
|
||||
# based off of https://github.com/nushell/nushell/blob/main/.github/workflows/winget-submission.yml
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -8,31 +9,23 @@ on:
|
||||
jobs:
|
||||
winget:
|
||||
name: Publish winget package
|
||||
|
||||
# winget-create is only supported on Windows
|
||||
runs-on: windows-latest
|
||||
|
||||
# winget-create will read the following environment variable to access the GitHub token needed for submitting a PR
|
||||
# See https://aka.ms/winget-create-token
|
||||
env:
|
||||
WINGET_CREATE_GITHUB_TOKEN: ${{ secrets.PT_WINGET }}
|
||||
|
||||
# Only submit stable releases
|
||||
if: ${{ !github.event.release.prerelease }}
|
||||
steps:
|
||||
- name: Submit Microsoft.PowerToys package to Windows Package Manager Community Repository
|
||||
run: |
|
||||
# Get installer info from GitHub release event
|
||||
$assets = '${{ toJSON(github.event.release.assets) }}' | ConvertFrom-Json
|
||||
$x64UserInstallerUrl = $assets | Where-Object -Property name -match 'PowerToysUserSetup.*x64' | Select -ExpandProperty browser_download_url
|
||||
$x64MachineInstallerUrl = $assets | Where-Object -Property name -match 'PowerToysSetup.*x64' | Select -ExpandProperty browser_download_url
|
||||
$arm64UserInstallerUrl = $assets | Where-Object -Property name -match 'PowerToysUserSetup.*arm64' | Select -ExpandProperty browser_download_url
|
||||
$arm64MachineInstallerUrl = $assets | Where-Object -Property name -match 'PowerToysSetup.*arm64' | Select -ExpandProperty browser_download_url
|
||||
$packageVersion = (${{ toJSON(github.event.release.tag_name) }}).Trim('v')
|
||||
|
||||
# Update package using wingetcreate
|
||||
curl.exe -JLO https://aka.ms/wingetcreate/latest
|
||||
.\wingetcreate.exe update Microsoft.PowerToys `
|
||||
--version $packageVersion `
|
||||
--urls "$x64UserInstallerUrl|user" "$x64MachineInstallerUrl|machine" "$arm64UserInstallerUrl|user" "$arm64MachineInstallerUrl|machine" `
|
||||
--submit
|
||||
$wingetPackage = "Microsoft.PowerToys"
|
||||
$gitToken = "${{ secrets.PT_WINGET }}"
|
||||
|
||||
$github = Invoke-RestMethod -uri "https://api.github.com/repos/Microsoft/PowerToys/releases"
|
||||
|
||||
$targetRelease = $github | Where-Object -Property name -match 'Release'| Select -First 1
|
||||
$installerUserX64Url = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysUserSetup.*x64' | Select -ExpandProperty browser_download_url
|
||||
$installerMachineX64Url = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysSetup.*x64' | Select -ExpandProperty browser_download_url
|
||||
$installerUserArmUrl = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysUserSetup.*arm64' | Select -ExpandProperty browser_download_url
|
||||
$installerMachineArmUrl = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysSetup.*arm64' | Select -ExpandProperty browser_download_url
|
||||
$ver = $targetRelease.tag_name -ireplace '^v'
|
||||
|
||||
# getting latest wingetcreate file
|
||||
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
|
||||
.\wingetcreate.exe update $wingetPackage -s -v $ver -u "$installerUserX64Url|user" "$installerMachineX64Url|machine" "$installerUserArmUrl|user" "$installerMachineArmUrl|machine" -t $gitToken
|
||||
|
||||
@@ -3,227 +3,226 @@
|
||||
"UseMinimatch": false,
|
||||
"SignBatches": [
|
||||
{
|
||||
"MatchedPath": [
|
||||
"*.resources.dll",
|
||||
"MatchedPath": [
|
||||
"*.resources.dll",
|
||||
|
||||
"WinUI3Apps\\Assets\\Settings\\Scripts\\*.ps1",
|
||||
|
||||
"WinUI3Apps\\Assets\\Settings\\Scripts\\*.ps1",
|
||||
"PowerToys.ActionRunner.exe",
|
||||
"PowerToys.Update.exe",
|
||||
"PowerToys.BackgroundActivatorDLL.dll",
|
||||
"Notifications.dll",
|
||||
"os-detection.dll",
|
||||
"PowerToys.exe",
|
||||
"PowerToys.FilePreviewCommon.dll",
|
||||
"PowerToys.Interop.dll",
|
||||
"Tools\\PowerToys.BugReportTool.exe",
|
||||
"StylesReportTool\\PowerToys.StylesReportTool.exe",
|
||||
"Telemetry.dll",
|
||||
"PowerToys.ManagedTelemetry.dll",
|
||||
"PowerToys.ManagedCommon.dll",
|
||||
"PowerToys.Common.UI.dll",
|
||||
"PowerToys.Settings.UI.Lib.dll",
|
||||
"PowerToys.GPOWrapper.dll",
|
||||
"PowerToys.GPOWrapperProjection.dll",
|
||||
"PowerToys.AllExperiments.dll",
|
||||
|
||||
"PowerToys.ActionRunner.exe",
|
||||
"PowerToys.Update.exe",
|
||||
"PowerToys.BackgroundActivatorDLL.dll",
|
||||
"Notifications.dll",
|
||||
"os-detection.dll",
|
||||
"PowerToys.exe",
|
||||
"PowerToys.FilePreviewCommon.dll",
|
||||
"PowerToys.Interop.dll",
|
||||
"Tools\\PowerToys.BugReportTool.exe",
|
||||
"StylesReportTool\\PowerToys.StylesReportTool.exe",
|
||||
"Telemetry.dll",
|
||||
"CalculatorEngineCommon.dll",
|
||||
"PowerToys.ManagedTelemetry.dll",
|
||||
"PowerToys.ManagedCommon.dll",
|
||||
"PowerToys.Common.UI.dll",
|
||||
"PowerToys.Settings.UI.Lib.dll",
|
||||
"PowerToys.GPOWrapper.dll",
|
||||
"PowerToys.GPOWrapperProjection.dll",
|
||||
"PowerToys.AllExperiments.dll",
|
||||
"PowerToys.AlwaysOnTop.exe",
|
||||
"PowerToys.AlwaysOnTopModuleInterface.dll",
|
||||
|
||||
"PowerToys.AlwaysOnTop.exe",
|
||||
"PowerToys.AlwaysOnTopModuleInterface.dll",
|
||||
"PowerToys.CmdNotFoundModuleInterface.dll",
|
||||
"PowerToys.CmdNotFound.dll",
|
||||
|
||||
"PowerToys.CmdNotFoundModuleInterface.dll",
|
||||
"PowerToys.CmdNotFound.dll",
|
||||
"PowerToys.ColorPicker.dll",
|
||||
"PowerToys.ColorPickerUI.dll",
|
||||
"PowerToys.ColorPickerUI.exe",
|
||||
|
||||
"PowerToys.ColorPicker.dll",
|
||||
"PowerToys.ColorPickerUI.dll",
|
||||
"PowerToys.ColorPickerUI.exe",
|
||||
"PowerToys.CropAndLockModuleInterface.dll",
|
||||
"PowerToys.CropAndLock.exe",
|
||||
|
||||
"PowerToys.CropAndLockModuleInterface.dll",
|
||||
"PowerToys.CropAndLock.exe",
|
||||
"PowerToys.PowerOCRModuleInterface.dll",
|
||||
"PowerToys.PowerOCR.dll",
|
||||
"PowerToys.PowerOCR.exe",
|
||||
|
||||
"PowerToys.PowerOCRModuleInterface.dll",
|
||||
"PowerToys.PowerOCR.dll",
|
||||
"PowerToys.PowerOCR.exe",
|
||||
"PowerToys.AdvancedPasteModuleInterface.dll",
|
||||
"WinUI3Apps\\PowerToys.AdvancedPaste.exe",
|
||||
"WinUI3Apps\\PowerToys.AdvancedPaste.dll",
|
||||
|
||||
"PowerToys.AdvancedPasteModuleInterface.dll",
|
||||
"WinUI3Apps\\PowerToys.AdvancedPaste.exe",
|
||||
"WinUI3Apps\\PowerToys.AdvancedPaste.dll",
|
||||
"PowerToys.AwakeModuleInterface.dll",
|
||||
"PowerToys.Awake.exe",
|
||||
"PowerToys.Awake.dll",
|
||||
|
||||
"PowerToys.AwakeModuleInterface.dll",
|
||||
"PowerToys.Awake.exe",
|
||||
"PowerToys.Awake.dll",
|
||||
"fancyzones.dll",
|
||||
"PowerToys.FancyZonesEditor.exe",
|
||||
"PowerToys.FancyZonesEditor.dll",
|
||||
"PowerToys.FancyZonesEditorCommon.dll",
|
||||
"PowerToys.FancyZonesModuleInterface.dll",
|
||||
"PowerToys.FancyZones.exe",
|
||||
|
||||
"fancyzones.dll",
|
||||
"PowerToys.FancyZonesEditor.exe",
|
||||
"PowerToys.FancyZonesEditor.dll",
|
||||
"PowerToys.FancyZonesEditorCommon.dll",
|
||||
"PowerToys.FancyZonesModuleInterface.dll",
|
||||
"PowerToys.FancyZones.exe",
|
||||
"PowerToys.GcodePreviewHandler.dll",
|
||||
"PowerToys.GcodePreviewHandler.exe",
|
||||
"PowerToys.GcodePreviewHandlerCpp.dll",
|
||||
"PowerToys.GcodeThumbnailProvider.dll",
|
||||
"PowerToys.GcodeThumbnailProvider.exe",
|
||||
"PowerToys.GcodeThumbnailProviderCpp.dll",
|
||||
"PowerToys.ManagedTelemetry.dll",
|
||||
"PowerToys.MarkdownPreviewHandler.dll",
|
||||
"PowerToys.MarkdownPreviewHandler.exe",
|
||||
"PowerToys.MarkdownPreviewHandlerCpp.dll",
|
||||
"PowerToys.MonacoPreviewHandler.dll",
|
||||
"PowerToys.MonacoPreviewHandler.exe",
|
||||
"PowerToys.MonacoPreviewHandlerCpp.dll",
|
||||
"PowerToys.PdfPreviewHandler.dll",
|
||||
"PowerToys.PdfPreviewHandler.exe",
|
||||
"PowerToys.PdfPreviewHandlerCpp.dll",
|
||||
"PowerToys.PdfThumbnailProvider.dll",
|
||||
"PowerToys.PdfThumbnailProvider.exe",
|
||||
"PowerToys.PdfThumbnailProviderCpp.dll",
|
||||
"PowerToys.powerpreview.dll",
|
||||
"PowerToys.PreviewHandlerCommon.dll",
|
||||
"PowerToys.QoiPreviewHandler.dll",
|
||||
"PowerToys.QoiPreviewHandler.exe",
|
||||
"PowerToys.QoiPreviewHandlerCpp.dll",
|
||||
"PowerToys.QoiThumbnailProvider.dll",
|
||||
"PowerToys.QoiThumbnailProvider.exe",
|
||||
"PowerToys.QoiThumbnailProviderCpp.dll",
|
||||
"PowerToys.StlThumbnailProvider.dll",
|
||||
"PowerToys.StlThumbnailProvider.exe",
|
||||
"PowerToys.StlThumbnailProviderCpp.dll",
|
||||
"PowerToys.SvgPreviewHandler.dll",
|
||||
"PowerToys.SvgPreviewHandler.exe",
|
||||
"PowerToys.SvgPreviewHandlerCpp.dll",
|
||||
"PowerToys.SvgThumbnailProvider.dll",
|
||||
"PowerToys.SvgThumbnailProvider.exe",
|
||||
"PowerToys.SvgThumbnailProviderCpp.dll",
|
||||
|
||||
"PowerToys.GcodePreviewHandler.dll",
|
||||
"PowerToys.GcodePreviewHandler.exe",
|
||||
"PowerToys.GcodePreviewHandlerCpp.dll",
|
||||
"PowerToys.GcodeThumbnailProvider.dll",
|
||||
"PowerToys.GcodeThumbnailProvider.exe",
|
||||
"PowerToys.GcodeThumbnailProviderCpp.dll",
|
||||
"PowerToys.ManagedTelemetry.dll",
|
||||
"PowerToys.MarkdownPreviewHandler.dll",
|
||||
"PowerToys.MarkdownPreviewHandler.exe",
|
||||
"PowerToys.MarkdownPreviewHandlerCpp.dll",
|
||||
"PowerToys.MonacoPreviewHandler.dll",
|
||||
"PowerToys.MonacoPreviewHandler.exe",
|
||||
"PowerToys.MonacoPreviewHandlerCpp.dll",
|
||||
"PowerToys.PdfPreviewHandler.dll",
|
||||
"PowerToys.PdfPreviewHandler.exe",
|
||||
"PowerToys.PdfPreviewHandlerCpp.dll",
|
||||
"PowerToys.PdfThumbnailProvider.dll",
|
||||
"PowerToys.PdfThumbnailProvider.exe",
|
||||
"PowerToys.PdfThumbnailProviderCpp.dll",
|
||||
"PowerToys.powerpreview.dll",
|
||||
"PowerToys.PreviewHandlerCommon.dll",
|
||||
"PowerToys.QoiPreviewHandler.dll",
|
||||
"PowerToys.QoiPreviewHandler.exe",
|
||||
"PowerToys.QoiPreviewHandlerCpp.dll",
|
||||
"PowerToys.QoiThumbnailProvider.dll",
|
||||
"PowerToys.QoiThumbnailProvider.exe",
|
||||
"PowerToys.QoiThumbnailProviderCpp.dll",
|
||||
"PowerToys.StlThumbnailProvider.dll",
|
||||
"PowerToys.StlThumbnailProvider.exe",
|
||||
"PowerToys.StlThumbnailProviderCpp.dll",
|
||||
"PowerToys.SvgPreviewHandler.dll",
|
||||
"PowerToys.SvgPreviewHandler.exe",
|
||||
"PowerToys.SvgPreviewHandlerCpp.dll",
|
||||
"PowerToys.SvgThumbnailProvider.dll",
|
||||
"PowerToys.SvgThumbnailProvider.exe",
|
||||
"PowerToys.SvgThumbnailProviderCpp.dll",
|
||||
"WinUI3Apps\\PowerToys.HostsModuleInterface.dll",
|
||||
"WinUI3Apps\\PowerToys.HostsUILib.dll",
|
||||
"WinUI3Apps\\PowerToys.Hosts.dll",
|
||||
"WinUI3Apps\\PowerToys.Hosts.exe",
|
||||
|
||||
"WinUI3Apps\\PowerToys.HostsModuleInterface.dll",
|
||||
"WinUI3Apps\\PowerToys.HostsUILib.dll",
|
||||
"WinUI3Apps\\PowerToys.Hosts.dll",
|
||||
"WinUI3Apps\\PowerToys.Hosts.exe",
|
||||
"WinUI3Apps\\PowerToys.FileLocksmithLib.Interop.dll",
|
||||
"WinUI3Apps\\PowerToys.FileLocksmithExt.dll",
|
||||
"WinUI3Apps\\PowerToys.FileLocksmithUI.exe",
|
||||
"WinUI3Apps\\PowerToys.FileLocksmithUI.dll",
|
||||
"WinUI3Apps\\PowerToys.FileLocksmithContextMenu.dll",
|
||||
"FileLocksmithContextMenuPackage.msix",
|
||||
|
||||
"WinUI3Apps\\PowerToys.FileLocksmithLib.Interop.dll",
|
||||
"WinUI3Apps\\PowerToys.FileLocksmithExt.dll",
|
||||
"WinUI3Apps\\PowerToys.FileLocksmithUI.exe",
|
||||
"WinUI3Apps\\PowerToys.FileLocksmithUI.dll",
|
||||
"WinUI3Apps\\PowerToys.FileLocksmithContextMenu.dll",
|
||||
"FileLocksmithContextMenuPackage.msix",
|
||||
"WinUI3Apps\\Peek.Common.dll",
|
||||
"WinUI3Apps\\Peek.FilePreviewer.dll",
|
||||
"WinUI3Apps\\Powertoys.Peek.UI.dll",
|
||||
"WinUI3Apps\\Powertoys.Peek.UI.exe",
|
||||
"WinUI3Apps\\Powertoys.Peek.dll",
|
||||
|
||||
"WinUI3Apps\\Peek.Common.dll",
|
||||
"WinUI3Apps\\Peek.FilePreviewer.dll",
|
||||
"WinUI3Apps\\Powertoys.Peek.UI.dll",
|
||||
"WinUI3Apps\\Powertoys.Peek.UI.exe",
|
||||
"WinUI3Apps\\Powertoys.Peek.dll",
|
||||
"WinUI3Apps\\PowerToys.EnvironmentVariablesModuleInterface.dll",
|
||||
"WinUI3Apps\\PowerToys.EnvironmentVariablesUILib.dll",
|
||||
"WinUI3Apps\\PowerToys.EnvironmentVariables.dll",
|
||||
"WinUI3Apps\\PowerToys.EnvironmentVariables.exe",
|
||||
|
||||
"WinUI3Apps\\PowerToys.EnvironmentVariablesModuleInterface.dll",
|
||||
"WinUI3Apps\\PowerToys.EnvironmentVariablesUILib.dll",
|
||||
"WinUI3Apps\\PowerToys.EnvironmentVariables.dll",
|
||||
"WinUI3Apps\\PowerToys.EnvironmentVariables.exe",
|
||||
"PowerToys.ImageResizer.exe",
|
||||
"PowerToys.ImageResizer.dll",
|
||||
"PowerToys.ImageResizerExt.dll",
|
||||
"PowerToys.ImageResizerContextMenu.dll",
|
||||
"ImageResizerContextMenuPackage.msix",
|
||||
|
||||
"PowerToys.ImageResizer.exe",
|
||||
"PowerToys.ImageResizer.dll",
|
||||
"PowerToys.ImageResizerExt.dll",
|
||||
"PowerToys.ImageResizerContextMenu.dll",
|
||||
"ImageResizerContextMenuPackage.msix",
|
||||
"PowerToys.KeyboardManager.dll",
|
||||
"KeyboardManagerEditor\\PowerToys.KeyboardManagerEditor.exe",
|
||||
"KeyboardManagerEngine\\PowerToys.KeyboardManagerEngine.exe",
|
||||
"PowerToys.KeyboardManagerEditorLibraryWrapper.dll",
|
||||
|
||||
"PowerToys.KeyboardManager.dll",
|
||||
"KeyboardManagerEditor\\PowerToys.KeyboardManagerEditor.exe",
|
||||
"KeyboardManagerEngine\\PowerToys.KeyboardManagerEngine.exe",
|
||||
"PowerToys.KeyboardManagerEditorLibraryWrapper.dll",
|
||||
"PowerToys.Launcher.dll",
|
||||
"PowerToys.PowerLauncher.dll",
|
||||
"PowerToys.PowerLauncher.exe",
|
||||
"PowerToys.PowerLauncher.Telemetry.dll",
|
||||
"Wox.dll",
|
||||
"Wox.Infrastructure.dll",
|
||||
"Wox.Plugin.dll",
|
||||
"RunPlugins\\Calculator\\Microsoft.PowerToys.Run.Plugin.Calculator.dll",
|
||||
"RunPlugins\\Folder\\Microsoft.Plugin.Folder.dll",
|
||||
"RunPlugins\\Indexer\\Microsoft.Plugin.Indexer.dll",
|
||||
"RunPlugins\\OneNote\\Microsoft.PowerToys.Run.Plugin.OneNote.dll",
|
||||
"RunPlugins\\History\\Microsoft.PowerToys.Run.Plugin.History.dll",
|
||||
"RunPlugins\\PowerToys\\Microsoft.PowerToys.Run.Plugin.PowerToys.dll",
|
||||
"RunPlugins\\Program\\Microsoft.Plugin.Program.dll",
|
||||
"RunPlugins\\Registry\\Microsoft.PowerToys.Run.Plugin.Registry.dll",
|
||||
"RunPlugins\\WindowsSettings\\Microsoft.PowerToys.Run.Plugin.WindowsSettings.dll",
|
||||
"RunPlugins\\Shell\\Microsoft.Plugin.Shell.dll",
|
||||
"RunPlugins\\Uri\\Microsoft.Plugin.Uri.dll",
|
||||
"RunPlugins\\WindowWalker\\Microsoft.Plugin.WindowWalker.dll",
|
||||
"RunPlugins\\UnitConverter\\Community.PowerToys.Run.Plugin.UnitConverter.dll",
|
||||
"RunPlugins\\VSCodeWorkspaces\\Community.PowerToys.Run.Plugin.VSCodeWorkspaces.dll",
|
||||
"RunPlugins\\Service\\Microsoft.PowerToys.Run.Plugin.Service.dll",
|
||||
"RunPlugins\\System\\Microsoft.PowerToys.Run.Plugin.System.dll",
|
||||
"RunPlugins\\TimeDate\\Microsoft.PowerToys.Run.Plugin.TimeDate.dll",
|
||||
"RunPlugins\\ValueGenerator\\Community.PowerToys.Run.Plugin.ValueGenerator.dll",
|
||||
"RunPlugins\\WebSearch\\Community.PowerToys.Run.Plugin.WebSearch.dll",
|
||||
"RunPlugins\\WindowsTerminal\\Microsoft.PowerToys.Run.Plugin.WindowsTerminal.dll",
|
||||
|
||||
"WinUI3Apps\\PowerToys.MeasureToolModuleInterface.dll",
|
||||
"WinUI3Apps\\PowerToys.MeasureToolCore.dll",
|
||||
"WinUI3Apps\\PowerToys.MeasureToolUI.dll",
|
||||
"WinUI3Apps\\PowerToys.MeasureToolUI.exe",
|
||||
|
||||
"PowerToys.Launcher.dll",
|
||||
"PowerToys.PowerLauncher.dll",
|
||||
"PowerToys.PowerLauncher.exe",
|
||||
"PowerToys.PowerLauncher.Telemetry.dll",
|
||||
"Wox.dll",
|
||||
"Wox.Infrastructure.dll",
|
||||
"Wox.Plugin.dll",
|
||||
"RunPlugins\\Calculator\\Microsoft.PowerToys.Run.Plugin.Calculator.dll",
|
||||
"RunPlugins\\Folder\\Microsoft.Plugin.Folder.dll",
|
||||
"RunPlugins\\Indexer\\Microsoft.Plugin.Indexer.dll",
|
||||
"RunPlugins\\OneNote\\Microsoft.PowerToys.Run.Plugin.OneNote.dll",
|
||||
"RunPlugins\\History\\Microsoft.PowerToys.Run.Plugin.History.dll",
|
||||
"RunPlugins\\PowerToys\\Microsoft.PowerToys.Run.Plugin.PowerToys.dll",
|
||||
"RunPlugins\\Program\\Microsoft.Plugin.Program.dll",
|
||||
"RunPlugins\\Registry\\Microsoft.PowerToys.Run.Plugin.Registry.dll",
|
||||
"RunPlugins\\WindowsSettings\\Microsoft.PowerToys.Run.Plugin.WindowsSettings.dll",
|
||||
"RunPlugins\\Shell\\Microsoft.Plugin.Shell.dll",
|
||||
"RunPlugins\\Uri\\Microsoft.Plugin.Uri.dll",
|
||||
"RunPlugins\\WindowWalker\\Microsoft.Plugin.WindowWalker.dll",
|
||||
"RunPlugins\\UnitConverter\\Community.PowerToys.Run.Plugin.UnitConverter.dll",
|
||||
"RunPlugins\\VSCodeWorkspaces\\Community.PowerToys.Run.Plugin.VSCodeWorkspaces.dll",
|
||||
"RunPlugins\\Service\\Microsoft.PowerToys.Run.Plugin.Service.dll",
|
||||
"RunPlugins\\System\\Microsoft.PowerToys.Run.Plugin.System.dll",
|
||||
"RunPlugins\\TimeDate\\Microsoft.PowerToys.Run.Plugin.TimeDate.dll",
|
||||
"RunPlugins\\ValueGenerator\\Community.PowerToys.Run.Plugin.ValueGenerator.dll",
|
||||
"RunPlugins\\WebSearch\\Community.PowerToys.Run.Plugin.WebSearch.dll",
|
||||
"RunPlugins\\WindowsTerminal\\Microsoft.PowerToys.Run.Plugin.WindowsTerminal.dll",
|
||||
"PowerToys.FindMyMouse.dll",
|
||||
"PowerToys.MouseHighlighter.dll",
|
||||
"PowerToys.MouseJump.dll",
|
||||
"PowerToys.MouseJump.Common.dll",
|
||||
"PowerToys.MousePointerCrosshairs.dll",
|
||||
"PowerToys.MouseJumpUI.dll",
|
||||
"PowerToys.MouseJumpUI.exe",
|
||||
|
||||
"WinUI3Apps\\PowerToys.MeasureToolModuleInterface.dll",
|
||||
"WinUI3Apps\\PowerToys.MeasureToolCore.dll",
|
||||
"WinUI3Apps\\PowerToys.MeasureToolUI.dll",
|
||||
"WinUI3Apps\\PowerToys.MeasureToolUI.exe",
|
||||
"PowerToys.MouseWithoutBorders.dll",
|
||||
"PowerToys.MouseWithoutBorders.exe",
|
||||
"PowerToys.MouseWithoutBordersModuleInterface.dll",
|
||||
"PowerToys.MouseWithoutBordersService.dll",
|
||||
"PowerToys.MouseWithoutBordersService.exe",
|
||||
"PowerToys.MouseWithoutBordersHelper.dll",
|
||||
"PowerToys.MouseWithoutBordersHelper.exe",
|
||||
|
||||
"PowerToys.FindMyMouse.dll",
|
||||
"PowerToys.MouseHighlighter.dll",
|
||||
"PowerToys.MouseJump.dll",
|
||||
"PowerToys.MouseJump.Common.dll",
|
||||
"PowerToys.MousePointerCrosshairs.dll",
|
||||
"PowerToys.MouseJumpUI.dll",
|
||||
"PowerToys.MouseJumpUI.exe",
|
||||
"WinUI3Apps\\PowerToys.NewPlus.ShellExtension.dll",
|
||||
"WinUI3Apps\\NewPlusPackage.msix",
|
||||
"WinUI3Apps\\PowerToys.NewPlus.ShellExtension.win10.dll",
|
||||
|
||||
"PowerToys.MouseWithoutBorders.dll",
|
||||
"PowerToys.MouseWithoutBorders.exe",
|
||||
"PowerToys.MouseWithoutBordersModuleInterface.dll",
|
||||
"PowerToys.MouseWithoutBordersService.dll",
|
||||
"PowerToys.MouseWithoutBordersService.exe",
|
||||
"PowerToys.MouseWithoutBordersHelper.dll",
|
||||
"PowerToys.MouseWithoutBordersHelper.exe",
|
||||
"PowerAccent.Core.dll",
|
||||
"PowerToys.PowerAccent.dll",
|
||||
"PowerToys.PowerAccent.exe",
|
||||
"PowerToys.PowerAccentModuleInterface.dll",
|
||||
"PowerToys.PowerAccentKeyboardService.dll",
|
||||
|
||||
"WinUI3Apps\\PowerToys.NewPlus.ShellExtension.dll",
|
||||
"WinUI3Apps\\NewPlusPackage.msix",
|
||||
"WinUI3Apps\\PowerToys.NewPlus.ShellExtension.win10.dll",
|
||||
"WinUI3Apps\\PowerToys.PowerRenameExt.dll",
|
||||
"WinUI3Apps\\PowerToys.PowerRename.exe",
|
||||
"WinUI3Apps\\PowerToys.PowerRenameContextMenu.dll",
|
||||
"WinUI3Apps\\PowerRenameContextMenuPackage.msix",
|
||||
|
||||
"PowerAccent.Core.dll",
|
||||
"PowerToys.PowerAccent.dll",
|
||||
"PowerToys.PowerAccent.exe",
|
||||
"PowerToys.PowerAccentModuleInterface.dll",
|
||||
"PowerToys.PowerAccentKeyboardService.dll",
|
||||
"PowerToys.WorkspacesSnapshotTool.exe",
|
||||
"PowerToys.WorkspacesLauncher.exe",
|
||||
"PowerToys.WorkspacesWindowArranger.exe",
|
||||
"PowerToys.WorkspacesEditor.exe",
|
||||
"PowerToys.WorkspacesEditor.dll",
|
||||
"PowerToys.WorkspacesLauncherUI.exe",
|
||||
"PowerToys.WorkspacesLauncherUI.dll",
|
||||
"PowerToys.WorkspacesModuleInterface.dll",
|
||||
"PowerToys.WorkspacesCsharpLibrary.dll",
|
||||
|
||||
"WinUI3Apps\\PowerToys.PowerRenameExt.dll",
|
||||
"WinUI3Apps\\PowerToys.PowerRename.exe",
|
||||
"WinUI3Apps\\PowerToys.PowerRenameContextMenu.dll",
|
||||
"WinUI3Apps\\PowerRenameContextMenuPackage.msix",
|
||||
"WinUI3Apps\\PowerToys.RegistryPreviewExt.dll",
|
||||
"WinUI3Apps\\PowerToys.RegistryPreviewUILib.dll",
|
||||
"WinUI3Apps\\PowerToys.RegistryPreview.dll",
|
||||
"WinUI3Apps\\PowerToys.RegistryPreview.exe",
|
||||
|
||||
"PowerToys.WorkspacesSnapshotTool.exe",
|
||||
"PowerToys.WorkspacesLauncher.exe",
|
||||
"PowerToys.WorkspacesWindowArranger.exe",
|
||||
"PowerToys.WorkspacesEditor.exe",
|
||||
"PowerToys.WorkspacesEditor.dll",
|
||||
"PowerToys.WorkspacesLauncherUI.exe",
|
||||
"PowerToys.WorkspacesLauncherUI.dll",
|
||||
"PowerToys.WorkspacesModuleInterface.dll",
|
||||
"PowerToys.WorkspacesCsharpLibrary.dll",
|
||||
"PowerToys.ShortcutGuide.exe",
|
||||
"PowerToys.ShortcutGuideModuleInterface.dll",
|
||||
|
||||
"WinUI3Apps\\PowerToys.RegistryPreviewExt.dll",
|
||||
"WinUI3Apps\\PowerToys.RegistryPreviewUILib.dll",
|
||||
"WinUI3Apps\\PowerToys.RegistryPreview.dll",
|
||||
"WinUI3Apps\\PowerToys.RegistryPreview.exe",
|
||||
"PowerToys.ZoomIt.exe",
|
||||
"PowerToys.ZoomItModuleInterface.dll",
|
||||
"PowerToys.ZoomItSettingsInterop.dll",
|
||||
|
||||
"PowerToys.ShortcutGuide.exe",
|
||||
"PowerToys.ShortcutGuideModuleInterface.dll",
|
||||
"WinUI3Apps\\PowerToys.Settings.dll",
|
||||
"WinUI3Apps\\PowerToys.Settings.exe",
|
||||
|
||||
"PowerToys.ZoomIt.exe",
|
||||
"PowerToys.ZoomItModuleInterface.dll",
|
||||
"PowerToys.ZoomItSettingsInterop.dll",
|
||||
|
||||
"WinUI3Apps\\PowerToys.Settings.dll",
|
||||
"WinUI3Apps\\PowerToys.Settings.exe",
|
||||
|
||||
"PowerToys.CmdPalModuleInterface.dll",
|
||||
"CmdPalKeyboardService.dll",
|
||||
"*Microsoft.CmdPal.UI_*.msix"
|
||||
],
|
||||
"PowerToys.CmdPalModuleInterface.dll",
|
||||
"CmdPalKeyboardService.dll",
|
||||
"*Microsoft.CmdPal.UI_*.msix"
|
||||
],
|
||||
"SigningInfo": {
|
||||
"Operations": [
|
||||
{
|
||||
|
||||
@@ -41,9 +41,6 @@ Write-Output ""
|
||||
Write-Output "Restoring dotnet tools..."
|
||||
dotnet tool restore --disable-parallel --no-cache
|
||||
|
||||
# Use Regex syntax
|
||||
$PathExcludes = "(\\obj\\)|(\\bin\\)|(\\x64\\)|(\\Generated Files\\PowerRenameXAML\\)|(\\RegistryPreviewUILib\\Controls\\HexBox\\)"
|
||||
|
||||
if (-not $Passive)
|
||||
{
|
||||
# Look for unstaged changed files by default
|
||||
@@ -90,7 +87,7 @@ if (-not $Passive)
|
||||
}
|
||||
|
||||
Write-Output "Running Git Diff: $gitDiffCommand"
|
||||
$files = Invoke-Expression $gitDiffCommand | Select-String -Pattern "\.xaml$" | Where-Object { $_ -notmatch $PathExcludes }
|
||||
$files = Invoke-Expression $gitDiffCommand | Select-String -Pattern "\.xaml$"
|
||||
|
||||
if (-not $Passive -and -not $Main -and -not $Unstaged -and -not $Staged -and -not $LastCommit)
|
||||
{
|
||||
@@ -110,7 +107,7 @@ if (-not $Passive)
|
||||
else
|
||||
{
|
||||
Write-Output "Checking all files (passively)"
|
||||
$files = Get-ChildItem -Path "$PSScriptRoot\..\src\*.xaml" -Recurse | Select-Object -ExpandProperty FullName | Where-Object { $_ -notmatch $PathExcludes }
|
||||
$files = Get-ChildItem -Path "$PSScriptRoot\..\src\*.xaml" -Recurse | Select-Object -ExpandProperty FullName | Where-Object { $_ -notmatch "(\\obj\\)|(\\bin\\)|(\\x64\\)|(\\Generated Files\\PowerRenameXAML\\)" }
|
||||
|
||||
if ($files.count -gt 0)
|
||||
{
|
||||
|
||||
@@ -394,7 +394,9 @@ jobs:
|
||||
testAssemblyVer2: |
|
||||
**\KeyboardManagerEngineTest.dll
|
||||
**\KeyboardManagerEditorTest.dll
|
||||
**\*UnitTest*.dll
|
||||
**\UnitTests-CommonLib.dll
|
||||
**\PowerRenameUnitTests.dll
|
||||
**\UnitTests-FancyZones.dll
|
||||
!**\obj\**
|
||||
|
||||
- pwsh: |-
|
||||
|
||||
@@ -68,7 +68,7 @@ jobs:
|
||||
pwsh: true
|
||||
ScriptType: InlineScript
|
||||
Inline: |-
|
||||
$AzToken = (Get-AzAccessToken -AsSecureString -ResourceUrl api://30471ccf-0966-45b9-a979-065dbedb24c1).Token | ConvertFrom-SecureString -AsPlainText
|
||||
$AzToken = (Get-AzAccessToken -ResourceUrl api://30471ccf-0966-45b9-a979-065dbedb24c1).Token
|
||||
Write-Host "##vso[task.setvariable variable=SymbolAccessToken;issecret=true]$AzToken"
|
||||
|
||||
|
||||
|
||||
@@ -72,57 +72,9 @@ $returnList = [System.Collections.Generic.HashSet[string]]($totalList) -join "`r
|
||||
|
||||
Write-Host $returnList
|
||||
|
||||
# Extract the current package list from NOTICE.md
|
||||
$noticePattern = "## NuGet Packages used by PowerToys\s*((?:\r?\n- .+)+)"
|
||||
$noticeMatch = [regex]::Match($noticeFile, $noticePattern)
|
||||
|
||||
if ($noticeMatch.Success) {
|
||||
$currentNoticePackageList = $noticeMatch.Groups[1].Value.Trim()
|
||||
} else {
|
||||
Write-Warning "Warning: Could not find 'NuGet Packages used by PowerToys' section in NOTICE.md"
|
||||
$currentNoticePackageList = ""
|
||||
}
|
||||
|
||||
if (!$noticeFile.Trim().EndsWith($returnList.Trim()))
|
||||
{
|
||||
Write-Host -ForegroundColor Red "Notice.md does not match NuGet list."
|
||||
|
||||
# Show detailed differences
|
||||
$generatedPackages = $returnList -split "`r`n|`n" | Where-Object { $_.Trim() -ne "" } | Sort-Object
|
||||
$noticePackages = $currentNoticePackageList -split "`r`n|`n" | Where-Object { $_.Trim() -ne "" } | ForEach-Object { $_.Trim() } | Sort-Object
|
||||
|
||||
Write-Host ""
|
||||
Write-Host -ForegroundColor Cyan "=== DETAILED DIFFERENCE ANALYSIS ==="
|
||||
Write-Host ""
|
||||
|
||||
# Find packages in proj file list but not in NOTICE.md
|
||||
$missingFromNotice = $generatedPackages | Where-Object { $noticePackages -notcontains $_ }
|
||||
if ($missingFromNotice.Count -gt 0) {
|
||||
Write-Host -ForegroundColor Red "MissingFromNotice:"
|
||||
foreach ($pkg in $missingFromNotice) {
|
||||
Write-Host -ForegroundColor Red " $pkg"
|
||||
}
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Find packages in NOTICE.md but not in proj file list
|
||||
$extraInNotice = $noticePackages | Where-Object { $generatedPackages -notcontains $_ }
|
||||
if ($extraInNotice.Count -gt 0) {
|
||||
Write-Host -ForegroundColor Yellow "ExtraInNotice:"
|
||||
foreach ($pkg in $extraInNotice) {
|
||||
Write-Host -ForegroundColor Yellow " $pkg"
|
||||
}
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Show counts for summary
|
||||
Write-Host -ForegroundColor Cyan "Summary:"
|
||||
Write-Host " Proj file list has $($generatedPackages.Count) packages"
|
||||
Write-Host " NOTICE.md has $($noticePackages.Count) packages"
|
||||
Write-Host " MissingFromNotice: $($missingFromNotice.Count) packages"
|
||||
Write-Host " ExtraInNotice: $($extraInNotice.Count) packages"
|
||||
Write-Host ""
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,6 @@ $versionExceptions = @(
|
||||
"ObjectModelCsProjection.dll",
|
||||
"RendererCsProjection.dll") -join '|';
|
||||
$nullVersionExceptions = @(
|
||||
"SkiaSharp.Views.WinUI.Native.dll",
|
||||
"libSkiaSharp.dll",
|
||||
"codicon.ttf",
|
||||
"e_sqlite3.dll",
|
||||
"getfilesiginforedist.dll",
|
||||
|
||||
@@ -21,7 +21,7 @@ Connor was the creator of Workspaces and helped create Command Palette (PowerToy
|
||||
### [@damienleroy](https://github.com/damienleroy) - [Damien Leroy](https://www.linkedin.com/in/Damien-Leroy-b2734416a/)
|
||||
Damien has helped out by developing and contributing the Quick Accent utility.
|
||||
|
||||
### [@daverayment](https://github.com/daverayment) - [David Rayment](https://www.linkedin.com/in/david-rayment-168b5251/)
|
||||
### [@daverayment ](https://github.com/daverayment) - [David Rayment](https://www.linkedin.com/in/david-rayment-168b5251/)
|
||||
Dave has helped improve the experience inside of Peek by adding in new features and fixing bugs.
|
||||
|
||||
### [@davidegiacometti](https://github.com/davidegiacometti) - [Davide Giacometti](https://www.linkedin.com/in/davidegiacometti/)
|
||||
@@ -181,8 +181,10 @@ ZoomIt source code was originally implemented by [Sysinternals](https://sysinter
|
||||
## PowerToys core team
|
||||
|
||||
- [@cinnamon-msft](https://github.com/cinnamon-msft) - Kayla Cinnamon - Lead
|
||||
- [@nguyen-dows](https://github.com/nguyen-dows) - Christopher Nguyen - Product Manager
|
||||
- [@craigloewen-msft](https://github.com/craigloewen-msft) - Craig Loewen - Product Manager
|
||||
- [@niels9001](https://github.com/niels9001/) - Niels Laute - Product Manager
|
||||
- [@zhiwei-ms](https://github.com/zhiwei-ms) - Zhiwei Yu - Product Manager
|
||||
- [@dhowett](https://github.com/dhowett) - Dustin Howett - Dev lead
|
||||
- [@yeelam-gordon](https://github.com/yeelam-gordon) - Gordon Lam - Dev lead
|
||||
- [@jamrobot](https://github.com/jamrobot) - Jerry Xu - Dev lead
|
||||
@@ -203,7 +205,6 @@ ZoomIt source code was originally implemented by [Sysinternals](https://sysinter
|
||||
- [@chatasweetie](https://github.com/chatasweetie) - Jessica Earley-Cha - Dev
|
||||
- [@MichaelJolley](https://github.com/MichaelJolley) - Michael Jolley - Dev
|
||||
- [@Jaylyn-Barbee](https://github.com/Jaylyn-Barbee) - Jaylyn Barbee - Dev
|
||||
- [@zateutsch](https://github.com/zateutsch) - Zach Teutsch - Dev
|
||||
- [@crutkas](https://github.com/crutkas/) - Clint Rutkas - Overhead
|
||||
|
||||
## Former PowerToys core team members
|
||||
@@ -212,7 +213,6 @@ ZoomIt source code was originally implemented by [Sysinternals](https://sysinter
|
||||
- [@ethanfangg](https://github.com/ethanfangg) - Ethan Fang - Product Manager
|
||||
- [@plante-msft](https://github.com/plante-msft) - Connor Plante - Product Manager
|
||||
- [@joadoumie](https://github.com/joadoumie) - Jordi Adoumie - Product Manager
|
||||
- [@nguyen-dows](https://github.com/nguyen-dows) - Christopher Nguyen - Product Manager
|
||||
- [@enricogior](https://github.com/enricogior) - Enrico Giordani - Dev Lead
|
||||
- [@bzoz](https://github.com/bzoz) - Bartosz Sosnowski - Dev
|
||||
- [@ivan100sic](https://github.com/ivan100sic) - Ivan Stošić - Dev
|
||||
|
||||
@@ -69,8 +69,6 @@
|
||||
<PackageVersion Include="ReverseMarkdown" Version="4.1.0" />
|
||||
<PackageVersion Include="ScipBe.Common.Office.OneNote" Version="3.0.1" />
|
||||
<PackageVersion Include="SharpCompress" Version="0.37.2" />
|
||||
<!-- Don't update SkiaSharp.Views.WinUI to version 3.* branch as this brakes the HexBox control in Registry Preview. -->
|
||||
<PackageVersion Include="SkiaSharp.Views.WinUI" Version="2.88.9" />
|
||||
<PackageVersion Include="StreamJsonRpc" Version="2.21.69" />
|
||||
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
|
||||
<!-- Package System.CodeDom added as a hack for being able to exclude the runtime assets so they don't conflict with 8.0.1. This is a dependency of System.Management but the 8.0.1 version wasn't published to nuget. -->
|
||||
|
||||
107
NOTICE.md
107
NOTICE.md
@@ -79,43 +79,6 @@ For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
### Calculator
|
||||
|
||||
#### exprtk
|
||||
|
||||
We use the exprtk library (exprtk.hpp) to evaluate mathematical expressions.
|
||||
|
||||
**Source**: [https://github.com/ArashPartow/exprtk](https://github.com/ArashPartow/exprtk)
|
||||
|
||||
```
|
||||
MIT License
|
||||
|
||||
Copyright (c) 1999-2024 Arash Partow
|
||||
|
||||
https://www.partow.net/programming/exprtk/index.html
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
```
|
||||
|
||||
## Utility: PowerToys Run Built-in Extensions
|
||||
|
||||
### Calculator
|
||||
|
||||
#### Mages
|
||||
|
||||
We use the Mages NuGet package for calculating the result of expression.
|
||||
@@ -844,25 +807,30 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
**Source**: https://github.com/kuba--/zip
|
||||
|
||||
All Rights Reserved.
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
## Utility: Measure tool
|
||||
|
||||
@@ -1427,37 +1395,6 @@ EXHIBIT A -Mozilla Public License.
|
||||
|
||||
## Utility: Registry Preview
|
||||
|
||||
### HexBox.WinUI
|
||||
|
||||
We use HexBox.WinUI to show a preview of binary values.
|
||||
|
||||
**Source**: https://github.com/hotkidfamily/HexBox.WinUI
|
||||
|
||||
```
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Filip Jeremic
|
||||
Copyright (c) 2024~2025 hotkidfamily@gmail.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
```
|
||||
|
||||
### Monaco Editor
|
||||
|
||||
**Source**: https://github.com/Microsoft/monaco-editor
|
||||
@@ -1488,7 +1425,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
```
|
||||
|
||||
|
||||
## NuGet Packages used by PowerToys
|
||||
|
||||
- AdaptiveCards.ObjectModel.WinUI3 2.0.0-beta
|
||||
@@ -1549,7 +1485,6 @@ SOFTWARE.
|
||||
- ReverseMarkdown 4.1.0
|
||||
- ScipBe.Common.Office.OneNote 3.0.1
|
||||
- SharpCompress 0.37.2
|
||||
- SkiaSharp.Views.WinUI 2.88.9
|
||||
- StreamJsonRpc 2.21.69
|
||||
- StyleCop.Analyzers 1.2.0-beta.556
|
||||
- System.CodeDom 9.0.6
|
||||
|
||||
@@ -604,11 +604,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WindowProperties", "WindowP
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorkspacesLib", "src\modules\Workspaces\WorkspacesLib\WorkspacesLib.vcxproj", "{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorkspacesLibUnitTests", "src\modules\Workspaces\WorkspacesLib.UnitTests\WorkspacesLibUnitTests.vcxproj", "{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332} = {B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WorkspacesLauncherUI", "src\modules\Workspaces\WorkspacesLauncherUI\WorkspacesLauncherUI.csproj", "{9C53CC25-0623-4569-95BC-B05410675EE3}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorkspacesModuleInterface", "src\modules\Workspaces\WorkspacesModuleInterface\WorkspacesModuleInterface.vcxproj", "{45285DF2-9742-4ECA-9AC9-58951FC26489}"
|
||||
@@ -717,8 +712,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CmdPalKeyboardService", "sr
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRename.FuzzingTest", "src\modules\powerrename\PowerRename.FuzzingTest\PowerRename.FuzzingTest.vcxproj", "{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalculatorEngineCommon", "src\common\CalculatorEngineCommon\CalculatorEngineCommon.vcxproj", "{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM64 = Debug|ARM64
|
||||
@@ -2207,14 +2200,6 @@ Global
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Release|x64.ActiveCfg = Release|x64
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332}.Release|x64.Build.0 = Release|x64
|
||||
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Debug|x64.Build.0 = Debug|x64
|
||||
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Release|x64.ActiveCfg = Release|x64
|
||||
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}.Release|x64.Build.0 = Release|x64
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -2599,14 +2584,6 @@ Global
|
||||
{64B88F02-CD88-4ED8-9624-989A800230F9}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{64B88F02-CD88-4ED8-9624-989A800230F9}.Release|x64.ActiveCfg = Release|x64
|
||||
{64B88F02-CD88-4ED8-9624-989A800230F9}.Release|x64.Build.0 = Release|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|x64.Build.0 = Debug|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|x64.ActiveCfg = Release|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|x64.Build.0 = Release|x64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -2621,14 +2598,14 @@ Global
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Release|x64.ActiveCfg = Release|x64
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Release|x64.Build.0 = Release|x64
|
||||
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Debug|x64.Build.0 = Debug|x64
|
||||
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Release|x64.ActiveCfg = Release|x64
|
||||
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6}.Release|x64.Build.0 = Release|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|x64.Build.0 = Debug|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|x64.ActiveCfg = Release|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -2848,7 +2825,6 @@ Global
|
||||
{BE126CBB-AE12-406A-9837-A05ACFCA57A7} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
{14CB58B7-D280-4A7A-95DE-4B2DF14EA000} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
{B31FCC55-B5A4-4EA7-B414-2DCEAE6AF332} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
{9C53CC25-0623-4569-95BC-B05410675EE3} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
{45285DF2-9742-4ECA-9AC9-58951FC26489} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
{3D63307B-9D27-44FD-B033-B26F39245B85} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
@@ -2903,7 +2879,6 @@ Global
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A} = {D1D6BC88-09AE-4FB4-AD24-5DED46A791DD}
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2} = {3846508C-77EB-4034-A702-F8BB263C4F79}
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3}
|
||||
{2CF78CF7-8FEB-4BE1-9591-55FA25B48FC6} = {1AFB6476-670D-4E80-A464-657E01DFF482}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
|
||||
|
||||
2
deps/cziplib
vendored
2
deps/cziplib
vendored
Submodule deps/cziplib updated: 81314fff0a...7a57414261
@@ -76,47 +76,3 @@ using System.Diagnostics.CodeAnalysis;
|
||||
[assembly: SuppressMessage("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "MVVMTK0049:Using [INotifyPropertyChanged] is not AOT compatible for WinRT", Justification = "Updated MVVM toolkit package introduced this.", Scope = "namespaceanddescendants", Target = "Peek.FilePreviewer")]
|
||||
[assembly: SuppressMessage("CommunityToolkit.Mvvm.SourceGenerators.INotifyPropertyChangedGenerator", "MVVMTK0049:Using [INotifyPropertyChanged] is not AOT compatible for WinRT", Justification = "Updated MVVM toolkit package introduced this.", Scope = "type", Target = "~T:Peek.UI.Views.TitleBar")]
|
||||
[assembly: SuppressMessage("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "MVVMTK0049:Using [INotifyPropertyChanged] is not AOT compatible for WinRT", Justification = "Updated MVVM toolkit package introduced this.", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib")]
|
||||
|
||||
// HexBox control in RegistryPreviewUILib (We decided to copy the original code and not fix all theses problems for easier updating.)
|
||||
[assembly: SuppressMessage("Design", "CA1001:Types that own disposable fields should be disposable", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("Globalization", "CA1305:Specify IFormatProvider", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("Naming", "CA1720:Identifiers should not contain type names", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("Performance", "CA1805:Do not initialize unnecessarily", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1623:Property summary documentation should match accessors", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1642:Constructor summary documentation should begin with standard text", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1648:<inheritdoc> has been used on an element that doesn't inherit from a base class or implement an interface.", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1500:Braces for multi-line statements should not share line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1502:Element should not be on a single line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1505:Opening braces should not be followed by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1507:Code should not contain multiple blank lines in a row", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1508:Closing braces should not be preceded by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1509:Opening braces should not be preceded by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1512:Single-line comments should not be followed by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1513:Closing brace should be followed by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1514:Element documentation header should be preceded by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1515:Single-line comment should be preceded by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1516:Elements should be separated by blank line", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1119:Statement should not use unnecessary parenthesis", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:Fields should be private", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1407:Arithmetic expressions should declare precedence", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1413:Use trailing comma in multi-line initializers", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1306:Field names should begin with lower-case letter", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1312:Variable names should begin with lower-case letter", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1313:Parameter names should begin with lower-case letter", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1200:Using directives should be placed correctly", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1108:Block statements should not contain embedded comments", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1116:Split parameters should start on line after declaration", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1117:Parameters should be on same line or separate lines", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1129:Do not use default value type constructor", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1000:Keywords should be spaced correctly", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1003:Symbols should be spaced correctly", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1005:Single line comments should begin with single space", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1024:Colons Should Be Spaced Correctly", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1025:Code should not contain multiple whitespace in a row", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1028:Code should not contain trailing whitespace", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
[assembly: SuppressMessage("Usage", "CsWinRT1028:Class is not marked partial", Justification = "<Code port with style preservation>", Scope = "namespaceanddescendants", Target = "RegistryPreviewUILib.HexBox")]
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "Calculator.h"
|
||||
#include "Calculator.g.cpp"
|
||||
#include "ExprtkEvaluator.h"
|
||||
|
||||
namespace winrt::CalculatorEngineCommon::implementation
|
||||
{
|
||||
Calculator::Calculator(winrt::Windows::Foundation::Collections::IPropertySet const& constants)
|
||||
{
|
||||
for (auto const& pair : constants)
|
||||
{
|
||||
auto key = pair.Key();
|
||||
auto value = winrt::unbox_value<double>(pair.Value());
|
||||
m_constants.emplace(winrt::to_string(key), value);
|
||||
}
|
||||
}
|
||||
|
||||
hstring Calculator::EvaluateExpression(hstring const& expression)
|
||||
{
|
||||
auto result = ExprtkCalculator::internal::EvaluateExpression(winrt::to_string(expression), m_constants);
|
||||
|
||||
return hstring(result);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Calculator.g.h"
|
||||
|
||||
namespace winrt::CalculatorEngineCommon::implementation
|
||||
{
|
||||
struct Calculator : CalculatorT<Calculator>
|
||||
{
|
||||
Calculator() = default;
|
||||
|
||||
Calculator(winrt::Windows::Foundation::Collections::IPropertySet const& constants);
|
||||
|
||||
winrt::hstring EvaluateExpression(winrt::hstring const& expression);
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, double> m_constants;
|
||||
};
|
||||
}
|
||||
|
||||
namespace winrt::CalculatorEngineCommon::factory_implementation
|
||||
{
|
||||
struct Calculator : CalculatorT<Calculator, implementation::Calculator>
|
||||
{
|
||||
};
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace CalculatorEngineCommon
|
||||
{
|
||||
[default_interface]
|
||||
runtimeclass Calculator
|
||||
{
|
||||
Calculator();
|
||||
Calculator(Windows.Foundation.Collections.IPropertySet constants);
|
||||
String EvaluateExpression(String expression);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
EXPORTS
|
||||
DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
|
||||
DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
|
||||
@@ -1,36 +0,0 @@
|
||||
#include <windows.h>
|
||||
#include "resource.h"
|
||||
#include "../version/version.h"
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION FILE_VERSION
|
||||
PRODUCTVERSION PRODUCT_VERSION
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE VFT2_UNKNOWN
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0" // US English (0x0409), Unicode (0x04B0) charset
|
||||
BEGIN
|
||||
VALUE "CompanyName", COMPANY_NAME
|
||||
VALUE "FileDescription", FILE_DESCRIPTION
|
||||
VALUE "FileVersion", FILE_VERSION_STRING
|
||||
VALUE "InternalName", INTERNAL_NAME
|
||||
VALUE "LegalCopyright", COPYRIGHT_NOTE
|
||||
VALUE "OriginalFilename", ORIGINAL_FILENAME
|
||||
VALUE "ProductName", PRODUCT_NAME
|
||||
VALUE "ProductVersion", PRODUCT_VERSION_STRING
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200 // US English (0x0409), Unicode (1200) charset
|
||||
END
|
||||
END
|
||||
@@ -1,190 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
|
||||
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
|
||||
<ProjectGuid>{2cf78cf7-8feb-4be1-9591-55fa25b48fc6}</ProjectGuid>
|
||||
<ProjectName>CalculatorEngineCommon</ProjectName>
|
||||
<RootNamespace>CalculatorEngineCommon</RootNamespace>
|
||||
<AppxPackage>false</AppxPackage>
|
||||
</PropertyGroup>
|
||||
<!-- BEGIN common.build.pre.props -->
|
||||
<PropertyGroup Label="Configuration">
|
||||
<EnableHybridCRT>true</EnableHybridCRT>
|
||||
<UseCrtSDKReferenceStaticWarning Condition="'$(EnableHybridCRT)'=='true'">false</UseCrtSDKReferenceStaticWarning>
|
||||
</PropertyGroup>
|
||||
<!-- END common.build.pre.props -->
|
||||
<!-- BEGIN cppwinrt.build.pre.props -->
|
||||
<PropertyGroup Label="Globals">
|
||||
<CppWinRTEnabled>true</CppWinRTEnabled>
|
||||
<CppWinRTOptimized>true</CppWinRTOptimized>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<MinimumVisualStudioVersion>17.0</MinimumVisualStudioVersion>
|
||||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<MinimalCoreWin>true</MinimalCoreWin>
|
||||
<AppContainerApplication>true</AppContainerApplication>
|
||||
<WindowsStoreApp>true</WindowsStoreApp>
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<UseCrtSDKReference Condition="'$(EnableHybridCRT)'=='true'">false</UseCrtSDKReference>
|
||||
<!-- The SDK reference breaks the Hybrid CRT -->
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<!-- We have to use the Desktop platform for Hybrid CRT to work. -->
|
||||
<_VC_Target_Library_Platform>Desktop</_VC_Target_Library_Platform>
|
||||
<_NoWinAPIFamilyApp>true</_NoWinAPIFamilyApp>
|
||||
</PropertyGroup>
|
||||
<!-- END cppwinrt.build.pre.props -->
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="PropertySheet.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup>
|
||||
<TargetName>CalculatorEngineCommon</TargetName>
|
||||
<OutDir>..\..\..\$(Platform)\$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
|
||||
<PreprocessorDefinitions>_WINRT_DLL;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
<ModuleDefinitionFile>CalculatorEngineCommon.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>Shell32.lib;user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\version\version.vcxproj">
|
||||
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ExprtkEvaluator.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="exprtk.hpp" />
|
||||
<ClInclude Include="Calculator.h">
|
||||
<DependentUpon>Calculator.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ExprtkEvaluator.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Calculator.cpp">
|
||||
<DependentUpon>Calculator.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Midl Include="Calculator.idl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="CalculatorEngineCommon.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="PropertySheet.props" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="CalculatorEngineCommon.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="..\..\..\deps\spdlog.props" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
<!-- BEGIN common.build.post.props -->
|
||||
<!--
|
||||
The Hybrid CRT model statically links the runtime and STL and dynamically
|
||||
links the UCRT instead of the VC++ CRT. The UCRT ships with Windows.
|
||||
WinAppSDK asserts that this is "supported according to the CRT maintainer."
|
||||
|
||||
This must come before Microsoft.Cpp.targets because it manipulates ClCompile.RuntimeLibrary.
|
||||
-->
|
||||
<ItemDefinitionGroup Condition="'$(EnableHybridCRT)'=='true' and '$(Configuration)'=='Debug'">
|
||||
<ClCompile>
|
||||
<!-- We use MultiThreadedDebug, rather than MultiThreadedDebugDLL, to avoid DLL dependencies on VCRUNTIME140d.dll and MSVCP140d.dll. -->
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<!-- Link statically against the runtime and STL, but link dynamically against the CRT by ignoring the static CRT
|
||||
lib and instead linking against the Universal CRT DLL import library. This "hybrid" linking mechanism is
|
||||
supported according to the CRT maintainer. Dynamic linking against the CRT makes the binaries a bit smaller
|
||||
than they would otherwise be if the CRT, runtime, and STL were all statically linked in. -->
|
||||
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries);libucrtd.lib</IgnoreSpecificDefaultLibraries>
|
||||
<AdditionalOptions>%(AdditionalOptions) /defaultlib:ucrtd.lib</AdditionalOptions>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(EnableHybridCRT)'=='true' and ('$(Configuration)'=='Release' or '$(Configuration)'=='AuditMode')">
|
||||
<ClCompile>
|
||||
<!-- We use MultiThreaded, rather than MultiThreadedDLL, to avoid DLL dependencies on VCRUNTIME140.dll and MSVCP140.dll. -->
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<!-- Link statically against the runtime and STL, but link dynamically against the CRT by ignoring the static CRT
|
||||
lib and instead linking against the Universal CRT DLL import library. This "hybrid" linking mechanism is
|
||||
supported according to the CRT maintainer. Dynamic linking against the CRT makes the binaries a bit smaller
|
||||
than they would otherwise be if the CRT, runtime, and STL were all statically linked in. -->
|
||||
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries);libucrt.lib</IgnoreSpecificDefaultLibraries>
|
||||
<AdditionalOptions>%(AdditionalOptions) /defaultlib:ucrt.lib</AdditionalOptions>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- END common.build.post.props -->
|
||||
</Project>
|
||||
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Resources">
|
||||
<UniqueIdentifier>accd3aa8-1ba0-4223-9bbe-0c431709210b</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Generated Files">
|
||||
<UniqueIdentifier>{926ab91d-31b4-48c3-b9a4-e681349f27f0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp" />
|
||||
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Midl Include="Calculator.idl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="CalculatorEngineCommon.def" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="PropertySheet.props" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,50 +0,0 @@
|
||||
#include "ExprtkEvaluator.h"
|
||||
#include "exprtk.hpp"
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
namespace ExprtkCalculator::internal
|
||||
{
|
||||
|
||||
std::wstring ToWStringFullPrecision(double value)
|
||||
{
|
||||
std::wostringstream oss;
|
||||
oss << std::fixed << std::setprecision(15) << value;
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::wstring EvaluateExpression(
|
||||
const std::string& expressionText,
|
||||
const std::unordered_map<std::string, double>& constants)
|
||||
{
|
||||
exprtk::symbol_table<double> symbol_table;
|
||||
|
||||
for (auto const& [name, value] : constants)
|
||||
{
|
||||
symbol_table.add_constant(name, value);
|
||||
}
|
||||
|
||||
exprtk::expression<double> expression;
|
||||
expression.register_symbol_table(symbol_table);
|
||||
|
||||
exprtk::parser<double> parser;
|
||||
|
||||
// Enable all base functions and arithmetic operators
|
||||
parser.settings().enable_all_base_functions(); // Enable all base functions like sin, cos, log, etc.
|
||||
parser.settings().enable_all_arithmetic_ops(); // Enable all arithmetic operators like +, -, *, /, etc.
|
||||
|
||||
// Disable all control structures and assignment operators to ensure only expressions are evaluated
|
||||
parser.settings().disable_all_control_structures(); // Disable control structures like if, for, while, etc.
|
||||
parser.settings().disable_all_assignment_ops(); // Disable assignment operators like =, +=, -=, etc.
|
||||
|
||||
// Disabled for now, but can be enabled later for enhanced functionality
|
||||
parser.settings().disable_all_logic_ops(); // Disable logical operators like &&, ||, !, etc.
|
||||
parser.settings().disable_all_inequality_ops(); // Disable inequality operators like <, >, <=, >=, !=, etc.
|
||||
|
||||
if (!parser.compile(expressionText, expression))
|
||||
return L"NaN";
|
||||
|
||||
return ToWStringFullPrecision(expression.value());
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace ExprtkCalculator::internal
|
||||
{
|
||||
std::wstring EvaluateExpression(
|
||||
const std::string& expression,
|
||||
const std::unordered_map<std::string, double>& constants);
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<!--
|
||||
To customize common C++/WinRT project properties:
|
||||
* right-click the project node
|
||||
* expand the Common Properties item
|
||||
* select the C++/WinRT property page
|
||||
|
||||
For more advanced scenarios, and complete documentation, please see:
|
||||
https://github.com/Microsoft/cppwinrt/tree/master/nuget
|
||||
-->
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup />
|
||||
</Project>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -1 +0,0 @@
|
||||
#include "pch.h"
|
||||
@@ -1,4 +0,0 @@
|
||||
#pragma once
|
||||
#include <unknwn.h>
|
||||
#include <winrt/Windows.Foundation.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
@@ -1,29 +0,0 @@
|
||||
# C++/WinRT CalculatorEngine Project Overview
|
||||
|
||||
This project wraps the exprtk expression parsing library with a C++/WinRT component,
|
||||
making advanced mathematical evaluation capabilities available to Windows applications.
|
||||
It is designed specifically to provide calculation support for the CmdPal calculator extension.
|
||||
|
||||
## Using exprtk
|
||||
|
||||
This project uses [exprtk](https://github.com/ArashPartow/exprtk) as the
|
||||
expression parsing and evaluation engine.
|
||||
|
||||
How to use exprtk in this project:
|
||||
- The exprtk header file (`exprtk.hpp`) is included in the project source.
|
||||
- You can use exprtk to parse and evaluate mathematical expressions in your
|
||||
C++ code. For example:
|
||||
|
||||
```cpp
|
||||
#include "exprtk.hpp"
|
||||
exprtk::expression<double> expression;
|
||||
exprtk::parser<double> parser;
|
||||
std::string formula = "3 + 4 * 2";
|
||||
parser.compile(formula, expression);
|
||||
double result = expression.value();
|
||||
```
|
||||
|
||||
How to update exprtk:
|
||||
1. Download the latest `exprtk.hpp` from the [official repository](https://github.com/ArashPartow/exprtk).
|
||||
2. Replace the existing `exprtk.hpp` file in the project with the new version.
|
||||
3. Rebuild the project to ensure compatibility and take advantage of any updates.
|
||||
@@ -1,13 +0,0 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by CalculatorEngineCommon.rc
|
||||
|
||||
//////////////////////////////
|
||||
// Non-localizable
|
||||
|
||||
#define FILE_DESCRIPTION "CalculatorEngineCommon"
|
||||
#define INTERNAL_NAME "CalculatorEngineCommon"
|
||||
#define ORIGINAL_FILENAME "CalculatorEngineCommon.dll"
|
||||
|
||||
// Non-localizable
|
||||
//////////////////////////////
|
||||
@@ -20,7 +20,7 @@
|
||||
"AreaPath": "OS\\Windows Client and Services\\WinPD\\DFX-Developer Fundamentals and Experiences\\DEFT\\SALT",
|
||||
"IterationPath": "OS\\Future"
|
||||
},
|
||||
"jobNotificationEmail": "PowerToys@microsoft.com",
|
||||
"jobNotificationEmail": "leilzh@microsoft.com",
|
||||
"skip": false,
|
||||
"rebootAfterSetup": false,
|
||||
"oneFuzzJobs": [
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
"AreaPath": "OS\\Windows Client and Services\\WinPD\\DFX-Developer Fundamentals and Experiences\\DEFT\\SALT",
|
||||
"IterationPath": "OS\\Future"
|
||||
},
|
||||
"jobNotificationEmail": "PowerToys@microsoft.com",
|
||||
"jobNotificationEmail": "mengyuanchen@microsoft.com",
|
||||
"skip": false,
|
||||
"rebootAfterSetup": false,
|
||||
"oneFuzzJobs": [
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">System</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
|
||||
|
||||
@@ -1,239 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include <filesystem> // Add this line
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
namespace WorkspacesLibUnitTests
|
||||
{
|
||||
TEST_CLASS(AppUtilsTests)
|
||||
{
|
||||
public:
|
||||
TEST_METHOD(GetCurrentFolder_ReturnsNonEmptyPath)
|
||||
{
|
||||
// Act
|
||||
const std::wstring& result = Utils::Apps::GetCurrentFolder();
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result.empty());
|
||||
Assert::IsTrue(std::filesystem::exists(result));
|
||||
}
|
||||
|
||||
TEST_METHOD(GetCurrentFolderUpper_ReturnsUppercasePath)
|
||||
{
|
||||
// Act
|
||||
const std::wstring& currentFolder = Utils::Apps::GetCurrentFolder();
|
||||
const std::wstring& currentFolderUpper = Utils::Apps::GetCurrentFolderUpper();
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(currentFolderUpper.empty());
|
||||
Assert::AreEqual(currentFolder.length(), currentFolderUpper.length());
|
||||
|
||||
// Verify it's actually uppercase
|
||||
std::wstring expectedUpper = currentFolder;
|
||||
std::transform(expectedUpper.begin(), expectedUpper.end(), expectedUpper.begin(), towupper);
|
||||
Assert::AreEqual(expectedUpper, currentFolderUpper);
|
||||
}
|
||||
|
||||
TEST_METHOD(GetCurrentFolder_ConsistentResults)
|
||||
{
|
||||
// Act
|
||||
const std::wstring& result1 = Utils::Apps::GetCurrentFolder();
|
||||
const std::wstring& result2 = Utils::Apps::GetCurrentFolder();
|
||||
|
||||
// Assert
|
||||
Assert::AreEqual(result1, result2);
|
||||
}
|
||||
|
||||
TEST_METHOD(GetCurrentFolderUpper_ConsistentResults)
|
||||
{
|
||||
// Act
|
||||
const std::wstring& result1 = Utils::Apps::GetCurrentFolderUpper();
|
||||
const std::wstring& result2 = Utils::Apps::GetCurrentFolderUpper();
|
||||
|
||||
// Assert
|
||||
Assert::AreEqual(result1, result2);
|
||||
}
|
||||
|
||||
TEST_METHOD(AppData_IsEdge_EdgePath_ReturnsTrue)
|
||||
{
|
||||
// Arrange
|
||||
Utils::Apps::AppData appData;
|
||||
appData.installPath = L"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe";
|
||||
|
||||
// Act
|
||||
bool result = appData.IsEdge();
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(AppData_IsEdge_NonEdgePath_ReturnsFalse)
|
||||
{
|
||||
// Arrange
|
||||
Utils::Apps::AppData appData;
|
||||
appData.installPath = L"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
|
||||
|
||||
// Act
|
||||
bool result = appData.IsEdge();
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(AppData_IsEdge_EmptyPath_ReturnsFalse)
|
||||
{
|
||||
// Arrange
|
||||
Utils::Apps::AppData appData;
|
||||
appData.installPath = L"";
|
||||
|
||||
// Act
|
||||
bool result = appData.IsEdge();
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(AppData_IsChrome_ChromePath_ReturnsTrue)
|
||||
{
|
||||
// Arrange
|
||||
Utils::Apps::AppData appData;
|
||||
appData.installPath = L"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
|
||||
|
||||
// Act
|
||||
bool result = appData.IsChrome();
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(AppData_IsChrome_NonChromePath_ReturnsFalse)
|
||||
{
|
||||
// Arrange
|
||||
Utils::Apps::AppData appData;
|
||||
appData.installPath = L"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe";
|
||||
|
||||
// Act
|
||||
bool result = appData.IsChrome();
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(AppData_IsChrome_EmptyPath_ReturnsFalse)
|
||||
{
|
||||
// Arrange
|
||||
Utils::Apps::AppData appData;
|
||||
appData.installPath = L"";
|
||||
|
||||
// Act
|
||||
bool result = appData.IsChrome();
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(AppData_IsSteamGame_SteamProtocol_ReturnsTrue)
|
||||
{
|
||||
// Arrange
|
||||
Utils::Apps::AppData appData;
|
||||
appData.protocolPath = L"steam://run/123456";
|
||||
|
||||
// Act
|
||||
bool result = appData.IsSteamGame();
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(AppData_IsSteamGame_NonSteamProtocol_ReturnsFalse)
|
||||
{
|
||||
// Arrange
|
||||
Utils::Apps::AppData appData;
|
||||
appData.protocolPath = L"https://example.com";
|
||||
|
||||
// Act
|
||||
bool result = appData.IsSteamGame();
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(AppData_IsSteamGame_EmptyProtocol_ReturnsFalse)
|
||||
{
|
||||
// Arrange
|
||||
Utils::Apps::AppData appData;
|
||||
appData.protocolPath = L"";
|
||||
|
||||
// Act
|
||||
bool result = appData.IsSteamGame();
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(AppData_IsSteamGame_PartialSteamString_ReturnsFalse)
|
||||
{
|
||||
// Arrange
|
||||
Utils::Apps::AppData appData;
|
||||
appData.protocolPath = L"http://run/123456";
|
||||
|
||||
// Act
|
||||
bool result = appData.IsSteamGame();
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(AppData_DefaultValues)
|
||||
{
|
||||
// Arrange & Act
|
||||
Utils::Apps::AppData appData;
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(appData.name.empty());
|
||||
Assert::IsTrue(appData.installPath.empty());
|
||||
Assert::IsTrue(appData.packageFullName.empty());
|
||||
Assert::IsTrue(appData.appUserModelId.empty());
|
||||
Assert::IsTrue(appData.pwaAppId.empty());
|
||||
Assert::IsTrue(appData.protocolPath.empty());
|
||||
Assert::IsFalse(appData.canLaunchElevated);
|
||||
}
|
||||
|
||||
TEST_METHOD(AppData_MultipleBrowserDetection)
|
||||
{
|
||||
// Arrange
|
||||
Utils::Apps::AppData edgeApp;
|
||||
edgeApp.installPath = L"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe";
|
||||
|
||||
Utils::Apps::AppData chromeApp;
|
||||
chromeApp.installPath = L"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
|
||||
|
||||
Utils::Apps::AppData otherApp;
|
||||
otherApp.installPath = L"C:\\Program Files\\Firefox\\firefox.exe";
|
||||
|
||||
// Act & Assert
|
||||
Assert::IsTrue(edgeApp.IsEdge());
|
||||
Assert::IsFalse(edgeApp.IsChrome());
|
||||
Assert::IsFalse(edgeApp.IsSteamGame());
|
||||
|
||||
Assert::IsFalse(chromeApp.IsEdge());
|
||||
Assert::IsTrue(chromeApp.IsChrome());
|
||||
Assert::IsFalse(chromeApp.IsSteamGame());
|
||||
|
||||
Assert::IsFalse(otherApp.IsEdge());
|
||||
Assert::IsFalse(otherApp.IsChrome());
|
||||
Assert::IsFalse(otherApp.IsSteamGame());
|
||||
}
|
||||
|
||||
TEST_METHOD(GetAppsList_ReturnsAppList)
|
||||
{
|
||||
// Act
|
||||
Utils::Apps::AppList apps = Utils::Apps::GetAppsList();
|
||||
|
||||
// Assert
|
||||
// The list can be empty or non-empty depending on the system
|
||||
// But it should not crash and should return a valid list
|
||||
Assert::IsTrue(apps.size() >= 0);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
namespace WorkspacesLibUnitTests
|
||||
{
|
||||
TEST_CLASS (JsonUtilsTests)
|
||||
{
|
||||
private:
|
||||
std::wstring CreateTempJsonFile(const std::wstring& content)
|
||||
{
|
||||
std::wstring tempPath = std::filesystem::temp_directory_path();
|
||||
tempPath += L"\\test_workspace_" + std::to_wstring(GetTickCount64()) + L".json";
|
||||
|
||||
std::wofstream file(tempPath);
|
||||
file << content;
|
||||
file.close();
|
||||
|
||||
return tempPath;
|
||||
}
|
||||
|
||||
void DeleteTempFile(const std::wstring& filePath)
|
||||
{
|
||||
if (std::filesystem::exists(filePath))
|
||||
{
|
||||
std::filesystem::remove(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
TEST_METHOD (ReadSingleWorkspace_NonExistentFile_ReturnsEmptyWorkspace)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring nonExistentFile = L"C:\\NonExistent\\File.json";
|
||||
|
||||
// Act
|
||||
auto result = JsonUtils::ReadSingleWorkspace(nonExistentFile);
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result.isOk());
|
||||
auto workspace = result.value();
|
||||
Assert::IsTrue(workspace.name.empty());
|
||||
}
|
||||
|
||||
TEST_METHOD (ReadSingleWorkspace_InvalidJsonFile_ReturnsError)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring tempFile = CreateTempJsonFile(L"invalid json content {");
|
||||
|
||||
// Act
|
||||
auto result = JsonUtils::ReadSingleWorkspace(tempFile);
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result.isError());
|
||||
Assert::AreEqual(static_cast<int>(JsonUtils::WorkspacesFileError::IncorrectFileError),
|
||||
static_cast<int>(result.error()));
|
||||
|
||||
// Cleanup
|
||||
DeleteTempFile(tempFile);
|
||||
}
|
||||
|
||||
TEST_METHOD (ReadWorkspaces_NonExistentFile_ReturnsEmptyVector)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring nonExistentFile = L"C:\\NonExistent\\File.json";
|
||||
|
||||
// Act
|
||||
auto result = JsonUtils::ReadWorkspaces(nonExistentFile);
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result.isError());
|
||||
Assert::AreEqual(static_cast<int>(JsonUtils::WorkspacesFileError::IncorrectFileError),
|
||||
static_cast<int>(result.error()));
|
||||
}
|
||||
|
||||
TEST_METHOD (ReadWorkspaces_InvalidJsonFile_ReturnsError)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring tempFile = CreateTempJsonFile(L"invalid json content {");
|
||||
|
||||
// Act
|
||||
auto result = JsonUtils::ReadWorkspaces(tempFile);
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result.isError());
|
||||
Assert::AreEqual(static_cast<int>(JsonUtils::WorkspacesFileError::IncorrectFileError),
|
||||
static_cast<int>(result.error()));
|
||||
|
||||
// Cleanup
|
||||
DeleteTempFile(tempFile);
|
||||
}
|
||||
|
||||
TEST_METHOD (Write_ValidWorkspace_ReturnsTrue)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring tempPath = std::filesystem::temp_directory_path();
|
||||
tempPath += L"\\test_write_workspace_" + std::to_wstring(GetTickCount64()) + L".json";
|
||||
|
||||
WorkspacesData::WorkspacesProject workspace;
|
||||
workspace.name = L"Test Workspace";
|
||||
|
||||
// Convert string to time_t
|
||||
std::tm tm = {};
|
||||
workspace.creationTime = std::mktime(&tm);
|
||||
|
||||
// Act
|
||||
bool result = JsonUtils::Write(tempPath, workspace);
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result);
|
||||
Assert::IsTrue(std::filesystem::exists(tempPath));
|
||||
|
||||
// Cleanup
|
||||
DeleteTempFile(tempPath);
|
||||
}
|
||||
|
||||
TEST_METHOD (Write_ValidWorkspacesList_ReturnsTrue)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring tempPath = std::filesystem::temp_directory_path();
|
||||
tempPath += L"\\test_write_workspaces_" + std::to_wstring(GetTickCount64()) + L".json";
|
||||
|
||||
std::vector<WorkspacesData::WorkspacesProject> workspaces;
|
||||
|
||||
WorkspacesData::WorkspacesProject workspace1;
|
||||
workspace1.name = L"Test Workspace 1";
|
||||
workspace1.creationTime = std::time(nullptr);
|
||||
|
||||
WorkspacesData::WorkspacesProject workspace2;
|
||||
workspace2.name = L"Test Workspace 2";
|
||||
workspace2.creationTime = std::time(nullptr);
|
||||
|
||||
workspaces.push_back(workspace1);
|
||||
workspaces.push_back(workspace2);
|
||||
|
||||
// Act
|
||||
bool result = JsonUtils::Write(tempPath, workspaces);
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result);
|
||||
Assert::IsTrue(std::filesystem::exists(tempPath));
|
||||
|
||||
// Cleanup
|
||||
DeleteTempFile(tempPath);
|
||||
}
|
||||
|
||||
TEST_METHOD (Write_EmptyWorkspacesList_ReturnsTrue)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring tempPath = std::filesystem::temp_directory_path();
|
||||
tempPath += L"\\test_write_empty_" + std::to_wstring(GetTickCount64()) + L".json";
|
||||
|
||||
std::vector<WorkspacesData::WorkspacesProject> emptyWorkspaces;
|
||||
|
||||
// Act
|
||||
bool result = JsonUtils::Write(tempPath, emptyWorkspaces);
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result);
|
||||
Assert::IsTrue(std::filesystem::exists(tempPath));
|
||||
|
||||
// Cleanup
|
||||
DeleteTempFile(tempPath);
|
||||
}
|
||||
|
||||
/*
|
||||
TEST_METHOD(Write_InvalidPath_ReturnsFalse)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring invalidPath = L"C:\\NonExistent\\Path\\workspace.json";
|
||||
|
||||
WorkspacesData::WorkspacesProject workspace;
|
||||
workspace.name = L"Test Workspace";
|
||||
workspace.creationTime = std::time(nullptr);
|
||||
|
||||
// Act
|
||||
bool result = JsonUtils::Write(invalidPath, workspace);
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result);
|
||||
}
|
||||
*/
|
||||
};
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
#include "pch.h"
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
namespace WorkspacesLibUnitTests
|
||||
{
|
||||
TEST_CLASS (PwaHelperTests)
|
||||
{
|
||||
public:
|
||||
TEST_METHOD (PwaHelper_Constructor_DoesNotThrow)
|
||||
{
|
||||
// Act & Assert - Constructor should not crash when called
|
||||
try
|
||||
{
|
||||
Utils::PwaHelper helper;
|
||||
// If we get here, the constructor didn't throw
|
||||
Assert::IsTrue(true);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Assert::Fail(L"PwaHelper constructor should not throw exceptions");
|
||||
}
|
||||
}
|
||||
|
||||
TEST_METHOD (PwaHelper_GetEdgeAppId_EmptyAumid_ReturnsEmpty)
|
||||
{
|
||||
// Arrange
|
||||
Utils::PwaHelper helper;
|
||||
std::wstring emptyAumid = L"";
|
||||
|
||||
// Act
|
||||
auto result = helper.GetEdgeAppId(emptyAumid);
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result.has_value());
|
||||
}
|
||||
|
||||
TEST_METHOD (PwaHelper_GetChromeAppId_EmptyAumid_ReturnsEmpty)
|
||||
{
|
||||
// Arrange
|
||||
Utils::PwaHelper helper;
|
||||
std::wstring emptyAumid = L"";
|
||||
|
||||
// Act
|
||||
auto result = helper.GetChromeAppId(emptyAumid);
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result.has_value());
|
||||
}
|
||||
|
||||
TEST_METHOD (PwaHelper_SearchPwaName_EmptyParameters_ReturnsEmpty)
|
||||
{
|
||||
// Arrange
|
||||
Utils::PwaHelper helper;
|
||||
std::wstring emptyPwaAppId = L"";
|
||||
std::wstring emptyWindowAumid = L"";
|
||||
|
||||
// Act
|
||||
std::wstring result = helper.SearchPwaName(emptyPwaAppId, emptyWindowAumid);
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result.empty());
|
||||
}
|
||||
|
||||
TEST_METHOD (PwaHelper_SearchPwaName_NonExistentIds_ReturnsEmpty)
|
||||
{
|
||||
// Arrange
|
||||
Utils::PwaHelper helper;
|
||||
std::wstring nonExistentPwaAppId = L"nonexistent_app_id";
|
||||
std::wstring nonExistentWindowAumid = L"nonexistent_aumid";
|
||||
|
||||
// Act
|
||||
std::wstring result = helper.SearchPwaName(nonExistentPwaAppId, nonExistentWindowAumid);
|
||||
|
||||
// TODO: is it really expected?
|
||||
Assert::IsTrue(result == nonExistentWindowAumid);
|
||||
}
|
||||
|
||||
TEST_METHOD (PwaHelper_GetAUMIDFromWindow_InvalidWindow_ReturnsEmpty)
|
||||
{
|
||||
// Arrange
|
||||
Utils::PwaHelper helper;
|
||||
HWND invalidWindow = nullptr;
|
||||
|
||||
// Act
|
||||
std::wstring result = helper.GetAUMIDFromWindow(invalidWindow);
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result.empty());
|
||||
}
|
||||
|
||||
TEST_METHOD (PwaHelper_GetEdgeAppId_ValidConstruction_DoesNotCrash)
|
||||
{
|
||||
// Arrange
|
||||
Utils::PwaHelper helper;
|
||||
std::wstring testAumid = L"Microsoft.MicrosoftEdge_8wekyb3d8bbwe!App";
|
||||
|
||||
// Act & Assert - Should not crash
|
||||
auto result = helper.GetEdgeAppId(testAumid);
|
||||
// Result can be empty or have value, but should not crash
|
||||
}
|
||||
|
||||
TEST_METHOD (PwaHelper_GetChromeAppId_ValidConstruction_DoesNotCrash)
|
||||
{
|
||||
// Arrange
|
||||
Utils::PwaHelper helper;
|
||||
std::wstring testAumid = L"Chrome.App.TestId";
|
||||
|
||||
// Act & Assert - Should not crash
|
||||
auto result = helper.GetChromeAppId(testAumid);
|
||||
// Result can be empty or have value, but should not crash
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include <StringUtils.h>
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
namespace WorkspacesLibUnitTests
|
||||
{
|
||||
TEST_CLASS(StringUtilsTests)
|
||||
{
|
||||
public:
|
||||
TEST_METHOD(CaseInsensitiveEquals_SameStrings_ReturnsTrue)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring str1 = L"test";
|
||||
std::wstring str2 = L"test";
|
||||
|
||||
// Act
|
||||
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(CaseInsensitiveEquals_DifferentCase_ReturnsTrue)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring str1 = L"Test";
|
||||
std::wstring str2 = L"TEST";
|
||||
|
||||
// Act
|
||||
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(CaseInsensitiveEquals_MixedCase_ReturnsTrue)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring str1 = L"TeSt StRiNg";
|
||||
std::wstring str2 = L"test STRING";
|
||||
|
||||
// Act
|
||||
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(CaseInsensitiveEquals_DifferentStrings_ReturnsFalse)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring str1 = L"test";
|
||||
std::wstring str2 = L"different";
|
||||
|
||||
// Act
|
||||
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(CaseInsensitiveEquals_DifferentLengths_ReturnsFalse)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring str1 = L"test";
|
||||
std::wstring str2 = L"testing";
|
||||
|
||||
// Act
|
||||
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(CaseInsensitiveEquals_EmptyStrings_ReturnsTrue)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring str1 = L"";
|
||||
std::wstring str2 = L"";
|
||||
|
||||
// Act
|
||||
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(CaseInsensitiveEquals_OneEmpty_ReturnsFalse)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring str1 = L"test";
|
||||
std::wstring str2 = L"";
|
||||
|
||||
// Act
|
||||
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result);
|
||||
}
|
||||
|
||||
TEST_METHOD(CaseInsensitiveEquals_SpecialCharacters_ReturnsTrue)
|
||||
{
|
||||
// Arrange
|
||||
std::wstring str1 = L"Test-123_Special!";
|
||||
std::wstring str2 = L"test-123_special!";
|
||||
|
||||
// Act
|
||||
bool result = StringUtils::CaseInsensitiveEquals(str1, str2);
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(result);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,194 +0,0 @@
|
||||
#include "pch.h"
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
namespace WorkspacesLibUnitTests
|
||||
{
|
||||
TEST_CLASS(WorkspacesDataTests)
|
||||
{
|
||||
public:
|
||||
TEST_METHOD(WorkspacesFile_ReturnsValidPath)
|
||||
{
|
||||
// Act
|
||||
std::wstring result = WorkspacesData::WorkspacesFile();
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result.empty());
|
||||
Assert::IsTrue(result.find(L"workspaces.json") != std::wstring::npos);
|
||||
}
|
||||
|
||||
TEST_METHOD(TempWorkspacesFile_ReturnsValidPath)
|
||||
{
|
||||
// Act
|
||||
std::wstring result = WorkspacesData::TempWorkspacesFile();
|
||||
|
||||
// Assert
|
||||
Assert::IsFalse(result.empty());
|
||||
Assert::IsTrue(result.find(L"temp-workspaces.json") != std::wstring::npos);
|
||||
}
|
||||
|
||||
TEST_METHOD(WorkspacesFile_TempWorkspacesFile_DifferentPaths)
|
||||
{
|
||||
// Act
|
||||
std::wstring workspacesFile = WorkspacesData::WorkspacesFile();
|
||||
std::wstring tempWorkspacesFile = WorkspacesData::TempWorkspacesFile();
|
||||
|
||||
// Assert
|
||||
Assert::AreNotEqual(workspacesFile, tempWorkspacesFile);
|
||||
}
|
||||
|
||||
TEST_METHOD(Position_ToRect_ConvertsCorrectly)
|
||||
{
|
||||
// Arrange
|
||||
WorkspacesData::WorkspacesProject::Application::Position position;
|
||||
position.x = 100;
|
||||
position.y = 200;
|
||||
position.width = 800;
|
||||
position.height = 600;
|
||||
|
||||
// Act
|
||||
RECT rect = position.toRect();
|
||||
|
||||
// Assert
|
||||
Assert::AreEqual(100, static_cast<int>(rect.left));
|
||||
Assert::AreEqual(200, static_cast<int>(rect.top));
|
||||
Assert::AreEqual(900, static_cast<int>(rect.right)); // x + width
|
||||
Assert::AreEqual(800, static_cast<int>(rect.bottom)); // y + height
|
||||
}
|
||||
|
||||
TEST_METHOD(Position_ToRect_ZeroPosition)
|
||||
{
|
||||
// Arrange
|
||||
WorkspacesData::WorkspacesProject::Application::Position position;
|
||||
position.x = 0;
|
||||
position.y = 0;
|
||||
position.width = 0;
|
||||
position.height = 0;
|
||||
|
||||
// Act
|
||||
RECT rect = position.toRect();
|
||||
|
||||
// Assert
|
||||
Assert::AreEqual(0, static_cast<int>(rect.left));
|
||||
Assert::AreEqual(0, static_cast<int>(rect.top));
|
||||
Assert::AreEqual(0, static_cast<int>(rect.right));
|
||||
Assert::AreEqual(0, static_cast<int>(rect.bottom));
|
||||
}
|
||||
|
||||
TEST_METHOD(Position_ToRect_NegativeCoordinates)
|
||||
{
|
||||
// Arrange
|
||||
WorkspacesData::WorkspacesProject::Application::Position position;
|
||||
position.x = -100;
|
||||
position.y = -50;
|
||||
position.width = 200;
|
||||
position.height = 150;
|
||||
|
||||
// Act
|
||||
RECT rect = position.toRect();
|
||||
|
||||
// Assert
|
||||
Assert::AreEqual(-100, static_cast<int>(rect.left));
|
||||
Assert::AreEqual(-50, static_cast<int>(rect.top));
|
||||
Assert::AreEqual(100, static_cast<int>(rect.right)); // -100 + 200
|
||||
Assert::AreEqual(100, static_cast<int>(rect.bottom)); // -50 + 150
|
||||
}
|
||||
|
||||
TEST_METHOD(Application_DefaultValues)
|
||||
{
|
||||
// Arrange & Act
|
||||
WorkspacesData::WorkspacesProject::Application app;
|
||||
|
||||
// Assert
|
||||
Assert::IsTrue(app.id.empty());
|
||||
Assert::IsTrue(app.name.empty());
|
||||
Assert::IsTrue(app.title.empty());
|
||||
Assert::IsTrue(app.path.empty());
|
||||
Assert::IsTrue(app.packageFullName.empty());
|
||||
Assert::IsTrue(app.appUserModelId.empty());
|
||||
Assert::IsTrue(app.pwaAppId.empty());
|
||||
Assert::IsTrue(app.commandLineArgs.empty());
|
||||
Assert::IsFalse(app.isElevated);
|
||||
Assert::IsFalse(app.canLaunchElevated);
|
||||
Assert::IsFalse(app.isMinimized);
|
||||
Assert::IsFalse(app.isMaximized);
|
||||
Assert::AreEqual(0, static_cast<int>(app.position.x));
|
||||
Assert::AreEqual(0, static_cast<int>(app.position.y));
|
||||
Assert::AreEqual(0, static_cast<int>(app.position.width));
|
||||
Assert::AreEqual(0, static_cast<int>(app.position.height));
|
||||
Assert::AreEqual(0u, static_cast<unsigned int>(app.monitor));
|
||||
}
|
||||
|
||||
TEST_METHOD(Application_Comparison_EqualObjects)
|
||||
{
|
||||
// Arrange
|
||||
WorkspacesData::WorkspacesProject::Application app1;
|
||||
app1.id = L"test-id";
|
||||
app1.name = L"Test App";
|
||||
app1.position.x = 100;
|
||||
app1.position.y = 200;
|
||||
|
||||
WorkspacesData::WorkspacesProject::Application app2;
|
||||
app2.id = L"test-id";
|
||||
app2.name = L"Test App";
|
||||
app2.position.x = 100;
|
||||
app2.position.y = 200;
|
||||
|
||||
// Act & Assert
|
||||
Assert::IsTrue(app1 == app2);
|
||||
}
|
||||
|
||||
TEST_METHOD(Application_Comparison_DifferentObjects)
|
||||
{
|
||||
// Arrange
|
||||
WorkspacesData::WorkspacesProject::Application app1;
|
||||
app1.id = L"test-id-1";
|
||||
app1.name = L"Test App 1";
|
||||
|
||||
WorkspacesData::WorkspacesProject::Application app2;
|
||||
app2.id = L"test-id-2";
|
||||
app2.name = L"Test App 2";
|
||||
|
||||
// Act & Assert
|
||||
Assert::IsTrue(app1 != app2);
|
||||
}
|
||||
|
||||
TEST_METHOD(Position_Comparison_EqualPositions)
|
||||
{
|
||||
// Arrange
|
||||
WorkspacesData::WorkspacesProject::Application::Position pos1;
|
||||
pos1.x = 100;
|
||||
pos1.y = 200;
|
||||
pos1.width = 800;
|
||||
pos1.height = 600;
|
||||
|
||||
WorkspacesData::WorkspacesProject::Application::Position pos2;
|
||||
pos2.x = 100;
|
||||
pos2.y = 200;
|
||||
pos2.width = 800;
|
||||
pos2.height = 600;
|
||||
|
||||
// Act & Assert
|
||||
Assert::IsTrue(pos1 == pos2);
|
||||
}
|
||||
|
||||
TEST_METHOD(Position_Comparison_DifferentPositions)
|
||||
{
|
||||
// Arrange
|
||||
WorkspacesData::WorkspacesProject::Application::Position pos1;
|
||||
pos1.x = 100;
|
||||
pos1.y = 200;
|
||||
pos1.width = 800;
|
||||
pos1.height = 600;
|
||||
|
||||
WorkspacesData::WorkspacesProject::Application::Position pos2;
|
||||
pos2.x = 150;
|
||||
pos2.y = 200;
|
||||
pos2.width = 800;
|
||||
pos2.height = 600;
|
||||
|
||||
// Act & Assert
|
||||
Assert::IsTrue(pos1 != pos2);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>WorkspacesLibUnitTests</RootNamespace>
|
||||
<ProjectName>WorkspacesLibUnitTests</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<OutDir>..\..\..\..\$(Platform)\$(Configuration)\tests\Workspaces\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\;..\WorkspacesLib\;$(SolutionDir)src\;$(SolutionDir)src\common;$(SolutionDir)src\common\Telemetry;..\..\;..\..\..\;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<UseFullPaths>true</UseFullPaths>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\\lib;$(SolutionDir)$(Platform)\\$(Configuration)\\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>propsys.lib;comctl32.lib;pathcch.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="WorkspacesDataTests.cpp" />
|
||||
<ClCompile Include="StringUtilsTests.cpp" />
|
||||
<ClCompile Include="JsonUtilsTests.cpp" />
|
||||
<ClCompile Include="AppUtilsTests.cpp" />
|
||||
<ClCompile Include="PwaHelperTests.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
|
||||
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\WorkspacesLib\WorkspacesLib.vcxproj">
|
||||
<Project>{b31fcc55-b5a4-4ea7-b414-2dceae6af332}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,48 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="WorkspacesDataTests.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StringUtilsTests.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="JsonUtilsTests.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AppUtilsTests.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PwaHelperTests.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -1 +0,0 @@
|
||||
#include "pch.h"
|
||||
@@ -1,21 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
// Headers for CppUnitTest
|
||||
#pragma warning(disable : 26466)
|
||||
#include "CppUnitTest.h"
|
||||
|
||||
// Windows headers
|
||||
#include <windows.h>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
|
||||
// Workspaces headers
|
||||
#include <WorkspacesLib/WorkspacesData.h>
|
||||
#include <WorkspacesLib/JsonUtils.h>
|
||||
#include <WorkspacesLib/Result.h>
|
||||
#include <WorkspacesLib/AppUtils.h>
|
||||
#include <WorkspacesLib/PwaHelper.h>
|
||||
@@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// Including SDKDDKVer.h defines the highest available Windows platform.
|
||||
|
||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace StringUtils
|
||||
{
|
||||
inline bool CaseInsensitiveEquals(const std::wstring& str1, const std::wstring& str2)
|
||||
bool CaseInsensitiveEquals(const std::wstring& str1, const std::wstring& str2)
|
||||
{
|
||||
if (str1.size() != str2.size())
|
||||
{
|
||||
|
||||
@@ -69,10 +69,10 @@ namespace WorkspacesData
|
||||
|
||||
std::wstring id;
|
||||
std::wstring name;
|
||||
time_t creationTime{};
|
||||
time_t creationTime;
|
||||
std::optional<time_t> lastLaunchedTime;
|
||||
bool isShortcutNeeded{};
|
||||
bool moveExistingWindows{};
|
||||
bool isShortcutNeeded;
|
||||
bool moveExistingWindows;
|
||||
std::vector<Monitor> monitors;
|
||||
std::vector<Application> apps;
|
||||
};
|
||||
|
||||
@@ -117,18 +117,16 @@ private:
|
||||
|
||||
for (DWORD pid : processIds)
|
||||
{
|
||||
HANDLE hProcess = OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, FALSE, pid);
|
||||
HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
|
||||
|
||||
if (hProcess != NULL)
|
||||
{
|
||||
SetEvent(m_hTerminateEvent);
|
||||
|
||||
// Wait for 1.5 seconds for the process to end correctly, allowing time for ETW tracer and extensions to stop
|
||||
if (WaitForSingleObject(hProcess, 1500) == WAIT_TIMEOUT)
|
||||
{
|
||||
TerminateProcess(hProcess, 0);
|
||||
}
|
||||
// Wait for 1.5 seconds for the process to end correctly and stop etw tracer
|
||||
WaitForSingleObject(hProcess, 1500);
|
||||
|
||||
TerminateProcess(hProcess, 0);
|
||||
CloseHandle(hProcess);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,8 +102,6 @@ public sealed partial class TopLevelViewModel : ObservableObject, IListItem
|
||||
}
|
||||
|
||||
HandleChangeAlias();
|
||||
OnPropertyChanged(nameof(AliasText));
|
||||
OnPropertyChanged(nameof(IsDirectAlias));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +116,6 @@ public sealed partial class TopLevelViewModel : ObservableObject, IListItem
|
||||
}
|
||||
|
||||
HandleChangeAlias();
|
||||
OnPropertyChanged(nameof(IsDirectAlias));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ public partial class App : Application
|
||||
"Local\\PowerToysCmdPal-ExitEvent-eb73f6be-3f22-4b36-aee3-62924ba40bfd", () =>
|
||||
{
|
||||
EtwTrace?.Dispose();
|
||||
AppWindow?.Close();
|
||||
Environment.Exit(0);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public sealed partial class ContentFormControl : UserControl
|
||||
|
||||
// LOAD-BEARING: if you don't hang onto a reference to the RenderedAdaptiveCard
|
||||
// then the GC might clean it up sometime, even while the card is in the UI
|
||||
// tree. If this gets GC'ed, then it'll revoke our Action handler, and the
|
||||
// tree. If this gets GC'd, then it'll revoke our Action handler, and the
|
||||
// form will do seemingly nothing.
|
||||
private RenderedAdaptiveCard? _renderedCard;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Page
|
||||
x:Class="Microsoft.CmdPal.UI.Settings.ExtensionPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
@@ -92,11 +92,12 @@
|
||||
|
||||
<controls:SettingsCard x:Uid="Settings_ExtensionPage_Alias_SettingsCard" HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBox Text="{x:Bind AliasText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBox Text="{x:Bind AliasText, Mode=TwoWay}" />
|
||||
<ToggleSwitch
|
||||
x:Uid="Settings_ExtensionPage_Alias_ToggleSwitch"
|
||||
IsEnabled="{x:Bind AliasText, Converter={StaticResource StringEmptyToBoolConverter}, Mode=OneWay}"
|
||||
IsOn="{x:Bind IsDirectAlias, Mode=TwoWay}" />
|
||||
IsOn="{x:Bind IsDirectAlias, Mode=TwoWay}"
|
||||
OffContent="Indirect"
|
||||
OnContent="Direct" />
|
||||
</StackPanel>
|
||||
</controls:SettingsCard>
|
||||
|
||||
|
||||
@@ -418,10 +418,4 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
|
||||
<data name="TrayMenu_Exit" xml:space="preserve">
|
||||
<value>Exit</value>
|
||||
</data>
|
||||
<data name="Settings_ExtensionPage_Alias_ToggleSwitch.OnContent" xml:space="preserve">
|
||||
<value>Direct</value>
|
||||
</data>
|
||||
<data name="Settings_ExtensionPage_Alias_ToggleSwitch.OffContent" xml:space="preserve">
|
||||
<value>Indirect</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -39,8 +39,8 @@ Projects of interest are:
|
||||
|
||||
|
||||
[Initial SDK Spec]: ./doc/initial-sdk-spec/initial-sdk-spec.md
|
||||
[generic samples]: ./ext/SamplePagesExtension
|
||||
[real samples]: ./ext/ProcessMonitorExtension
|
||||
[generic samples]: ./Exts/SamplePagesExtension
|
||||
[real samples]: ./Exts/ProcessMonitorExtension
|
||||
[real extensions that we've "shipped" already]: https://github.com/zadjii/CmdPalExtensions/blob/main/src/extensions
|
||||
|
||||
|
||||
|
||||
@@ -6,20 +6,20 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
using CalculatorEngineCommon;
|
||||
using Windows.Foundation.Collections;
|
||||
|
||||
using Mages.Core;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.Calc.Helper;
|
||||
|
||||
public static class CalculateEngine
|
||||
{
|
||||
private static readonly PropertySet _constants = new()
|
||||
private static readonly Engine _magesEngine = new Engine(new Configuration
|
||||
{
|
||||
{ "pi", Math.PI },
|
||||
{ "e", Math.E },
|
||||
};
|
||||
|
||||
private static readonly Calculator _calculator = new Calculator(_constants);
|
||||
Scope = new Dictionary<string, object>
|
||||
{
|
||||
{ "e", Math.E }, // e is not contained in the default mages engine
|
||||
},
|
||||
});
|
||||
|
||||
public const int RoundingDigits = 10;
|
||||
|
||||
@@ -68,26 +68,28 @@ public static class CalculateEngine
|
||||
// Expand conversions between trig units
|
||||
input = CalculateHelper.ExpandTrigConversions(input, trigMode);
|
||||
|
||||
var result = _calculator.EvaluateExpression(input);
|
||||
var result = _magesEngine.Interpret(input);
|
||||
|
||||
// This could happen for some incorrect queries, like pi(2)
|
||||
if (result == "NaN")
|
||||
if (result == null)
|
||||
{
|
||||
error = Properties.Resources.calculator_expression_not_complete;
|
||||
return default;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(result))
|
||||
result = TransformResult(result);
|
||||
if (result is string)
|
||||
{
|
||||
error = result as string;
|
||||
return default;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(result?.ToString()))
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
var decimalResult = Convert.ToDecimal(result, cultureInfo);
|
||||
|
||||
// Remove trailing zeros from the decimal string representation (e.g., "1.2300" -> "1.23")
|
||||
// This is necessary because the value extracted from exprtk may contain unnecessary trailing zeros.
|
||||
var formatted = decimalResult.ToString("G29", cultureInfo);
|
||||
decimalResult = Convert.ToDecimal(formatted, cultureInfo);
|
||||
var roundedResult = Round(decimalResult);
|
||||
|
||||
return new CalculateResult()
|
||||
@@ -101,4 +103,25 @@ public static class CalculateEngine
|
||||
{
|
||||
return Math.Round(value, RoundingDigits, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
|
||||
private static dynamic TransformResult(object result)
|
||||
{
|
||||
if (result.ToString() == "NaN")
|
||||
{
|
||||
return Properties.Resources.calculator_not_a_number;
|
||||
}
|
||||
|
||||
if (result is Function)
|
||||
{
|
||||
return Properties.Resources.calculator_expression_not_complete;
|
||||
}
|
||||
|
||||
if (result is double[,])
|
||||
{
|
||||
// '[10,10]' is interpreted as array by mages engine
|
||||
return Properties.Resources.calculator_double_array_returned;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -64,61 +63,46 @@ public class NumberTranslator
|
||||
return Translate(input, targetCulture, sourceCulture, splitRegexForTarget);
|
||||
}
|
||||
|
||||
private static string ConvertBaseLiteral(string token, CultureInfo cultureTo)
|
||||
{
|
||||
var prefixes = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ "0x", 16 },
|
||||
{ "0b", 2 },
|
||||
{ "0o", 8 },
|
||||
};
|
||||
|
||||
foreach (var (prefix, numberBase) in prefixes)
|
||||
{
|
||||
if (token.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
try
|
||||
{
|
||||
var num = Convert.ToInt64(token.Substring(prefix.Length), numberBase);
|
||||
return num.ToString(cultureTo);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null; // fallback
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string Translate(string input, CultureInfo cultureFrom, CultureInfo cultureTo, Regex splitRegex)
|
||||
{
|
||||
var outputBuilder = new StringBuilder();
|
||||
var hexRegex = new Regex(@"(?:(0x[\da-fA-F]+))");
|
||||
|
||||
// Match numbers in hexadecimal (0x..), binary (0b..), or octal (0o..) format,
|
||||
// and convert them to decimal form for compatibility with ExprTk (which only supports decimal input).
|
||||
var baseNumberRegex = new Regex(@"(0[xX][\da-fA-F]+|0[bB][0-9]+|0[oO][0-9]+)");
|
||||
var hexTokens = hexRegex.Split(input);
|
||||
|
||||
var tokens = baseNumberRegex.Split(input);
|
||||
|
||||
foreach (var token in tokens)
|
||||
foreach (var hexToken in hexTokens)
|
||||
{
|
||||
// Currently, we only convert base literals (hexadecimal, binary, octal) to decimal.
|
||||
var converted = ConvertBaseLiteral(token, cultureTo);
|
||||
|
||||
if (converted != null)
|
||||
if (hexToken.StartsWith("0x", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
outputBuilder.Append(converted);
|
||||
// Mages engine has issues processing large hex number (larger than 7 hex digits + 0x prefix = 9 characters). So we convert it to decimal and pass it to the engine.
|
||||
if (hexToken.Length > 9)
|
||||
{
|
||||
try
|
||||
{
|
||||
var num = Convert.ToInt64(hexToken, 16);
|
||||
var numStr = num.ToString(cultureFrom);
|
||||
outputBuilder.Append(numStr);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
outputBuilder.Append(hexToken);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
outputBuilder.Append(hexToken);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (var inner in splitRegex.Split(token))
|
||||
var tokens = splitRegex.Split(hexToken);
|
||||
foreach (var token in tokens)
|
||||
{
|
||||
var leadingZeroCount = 0;
|
||||
|
||||
// Count leading zero characters.
|
||||
foreach (var c in inner)
|
||||
foreach (var c in token)
|
||||
{
|
||||
if (c != '0')
|
||||
{
|
||||
@@ -129,7 +113,7 @@ public class NumberTranslator
|
||||
}
|
||||
|
||||
// number is all zero characters. no need to add zero characters at the end.
|
||||
if (inner.Length == leadingZeroCount)
|
||||
if (token.Length == leadingZeroCount)
|
||||
{
|
||||
leadingZeroCount = 0;
|
||||
}
|
||||
@@ -137,9 +121,9 @@ public class NumberTranslator
|
||||
decimal number;
|
||||
|
||||
outputBuilder.Append(
|
||||
decimal.TryParse(inner, NumberStyles.Number, cultureFrom, out number)
|
||||
decimal.TryParse(token, NumberStyles.Number, cultureFrom, out number)
|
||||
? (new string('0', leadingZeroCount) + number.ToString(cultureTo))
|
||||
: inner.Replace(cultureFrom.TextInfo.ListSeparator, cultureTo.TextInfo.ListSeparator));
|
||||
: token.Replace(cultureFrom.TextInfo.ListSeparator, cultureTo.TextInfo.ListSeparator));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,11 @@ public static partial class QueryHelper
|
||||
|
||||
return ResultHelper.CreateResult(result.RoundedResult, inputCulture, outputCulture, query, handleSave);
|
||||
}
|
||||
catch (Mages.Core.ParseException)
|
||||
{
|
||||
// Invalid input
|
||||
return ErrorHandler.OnError(isFallbackSearch, query, Properties.Resources.calculator_expression_not_complete);
|
||||
}
|
||||
catch (OverflowException)
|
||||
{
|
||||
// Result to big to convert to decimal
|
||||
|
||||
@@ -9,25 +9,15 @@
|
||||
<!-- MRT from windows app sdk will search for a pri file with the same name of the module before defaulting to resources.pri -->
|
||||
<ProjectPriFileName>Microsoft.CmdPal.Ext.Calc.pri</ProjectPriFileName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<CsWinRTIncludes>CalculatorEngineCommon</CsWinRTIncludes>
|
||||
<CsWinRTGeneratedFilesDir>$(OutDir)</CsWinRTGeneratedFilesDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\common\CalculatorEngineCommon\CalculatorEngineCommon.vcxproj" />
|
||||
<ProjectReference Include="..\..\..\..\common\ManagedCommon\ManagedCommon.csproj" />
|
||||
<ProjectReference Include="..\..\extensionsdk\Microsoft.CommandPalette.Extensions.Toolkit\Microsoft.CommandPalette.Extensions.Toolkit.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<CsWinRTInputs Include="..\..\..\..\..\$(Platform)\$(Configuration)\CalculatorEngineCommon.winmd" />
|
||||
<Content Include="..\..\..\..\..\$(Platform)\$(Configuration)\CalculatorEngineCommon.winmd" Link="CalculatorEngineCommon.winmd">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\..\..\..\..\$(Platform)\$(Configuration)\CalculatorEngineCommon.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<PackageReference Include="Mages" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
|
||||
@@ -107,14 +107,21 @@ namespace ColorPicker.Helpers
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenColorEditor()
|
||||
public void OnColorPickerMouseDown()
|
||||
{
|
||||
lock (_colorPickerVisibilityLock)
|
||||
if (_userSettings.ActivationAction.Value == ColorPickerActivationAction.OpenColorPickerAndThenEditor || _userSettings.ActivationAction.Value == ColorPickerActivationAction.OpenEditor)
|
||||
{
|
||||
HideColorPicker();
|
||||
}
|
||||
lock (_colorPickerVisibilityLock)
|
||||
{
|
||||
HideColorPicker();
|
||||
}
|
||||
|
||||
ShowColorPickerEditor();
|
||||
ShowColorPickerEditor();
|
||||
}
|
||||
else
|
||||
{
|
||||
EndUserSession();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetTopMost()
|
||||
|
||||
@@ -16,12 +16,10 @@ namespace ColorPicker.Mouse
|
||||
// position and bool indicating zoom in or zoom out
|
||||
event EventHandler<Tuple<System.Windows.Point, bool>> OnMouseWheel;
|
||||
|
||||
event PrimaryMouseDownEventHandler OnPrimaryMouseDown;
|
||||
event MouseUpEventHandler OnMouseDown;
|
||||
|
||||
event SecondaryMouseUpEventHandler OnSecondaryMouseUp;
|
||||
|
||||
event MiddleMouseDownEventHandler OnMiddleMouseDown;
|
||||
|
||||
System.Windows.Point CurrentPosition { get; }
|
||||
|
||||
Color CurrentColor { get; }
|
||||
|
||||
@@ -7,18 +7,17 @@ using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Input;
|
||||
|
||||
using ColorPicker.Helpers;
|
||||
using ManagedCommon;
|
||||
|
||||
using static ColorPicker.NativeMethods;
|
||||
|
||||
namespace ColorPicker.Mouse
|
||||
{
|
||||
public delegate void PrimaryMouseDownEventHandler(object sender, IntPtr wParam);
|
||||
public delegate void MouseUpEventHandler(object sender, System.Drawing.Point p);
|
||||
|
||||
public delegate void SecondaryMouseUpEventHandler(object sender, IntPtr wParam);
|
||||
|
||||
public delegate void MiddleMouseDownEventHandler(object sender, IntPtr wParam);
|
||||
|
||||
internal class MouseHook
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop object")]
|
||||
@@ -31,25 +30,23 @@ namespace ColorPicker.Mouse
|
||||
private const int WM_RBUTTONUP = 0x0205;
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop object")]
|
||||
private const int WM_RBUTTONDOWN = 0x0204;
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop object")]
|
||||
private const int WM_MBUTTONDOWN = 0x0207;
|
||||
|
||||
private IntPtr _mouseHookHandle;
|
||||
private HookProc _mouseDelegate;
|
||||
|
||||
private event PrimaryMouseDownEventHandler PrimaryMouseDown;
|
||||
private event MouseUpEventHandler MouseDown;
|
||||
|
||||
public event PrimaryMouseDownEventHandler OnPrimaryMouseDown
|
||||
public event MouseUpEventHandler OnMouseDown
|
||||
{
|
||||
add
|
||||
{
|
||||
Subscribe();
|
||||
PrimaryMouseDown += value;
|
||||
MouseDown += value;
|
||||
}
|
||||
|
||||
remove
|
||||
{
|
||||
PrimaryMouseDown -= value;
|
||||
MouseDown -= value;
|
||||
Unsubscribe();
|
||||
}
|
||||
}
|
||||
@@ -71,23 +68,6 @@ namespace ColorPicker.Mouse
|
||||
}
|
||||
}
|
||||
|
||||
private event MiddleMouseDownEventHandler MiddleMouseDown;
|
||||
|
||||
public event MiddleMouseDownEventHandler OnMiddleMouseDown
|
||||
{
|
||||
add
|
||||
{
|
||||
Subscribe();
|
||||
MiddleMouseDown += value;
|
||||
}
|
||||
|
||||
remove
|
||||
{
|
||||
MiddleMouseDown -= value;
|
||||
Unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
private event MouseWheelEventHandler MouseWheel;
|
||||
|
||||
public event MouseWheelEventHandler OnMouseWheel
|
||||
@@ -146,9 +126,9 @@ namespace ColorPicker.Mouse
|
||||
MSLLHOOKSTRUCT mouseHookStruct = (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT));
|
||||
if (wParam.ToInt32() == WM_LBUTTONDOWN)
|
||||
{
|
||||
if (PrimaryMouseDown != null)
|
||||
if (MouseDown != null)
|
||||
{
|
||||
PrimaryMouseDown.Invoke(null, wParam);
|
||||
MouseDown.Invoke(null, new System.Drawing.Point(mouseHookStruct.pt.x, mouseHookStruct.pt.y));
|
||||
}
|
||||
|
||||
return new IntPtr(-1);
|
||||
@@ -170,16 +150,6 @@ namespace ColorPicker.Mouse
|
||||
return new IntPtr(-1);
|
||||
}
|
||||
|
||||
if (wParam.ToInt32() == WM_MBUTTONDOWN)
|
||||
{
|
||||
if (MiddleMouseDown != null)
|
||||
{
|
||||
MiddleMouseDown.Invoke(null, wParam);
|
||||
}
|
||||
|
||||
return new IntPtr(-1);
|
||||
}
|
||||
|
||||
if (wParam.ToInt32() == WM_MOUSEWHEEL)
|
||||
{
|
||||
if (MouseWheel != null)
|
||||
|
||||
@@ -56,12 +56,10 @@ namespace ColorPicker.Mouse
|
||||
|
||||
public event EventHandler<Tuple<System.Windows.Point, bool>> OnMouseWheel;
|
||||
|
||||
public event PrimaryMouseDownEventHandler OnPrimaryMouseDown;
|
||||
public event MouseUpEventHandler OnMouseDown;
|
||||
|
||||
public event SecondaryMouseUpEventHandler OnSecondaryMouseUp;
|
||||
|
||||
public event MiddleMouseDownEventHandler OnMiddleMouseDown;
|
||||
|
||||
public System.Windows.Point CurrentPosition
|
||||
{
|
||||
get
|
||||
@@ -150,10 +148,9 @@ namespace ColorPicker.Mouse
|
||||
_timer.Start();
|
||||
}
|
||||
|
||||
_mouseHook.OnPrimaryMouseDown += MouseHook_OnPrimaryMouseDown;
|
||||
_mouseHook.OnMouseDown += MouseHook_OnMouseDown;
|
||||
_mouseHook.OnMouseWheel += MouseHook_OnMouseWheel;
|
||||
_mouseHook.OnSecondaryMouseUp += MouseHook_OnSecondaryMouseUp;
|
||||
_mouseHook.OnMiddleMouseDown += MouseHook_OnMiddleMouseDown;
|
||||
|
||||
if (_userSettings.ChangeCursor.Value)
|
||||
{
|
||||
@@ -172,10 +169,10 @@ namespace ColorPicker.Mouse
|
||||
OnMouseWheel?.Invoke(this, new Tuple<System.Windows.Point, bool>(_previousMousePosition, zoomIn));
|
||||
}
|
||||
|
||||
private void MouseHook_OnPrimaryMouseDown(object sender, IntPtr wParam)
|
||||
private void MouseHook_OnMouseDown(object sender, Point p)
|
||||
{
|
||||
DisposeHook();
|
||||
OnPrimaryMouseDown?.Invoke(this, wParam);
|
||||
OnMouseDown?.Invoke(this, p);
|
||||
}
|
||||
|
||||
private void MouseHook_OnSecondaryMouseUp(object sender, IntPtr wParam)
|
||||
@@ -184,12 +181,6 @@ namespace ColorPicker.Mouse
|
||||
OnSecondaryMouseUp?.Invoke(this, wParam);
|
||||
}
|
||||
|
||||
private void MouseHook_OnMiddleMouseDown(object sender, IntPtr wParam)
|
||||
{
|
||||
DisposeHook();
|
||||
OnMiddleMouseDown?.Invoke(this, wParam);
|
||||
}
|
||||
|
||||
private void CopiedColorRepresentation_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
_colorFormatChanged = true;
|
||||
@@ -203,10 +194,9 @@ namespace ColorPicker.Mouse
|
||||
}
|
||||
|
||||
_previousMousePosition = new System.Windows.Point(-1, 1);
|
||||
_mouseHook.OnPrimaryMouseDown -= MouseHook_OnPrimaryMouseDown;
|
||||
_mouseHook.OnMouseDown -= MouseHook_OnMouseDown;
|
||||
_mouseHook.OnMouseWheel -= MouseHook_OnMouseWheel;
|
||||
_mouseHook.OnSecondaryMouseUp -= MouseHook_OnSecondaryMouseUp;
|
||||
_mouseHook.OnMiddleMouseDown -= MouseHook_OnMiddleMouseDown;
|
||||
|
||||
if (_userSettings.ChangeCursor.Value)
|
||||
{
|
||||
|
||||
@@ -21,12 +21,6 @@ namespace ColorPicker.Settings
|
||||
|
||||
SettingItem<ColorPickerActivationAction> ActivationAction { get; }
|
||||
|
||||
SettingItem<ColorPickerClickAction> PrimaryClickAction { get; }
|
||||
|
||||
SettingItem<ColorPickerClickAction> MiddleClickAction { get; }
|
||||
|
||||
SettingItem<ColorPickerClickAction> SecondaryClickAction { get; }
|
||||
|
||||
RangeObservableCollection<string> ColorHistory { get; }
|
||||
|
||||
SettingItem<int> ColorHistoryLimit { get; }
|
||||
|
||||
@@ -49,10 +49,7 @@ namespace ColorPicker.Settings
|
||||
ChangeCursor = new SettingItem<bool>(true);
|
||||
ActivationShortcut = new SettingItem<string>(DefaultActivationShortcut);
|
||||
CopiedColorRepresentation = new SettingItem<string>(ColorRepresentationType.HEX.ToString());
|
||||
ActivationAction = new SettingItem<ColorPickerActivationAction>(ColorPickerActivationAction.OpenColorPicker);
|
||||
PrimaryClickAction = new SettingItem<ColorPickerClickAction>(ColorPickerClickAction.PickColorThenEditor);
|
||||
MiddleClickAction = new SettingItem<ColorPickerClickAction>(ColorPickerClickAction.PickColorAndClose);
|
||||
SecondaryClickAction = new SettingItem<ColorPickerClickAction>(ColorPickerClickAction.Close);
|
||||
ActivationAction = new SettingItem<ColorPickerActivationAction>(ColorPickerActivationAction.OpenEditor);
|
||||
ColorHistoryLimit = new SettingItem<int>(20);
|
||||
ColorHistory.CollectionChanged += ColorHistory_CollectionChanged;
|
||||
ShowColorName = new SettingItem<bool>(false);
|
||||
@@ -81,12 +78,6 @@ namespace ColorPicker.Settings
|
||||
|
||||
public SettingItem<ColorPickerActivationAction> ActivationAction { get; private set; }
|
||||
|
||||
public SettingItem<ColorPickerClickAction> PrimaryClickAction { get; private set; }
|
||||
|
||||
public SettingItem<ColorPickerClickAction> MiddleClickAction { get; private set; }
|
||||
|
||||
public SettingItem<ColorPickerClickAction> SecondaryClickAction { get; private set; }
|
||||
|
||||
public RangeObservableCollection<string> ColorHistory { get; private set; } = new RangeObservableCollection<string>();
|
||||
|
||||
public SettingItem<int> ColorHistoryLimit { get; }
|
||||
@@ -130,9 +121,6 @@ namespace ColorPicker.Settings
|
||||
CopiedColorRepresentation.Value = settings.Properties.CopiedColorRepresentation;
|
||||
CopiedColorRepresentationFormat = new SettingItem<string>(string.Empty);
|
||||
ActivationAction.Value = settings.Properties.ActivationAction;
|
||||
PrimaryClickAction.Value = settings.Properties.PrimaryClickAction;
|
||||
MiddleClickAction.Value = settings.Properties.MiddleClickAction;
|
||||
SecondaryClickAction.Value = settings.Properties.SecondaryClickAction;
|
||||
ColorHistoryLimit.Value = settings.Properties.ColorHistoryLimit;
|
||||
ShowColorName.Value = settings.Properties.ShowColorName;
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ using ColorPicker.Settings;
|
||||
using ColorPicker.ViewModelContracts;
|
||||
using Common.UI;
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
|
||||
using PowerToys.Interop;
|
||||
|
||||
namespace ColorPicker.ViewModels
|
||||
@@ -80,10 +79,9 @@ namespace ColorPicker.ViewModels
|
||||
{
|
||||
SetColorDetails(mouseInfoProvider.CurrentColor);
|
||||
mouseInfoProvider.MouseColorChanged += Mouse_ColorChanged;
|
||||
mouseInfoProvider.OnPrimaryMouseDown += MouseInfoProvider_OnPrimaryMouseDown;
|
||||
mouseInfoProvider.OnMouseDown += MouseInfoProvider_OnMouseDown;
|
||||
mouseInfoProvider.OnMouseWheel += MouseInfoProvider_OnMouseWheel;
|
||||
mouseInfoProvider.OnSecondaryMouseUp += MouseInfoProvider_OnSecondaryMouseUp;
|
||||
mouseInfoProvider.OnMiddleMouseDown += MouseInfoProvider_OnMiddleMouseDown;
|
||||
}
|
||||
|
||||
_userSettings.ShowColorName.PropertyChanged += (s, e) => { OnPropertyChanged(nameof(ShowColorName)); };
|
||||
@@ -115,7 +113,7 @@ namespace ColorPicker.ViewModels
|
||||
|
||||
private void AppStateHandler_EnterPressed(object sender, EventArgs e)
|
||||
{
|
||||
MouseInfoProvider_OnPrimaryMouseDown(null, default);
|
||||
MouseInfoProvider_OnMouseDown(null, default(System.Drawing.Point));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -169,50 +167,18 @@ namespace ColorPicker.ViewModels
|
||||
SetColorDetails(color);
|
||||
}
|
||||
|
||||
private void MouseInfoProvider_OnPrimaryMouseDown(object sender, IntPtr wParam)
|
||||
/// <summary>
|
||||
/// Tell the color picker that the user have press a mouse button (after release the button)
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender of this event</param>
|
||||
/// <param name="p">The current <see cref="System.Drawing.Point"/> of the mouse cursor</param>
|
||||
private void MouseInfoProvider_OnMouseDown(object sender, System.Drawing.Point p)
|
||||
{
|
||||
HandleMouseClickAction(_userSettings.PrimaryClickAction.Value);
|
||||
}
|
||||
ClipboardHelper.CopyToClipboard(ColorText);
|
||||
|
||||
private void MouseInfoProvider_OnMiddleMouseDown(object sender, IntPtr wParam)
|
||||
{
|
||||
HandleMouseClickAction(_userSettings.MiddleClickAction.Value);
|
||||
}
|
||||
var color = GetColorString();
|
||||
|
||||
private void MouseInfoProvider_OnSecondaryMouseUp(object sender, IntPtr wParam)
|
||||
{
|
||||
HandleMouseClickAction(_userSettings.SecondaryClickAction.Value);
|
||||
}
|
||||
|
||||
private void HandleMouseClickAction(ColorPickerClickAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case ColorPickerClickAction.PickColorThenEditor:
|
||||
ClipboardHelper.CopyToClipboard(ColorText);
|
||||
UpdateColorHistory(GetColorString());
|
||||
|
||||
_appStateHandler.OpenColorEditor();
|
||||
|
||||
break;
|
||||
|
||||
case ColorPickerClickAction.PickColorAndClose:
|
||||
ClipboardHelper.CopyToClipboard(ColorText);
|
||||
UpdateColorHistory(GetColorString());
|
||||
|
||||
_appStateHandler.EndUserSession();
|
||||
|
||||
break;
|
||||
|
||||
case ColorPickerClickAction.Close:
|
||||
_appStateHandler.EndUserSession();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateColorHistory(string color)
|
||||
{
|
||||
int oldIndex = _userSettings.ColorHistory.IndexOf(color);
|
||||
var oldIndex = _userSettings.ColorHistory.IndexOf(color);
|
||||
if (oldIndex != -1)
|
||||
{
|
||||
_userSettings.ColorHistory.Move(oldIndex, 0);
|
||||
@@ -226,6 +192,13 @@ namespace ColorPicker.ViewModels
|
||||
{
|
||||
_userSettings.ColorHistory.RemoveAt(_userSettings.ColorHistory.Count - 1);
|
||||
}
|
||||
|
||||
_appStateHandler.OnColorPickerMouseDown();
|
||||
}
|
||||
|
||||
private void MouseInfoProvider_OnSecondaryMouseUp(object sender, IntPtr wParam)
|
||||
{
|
||||
_appStateHandler.EndUserSession();
|
||||
}
|
||||
|
||||
private string GetColorString()
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
"org": "microsoft",
|
||||
"project": "OS",
|
||||
"AssignedTo": "mengyuanchen@microsoft.com",
|
||||
"AreaPath": "OS\\Windows Client and Services\\WinPD\\DFX-Developer Fundamentals and Experiences\\DEFT\\SALT",
|
||||
"AreaPath": "OS\\Windows Client and Services\\WinPD\\DEEP-Developer Experience, Ecosystem and Partnerships\\SHINE\\PowerToys",
|
||||
"IterationPath": "OS\\Future"
|
||||
},
|
||||
"jobNotificationEmail": "PowerToys@microsoft.com",
|
||||
"jobNotificationEmail": "mengyuanchen@microsoft.com",
|
||||
"skip": false,
|
||||
"rebootAfterSetup": false,
|
||||
"oneFuzzJobs": [
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">System</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"AreaPath": "OS\\Windows Client and Services\\WinPD\\DFX-Developer Fundamentals and Experiences\\DEFT\\SALT",
|
||||
"IterationPath": "OS\\Future"
|
||||
},
|
||||
"jobNotificationEmail": "PowerToys@microsoft.com",
|
||||
"jobNotificationEmail": "mengyuanchen@microsoft.com",
|
||||
"skip": false,
|
||||
"rebootAfterSetup": false,
|
||||
"oneFuzzJobs": [
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<ItemGroup>
|
||||
<Folder Include="RegistryPreviewXAML\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.DataGrid" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.Sizers" />
|
||||
|
||||
@@ -10,31 +10,7 @@
|
||||
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
|
||||
<!-- Other merged dictionaries here -->
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Default">
|
||||
<SolidColorBrush x:Key="HexBox_SelectionTextBrush" Color="{ThemeResource TextOnAccentFillColorSelectedText}" />
|
||||
<SolidColorBrush x:Key="HexBox_SelectionBackgroundBrush" Color="{ThemeResource SystemAccentColor}" />
|
||||
<SolidColorBrush x:Key="HexBox_VerticalLineBrush" Color="{ThemeResource DividerStrokeColorDefault}" />
|
||||
<StaticResource x:Key="HexBox_ControlBorderBrush" ResourceKey="TextControlElevationBorderBrush" />
|
||||
<StaticResource x:Key="HexBox_ControlBorderFocusedBrush" ResourceKey="TextControlElevationBorderFocusedBrush" />
|
||||
<Thickness x:Key="HexBox_ControlBorderThickness">1</Thickness>
|
||||
<Thickness x:Key="HexBox_ControlBorderFocusedThickness">1,1,1,2</Thickness>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<SolidColorBrush x:Key="HexBox_SelectionTextBrush" Color="{ThemeResource SystemColorHighlightTextColor}" />
|
||||
<SolidColorBrush x:Key="HexBox_SelectionBackgroundBrush" Color="{ThemeResource SystemColorHighlightColor}" />
|
||||
<SolidColorBrush x:Key="HexBox_VerticalLineBrush" Color="{ThemeResource SystemColorWindowTextColor}" />
|
||||
<LinearGradientBrush x:Key="HexBox_ControlBorderBrush" StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Offset="0" Color="{ThemeResource SystemColorButtonTextColor}" />
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="HexBox_ControlBorderFocusedBrush" StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Offset="0" Color="{ThemeResource SystemColorHighlightColor}" />
|
||||
</LinearGradientBrush>
|
||||
<Thickness x:Key="HexBox_ControlBorderThickness">1</Thickness>
|
||||
<Thickness x:Key="HexBox_ControlBorderFocusedThickness">2</Thickness>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
<!-- Other app resources here -->
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// <history>
|
||||
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
|
||||
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
|
||||
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
|
||||
// </history>
|
||||
|
||||
namespace RegistryPreviewUILib.HexBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumerates the address column formatting options.
|
||||
/// </summary>
|
||||
public enum AddressFormat
|
||||
{
|
||||
/// <summary>
|
||||
/// 16 bit HEX address "0000".
|
||||
/// </summary>
|
||||
Address16,
|
||||
|
||||
/// <summary>
|
||||
/// 24 bit HEX address "00:0000".
|
||||
/// </summary>
|
||||
Address24,
|
||||
|
||||
/// <summary>
|
||||
/// 32 bit HEX address "0000:0000".
|
||||
/// </summary>
|
||||
Address32,
|
||||
|
||||
/// <summary>
|
||||
/// 48 bit HEX address "0000:00000000".
|
||||
/// </summary>
|
||||
Address48,
|
||||
|
||||
/// <summary>
|
||||
/// 64 bit HEX address "00000000:00000000".
|
||||
/// </summary>
|
||||
Address64,
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// <history>
|
||||
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
|
||||
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
|
||||
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
|
||||
// </history>
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace RegistryPreviewUILib.HexBox
|
||||
{
|
||||
public class RelayCommand : ICommand
|
||||
{
|
||||
private readonly Action<object> _execute;
|
||||
private readonly Func<object, bool> _canExecute;
|
||||
|
||||
public RelayCommand(Action<object> execute, Func<object, bool> canExecute = null)
|
||||
{
|
||||
_execute = execute;
|
||||
_canExecute = canExecute;
|
||||
}
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return _canExecute == null || _canExecute(parameter);
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_execute(parameter);
|
||||
}
|
||||
|
||||
public void RaiseCanExecuteChanged()
|
||||
{
|
||||
CanExecuteChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// <history>
|
||||
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
|
||||
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
|
||||
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
|
||||
// </history>
|
||||
|
||||
namespace RegistryPreviewUILib.HexBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumerates the format to display integral data in.
|
||||
/// </summary>
|
||||
public enum DataFormat
|
||||
{
|
||||
/// <summary>
|
||||
/// Display the data in decimal format.
|
||||
/// </summary>
|
||||
Decimal,
|
||||
|
||||
/// <summary>
|
||||
/// Display the data in hexadecimal format.
|
||||
/// </summary>
|
||||
Hexadecimal,
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// <history>
|
||||
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
|
||||
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
|
||||
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
|
||||
// </history>
|
||||
|
||||
namespace RegistryPreviewUILib.HexBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumerates the signedness of the data to display.
|
||||
/// </summary>
|
||||
public enum DataSignedness
|
||||
{
|
||||
/// <summary>
|
||||
/// Display the data as signed values.
|
||||
/// </summary>
|
||||
Signed,
|
||||
|
||||
/// <summary>
|
||||
/// Display the data as unsigned values.
|
||||
/// </summary>
|
||||
Unsigned,
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// <history>
|
||||
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
|
||||
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
|
||||
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
|
||||
// </history>
|
||||
|
||||
namespace RegistryPreviewUILib.HexBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumerates how the data (bytes read from the buffer) is to be interpreted when displayed.
|
||||
/// </summary>
|
||||
public enum DataType
|
||||
{
|
||||
/// <summary>
|
||||
/// Display the data as integral (integer) values.
|
||||
/// </summary>
|
||||
Int_1 = 1,
|
||||
/// <summary>
|
||||
/// Display the data as integral (integer) values.
|
||||
/// </summary>
|
||||
Int_2 = 2,
|
||||
/// <summary>
|
||||
/// Display the data as integral (integer) values.
|
||||
/// </summary>
|
||||
Int_4 = 4,
|
||||
/// <summary>
|
||||
/// Display the data as integral (integer) values.
|
||||
/// </summary>
|
||||
Int_8 = 8,
|
||||
/// <summary>
|
||||
/// Display the data as floating point values.
|
||||
/// </summary>
|
||||
Float_32 = 32,
|
||||
/// <summary>
|
||||
/// Display the data as floating point values.
|
||||
/// </summary>
|
||||
Float_64 = 64,
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,231 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// <history>
|
||||
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
|
||||
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
|
||||
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
|
||||
// </history>
|
||||
|
||||
namespace RegistryPreviewUILib.HexBox.Library.EndianConvert
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
/// <summary>
|
||||
/// Reads primitive data types as binary values in a specific encoding and endianness.
|
||||
/// </summary>
|
||||
public class EndianBinaryReader : BinaryReader
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EndianBinaryReader"/> class based on the specified stream, endianness, and using UTF-8
|
||||
/// encoding.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="input">
|
||||
/// The input stream.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="endianness">
|
||||
/// The endianness of the data in the input stream.
|
||||
/// </param>
|
||||
///
|
||||
/// <exception cref="System.ArgumentException">
|
||||
/// The stream does not support reading, is null, or is already closed.
|
||||
/// </exception>
|
||||
public EndianBinaryReader(Stream input, Endianness endianness)
|
||||
: this(input, endianness, Encoding.UTF8)
|
||||
{
|
||||
// Void
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EndianBinaryReader"/> class based on the specified stream, endianness, and character
|
||||
/// encoding.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="input">
|
||||
/// The input stream.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="endianness">
|
||||
/// The endianness of the data in the input stream.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="encoding">
|
||||
/// The character encoding to use.
|
||||
/// </param>
|
||||
///
|
||||
/// <exception cref="System.ArgumentException">
|
||||
/// The stream does not support reading, is null, or is already closed.
|
||||
/// </exception>
|
||||
public EndianBinaryReader(Stream input, Endianness endianness, Encoding encoding)
|
||||
: this(input, endianness, encoding, false)
|
||||
{
|
||||
// Void
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EndianBinaryReader"/> class based on the specified stream, endianness, and character
|
||||
/// encoding, and optionally leaves the stream open.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="input">
|
||||
/// The input stream.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="endianness">
|
||||
/// The endianness of the data in the input stream.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="encoding">
|
||||
/// The character encoding to use.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="leaveOpen">
|
||||
/// <c>true</c> to leave the stream open after the <see cref="EndianBinaryReader"/> object is disposed; <c>false</c> otherwise.
|
||||
/// </param>
|
||||
///
|
||||
/// <exception cref="System.ArgumentException">
|
||||
/// The stream does not support reading, is null, or is already closed.
|
||||
/// </exception>
|
||||
public EndianBinaryReader(Stream input, Endianness endianness, Encoding encoding, bool leaveOpen)
|
||||
: base(input, encoding, leaveOpen)
|
||||
{
|
||||
Endianness = endianness;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the endianness of the data in the input stream.
|
||||
/// </summary>
|
||||
public Endianness Endianness
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a decimal value from the current stream and advances the current position of the stream by sixteen bytes.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>
|
||||
/// A decimal value read from the current stream.
|
||||
/// </returns>
|
||||
public override decimal ReadDecimal()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads an 8-byte floating point value from the current stream and advances the current position of the stream by eight bytes.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>
|
||||
/// An 8-byte floating point value read from the current stream.
|
||||
/// </returns>
|
||||
public override double ReadDouble()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a 2-byte signed integer from the current stream and advances the current position of the stream by two bytes.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>
|
||||
/// A 2-byte signed integer read from the current stream.
|
||||
/// </returns>
|
||||
public override short ReadInt16()
|
||||
{
|
||||
return EndianBitConverter.Convert(base.ReadInt16(), Endianness);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a 4-byte signed integer from the current stream and advances the current position of the stream by four bytes.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>
|
||||
/// A 4-byte signed integer read from the current stream.
|
||||
/// </returns>
|
||||
public override int ReadInt32()
|
||||
{
|
||||
return EndianBitConverter.Convert(base.ReadInt32(), Endianness);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads an 8-byte signed integer from the current stream and advances the current position of the stream by eight bytes.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>
|
||||
/// An 8-byte signed integer read from the current stream.
|
||||
/// </returns>
|
||||
public override long ReadInt64()
|
||||
{
|
||||
return EndianBitConverter.Convert(base.ReadInt64(), Endianness);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a 4-byte floating point value from the current stream and advances the current position of the stream by four bytes.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>
|
||||
/// A 4-byte floating point value read from the current stream.
|
||||
/// </returns>
|
||||
public override float ReadSingle()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a string from the current stream. The string is prefixed with the length, encoded as an integer seven bits at a time.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>
|
||||
/// The string being read.
|
||||
/// </returns>
|
||||
public override string ReadString()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a 2-byte unsigned integer from the current stream using little-endian encoding and advances the position of the stream by
|
||||
/// two bytes.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>
|
||||
/// A 2-byte unsigned integer read from this stream.
|
||||
/// </returns>
|
||||
public override ushort ReadUInt16()
|
||||
{
|
||||
return EndianBitConverter.Convert(base.ReadUInt16(), Endianness);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a 4-byte unsigned integer from the current stream using little-endian encoding and advances the position of the stream by
|
||||
/// four bytes.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>
|
||||
/// A 4-byte unsigned integer read from this stream.
|
||||
/// </returns>
|
||||
public override uint ReadUInt32()
|
||||
{
|
||||
return EndianBitConverter.Convert(base.ReadUInt32(), Endianness);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads an 8-byte unsigned integer from the current stream using little-endian encoding and advances the position of the stream by
|
||||
/// eight bytes.
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>
|
||||
/// An 8-byte unsigned integer read from this stream.
|
||||
/// </returns>
|
||||
public override ulong ReadUInt64()
|
||||
{
|
||||
return EndianBitConverter.Convert(base.ReadUInt64(), Endianness);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// <history>
|
||||
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
|
||||
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
|
||||
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
|
||||
// </history>
|
||||
|
||||
namespace RegistryPreviewUILib.HexBox.Library.EndianConvert
|
||||
{
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// Converts integral values to the native endianness of this computer architecture.
|
||||
/// </summary>
|
||||
public static class EndianBitConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the native endianness of this computer architecture.
|
||||
/// </summary>
|
||||
public static readonly Endianness NativeEndianness = BitConverter.IsLittleEndian ? Endianness.LittleEndian : Endianness.BigEndian;
|
||||
|
||||
/// <summary>
|
||||
/// Converts a value from the specified endianness to the native endianness.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="value">
|
||||
/// The value to convert.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="endianness">
|
||||
/// The endianness of <paramref name="value"/>.
|
||||
/// </param>
|
||||
///
|
||||
/// <returns>
|
||||
/// The value converted from the specified endianness to the native endianness (<see cref="NativeEndianness"/>).
|
||||
/// </returns>
|
||||
public static ushort Convert(ushort value, Endianness endianness)
|
||||
{
|
||||
if (endianness == NativeEndianness)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
return (ushort)((value & 0x00FFU) << 8 |
|
||||
(value & 0xFF00U) >> 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a value from the specified endianness to the native endianness.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="value">
|
||||
/// The value to convert.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="endianness">
|
||||
/// The endianness of <paramref name="value"/>.
|
||||
/// </param>
|
||||
///
|
||||
/// <returns>
|
||||
/// The value converted from the specified endianness to the native endianness (<see cref="NativeEndianness"/>).
|
||||
/// </returns>
|
||||
public static uint Convert(uint value, Endianness endianness)
|
||||
{
|
||||
if (endianness == NativeEndianness)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
return (value & 0x000000FFU) << 24 |
|
||||
(value & 0xFF000000U) >> 24 |
|
||||
(value & 0x0000FF00U) << 8 |
|
||||
(value & 0x00FF0000U) >> 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a value from the specified endianness to the native endianness.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="value">
|
||||
/// The value to convert.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="endianness">
|
||||
/// The endianness of <paramref name="value"/>.
|
||||
/// </param>
|
||||
///
|
||||
/// <returns>
|
||||
/// The value converted from the specified endianness to the native endianness (<see cref="NativeEndianness"/>).
|
||||
/// </returns>
|
||||
public static ulong Convert(ulong value, Endianness endianness)
|
||||
{
|
||||
if (endianness == NativeEndianness)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
return (value & 0x00000000000000FFUL) << 56 |
|
||||
(value & 0xFF00000000000000UL) >> 56 |
|
||||
(value & 0x000000000000FF00UL) << 40 |
|
||||
(value & 0x00FF000000000000UL) >> 40 |
|
||||
(value & 0x0000000000FF0000UL) << 24 |
|
||||
(value & 0x0000FF0000000000UL) >> 24 |
|
||||
(value & 0x00000000FF000000UL) << 8 |
|
||||
(value & 0x000000FF00000000UL) >> 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a value from the specified endianness to the native endianness.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="value">
|
||||
/// The value to convert.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="endianness">
|
||||
/// The endianness of <paramref name="value"/>.
|
||||
/// </param>
|
||||
///
|
||||
/// <returns>
|
||||
/// The value converted from the specified endianness to the native endianness (<see cref="NativeEndianness"/>).
|
||||
/// </returns>
|
||||
public static short Convert(short value, Endianness endianness)
|
||||
{
|
||||
return (short)Convert((ushort)value, endianness);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a value from the specified endianness to the native endianness.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="value">
|
||||
/// The value to convert.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="endianness">
|
||||
/// The endianness of <paramref name="value"/>.
|
||||
/// </param>
|
||||
///
|
||||
/// <returns>
|
||||
/// The value converted from the specified endianness to the native endianness (<see cref="NativeEndianness"/>).
|
||||
/// </returns>
|
||||
public static int Convert(int value, Endianness endianness)
|
||||
{
|
||||
return (int)Convert((uint)value, endianness);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a value from the specified endianness to the native endianness.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="value">
|
||||
/// The value to convert.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="endianness">
|
||||
/// The endianness of <paramref name="value"/>.
|
||||
/// </param>
|
||||
///
|
||||
/// <returns>
|
||||
/// The value converted from the specified endianness to the native endianness (<see cref="NativeEndianness"/>).
|
||||
/// </returns>
|
||||
public static long Convert(long value, Endianness endianness)
|
||||
{
|
||||
return (long)Convert((ulong)value, endianness);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// <history>
|
||||
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
|
||||
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
|
||||
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
|
||||
// </history>
|
||||
|
||||
namespace RegistryPreviewUILib.HexBox.Library.EndianConvert
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the endianness of a value in a computer architecture.
|
||||
/// </summary>
|
||||
public enum Endianness
|
||||
{
|
||||
/// <summary>
|
||||
/// Most significant byte first.
|
||||
/// </summary>
|
||||
BigEndian,
|
||||
|
||||
/// <summary>
|
||||
/// Least significant byte first.
|
||||
/// </summary>
|
||||
LittleEndian,
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// <history>
|
||||
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
|
||||
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
|
||||
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
|
||||
// </history>
|
||||
|
||||
namespace RegistryPreviewUILib.HexBox.Library.EndianConvert
|
||||
{
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// The exception that is thrown when an input file or a data stream is malformed.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public sealed class FileFormatException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileFormatException"/> class.
|
||||
/// </summary>
|
||||
public FileFormatException()
|
||||
{
|
||||
// Void
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileFormatException"/> class with a specified error message.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="message">
|
||||
/// The message that describes the error.
|
||||
/// </param>
|
||||
public FileFormatException(string message)
|
||||
: base(message)
|
||||
{
|
||||
// Void
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileFormatException"/> class with a specified error message and a reference to the inner
|
||||
/// exception that is the cause of this exception.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="message">
|
||||
/// The message that describes the error.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="innerException">
|
||||
/// The exception that is the cause of the current exception, or a null reference if no inner exception is specified.
|
||||
/// </param>
|
||||
public FileFormatException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
// Void
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// <history>
|
||||
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
|
||||
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
|
||||
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
|
||||
// </history>
|
||||
|
||||
namespace RegistryPreviewUILib.HexBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumerates the text section encodings/formats that the control is able to display.
|
||||
/// </summary>
|
||||
public enum TextFormat
|
||||
{
|
||||
/// <summary>
|
||||
/// Display data in ASCII (ISO-8859-1) encoding.
|
||||
/// </summary>
|
||||
Ascii,
|
||||
}
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:convert="using:CommunityToolkit.WinUI.Converters"
|
||||
xmlns:local="using:RegistryPreviewUILib.HexBox"
|
||||
xmlns:skia="using:SkiaSharp.Views.Windows">
|
||||
|
||||
<Style TargetType="local:HexBox">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="local:HexBox">
|
||||
<Grid
|
||||
Margin="{TemplateBinding Margin}"
|
||||
Padding="4"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
IsTabStop="False">
|
||||
<Grid.Resources>
|
||||
<convert:BoolNegationConverter x:Key="BoolNegationConverter" />
|
||||
<local:BigEndianConverter x:Key="BigEndianConverter" />
|
||||
<local:HexboxDataFormatConverter x:Key="HexboxDataFormatConverter" />
|
||||
<local:HexboxDataSignednessConverter x:Key="HexboxDataSignednessConverter" />
|
||||
<local:HexboxDataFormatBoolConverter x:Key="HexboxDataFormatBoolConverter" />
|
||||
<local:HexboxDataTypeConverter x:Key="HexboxDataTypeConverter" />
|
||||
<MenuFlyout x:Key="DataMenuFlyout">
|
||||
<!-- New code for PowerToys implementation -->
|
||||
<MenuFlyoutItem
|
||||
x:Uid="/PowerToys.RegistryPreviewUILib/Resources/HexBox_CopyCommand"
|
||||
Command="{Binding CopyCommand, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Icon="Copy">
|
||||
<MenuFlyoutItem.KeyboardAccelerators>
|
||||
<KeyboardAccelerator Key="C" Modifiers="Control" />
|
||||
</MenuFlyoutItem.KeyboardAccelerators>
|
||||
</MenuFlyoutItem>
|
||||
<MenuFlyoutItem
|
||||
x:Uid="/PowerToys.RegistryPreviewUILib/Resources/HexBox_CopyTextCommand"
|
||||
Command="{Binding CopyTextCommand, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Icon="Font">
|
||||
<MenuFlyoutItem.KeyboardAccelerators>
|
||||
<KeyboardAccelerator Key="C" Modifiers="Control,Shift" />
|
||||
</MenuFlyoutItem.KeyboardAccelerators>
|
||||
</MenuFlyoutItem>
|
||||
<MenuFlyoutItem
|
||||
x:Uid="/PowerToys.RegistryPreviewUILib/Resources/HexBox_SelectAllCommand"
|
||||
Command="{Binding SelectAllCommand, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Icon="SelectAll">
|
||||
<MenuFlyoutItem.KeyboardAccelerators>
|
||||
<KeyboardAccelerator Key="A" Modifiers="Control" />
|
||||
</MenuFlyoutItem.KeyboardAccelerators>
|
||||
</MenuFlyoutItem>
|
||||
<!-- Original source code from HexBox.WinUI.HexBox
|
||||
<MenuFlyoutItem
|
||||
Command="{Binding CopyCommand, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Icon="Copy"
|
||||
Text="Copy">
|
||||
<MenuFlyoutItem.KeyboardAccelerators>
|
||||
<KeyboardAccelerator Key="C" Modifiers="Control" />
|
||||
</MenuFlyoutItem.KeyboardAccelerators>
|
||||
</MenuFlyoutItem>
|
||||
<MenuFlyoutItem
|
||||
Command="{Binding CopyTextCommand, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Icon="Font"
|
||||
Text="Copy text">
|
||||
<MenuFlyoutItem.KeyboardAccelerators>
|
||||
<KeyboardAccelerator Key="C" Modifiers="Control,Shift"/>
|
||||
</MenuFlyoutItem.KeyboardAccelerators>
|
||||
</MenuFlyoutItem>
|
||||
<MenuFlyoutItem
|
||||
Command="{Binding SelectAllCommand, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Icon="SelectAll"
|
||||
Text="Select all">
|
||||
<MenuFlyoutItem.KeyboardAccelerators>
|
||||
<KeyboardAccelerator Key="A" Modifiers="Control" />
|
||||
</MenuFlyoutItem.KeyboardAccelerators>
|
||||
</MenuFlyoutItem>
|
||||
<MenuFlyoutSeparator />
|
||||
<MenuFlyoutSubItem IsEnabled="{Binding EnforceProperties, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}" Text="Address properties">
|
||||
<ToggleMenuFlyoutItem IsChecked="{Binding ShowAddress, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource BoolNegationConverter}}" Text="No Address" />
|
||||
</MenuFlyoutSubItem>
|
||||
<MenuFlyoutSubItem IsEnabled="{Binding EnforceProperties, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}" Text="Data properties">
|
||||
<ToggleMenuFlyoutItem IsChecked="{Binding ShowData, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource BoolNegationConverter}}" Text="No Data" />
|
||||
<RadioMenuFlyoutItem
|
||||
GroupName="DataType"
|
||||
IsChecked="{Binding DataType, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataTypeConverter}, ConverterParameter=Int_1}"
|
||||
IsEnabled="{Binding ShowData, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Text="1 byte-integer" />
|
||||
<RadioMenuFlyoutItem
|
||||
GroupName="DataType"
|
||||
IsChecked="{Binding DataType, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataTypeConverter}, ConverterParameter=Int_2}"
|
||||
IsEnabled="{Binding ShowData, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Text="2 byte-integer" />
|
||||
<RadioMenuFlyoutItem
|
||||
GroupName="DataType"
|
||||
IsChecked="{Binding DataType, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataTypeConverter}, ConverterParameter=Int_4}"
|
||||
IsEnabled="{Binding ShowData, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Text="4 byte-integer" />
|
||||
<RadioMenuFlyoutItem
|
||||
GroupName="DataType"
|
||||
IsChecked="{Binding DataType, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataTypeConverter}, ConverterParameter=Int_8}"
|
||||
IsEnabled="{Binding ShowData, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Text="8 byte-integer" />
|
||||
<RadioMenuFlyoutItem
|
||||
GroupName="DataType"
|
||||
IsChecked="{Binding DataType, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataTypeConverter}, ConverterParameter=Float_32}"
|
||||
IsEnabled="{Binding ShowData, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Text="32-bit Floating Point" />
|
||||
<RadioMenuFlyoutItem
|
||||
GroupName="DataType"
|
||||
IsChecked="{Binding DataType, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataTypeConverter}, ConverterParameter=Float_64}"
|
||||
IsEnabled="{Binding ShowData, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Text="64-bit Floating Point" />
|
||||
<MenuFlyoutSeparator />
|
||||
<ToggleMenuFlyoutItem
|
||||
IsChecked="{Binding DataSignedness, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataSignednessConverter}, ConverterParameter=Signed}"
|
||||
IsEnabled="{Binding DataFormat, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource HexboxDataFormatBoolConverter}, ConverterParameter={Binding DataFormat}}"
|
||||
Text="Signed" />
|
||||
<ToggleMenuFlyoutItem
|
||||
IsChecked="{Binding DataSignedness, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataSignednessConverter}, ConverterParameter=Unsigned}"
|
||||
IsEnabled="{Binding DataFormat, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource HexboxDataFormatBoolConverter}, ConverterParameter={Binding DataFormat}}"
|
||||
Text="Unsigned" />
|
||||
<MenuFlyoutSeparator />
|
||||
<ToggleMenuFlyoutItem IsChecked="{Binding DataFormat, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataFormatConverter}, ConverterParameter=Decimal}" Text="Decimal" />
|
||||
<ToggleMenuFlyoutItem IsChecked="{Binding DataFormat, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource HexboxDataFormatConverter}, ConverterParameter=Hexadecimal}" Text="Hexadecimal" />
|
||||
<MenuFlyoutSeparator />
|
||||
<ToggleMenuFlyoutItem IsChecked="{Binding Endianness, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource BigEndianConverter}, ConverterParameter=BigEndian}" Text="Big-Endian" />
|
||||
<ToggleMenuFlyoutItem IsChecked="{Binding Endianness, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource BigEndianConverter}, ConverterParameter=LittleEndian}" Text="Little-Endian" />
|
||||
</MenuFlyoutSubItem>
|
||||
<MenuFlyoutSubItem IsEnabled="{Binding EnforceProperties, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}" Text="Text properties">
|
||||
<ToggleMenuFlyoutItem IsChecked="{Binding ShowText, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay, Converter={StaticResource BoolNegationConverter}}" Text="No Text" />
|
||||
<ToggleMenuFlyoutItem
|
||||
IsChecked="{Binding ShowText, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}"
|
||||
IsEnabled="False"
|
||||
Text="ASCII" />
|
||||
</MenuFlyoutSubItem>-->
|
||||
</MenuFlyout>
|
||||
</Grid.Resources>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="24" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<skia:SKXamlCanvas
|
||||
Name="ElementCanvas"
|
||||
Grid.Column="0"
|
||||
Margin="2,0,2,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
ContextFlyout="{StaticResource DataMenuFlyout}" />
|
||||
|
||||
<ScrollBar
|
||||
Name="ElementScrollBar"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,2,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
FontFamily="{TemplateBinding FontFamily}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
IndicatorMode="MouseIndicator"
|
||||
Orientation="Vertical" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -1,264 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// <history>
|
||||
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
|
||||
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
|
||||
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
|
||||
// </history>
|
||||
#pragma warning disable SA1210 // Using directives should be ordered alphabetically by namespace
|
||||
#pragma warning disable SA1208 // System using directives should be placed before other using directives
|
||||
using RegistryPreviewUILib.HexBox.Library.EndianConvert;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using System;
|
||||
#pragma warning restore SA1208 // System using directives should be placed before other using directives
|
||||
#pragma warning restore SA1210 // Using directives should be ordered alphabetically by namespace
|
||||
|
||||
namespace RegistryPreviewUILib.HexBox
|
||||
{
|
||||
public partial class HexboxDataTypeConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Convert a DataType value to its negation.
|
||||
/// </summary>
|
||||
/// <param name="value">The <see cref="DataType"/> value to negate.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference.</param>
|
||||
/// <param name="parameter">Optional parameter. Not used.</param>
|
||||
/// <param name="language">The language of the conversion. Not used</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if (value is DataType b)
|
||||
{
|
||||
if (parameter is string c)
|
||||
{
|
||||
return c == b.ToString();
|
||||
}
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert back a DataType value to its negation.
|
||||
/// </summary>
|
||||
/// <param name="value">The <see cref="DataType"/> value to negate.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference.</param>
|
||||
/// <param name="parameter">Optional parameter. Not used.</param>
|
||||
/// <param name="language">The language of the conversion. Not used</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if (value is bool b && parameter is string c)
|
||||
{
|
||||
if(c == "Int_1")
|
||||
{
|
||||
return DataType.Int_1;
|
||||
}
|
||||
else if (c == "Int_2")
|
||||
{
|
||||
return DataType.Int_2;
|
||||
}
|
||||
else if (c == "Int_4")
|
||||
{
|
||||
return DataType.Int_4;
|
||||
}
|
||||
else if (c == "Int_8")
|
||||
{
|
||||
return DataType.Int_8;
|
||||
}
|
||||
else if (c == "Float_32")
|
||||
{
|
||||
return DataType.Float_32;
|
||||
}
|
||||
else /*if (c == "Float_64")*/
|
||||
{
|
||||
return DataType.Float_64;
|
||||
}
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class HexboxDataSignednessConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Convert a DataSignedness value to its negation.
|
||||
/// </summary>
|
||||
/// <param name="value">The <see cref="DataSignedness"/> value to negate.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference.</param>
|
||||
/// <param name="parameter">Optional parameter. Not used.</param>
|
||||
/// <param name="language">The language of the conversion. Not used</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if (value is DataSignedness b)
|
||||
{
|
||||
if (parameter is string c)
|
||||
{
|
||||
var end = c == "Signed" ? DataSignedness.Signed : DataSignedness.Unsigned;
|
||||
return (b == end);
|
||||
}
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert back a DataSignedness value to its negation.
|
||||
/// </summary>
|
||||
/// <param name="value">The <see cref="DataSignedness"/> value to negate.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference.</param>
|
||||
/// <param name="parameter">Optional parameter. Not used.</param>
|
||||
/// <param name="language">The language of the conversion. Not used</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if (value is bool b && parameter is string c)
|
||||
{
|
||||
var end = c == "Signed" ? DataSignedness.Signed : DataSignedness.Unsigned;
|
||||
if (b)
|
||||
{
|
||||
return end;
|
||||
}
|
||||
else
|
||||
{
|
||||
return c == "Signed" ? DataSignedness.Unsigned : DataSignedness.Signed;
|
||||
}
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class HexboxDataFormatBoolConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Convert a DataFormat value to its negation.
|
||||
/// </summary>
|
||||
/// <param name="value">The <see cref="DataFormat"/> value to negate.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference.</param>
|
||||
/// <param name="parameter">Optional parameter. Not used.</param>
|
||||
/// <param name="language">The language of the conversion. Not used</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if(value is DataFormat f)
|
||||
{
|
||||
return f != DataFormat.Hexadecimal;
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert back a DataFormat value to its negation.
|
||||
/// </summary>
|
||||
/// <param name="value">The <see cref="DataFormat"/> value to negate.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference.</param>
|
||||
/// <param name="parameter">Optional parameter. Not used.</param>
|
||||
/// <param name="language">The language of the conversion. Not used</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class HexboxDataFormatConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Convert a DataFormat value to its negation.
|
||||
/// </summary>
|
||||
/// <param name="value">The <see cref="DataFormat"/> value to negate.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference.</param>
|
||||
/// <param name="parameter">Optional parameter. Not used.</param>
|
||||
/// <param name="language">The language of the conversion. Not used</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if (value is DataFormat b)
|
||||
{
|
||||
if (parameter is string c)
|
||||
{
|
||||
var end = c == "Decimal" ? DataFormat.Decimal: DataFormat.Hexadecimal;
|
||||
return (b == end);
|
||||
}
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert back a DataFormat value to its negation.
|
||||
/// </summary>
|
||||
/// <param name="value">The <see cref="DataFormat"/> value to negate.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference.</param>
|
||||
/// <param name="parameter">Optional parameter. Not used.</param>
|
||||
/// <param name="language">The language of the conversion. Not used</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if (value is bool b && parameter is string c)
|
||||
{
|
||||
var end = c == "Decimal" ? DataFormat.Decimal : DataFormat.Hexadecimal;
|
||||
if (b)
|
||||
{
|
||||
return end;
|
||||
}
|
||||
else
|
||||
{
|
||||
return end == DataFormat.Decimal ? DataFormat.Hexadecimal : DataFormat.Decimal;
|
||||
}
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class BigEndianConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Convert a Endian value to its negation.
|
||||
/// </summary>
|
||||
/// <param name="value">The <see cref="Endian"/> value to negate.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference.</param>
|
||||
/// <param name="parameter">Optional parameter. Not used.</param>
|
||||
/// <param name="language">The language of the conversion. Not used</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if (value is Endianness b)
|
||||
{
|
||||
if (parameter is string c)
|
||||
{
|
||||
var end = c == "BigEndian" ? Endianness.BigEndian : Endianness.LittleEndian;
|
||||
return (b == end);
|
||||
}
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert back a Endian value to its negation.
|
||||
/// </summary>
|
||||
/// <param name="value">The <see cref="Endian"/> value to negate.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference.</param>
|
||||
/// <param name="parameter">Optional parameter. Not used.</param>
|
||||
/// <param name="language">The language of the conversion. Not used</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if (value is bool b && parameter is string c)
|
||||
{
|
||||
var end = c == "BigEndian" ? Endianness.BigEndian : Endianness.LittleEndian;
|
||||
if (b)
|
||||
{
|
||||
return end;
|
||||
}
|
||||
else
|
||||
{
|
||||
return end == Endianness.BigEndian ? Endianness.LittleEndian : Endianness.BigEndian;
|
||||
}
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// <history>
|
||||
// 2020-... created by Filip Jeremic (fjeremic) as "HexView.Wpf".
|
||||
// 2024-... republished by @hotkidfamily as "HexBox.WinUI".
|
||||
// 2025 Included in PowerToys. (Branch master; commit 72dcf64dc858c693a7a16887004c8ddbab61fce7.)
|
||||
// </history>
|
||||
|
||||
namespace RegistryPreviewUILib.HexBox
|
||||
{
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// A utility class with miscellaneous methods.
|
||||
/// </summary>
|
||||
internal static class Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Clamps the <paramref name="value"/> to the range [<paramref name="min"/>, <paramref name="max"/>].
|
||||
/// </summary>
|
||||
///
|
||||
/// <typeparam name="T">
|
||||
/// The type of the value to clamp.
|
||||
/// </typeparam>
|
||||
///
|
||||
/// <param name="value">
|
||||
/// The value to clamp.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="min">
|
||||
/// The upper bound on the clamped value.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="max">
|
||||
/// The lower bound on the clmaped value.
|
||||
/// </param>
|
||||
///
|
||||
/// <returns>
|
||||
/// The nearest value of <paramref name="value"/> in the range [<paramref name="min"/>,
|
||||
/// <paramref name="max"/>].
|
||||
/// </returns>
|
||||
public static T Clamp<T>(this T value, T min, T max)
|
||||
where T : IComparable<T>
|
||||
{
|
||||
return value.CompareTo(min) < 0 ? min : value.CompareTo(max) > 0 ? max : value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the arithmetic modulus of <paramref name="n"/> modulo <paramref name="m"/>.
|
||||
/// </summary>
|
||||
///
|
||||
/// <typeparam name="T">
|
||||
/// The type of the values.
|
||||
/// </typeparam>
|
||||
///
|
||||
/// <param name="n">
|
||||
/// The value to compute the modulus of.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="m">
|
||||
/// The modulus.
|
||||
/// </param>
|
||||
///
|
||||
/// <returns>
|
||||
/// The non-negative value <c>r</c> such that for some integral value <c>q</c>:
|
||||
/// <c><paramref name="n"/> = q*m + r</c>.
|
||||
/// </returns>
|
||||
public static T Mod<T>(this T n, T m)
|
||||
where T : IComparable<T>
|
||||
{
|
||||
dynamic dn = n;
|
||||
dynamic dm = m;
|
||||
|
||||
dynamic dr = dn % dm;
|
||||
|
||||
return dr.CompareTo(0) < 0 ? dr + dm : dr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,341 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Automation;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.Windows.ApplicationModel.Resources;
|
||||
using Windows.Foundation.Metadata;
|
||||
using HB = RegistryPreviewUILib.HexBox;
|
||||
|
||||
namespace RegistryPreviewUILib
|
||||
{
|
||||
public sealed partial class RegistryPreviewMainPage : Page
|
||||
{
|
||||
private static bool _isDataPreviewHexBoxLoaded;
|
||||
|
||||
internal async Task ShowExtendedDataPreview(string name, string type, string value)
|
||||
{
|
||||
// Create dialog
|
||||
_isDataPreviewHexBoxLoaded = false;
|
||||
var panel = new StackPanel()
|
||||
{
|
||||
Spacing = 16,
|
||||
Padding = new Thickness(0),
|
||||
};
|
||||
ContentDialog contentDialog = new ContentDialog()
|
||||
{
|
||||
Title = resourceLoader.GetString("DataPreviewTitle") + " - " + name,
|
||||
Content = panel,
|
||||
CloseButtonText = resourceLoader.GetString("DataPreviewClose"),
|
||||
DefaultButton = ContentDialogButton.Primary,
|
||||
Padding = new Thickness(0),
|
||||
};
|
||||
contentDialog.Opened += ExtendedDataPreview_Opened;
|
||||
|
||||
// Add content based on value type
|
||||
switch (type)
|
||||
{
|
||||
case "REG_DWORD":
|
||||
case "REG_QWORD":
|
||||
AddHexView(ref panel, ref resourceLoader, value);
|
||||
break;
|
||||
case "REG_NONE":
|
||||
case "REG_BINARY":
|
||||
// Convert value to BinaryReader
|
||||
byte[] byteArray = Convert.FromHexString(value.Replace(" ", string.Empty));
|
||||
MemoryStream memoryStream = new MemoryStream(byteArray);
|
||||
BinaryReader binaryData = new BinaryReader(memoryStream);
|
||||
binaryData.ReadBytes(byteArray.Length);
|
||||
|
||||
// Convert value to text
|
||||
// For more printable asci characters the following code lines are required:
|
||||
// var cpW1252 = CodePagesEncodingProvider.Instance.GetEncoding(1252);
|
||||
// || b == 128 || (b >= 130 && b <= 140) || b == 142 || (b >= 145 & b <= 156) || b >= 158
|
||||
// cpW1252.GetString([b]);
|
||||
string binaryDataText = string.Empty;
|
||||
foreach (byte b in byteArray)
|
||||
{
|
||||
// ASCII codes:
|
||||
// 9, 10, 13: Space, Line Feed, Carriage Return
|
||||
// 32-126: Printable characters
|
||||
// 128, 130-140, 142, 145-156, 158-255: Extended printable characters
|
||||
if (b == 9 || b == 10 || b == 13 || (b >= 32 && b <= 126))
|
||||
{
|
||||
binaryDataText += Convert.ToChar(b);
|
||||
}
|
||||
}
|
||||
|
||||
// Add controls
|
||||
AddBinaryView(ref panel, ref resourceLoader, ref binaryData, binaryDataText);
|
||||
break;
|
||||
case "REG_MULTI_SZ":
|
||||
var multiLineBox = new TextBox()
|
||||
{
|
||||
IsReadOnly = true,
|
||||
AcceptsReturn = true,
|
||||
TextWrapping = TextWrapping.NoWrap,
|
||||
MaxHeight = 200,
|
||||
FontSize = 14,
|
||||
RequestedTheme = panel.ActualTheme,
|
||||
Text = value,
|
||||
};
|
||||
ScrollViewer.SetVerticalScrollBarVisibility(multiLineBox, ScrollBarVisibility.Auto);
|
||||
ScrollViewer.SetHorizontalScrollBarVisibility(multiLineBox, ScrollBarVisibility.Auto);
|
||||
AutomationProperties.SetName(multiLineBox, resourceLoader.GetString("DataPreview_AutomationPropertiesName_MultilineTextValue"));
|
||||
panel.Children.Add(multiLineBox);
|
||||
break;
|
||||
case "REG_EXPAND_SZ":
|
||||
AddExpandStringView(ref panel, ref resourceLoader, value);
|
||||
break;
|
||||
default: // REG_SZ
|
||||
var stringBox = new TextBox()
|
||||
{
|
||||
IsReadOnly = true,
|
||||
FontSize = 14,
|
||||
RequestedTheme = panel.ActualTheme,
|
||||
Text = value,
|
||||
};
|
||||
AutomationProperties.SetName(stringBox, resourceLoader.GetString("DataPreview_AutomationPropertiesName_TextValue"));
|
||||
panel.Children.Add(stringBox);
|
||||
break;
|
||||
}
|
||||
|
||||
// Use this code to associate the dialog to the appropriate AppWindow by setting
|
||||
// the dialog's XamlRoot to the same XamlRoot as an element that is already present in the AppWindow.
|
||||
if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8))
|
||||
{
|
||||
contentDialog.XamlRoot = this.Content.XamlRoot;
|
||||
}
|
||||
|
||||
// Show dialog and wait.
|
||||
ChangeCursor(gridPreview, false);
|
||||
_ = await contentDialog.ShowAsync();
|
||||
}
|
||||
|
||||
private static void AddHexView(ref StackPanel panel, ref ResourceLoader resourceLoader, string value)
|
||||
{
|
||||
var hexBox = new TextBox()
|
||||
{
|
||||
Header = resourceLoader.GetString("DataPreviewHex"),
|
||||
IsReadOnly = true,
|
||||
FontSize = 14,
|
||||
RequestedTheme = panel.ActualTheme,
|
||||
Text = value.Split(" ")[0],
|
||||
};
|
||||
var decimalBox = new TextBox()
|
||||
{
|
||||
Header = resourceLoader.GetString("DataPreviewDec"),
|
||||
IsReadOnly = true,
|
||||
FontSize = 14,
|
||||
RequestedTheme = panel.ActualTheme,
|
||||
Text = value.Split(" ")[1].TrimStart('(').TrimEnd(')'),
|
||||
};
|
||||
panel.Children.Add(hexBox);
|
||||
panel.Children.Add(decimalBox);
|
||||
}
|
||||
|
||||
private static void AddBinaryView(ref StackPanel panel, ref ResourceLoader resourceLoader, ref BinaryReader data, string dataText)
|
||||
{
|
||||
// Create SelectorBar
|
||||
var navBar = new SelectorBar()
|
||||
{
|
||||
RequestedTheme = panel.ActualTheme,
|
||||
};
|
||||
navBar.SelectionChanged += BinaryPreview_SelectorChanged;
|
||||
navBar.Items.Add(new SelectorBarItem()
|
||||
{
|
||||
Text = resourceLoader.GetString("DataPreviewDataView"),
|
||||
Tag = "DataView",
|
||||
FontSize = 14,
|
||||
RequestedTheme = panel.ActualTheme,
|
||||
IsSelected = true,
|
||||
});
|
||||
navBar.Items.Add(new SelectorBarItem()
|
||||
{
|
||||
Text = resourceLoader.GetString("DataPreviewVisibleText"),
|
||||
Tag = "TextView",
|
||||
FontSize = 14,
|
||||
RequestedTheme = panel.ActualTheme,
|
||||
IsSelected = false,
|
||||
IsEnabled = !string.IsNullOrWhiteSpace(dataText),
|
||||
});
|
||||
|
||||
// Create HexBox
|
||||
var binaryPreviewBox = new HB.HexBox()
|
||||
{
|
||||
Height = 300,
|
||||
Width = 495,
|
||||
ShowAddress = true,
|
||||
ShowData = true,
|
||||
ShowText = true,
|
||||
Columns = 8,
|
||||
FontSize = 13,
|
||||
RequestedTheme = panel.ActualTheme,
|
||||
AddressBrush = (SolidColorBrush)Application.Current.Resources["AccentTextFillColorPrimaryBrush"],
|
||||
AlternatingDataColumnTextBrush = (SolidColorBrush)Application.Current.Resources["TextFillColorSecondaryBrush"],
|
||||
SelectionTextBrush = (SolidColorBrush)Application.Current.Resources["HexBox_SelectionTextBrush"],
|
||||
SelectionBrush = (SolidColorBrush)Application.Current.Resources["HexBox_SelectionBackgroundBrush"],
|
||||
VerticalSeparatorLineBrush = (SolidColorBrush)Application.Current.Resources["HexBox_VerticalLineBrush"],
|
||||
BorderBrush = (LinearGradientBrush)Application.Current.Resources["HexBox_ControlBorderBrush"],
|
||||
BorderThickness = (Thickness)Application.Current.Resources["HexBox_ControlBorderThickness"],
|
||||
CornerRadius = (CornerRadius)Application.Current.Resources["ControlCornerRadius"],
|
||||
DataFormat = HB.DataFormat.Hexadecimal,
|
||||
DataSignedness = HB.DataSignedness.Unsigned,
|
||||
DataType = HB.DataType.Int_1,
|
||||
EnforceProperties = true,
|
||||
Visibility = Visibility.Collapsed,
|
||||
DataSource = data,
|
||||
};
|
||||
AutomationProperties.SetName(binaryPreviewBox, resourceLoader.GetString("DataPreview_AutomationPropertiesName_BinaryDataPreview"));
|
||||
binaryPreviewBox.Loaded += BinaryPreview_HexBoxLoaded;
|
||||
binaryPreviewBox.GotFocus += BinaryPreview_HexBoxFocused;
|
||||
binaryPreviewBox.LostFocus += BinaryPreview_HexBoxFocusLost;
|
||||
|
||||
// Create TextBox
|
||||
var visibleText = new TextBox()
|
||||
{
|
||||
IsReadOnly = true,
|
||||
AcceptsReturn = true,
|
||||
TextWrapping = TextWrapping.Wrap,
|
||||
Height = 300,
|
||||
Width = 495,
|
||||
FontSize = 13,
|
||||
Text = dataText,
|
||||
RequestedTheme = panel.ActualTheme,
|
||||
Visibility = Visibility.Collapsed,
|
||||
};
|
||||
AutomationProperties.SetName(visibleText, resourceLoader.GetString("DataPreview_AutomationPropertiesName_VisibleTextPreview"));
|
||||
|
||||
// Add controls: 0 = SelectorBar, 1 = ProgressRing, 2 = HexBox, 3 = TextBox
|
||||
panel.Children.Add(navBar);
|
||||
panel.Children.Add(new ProgressRing());
|
||||
panel.Children.Add(binaryPreviewBox);
|
||||
panel.Children.Add(visibleText);
|
||||
}
|
||||
|
||||
private static void AddExpandStringView(ref StackPanel panel, ref ResourceLoader resourceLoader, string value)
|
||||
{
|
||||
var stringBoxRaw = new TextBox()
|
||||
{
|
||||
Header = resourceLoader.GetString("DataPreviewRawValue"),
|
||||
IsReadOnly = true,
|
||||
FontSize = 14,
|
||||
RequestedTheme = panel.ActualTheme,
|
||||
Text = value,
|
||||
};
|
||||
var stringBoxExp = new TextBox()
|
||||
{
|
||||
Header = resourceLoader.GetString("DataPreviewExpandedValue"),
|
||||
IsReadOnly = true,
|
||||
FontSize = 14,
|
||||
RequestedTheme = panel.ActualTheme,
|
||||
Text = Environment.ExpandEnvironmentVariables(value),
|
||||
};
|
||||
panel.Children.Add(stringBoxRaw);
|
||||
panel.Children.Add(stringBoxExp);
|
||||
}
|
||||
|
||||
private static void BinaryPreview_SelectorChanged(SelectorBar sender, SelectorBarSelectionChangedEventArgs args)
|
||||
{
|
||||
// Child controls: 0 = SelectorBar, 1 = ProgressRing, 2 = HexBox, 3 = TextBox
|
||||
var stackPanel = sender.Parent as StackPanel;
|
||||
var progressRing = (ProgressRing)stackPanel.Children[1];
|
||||
var hexBox = (HB.HexBox)stackPanel.Children[2];
|
||||
var textBox = (TextBox)stackPanel.Children[3];
|
||||
|
||||
if (sender.SelectedItem.Tag.ToString() == "DataView")
|
||||
{
|
||||
textBox.Visibility = Visibility.Collapsed;
|
||||
if (_isDataPreviewHexBoxLoaded)
|
||||
{
|
||||
progressRing.Visibility = Visibility.Collapsed;
|
||||
hexBox.Visibility = Visibility.Visible;
|
||||
|
||||
// Clear selection aligned to TextBox
|
||||
hexBox.ClearSelection();
|
||||
hexBox.Focus(FocusState.Programmatic);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexBox.Visibility = Visibility.Collapsed;
|
||||
progressRing.Visibility = Visibility.Visible;
|
||||
progressRing.Focus(FocusState.Programmatic);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
progressRing.Visibility = Visibility.Collapsed;
|
||||
|
||||
hexBox.Visibility = Visibility.Collapsed;
|
||||
textBox.Visibility = Visibility.Visible;
|
||||
|
||||
// Workaround for wrong text selection (color) after switching back to "Visible text"
|
||||
textBox.Focus(FocusState.Programmatic);
|
||||
textBox.Select(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private static void BinaryPreview_HexBoxLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_isDataPreviewHexBoxLoaded = true;
|
||||
|
||||
// Child controls: 0 = SelectorBar, 1 = ProgressRing, 2 = HexBox, 3 = TextBox
|
||||
var hexBox = (HB.HexBox)sender;
|
||||
var stackPanel = hexBox.Parent as StackPanel;
|
||||
var selectorBar = stackPanel.Children[0] as SelectorBar;
|
||||
var progressRing = stackPanel.Children[1] as ProgressRing;
|
||||
|
||||
if (selectorBar.SelectedItem.Tag.ToString() == "DataView")
|
||||
{
|
||||
progressRing.Visibility = Visibility.Collapsed;
|
||||
hexBox.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event handler to set correct control border if focused.
|
||||
/// </summary>
|
||||
private static void BinaryPreview_HexBoxFocused(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var hexBox = (HB.HexBox)sender;
|
||||
|
||||
hexBox.BorderThickness = (Thickness)Application.Current.Resources["HexBox_ControlBorderFocusedThickness"];
|
||||
hexBox.BorderBrush = (LinearGradientBrush)Application.Current.Resources["HexBox_ControlBorderFocusedBrush"];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event handler to set correct control border if not focused.
|
||||
/// </summary>
|
||||
private static void BinaryPreview_HexBoxFocusLost(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var hexBox = (HB.HexBox)sender;
|
||||
|
||||
// Workaround: Verify that the newly focused control isn't the context menu of the HexBox control
|
||||
if (FocusManager.GetFocusedElement(hexBox.XamlRoot).GetType() != typeof(MenuFlyoutPresenter))
|
||||
{
|
||||
hexBox.BorderThickness = (Thickness)Application.Current.Resources["HexBox_ControlBorderThickness"];
|
||||
hexBox.BorderBrush = (LinearGradientBrush)Application.Current.Resources["HexBox_ControlBorderBrush"];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure that for REG_Binary preview the HexBox control is focused after opening.
|
||||
/// </summary>
|
||||
private static void ExtendedDataPreview_Opened(ContentDialog sender, ContentDialogOpenedEventArgs e)
|
||||
{
|
||||
// If <_isDataPreviewHexBoxLoaded == true> then we have the right content on the dialog.
|
||||
if (_isDataPreviewHexBoxLoaded)
|
||||
{
|
||||
// Child controls: 0 = SelectorBar, 1 = ProgressRing, 2 = HexBox, 3 = TextBox
|
||||
(sender.Content as StackPanel).Children[2].Focus(FocusState.Programmatic);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
using CommunityToolkit.WinUI.UI.Controls;
|
||||
using Microsoft.UI.Dispatching;
|
||||
using Microsoft.UI.Xaml;
|
||||
@@ -414,48 +415,5 @@ namespace RegistryPreviewUILib
|
||||
saveButton.IsEnabled = true;
|
||||
});
|
||||
}
|
||||
|
||||
// Commands to show data preview
|
||||
public void ButtonExtendedPreview_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var data = ((Button)sender).DataContext as RegistryValue;
|
||||
InvokeExtendedDataPreview(data);
|
||||
}
|
||||
|
||||
public void MenuExtendedPreview_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var data = ((MenuFlyoutItem)sender).DataContext as RegistryValue;
|
||||
InvokeExtendedDataPreview(data);
|
||||
}
|
||||
|
||||
private async void InvokeExtendedDataPreview(RegistryValue valueData)
|
||||
{
|
||||
// Only one content dialog can be open at the same time and multiple instances of data preview can crash the app.
|
||||
if (_dialogSemaphore.CurrentCount == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Lock ui and request dialog lock
|
||||
_dialogSemaphore.Wait();
|
||||
ChangeCursor(gridPreview, true);
|
||||
|
||||
await ShowExtendedDataPreview(valueData.Name, valueData.Type, valueData.Value);
|
||||
}
|
||||
catch
|
||||
{
|
||||
#if DEBUG
|
||||
throw;
|
||||
#endif
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Unblock ui and release dialog lock
|
||||
ChangeCursor(gridPreview, false);
|
||||
_dialogSemaphore.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,7 +503,6 @@ namespace RegistryPreviewUILib
|
||||
case "REG_NONE":
|
||||
if (value.Length <= 0)
|
||||
{
|
||||
registryValue.IsEmptyBinary = true;
|
||||
value = resourceLoader.GetString("ZeroLength");
|
||||
}
|
||||
else
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
x:Class="RegistryPreviewUILib.RegistryPreviewMainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converter="using:CommunityToolkit.WinUI.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:RegistryPreviewUILib"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -11,12 +10,6 @@
|
||||
xmlns:ui="using:CommunityToolkit.WinUI"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Page.Resources>
|
||||
<ResourceDictionary>
|
||||
<converter:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
|
||||
</ResourceDictionary>
|
||||
</Page.Resources>
|
||||
|
||||
<Grid
|
||||
x:Name="gridPreview"
|
||||
Grid.Row="1"
|
||||
@@ -185,7 +178,7 @@
|
||||
Spacing="8">
|
||||
<StackPanel.ContextFlyout>
|
||||
<MenuFlyout>
|
||||
<MenuFlyoutItem x:Uid="ContextMenu_CopyKeyName" Command="{Binding Content.CopyToClipboardName_Click}" />
|
||||
<MenuFlyoutItem x:Uid="ContextMenu_CopyName" Command="{Binding Content.CopyToClipboardName_Click}" />
|
||||
<MenuFlyoutItem x:Uid="ContextMenu_CopyKeyPath" Command="{Binding Content.CopyToClipboardKeyPath_Click}" />
|
||||
</MenuFlyout>
|
||||
</StackPanel.ContextFlyout>
|
||||
@@ -232,18 +225,10 @@
|
||||
Spacing="8">
|
||||
<StackPanel.ContextFlyout>
|
||||
<MenuFlyout>
|
||||
<MenuFlyoutItem
|
||||
x:Uid="ContextMenu_CopyName"
|
||||
Command="{Binding CopyToClipboardName_Click}"
|
||||
Icon="Copy" />
|
||||
<MenuFlyoutItem x:Uid="ContextMenu_CopyName" Command="{Binding CopyToClipboardName_Click}" />
|
||||
<MenuFlyoutSeparator />
|
||||
<MenuFlyoutItem x:Uid="ContextMenu_CopyValue" Command="{Binding CopyToClipboardEntry_Click}" />
|
||||
<MenuFlyoutItem x:Uid="ContextMenu_CopyValueWithPath" Command="{Binding CopyToClipboardWithPath_Click}" />
|
||||
<MenuFlyoutSeparator />
|
||||
<MenuFlyoutItem
|
||||
x:Uid="ContextMenu_DataPreview"
|
||||
Click="MenuExtendedPreview_Click"
|
||||
Icon="Zoom"
|
||||
IsEnabled="{Binding ShowPreviewButton}" />
|
||||
</MenuFlyout>
|
||||
</StackPanel.ContextFlyout>
|
||||
<Image
|
||||
@@ -270,18 +255,10 @@
|
||||
<Setter Property="ContextFlyout">
|
||||
<Setter.Value>
|
||||
<MenuFlyout>
|
||||
<MenuFlyoutItem
|
||||
x:Uid="ContextMenu_CopyType"
|
||||
Command="{Binding CopyToClipboardType_Click}"
|
||||
Icon="Copy" />
|
||||
<MenuFlyoutItem x:Uid="ContextMenu_CopyType" Command="{Binding CopyToClipboardType_Click}" />
|
||||
<MenuFlyoutSeparator />
|
||||
<MenuFlyoutItem x:Uid="ContextMenu_CopyValue" Command="{Binding CopyToClipboardEntry_Click}" />
|
||||
<MenuFlyoutItem x:Uid="ContextMenu_CopyValueWithPath" Command="{Binding CopyToClipboardWithPath_Click}" />
|
||||
<MenuFlyoutSeparator />
|
||||
<MenuFlyoutItem
|
||||
x:Uid="ContextMenu_DataPreview"
|
||||
Click="MenuExtendedPreview_Click"
|
||||
Icon="Zoom"
|
||||
IsEnabled="{Binding ShowPreviewButton}" />
|
||||
</MenuFlyout>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
@@ -297,36 +274,20 @@
|
||||
<StackPanel
|
||||
Margin="4"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal"
|
||||
Spacing="6">
|
||||
Orientation="Horizontal">
|
||||
<StackPanel.ContextFlyout>
|
||||
<MenuFlyout>
|
||||
<MenuFlyoutItem
|
||||
x:Uid="ContextMenu_CopyData"
|
||||
Command="{Binding CopyToClipboardData_Click}"
|
||||
Icon="Copy" />
|
||||
<MenuFlyoutItem x:Uid="ContextMenu_CopyData" Command="{Binding CopyToClipboardData_Click}" />
|
||||
<MenuFlyoutSeparator />
|
||||
<MenuFlyoutItem x:Uid="ContextMenu_CopyValue" Command="{Binding CopyToClipboardEntry_Click}" />
|
||||
<MenuFlyoutItem x:Uid="ContextMenu_CopyValueWithPath" Command="{Binding CopyToClipboardWithPath_Click}" />
|
||||
<MenuFlyoutSeparator />
|
||||
<MenuFlyoutItem
|
||||
x:Uid="ContextMenu_DataPreview"
|
||||
Click="MenuExtendedPreview_Click"
|
||||
Icon="Zoom"
|
||||
IsEnabled="{Binding ShowPreviewButton}" />
|
||||
</MenuFlyout>
|
||||
</StackPanel.ContextFlyout>
|
||||
<Button
|
||||
x:Uid="ShowDataPreviewButton"
|
||||
Padding="2"
|
||||
Click="ButtonExtendedPreview_Click"
|
||||
Content=""
|
||||
FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
Visibility="{Binding ShowPreviewButton, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
IsTabStop="False"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="{Binding ValueOneLine}" />
|
||||
Text="{Binding ValueOneLine}"
|
||||
ToolTipService.ToolTip="{Binding Value}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</tk7controls:DataGridTemplateColumn.CellTemplate>
|
||||
|
||||
@@ -40,9 +40,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Controls\MonacoEditor\MonacoEditorControl.xaml" />
|
||||
<None Remove="Controls\HexBox\Themes\Generic.xaml" />
|
||||
<None Remove="Themes\Generic.xaml" />
|
||||
<None Remove="MonacoEditorControl.xaml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -53,7 +51,6 @@
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Extensions" />
|
||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" />
|
||||
<PackageReference Include="SkiaSharp.Views.WinUI" />
|
||||
<Manifest Include="$(ApplicationManifest)" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -62,21 +59,10 @@
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Update="Controls\MonacoEditor\MonacoEditorControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Update="Controls\HexBox\Themes\Generic.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Update="Themes\Generic.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Controls\MonacoEditor\" />
|
||||
<Folder Include="Controls\HexBox\" />
|
||||
<Page Update="MonacoEditorControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -6,6 +6,7 @@ using System;
|
||||
using System.Windows.Input;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Windows.ApplicationModel.DataTransfer;
|
||||
|
||||
namespace RegistryPreviewUILib
|
||||
{
|
||||
@@ -28,8 +29,6 @@ namespace RegistryPreviewUILib
|
||||
|
||||
public string Value { get; set; }
|
||||
|
||||
public bool IsEmptyBinary { private get; set; }
|
||||
|
||||
public string ValueOneLine => Value.Replace('\r', ' ');
|
||||
|
||||
public string ToolTipText { get; set; }
|
||||
@@ -55,10 +54,6 @@ namespace RegistryPreviewUILib
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowPreviewButton =>
|
||||
Type != "ERROR" && Type != string.Empty &&
|
||||
Value != string.Empty && IsEmptyBinary != true;
|
||||
|
||||
public RegistryValue(string name, string type, string value, string key)
|
||||
{
|
||||
this.Name = name;
|
||||
|
||||
@@ -277,20 +277,16 @@
|
||||
<value>Copy path</value>
|
||||
<comment>Like "Copy item"</comment>
|
||||
</data>
|
||||
<data name="ContextMenu_CopyKeyName.Text" xml:space="preserve">
|
||||
<data name="ContextMenu_CopyName.Text" xml:space="preserve">
|
||||
<value>Copy name</value>
|
||||
<comment>Like "Copy item"</comment>
|
||||
</data>
|
||||
<data name="ContextMenu_CopyName.Text" xml:space="preserve">
|
||||
<value>Copy</value>
|
||||
<comment>Like "Copy item"</comment>
|
||||
</data>
|
||||
<data name="ContextMenu_CopyType.Text" xml:space="preserve">
|
||||
<value>Copy</value>
|
||||
<value>Copy type</value>
|
||||
<comment>Like "Copy item"</comment>
|
||||
</data>
|
||||
<data name="ContextMenu_CopyData.Text" xml:space="preserve">
|
||||
<value>Copy</value>
|
||||
<value>Copy data</value>
|
||||
<comment>Like "Copy item"</comment>
|
||||
</data>
|
||||
<data name="ContextMenu_CopyValue.Text" xml:space="preserve">
|
||||
@@ -301,65 +297,6 @@
|
||||
<value>Copy value with key path</value>
|
||||
<comment>Like "Copy item"</comment>
|
||||
</data>
|
||||
<data name="ShowDataPreviewButton.ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Show extended preview</value>
|
||||
</data>
|
||||
<data name="ShowDataPreviewButton.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Show extended preview</value>
|
||||
</data>
|
||||
<data name="DataPreviewTitle" xml:space="preserve">
|
||||
<value>View data</value>
|
||||
</data>
|
||||
<data name="DataPreviewClose" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
<comment>like "Close window"</comment>
|
||||
</data>
|
||||
<data name="DataPreviewHex" xml:space="preserve">
|
||||
<value>Hexadecimal</value>
|
||||
</data>
|
||||
<data name="DataPreviewDec" xml:space="preserve">
|
||||
<value>Decimal</value>
|
||||
</data>
|
||||
<data name="DataPreviewRawValue" xml:space="preserve">
|
||||
<value>Raw value</value>
|
||||
</data>
|
||||
<data name="DataPreviewExpandedValue" xml:space="preserve">
|
||||
<value>Expanded value</value>
|
||||
</data>
|
||||
<data name="DataPreviewVisibleText" xml:space="preserve">
|
||||
<value>Readable text</value>
|
||||
<comment>Means text that is human readable and not only control characters.</comment>
|
||||
</data>
|
||||
<data name="DataPreviewDataView" xml:space="preserve">
|
||||
<value>Data</value>
|
||||
<comment>Like "binary data"</comment>
|
||||
</data>
|
||||
<data name="DataPreview_AutomationPropertiesName_MultilineTextValue" xml:space="preserve">
|
||||
<value>Multiline text value</value>
|
||||
</data>
|
||||
<data name="DataPreview_AutomationPropertiesName_TextValue" xml:space="preserve">
|
||||
<value>Text value</value>
|
||||
</data>
|
||||
<data name="DataPreview_AutomationPropertiesName_BinaryDataPreview" xml:space="preserve">
|
||||
<value>Binary data preview</value>
|
||||
</data>
|
||||
<data name="DataPreview_AutomationPropertiesName_VisibleTextPreview" xml:space="preserve">
|
||||
<value>Preview of readable text</value>
|
||||
</data>
|
||||
<data name="HexBox_CopyCommand.Text" xml:space="preserve">
|
||||
<value>Copy</value>
|
||||
<comment>Like "copy the value"</comment>
|
||||
</data>
|
||||
<data name="HexBox_CopyTextCommand.Text" xml:space="preserve">
|
||||
<value>Copy text</value>
|
||||
<comment>Like "Copy the text"</comment>
|
||||
</data>
|
||||
<data name="HexBox_SelectAllCommand.Text" xml:space="preserve">
|
||||
<value>Select all</value>
|
||||
</data>
|
||||
<data name="ContextMenu_DataPreview.Text" xml:space="preserve">
|
||||
<value>Extended data preview</value>
|
||||
</data>
|
||||
<data name="NewButton.Label" xml:space="preserve">
|
||||
<value>New</value>
|
||||
</data>
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:RegistryPreviewUILib">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/PowerToys.RegistryPreviewUILib/Controls/HexBox/Themes/Generic.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
@@ -40,10 +40,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
VisibleColorFormats.Add("Decimal", new KeyValuePair<bool, string>(false, ColorFormatHelper.GetDefaultFormat("Decimal")));
|
||||
VisibleColorFormats.Add("HEX Int", new KeyValuePair<bool, string>(false, ColorFormatHelper.GetDefaultFormat("HEX Int")));
|
||||
ShowColorName = false;
|
||||
ActivationAction = ColorPickerActivationAction.OpenColorPicker;
|
||||
PrimaryClickAction = ColorPickerClickAction.PickColorThenEditor;
|
||||
MiddleClickAction = ColorPickerClickAction.PickColorAndClose;
|
||||
SecondaryClickAction = ColorPickerClickAction.Close;
|
||||
ActivationAction = ColorPickerActivationAction.OpenColorPickerAndThenEditor;
|
||||
CopiedColorRepresentation = "HEX";
|
||||
}
|
||||
|
||||
@@ -60,15 +57,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonPropertyName("activationaction")]
|
||||
public ColorPickerActivationAction ActivationAction { get; set; }
|
||||
|
||||
[JsonPropertyName("primaryclickaction")]
|
||||
public ColorPickerClickAction PrimaryClickAction { get; set; }
|
||||
|
||||
[JsonPropertyName("middleclickaction")]
|
||||
public ColorPickerClickAction MiddleClickAction { get; set; }
|
||||
|
||||
[JsonPropertyName("secondaryclickaction")]
|
||||
public ColorPickerClickAction SecondaryClickAction { get; set; }
|
||||
|
||||
// Property ColorHistory is not used, the color history is saved separately in the colorHistory.json file
|
||||
[JsonPropertyName("colorhistory")]
|
||||
[CmdConfigureIgnoreAttribute]
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
VisibleColorFormats.Add("RGB", true);
|
||||
VisibleColorFormats.Add("HSL", true);
|
||||
ShowColorName = false;
|
||||
ActivationAction = ColorPickerActivationAction.OpenColorPicker;
|
||||
ActivationAction = ColorPickerActivationAction.OpenColorPickerAndThenEditor;
|
||||
}
|
||||
|
||||
public HotkeySettings ActivationShortcut { get; set; }
|
||||
|
||||
@@ -9,7 +9,6 @@ using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
@@ -24,7 +23,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
public ColorPickerSettings()
|
||||
{
|
||||
Properties = new ColorPickerProperties();
|
||||
Version = "2.1";
|
||||
Version = "2";
|
||||
Name = ModuleName;
|
||||
}
|
||||
|
||||
@@ -48,21 +47,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
|
||||
// This can be utilized in the future if the settings.json file is to be modified/deleted.
|
||||
public bool UpgradeSettingsConfiguration()
|
||||
{
|
||||
// Upgrading V1 to V2 doesn't set the version to 2.0, therefore V2 settings still report Version == 1.0
|
||||
if (Version == "1.0")
|
||||
{
|
||||
if (!Enum.IsDefined(Properties.ActivationAction))
|
||||
{
|
||||
Properties.ActivationAction = ColorPickerActivationAction.OpenColorPicker;
|
||||
}
|
||||
|
||||
Version = "2.1";
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
=> false;
|
||||
|
||||
public static object UpgradeSettings(object oldSettingsObject)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user