A Swiss Army knife for developers.
C# blazorcross-platformcsharpdesktopdesktop-appdesktop-applicationdeveloper-toolsextensiblefluentfluent-designlinuxmacosmicasyntax-highlightingtypescriptwindowswindows-10windows-11winui
Added an out-of-proc Win32 service. (#71)
Etienne Baudoux1cc22b2c0b6f
diff --git a/ci/azure-pipelines-release.yml b/ci/azure-pipelines-release.ymlindex bd6566f5a..509711d35 100644--- a/ci/azure-pipelines-release.yml+++ b/ci/azure-pipelines-release.yml@@ -12,7 +12,7 @@ pool:variables:group: BuildPipelineVariablesuwpProject: '**/*.wapproj'- buildPlatform: 'x86|x64|ARM'+ buildPlatform: 'x86|x64|arm64'buildConfiguration: 'Release'appxPackageDir: '$(build.artifactStagingDirectory)\AppxPackages\\'buildFolder: '$(Build.SourcesDirectory)\bin\'@@ -30,12 +30,12 @@ jobs:inputs:targetType: 'inline'script: |- [xml]$xmlDoc = Get-Content $(Build.SourcesDirectory)\src\dev\shared\Package.appxmanifest+ [xml]$xmlDoc = Get-Content $(Build.SourcesDirectory)\src\dev\DevToys.Startup\Package.appxmanifest$xmlDoc.Package.Identity.Name="DevToys"$xmlDoc.Package.Identity.Publisher="CN=etiennebaudoux"$xmlDoc.Package.Properties.DisplayName="DevToys"$xmlDoc.Package.Applications.Application.VisualElements.DisplayName="DevToys"- $xmlDoc.Save('$(Build.SourcesDirectory)\src\dev\shared\Package.appxmanifest')+ $xmlDoc.Save('$(Build.SourcesDirectory)\src\dev\DevToys.Startup\Package.appxmanifest')failOnStderr: true- task: PowerShell@2@@ -54,6 +54,12 @@ jobs:inputs:secureFile: '$(certificateSecureFilePath)'+ - task: UseDotNet@2+ displayName: 'Set to use .Net 6.0'+ inputs:+ packageType: sdk+ version: 6.x+# Run the init.ps1, which mostly restores dependencies- task: PowerShell@2displayName: 'Restore nuget packages & Monaco editor'@@ -69,7 +75,8 @@ jobs:platform: 'x86'configuration: '$(buildConfiguration)'msbuildArguments: '/bl:"$(buildFolder)\msbuild.binlog"- /t:build;_GenerateAppxPackage+ /t:build;_GenerateAppxPackage+ /restore/p:AppxBundlePlatforms="$(buildPlatform)"/p:AppxPackageDir="$(appxPackageDir)"/p:AppxBundle=Always@@ -103,12 +110,12 @@ jobs:inputs:targetType: 'inline'script: |- [xml]$xmlDoc = Get-Content $(Build.SourcesDirectory)\src\dev\shared\Package.appxmanifest+ [xml]$xmlDoc = Get-Content $(Build.SourcesDirectory)\src\dev\DevToys.Startup\Package.appxmanifest$xmlDoc.Package.Identity.Name="64360VelerSoftware.DevToys"$xmlDoc.Package.Identity.Publisher="CN=3D87C8C2-C6F4-4875-B258-5FEC13B08F81"$xmlDoc.Package.Properties.DisplayName="DevToys"$xmlDoc.Package.Applications.Application.VisualElements.DisplayName="DevToys"- $xmlDoc.Save('$(Build.SourcesDirectory)\src\dev\shared\Package.appxmanifest')+ $xmlDoc.Save('$(Build.SourcesDirectory)\src\dev\DevToys.Startup\Package.appxmanifest')failOnStderr: true- task: PowerShell@2@@ -121,6 +128,12 @@ jobs:}failOnStderr: true+ - task: UseDotNet@2+ displayName: 'Set to use .Net 6.0'+ inputs:+ packageType: sdk+ version: 6.x+# Run the init.ps1, which mostly restores dependencies- task: PowerShell@2displayName: 'Restore nuget packages & Monaco editor'@@ -136,7 +149,8 @@ jobs:platform: 'x86'configuration: '$(buildConfiguration)'msbuildArguments: '/bl:"$(buildFolder)\msbuild.binlog"- /t:build;_GenerateAppxPackage+ /t:build;_GenerateAppxPackage+ /restore/p:AppxBundlePlatforms="$(buildPlatform)"/p:AppxPackageDir="$(appxPackageDir)"/p:AppxBundle=Alwaysdiff --git a/ci/azure-pipelines.yml b/ci/azure-pipelines.ymlindex 2650db424..21e4268f0 100644--- a/ci/azure-pipelines.yml+++ b/ci/azure-pipelines.yml@@ -12,7 +12,7 @@ pool:variables:group: BuildPipelineVariablesuwpProject: '**/*.wapproj'- buildPlatform: 'x86|x64|ARM'+ buildPlatform: 'x86|x64|arm64'buildConfiguration: 'Release'appxPackageDir: '$(build.artifactStagingDirectory)\AppxPackages\\'buildFolder: '$(Build.SourcesDirectory)\bin\'@@ -22,6 +22,12 @@ jobs:timeoutInMinutes: 120steps:+ - task: UseDotNet@2+ displayName: 'Set to use .Net 6.0'+ inputs:+ packageType: sdk+ version: 6.x+# Run the init.ps1, which mostly restores dependencies- task: PowerShell@2displayName: 'Restore nuget packages & Monaco editor'@@ -37,6 +43,7 @@ jobs:configuration: '$(buildConfiguration)'msbuildArguments: '/bl:"$(buildFolder)\msbuild.binlog"/t:build+ /restore/p:AppxBundlePlatforms="$(buildPlatform)"/p:AppxPackageDir="$(appxPackageDir)"/p:AppxPackageSigningEnabled=falsediff --git a/src/DevToys.sln b/src/DevToys.slnindex f7f1b9b07..0caf10642 100644--- a/src/DevToys.sln+++ b/src/DevToys.sln@@ -4,6 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00VisualStudioVersion = 17.0.31903.59MinimumVisualStudioVersion = 10.0.40219.1Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dev", "dev", "{2C2B8C64-7BA1-4244-86E1-48CA7D85D7D9}"+ ProjectSection(SolutionItems) = preProject+ dev\Directory.Build.props = dev\Directory.Build.props+ EndProjectSectionEndProjectProject("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{F8A9E843-7AC1-414A-8F27-A8F416D2D489}"EndProject@@ -31,7 +34,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "SolutionEndProjectProject("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{EE2227BC-954E-4053-AE38-4AE7A391AEEA}"ProjectSection(SolutionItems) = preProject- dev\shared\Package.appxmanifest = dev\shared\Package.appxmanifestdev\shared\SharedAssemblyInfo.cs = dev\shared\SharedAssemblyInfo.csEndProjectSectionEndProject@@ -39,88 +41,104 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevToys.Tests", "tests\DevTEndProjectProject("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevToys.MonacoEditor", "dev\impl\DevToys.MonacoEditor\DevToys.MonacoEditor.csproj", "{0FE678BB-9F9B-4495-B777-F9B1E11DA20C}"EndProject+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.OutOfProcService", "dev\impl\DevToys.OutOfProcService\DevToys.OutOfProcService.csproj", "{61AAE058-5FB6-43C2-BFD2-7B5D8128EF58}"+EndProject+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.Shared", "dev\shared\DevToys.Shared\DevToys.Shared.csproj", "{CCBCAEFE-B245-413A-9C37-A21CE99EECB9}"+EndProjectGlobalGlobalSection(SolutionConfigurationPlatforms) = preSolution- Debug|ARM = Debug|ARM- Debug|ARM64 = Debug|ARM64+ Debug|arm64 = Debug|arm64Debug|x64 = Debug|x64Debug|x86 = Debug|x86- Release|ARM = Release|ARM- Release|ARM64 = Release|ARM64+ Release|arm64 = Release|arm64Release|x64 = Release|x64Release|x86 = Release|x86EndGlobalSectionGlobalSection(ProjectConfigurationPlatforms) = postSolution- {361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Debug|ARM.ActiveCfg = Debug|ARM- {361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Debug|ARM.Build.0 = Debug|ARM- {361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Debug|ARM.Deploy.0 = Debug|ARM- {361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Debug|ARM64.ActiveCfg = Debug|x86+ {361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Debug|arm64.ActiveCfg = Debug|arm64+ {361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Debug|arm64.Build.0 = Debug|arm64+ {361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Debug|arm64.Deploy.0 = Debug|arm64{361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Debug|x64.ActiveCfg = Debug|x64{361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Debug|x64.Build.0 = Debug|x64{361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Debug|x64.Deploy.0 = Debug|x64{361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Debug|x86.ActiveCfg = Debug|x86{361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Debug|x86.Build.0 = Debug|x86{361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Debug|x86.Deploy.0 = Debug|x86- {361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Release|ARM.ActiveCfg = Release|ARM- {361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Release|ARM.Build.0 = Release|ARM- {361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Release|ARM.Deploy.0 = Release|ARM- {361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Release|ARM64.ActiveCfg = Release|x86+ {361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Release|arm64.ActiveCfg = Release|arm64+ {361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Release|arm64.Build.0 = Release|arm64+ {361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Release|arm64.Deploy.0 = Release|arm64{361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Release|x64.ActiveCfg = Release|x64{361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Release|x64.Build.0 = Release|x64{361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Release|x64.Deploy.0 = Release|x64{361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Release|x86.ActiveCfg = Release|x86{361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Release|x86.Build.0 = Release|x86{361DB7BC-BE7B-41A2-A29A-978A9E3B4AA7}.Release|x86.Deploy.0 = Release|x86- {E3E4E200-B380-4207-9A7E-4C9421904502}.Debug|ARM.ActiveCfg = Debug|ARM- {E3E4E200-B380-4207-9A7E-4C9421904502}.Debug|ARM.Build.0 = Debug|ARM- {E3E4E200-B380-4207-9A7E-4C9421904502}.Debug|ARM64.ActiveCfg = Debug|x86+ {E3E4E200-B380-4207-9A7E-4C9421904502}.Debug|arm64.ActiveCfg = Debug|arm64+ {E3E4E200-B380-4207-9A7E-4C9421904502}.Debug|arm64.Build.0 = Debug|arm64{E3E4E200-B380-4207-9A7E-4C9421904502}.Debug|x64.ActiveCfg = Debug|x64{E3E4E200-B380-4207-9A7E-4C9421904502}.Debug|x64.Build.0 = Debug|x64{E3E4E200-B380-4207-9A7E-4C9421904502}.Debug|x86.ActiveCfg = Debug|x86{E3E4E200-B380-4207-9A7E-4C9421904502}.Debug|x86.Build.0 = Debug|x86- {E3E4E200-B380-4207-9A7E-4C9421904502}.Release|ARM.ActiveCfg = Release|ARM- {E3E4E200-B380-4207-9A7E-4C9421904502}.Release|ARM.Build.0 = Release|ARM- {E3E4E200-B380-4207-9A7E-4C9421904502}.Release|ARM64.ActiveCfg = Release|x86+ {E3E4E200-B380-4207-9A7E-4C9421904502}.Release|arm64.ActiveCfg = Release|arm64+ {E3E4E200-B380-4207-9A7E-4C9421904502}.Release|arm64.Build.0 = Release|arm64{E3E4E200-B380-4207-9A7E-4C9421904502}.Release|x64.ActiveCfg = Release|x64{E3E4E200-B380-4207-9A7E-4C9421904502}.Release|x64.Build.0 = Release|x64{E3E4E200-B380-4207-9A7E-4C9421904502}.Release|x86.ActiveCfg = Release|x86{E3E4E200-B380-4207-9A7E-4C9421904502}.Release|x86.Build.0 = Release|x86- {E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Debug|ARM.ActiveCfg = Debug|ARM- {E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Debug|ARM.Build.0 = Debug|ARM- {E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Debug|ARM.Deploy.0 = Debug|ARM- {E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Debug|ARM64.ActiveCfg = Debug|x86+ {E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Debug|arm64.ActiveCfg = Debug|arm64+ {E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Debug|arm64.Build.0 = Debug|arm64+ {E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Debug|arm64.Deploy.0 = Debug|arm64{E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Debug|x64.ActiveCfg = Debug|x64{E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Debug|x64.Build.0 = Debug|x64{E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Debug|x64.Deploy.0 = Debug|x64{E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Debug|x86.ActiveCfg = Debug|x86{E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Debug|x86.Build.0 = Debug|x86{E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Debug|x86.Deploy.0 = Debug|x86- {E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Release|ARM.ActiveCfg = Release|ARM- {E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Release|ARM.Build.0 = Release|ARM- {E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Release|ARM.Deploy.0 = Release|ARM- {E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Release|ARM64.ActiveCfg = Release|x86+ {E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Release|arm64.ActiveCfg = Release|arm64+ {E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Release|arm64.Build.0 = Release|arm64+ {E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Release|arm64.Deploy.0 = Release|arm64{E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Release|x64.ActiveCfg = Release|x64{E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Release|x64.Build.0 = Release|x64{E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Release|x64.Deploy.0 = Release|x64{E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Release|x86.ActiveCfg = Release|x86{E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Release|x86.Build.0 = Release|x86{E1C4AB49-CFFF-420E-A182-E3028BD0493C}.Release|x86.Deploy.0 = Release|x86- {0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Debug|ARM.ActiveCfg = Debug|ARM- {0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Debug|ARM.Build.0 = Debug|ARM- {0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Debug|ARM64.ActiveCfg = Debug|ARM64- {0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Debug|ARM64.Build.0 = Debug|ARM64+ {0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Debug|arm64.ActiveCfg = Debug|arm64+ {0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Debug|arm64.Build.0 = Debug|arm64{0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Debug|x64.ActiveCfg = Debug|x64{0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Debug|x64.Build.0 = Debug|x64{0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Debug|x86.ActiveCfg = Debug|x86{0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Debug|x86.Build.0 = Debug|x86- {0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Release|ARM.ActiveCfg = Release|ARM- {0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Release|ARM.Build.0 = Release|ARM- {0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Release|ARM64.ActiveCfg = Release|ARM64- {0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Release|ARM64.Build.0 = Release|ARM64+ {0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Release|arm64.ActiveCfg = Release|arm64+ {0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Release|arm64.Build.0 = Release|arm64{0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Release|x64.ActiveCfg = Release|x64{0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Release|x64.Build.0 = Release|x64{0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Release|x86.ActiveCfg = Release|x86{0FE678BB-9F9B-4495-B777-F9B1E11DA20C}.Release|x86.Build.0 = Release|x86+ {61AAE058-5FB6-43C2-BFD2-7B5D8128EF58}.Debug|arm64.ActiveCfg = Debug|arm64+ {61AAE058-5FB6-43C2-BFD2-7B5D8128EF58}.Debug|arm64.Build.0 = Debug|arm64+ {61AAE058-5FB6-43C2-BFD2-7B5D8128EF58}.Debug|x64.ActiveCfg = Debug|x64+ {61AAE058-5FB6-43C2-BFD2-7B5D8128EF58}.Debug|x64.Build.0 = Debug|x64+ {61AAE058-5FB6-43C2-BFD2-7B5D8128EF58}.Debug|x86.ActiveCfg = Debug|x86+ {61AAE058-5FB6-43C2-BFD2-7B5D8128EF58}.Debug|x86.Build.0 = Debug|x86+ {61AAE058-5FB6-43C2-BFD2-7B5D8128EF58}.Release|arm64.ActiveCfg = Release|arm64+ {61AAE058-5FB6-43C2-BFD2-7B5D8128EF58}.Release|arm64.Build.0 = Release|arm64+ {61AAE058-5FB6-43C2-BFD2-7B5D8128EF58}.Release|x64.ActiveCfg = Release|x64+ {61AAE058-5FB6-43C2-BFD2-7B5D8128EF58}.Release|x64.Build.0 = Release|x64+ {61AAE058-5FB6-43C2-BFD2-7B5D8128EF58}.Release|x86.ActiveCfg = Release|x86+ {61AAE058-5FB6-43C2-BFD2-7B5D8128EF58}.Release|x86.Build.0 = Release|x86+ {CCBCAEFE-B245-413A-9C37-A21CE99EECB9}.Debug|arm64.ActiveCfg = Debug|Any CPU+ {CCBCAEFE-B245-413A-9C37-A21CE99EECB9}.Debug|arm64.Build.0 = Debug|Any CPU+ {CCBCAEFE-B245-413A-9C37-A21CE99EECB9}.Debug|x64.ActiveCfg = Debug|Any CPU+ {CCBCAEFE-B245-413A-9C37-A21CE99EECB9}.Debug|x64.Build.0 = Debug|Any CPU+ {CCBCAEFE-B245-413A-9C37-A21CE99EECB9}.Debug|x86.ActiveCfg = Debug|Any CPU+ {CCBCAEFE-B245-413A-9C37-A21CE99EECB9}.Debug|x86.Build.0 = Debug|Any CPU+ {CCBCAEFE-B245-413A-9C37-A21CE99EECB9}.Release|arm64.ActiveCfg = Release|Any CPU+ {CCBCAEFE-B245-413A-9C37-A21CE99EECB9}.Release|arm64.Build.0 = Release|Any CPU+ {CCBCAEFE-B245-413A-9C37-A21CE99EECB9}.Release|x64.ActiveCfg = Release|Any CPU+ {CCBCAEFE-B245-413A-9C37-A21CE99EECB9}.Release|x64.Build.0 = Release|Any CPU+ {CCBCAEFE-B245-413A-9C37-A21CE99EECB9}.Release|x86.ActiveCfg = Release|Any CPU+ {CCBCAEFE-B245-413A-9C37-A21CE99EECB9}.Release|x86.Build.0 = Release|Any CPUEndGlobalSectionGlobalSection(SolutionProperties) = preSolutionHideSolutionNode = FALSE@@ -132,6 +150,8 @@ Global{EE2227BC-954E-4053-AE38-4AE7A391AEEA} = {2C2B8C64-7BA1-4244-86E1-48CA7D85D7D9}{E1C4AB49-CFFF-420E-A182-E3028BD0493C} = {F8A9E843-7AC1-414A-8F27-A8F416D2D489}{0FE678BB-9F9B-4495-B777-F9B1E11DA20C} = {93B72B9C-08BA-4838-9163-3ED67EC3EB9F}+ {61AAE058-5FB6-43C2-BFD2-7B5D8128EF58} = {93B72B9C-08BA-4838-9163-3ED67EC3EB9F}+ {CCBCAEFE-B245-413A-9C37-A21CE99EECB9} = {EE2227BC-954E-4053-AE38-4AE7A391AEEA}EndGlobalSectionGlobalSection(ExtensibilityGlobals) = postSolutionSolutionGuid = {78B10789-385B-4F7D-8E06-D86143CD76B5}diff --git a/src/Directory.Build.props b/src/Directory.Build.propsindex b7146bf61..17866cb93 100644--- a/src/Directory.Build.props+++ b/src/Directory.Build.props@@ -4,7 +4,7 @@<Platform Condition=" '$(Platform)' == '' ">x86</Platform><Windows10SDKVersion>10.0.19041.0</Windows10SDKVersion>- <Windows10MinSDKVersion>10.0.18362.0</Windows10MinSDKVersion>+ <Windows10MinSDKVersion>10.0.19041.0</Windows10MinSDKVersion><!-- Defines the bin and obj folder paths --><RepoRoot>$([System.IO.Path]::GetDirectoryName($([MSBuild]::GetPathOfFileAbove('.gitignore', '$(MSBuildThisFileDirectory)'))))\</RepoRoot>@@ -16,11 +16,8 @@<PackagesConfigRestorePath>$(RepoRoot)packages\</PackagesConfigRestorePath></PropertyGroup>- <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '15.0' ">- <VisualStudioVersion>15.0</VisualStudioVersion>- </PropertyGroup>-<PropertyGroup>+ <NuGet_DotNet>6.0.0</NuGet_DotNet><Nuget_GitInfo>2.2.0</Nuget_GitInfo><Nuget_Markdig>0.26.0</Nuget_Markdig><NuGet_MicrosoftNETCoreUniversalWindowsPlatform>6.2.12</NuGet_MicrosoftNETCoreUniversalWindowsPlatform>@@ -30,12 +27,12 @@<Nuget_MicrosoftToolkitUwpUIControls>7.0.2</Nuget_MicrosoftToolkitUwpUIControls><Nuget_MicrosoftTypeScriptMSBuild>4.4.2</Nuget_MicrosoftTypeScriptMSBuild><NuGet_MicrosoftUIXaml>2.6.2</NuGet_MicrosoftUIXaml>+ <NuGet_MicrosoftWindowsCsWinRT>1.3.5</NuGet_MicrosoftWindowsCsWinRT><NuGet_MicrosoftWindowsSDKBuildTools>10.0.20348.19</NuGet_MicrosoftWindowsSDKBuildTools><NuGet_MSTestTestAdapter>2.1.1</NuGet_MSTestTestAdapter><NuGet_MSTestTestFramework>2.1.1</NuGet_MSTestTestFramework><NuGet_NewtonsoftJson>12.0.3</NuGet_NewtonsoftJson><Nuget_ObservableVector>2.1.0</Nuget_ObservableVector>- <NuGet_SystemComposition>5.0.0</NuGet_SystemComposition><NuGet_Win2D>1.26.0</NuGet_Win2D><NuGet_YamlDotNet>11.2.1</NuGet_YamlDotNet><NuGet_IdentityModelTokenJwt>6.13.1</NuGet_IdentityModelTokenJwt>diff --git a/src/dev/DevToys.Startup/DevToys.Startup.wapproj b/src/dev/DevToys.Startup/DevToys.Startup.wapprojindex 6bd45055e..e469af3cc 100644--- a/src/dev/DevToys.Startup/DevToys.Startup.wapproj+++ b/src/dev/DevToys.Startup/DevToys.Startup.wapproj@@ -17,13 +17,13 @@<Configuration>Release</Configuration><Platform>x64</Platform></ProjectConfiguration>- <ProjectConfiguration Include="Debug|ARM">+ <ProjectConfiguration Include="Debug|arm64"><Configuration>Debug</Configuration>- <Platform>ARM</Platform>+ <Platform>arm64</Platform></ProjectConfiguration>- <ProjectConfiguration Include="Release|ARM">+ <ProjectConfiguration Include="Release|arm64"><Configuration>Release</Configuration>- <Platform>ARM</Platform>+ <Platform>arm64</Platform></ProjectConfiguration></ItemGroup><PropertyGroup>@@ -40,7 +40,7 @@<AppxSymbolPackageEnabled>True</AppxSymbolPackageEnabled><DisableXbfLineInfo>False</DisableXbfLineInfo><GenerateTestArtifacts>True</GenerateTestArtifacts>- <AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms>+ <AppxBundlePlatforms>x86|x64|arm64</AppxBundlePlatforms><HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks><AppxPackageDir>..\..\..\bin\AppPackages\</AppxPackageDir><AppxBundle>Always</AppxBundle>@@ -54,6 +54,7 @@<AppxUseHardlinksIfPossible>false</AppxUseHardlinksIfPossible></PropertyGroup><ItemGroup>+ <ProjectReference Include="..\impl\DevToys.OutOfProcService\DevToys.OutOfProcService.csproj" /><ProjectReference Include="..\impl\DevToys\DevToys.csproj" /></ItemGroup><ItemGroup>@@ -108,14 +109,14 @@<Content Include="Assets\Logo-Prev\Wide310x150Logo.scale-200.png" /><Content Include="Assets\Logo-Prev\Wide310x150Logo.scale-400.png" /></ItemGroup>+ <Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />+ <ItemGroup>+ <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="$(NuGet_MicrosoftWindowsSDKBuildTools)" PrivateAssets="all" />+ </ItemGroup><ItemGroup>- <AppxManifest Include="..\shared\Package.appxmanifest">- <Link>Package.appxmanifest</Link>+ <AppxManifest Include="Package.appxmanifest"><SubType>Designer</SubType></AppxManifest></ItemGroup><Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />- <!-- <ItemGroup>- <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="$(NuGet_MicrosoftWindowsSDKBuildTools)" PrivateAssets="all" />- </ItemGroup> --></Project>\ No newline at end of filediff --git a/src/dev/shared/Package.appxmanifest b/src/dev/DevToys.Startup/Package.appxmanifestsimilarity index 88%rename from src/dev/shared/Package.appxmanifestrename to src/dev/DevToys.Startup/Package.appxmanifestindex f49b7a224..3bec99355 100644--- a/src/dev/shared/Package.appxmanifest+++ b/src/dev/DevToys.Startup/Package.appxmanifest@@ -4,10 +4,12 @@xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"+ xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4"xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"+ xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4"xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"- IgnorableNamespaces="uap mp desktop4">+ IgnorableNamespaces="uap uap4 uap5 mp rescap desktop desktop4"><!-- Please DO NOT commit changes on the version number below unless you're about to release a new version of the app on the Store. --><Identity@@ -15,9 +17,6 @@Publisher="CN=etiennebaudoux"Version="0.0.0.0" />- <!-- TODO: maybe we need to remove this when adding runFullTrust capability -->- <mp:PhoneIdentity PhoneProductId="c12088ee-f979-4809-8039-7851a3aa2b7a" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>-<Properties><DisplayName>DevToys - Preview</DisplayName><PublisherDisplayName>etiennebaudoux</PublisherDisplayName>@@ -38,6 +37,7 @@Executable="$targetnametoken$.exe"EntryPoint="$targetentrypoint$"desktop4:SupportsMultipleInstances="true">+<uap:VisualElementsDisplayName="DevToys - Preview"Description="A Swiss Army knife for developers."@@ -59,6 +59,7 @@<uap:Rotation Preference="portraitFlipped"/></uap:InitialRotationPreference></uap:VisualElements>+<Extensions><uap:Extension Category="windows.protocol"><uap:Protocol ReturnResults="none" Name="devtoys">@@ -66,6 +67,7 @@<uap:Logo>Assets\Logo-Prev\Square512.png</uap:Logo></uap:Protocol></uap:Extension>+<uap:Extension Category="windows.fileOpenPicker"><uap:FileOpenPicker><uap:SupportedFileTypes>@@ -73,7 +75,14 @@</uap:SupportedFileTypes></uap:FileOpenPicker></uap:Extension>++ <desktop:Extension Category="windows.fullTrustProcess" Executable="DevToys.OutOfProcService\DevToys.OutOfProcService.exe" />+</Extensions></Application></Applications>++ <Capabilities>+ <rescap:Capability Name="runFullTrust" />+ </Capabilities></Package>diff --git a/src/dev/Directory.Build.props b/src/dev/Directory.Build.propsnew file mode 100644index 000000000..1b26194e6--- /dev/null+++ b/src/dev/Directory.Build.props@@ -0,0 +1,24 @@+<Project>+ <Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />++ <PropertyGroup>+ <LangVersion>9.0</LangVersion>+ <Nullable>enable</Nullable>++ <GenerateAssemblyInfo>false</GenerateAssemblyInfo>++ <!-- Enable generation of .tt files -->+ <TransformOnBuild>true</TransformOnBuild>+ <OverwriteReadOnlyOutputFiles>true</OverwriteReadOnlyOutputFiles>+ <TransformOutOfDateOnly>false</TransformOutOfDateOnly>+ </PropertyGroup>++ <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '16.0' ">+ <VisualStudioVersion>16.0</VisualStudioVersion>+ </PropertyGroup>++ <PropertyGroup Condition="'$(Configuration)' == 'Debug'">+ <!-- In Debug mode, don't generate .tt files at each build. -->+ <TransformOutOfDateOnly>true</TransformOutOfDateOnly>+ </PropertyGroup>+</Project>\ No newline at end of filediff --git a/src/dev/impl/DevToys.MonacoEditor/CodeEditorControl/CodeEditorCore.cs b/src/dev/impl/DevToys.MonacoEditor/CodeEditorControl/CodeEditorCore.csindex 0bfac3d7b..ffc44d911 100644--- a/src/dev/impl/DevToys.MonacoEditor/CodeEditorControl/CodeEditorCore.cs+++ b/src/dev/impl/DevToys.MonacoEditor/CodeEditorControl/CodeEditorCore.cs@@ -16,6 +16,7 @@ using DevToys.MonacoEditor.Helpers;using DevToys.MonacoEditor.Monaco;using DevToys.MonacoEditor.Monaco.Editor;using DevToys.MonacoEditor.Monaco.Helpers;+using DevToys.Shared.Core.Threading;using Newtonsoft.Json;using Windows.Foundation;using Windows.Foundation.Collections;@@ -453,12 +454,12 @@ namespace DevToys.MonacoEditor.CodeEditorControl/// <summary>/// When Editor is Loading, it is ready to receive commands to the Monaco Engine./// </summary>- public new event RoutedEventHandler? Loading;+ public event RoutedEventHandler? EditorLoading;/// <summary>/// When Editor is Loaded, it has been rendered and is ready to be displayed./// </summary>- public new event RoutedEventHandler? Loaded;+ public event RoutedEventHandler? EditorLoaded;/// <summary>/// Called when a link is Ctrl+Clicked on in the editor, set Handled to true to prevent opening.@@ -473,7 +474,7 @@ namespace DevToys.MonacoEditor.CodeEditorControl/// <summary>/// Custom Keyboard Handler./// </summary>- public new event WebKeyEventHandler? KeyDown;+ public event WebKeyEventHandler? EditorKeyDown;public static DependencyProperty IsEditorLoadedProperty { get; }= DependencyProperty.Register(@@ -596,11 +597,11 @@ namespace DevToys.MonacoEditor.CodeEditorControl_initialized = true;- Loading?.Invoke(this, new RoutedEventArgs());+ EditorLoading?.Invoke(this, new RoutedEventArgs());Unloaded += CodeEditor_Unloaded;- Loaded?.Invoke(this, new RoutedEventArgs());+ EditorLoaded?.Invoke(this, new RoutedEventArgs());}}@@ -817,7 +818,7 @@ namespace DevToys.MonacoEditor.CodeEditorControl_view.Focus(FocusState.Programmatic);}- Loaded?.Invoke(this, new RoutedEventArgs());+ EditorLoaded?.Invoke(this, new RoutedEventArgs());}private void WebView_NavigationStarting(WebView sender, WebViewNavigationStartingEventArgs args)@@ -860,7 +861,7 @@ namespace DevToys.MonacoEditor.CodeEditorControlDiffOptions.ReadOnly = ReadOnly;// Now we're done loading- Loading?.Invoke(this, new RoutedEventArgs());+ EditorLoading?.Invoke(this, new RoutedEventArgs());}private void WebView_NewWindowRequested(WebView sender, WebViewNewWindowRequestedEventArgs args)@@ -902,7 +903,7 @@ namespace DevToys.MonacoEditor.CodeEditorControlpublic bool TriggerKeyDown(WebKeyEventArgs args){- KeyDown?.Invoke(this, args);+ EditorKeyDown?.Invoke(this, args);return args.Handled;}diff --git a/src/dev/impl/DevToys.MonacoEditor/DevToys.MonacoEditor.csproj b/src/dev/impl/DevToys.MonacoEditor/DevToys.MonacoEditor.csprojindex af2ee5033..37886ef5c 100644--- a/src/dev/impl/DevToys.MonacoEditor/DevToys.MonacoEditor.csproj+++ b/src/dev/impl/DevToys.MonacoEditor/DevToys.MonacoEditor.csproj@@ -31,13 +31,12 @@</Compile><Compile Include="CodeEditorControl\CodeEditorCore.cs" /><Compile Include="CodeEditorControl\InvertedBooleanConverter.cs" />+ <Compile Include="Extensions\DispatcherExtensions.cs" /><Compile Include="Extensions\JavaScriptExecutionException.cs" /><Compile Include="Extensions\JavaScriptInnerException.cs" />- <Compile Include="Extensions\WebViewExtensions.cs" />- <Compile Include="Extensions\DispatcherExtensions.cs" /><Compile Include="Extensions\ThreadPriority.cs" />+ <Compile Include="Extensions\WebViewExtensions.cs" /><Compile Include="Helpers\DebugLogger.cs" />- <Compile Include="Helpers\DisposableSempahore.cs" /><Compile Include="Helpers\IParentAccessorAcceptor.cs" /><Compile Include="Helpers\KeyboardListener.cs" /><Compile Include="Helpers\ParentAccessor.cs" />@@ -220,6 +219,12 @@<PackageReference Include="Newtonsoft.Json" Version="$(NuGet_NewtonsoftJson)" /><PackageReference Include="ObservableVector" Version="$(Nuget_ObservableVector)" /></ItemGroup>+ <ItemGroup>+ <ProjectReference Include="..\..\shared\DevToys.Shared\DevToys.Shared.csproj">+ <Project>{ccbcaefe-b245-413a-9c37-a21ce99eecb9}</Project>+ <Name>DevToys.Shared</Name>+ </ProjectReference>+ </ItemGroup><Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" /><!-- To modify your build process, add your task inside one of the targets below and uncomment it.Other similar extension points exist, see Microsoft.Common.targets.diff --git a/src/dev/impl/DevToys.MonacoEditor/Helpers/DisposableSempahore.cs b/src/dev/impl/DevToys.MonacoEditor/Helpers/DisposableSempahore.csdeleted file mode 100644index 9cc26860c..000000000--- a/src/dev/impl/DevToys.MonacoEditor/Helpers/DisposableSempahore.cs+++ /dev/null@@ -1,60 +0,0 @@-#nullable enable--using System;-using System.Threading;-using System.Threading.Tasks;--namespace DevToys.MonacoEditor.Helpers-{- /// <summary>- /// Represents a semaphore that free other threads when disposing the result of the <see cref="WaitAsync(CancellationToken)"/> method..- /// </summary>- internal sealed class DisposableSempahore : IDisposable- {- private readonly object _lockObject = new();- private readonly SemaphoreSlim _semaphore;-- internal bool Disposed { get; private set; }-- internal bool IsBusy => _semaphore.CurrentCount == 0;-- internal DisposableSempahore(int maxTasksCount = 1)- {- _semaphore = new SemaphoreSlim(maxTasksCount, maxTasksCount);- }-- public void Dispose()- {- lock (_lockObject)- {- if (!Disposed)- {- Disposed = true;- _semaphore.Dispose();- }- }- }-- internal async Task<IDisposable> WaitAsync(CancellationToken cancellationToken)- {- await _semaphore.WaitAsync(cancellationToken).ConfigureAwait(false);-- return new DummyDisposable(_semaphore);- }-- private sealed class DummyDisposable : IDisposable- {- private readonly SemaphoreSlim _semaphore;-- internal DummyDisposable(SemaphoreSlim semaphore)- {- _semaphore = semaphore;- }-- public void Dispose()- {- _semaphore.Release();- }- }- }-}diff --git a/src/dev/impl/DevToys.MonacoEditor/Monaco/LanguagesHelper.cs b/src/dev/impl/DevToys.MonacoEditor/Monaco/LanguagesHelper.csindex 7f170ddc8..8af5d5e27 100644--- a/src/dev/impl/DevToys.MonacoEditor/Monaco/LanguagesHelper.cs+++ b/src/dev/impl/DevToys.MonacoEditor/Monaco/LanguagesHelper.cs@@ -54,7 +54,7 @@ namespace DevToys.MonacoEditor.Monaco{if (args != null && args.Length >= 2){- CompletionList? items = await provider.ProvideCompletionItemsAsync(editor.GetModel()!, JsonConvert.DeserializeObject<Position>(args[0]), JsonConvert.DeserializeObject<CompletionContext>(args[1]));+ CompletionList? items = await provider.ProvideCompletionItemsAsync(editor.GetModel()!, JsonConvert.DeserializeObject<Position>(args[0])!, JsonConvert.DeserializeObject<CompletionContext>(args[1])!);if (items != null){@@ -71,7 +71,7 @@ namespace DevToys.MonacoEditor.Monaco{Position? position = JsonConvert.DeserializeObject<Position>(args[0]);CompletionItem? requestedItem = JsonConvert.DeserializeObject<CompletionItem>(args[1]);- CompletionItem? completionItem = await provider.ResolveCompletionItemAsync(editor.GetModel()!, position, requestedItem);+ CompletionItem? completionItem = await provider.ResolveCompletionItemAsync(editor.GetModel()!, position!, requestedItem!);if (completionItem != null){@@ -98,7 +98,7 @@ namespace DevToys.MonacoEditor.Monaco{if (args != null && args.Length >= 1){- Hover? hover = await provider.ProvideHover(editor.GetModel()!, JsonConvert.DeserializeObject<Position>(args[0]));+ Hover? hover = await provider.ProvideHover(editor.GetModel()!, JsonConvert.DeserializeObject<Position>(args[0])!);if (hover != null){diff --git a/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/AppServiceProgressMessageEventArgs.cs b/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/AppServiceProgressMessageEventArgs.csnew file mode 100644index 000000000..8c7ff6463--- /dev/null+++ b/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/AppServiceProgressMessageEventArgs.cs@@ -0,0 +1,28 @@+using System;+using System.Threading.Tasks;+using DevToys.Shared.Core.OOP;++namespace DevToys.OutOfProcService.API.Core.OOP+{+ internal sealed class AppServiceProgressMessageEventArgs : EventArgs+ {+ internal AppServiceProgressMessage Message { get; }++ internal TaskCompletionSource MessageCompletedTask { get; } = new();++ internal AppServiceProgressMessageEventArgs(Guid messageId, int progressPercentage, string? message)+ {+ if (progressPercentage is < 0 or > 100)+ {+ throw new ArgumentOutOfRangeException(nameof(progressPercentage));+ }++ Message = new AppServiceProgressMessage+ {+ MessageId = messageId,+ ProgressPercentage = progressPercentage,+ Message = message+ };+ }+ }+}diff --git a/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/IOutOfProcService.cs b/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/IOutOfProcService.csnew file mode 100644index 000000000..a22d37bdc--- /dev/null+++ b/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/IOutOfProcService.cs@@ -0,0 +1,15 @@+#nullable enable++using System;+using System.Threading.Tasks;+using DevToys.Shared.Core.OOP;++namespace DevToys.OutOfProcService.API.Core.OOP+{+ internal interface IOutOfProcService+ {+ event EventHandler<AppServiceProgressMessageEventArgs>? ReportProgress;++ Task<AppServiceMessageBase> ProcessMessageAsync(AppServiceMessageBase inputMessage);+ }+}diff --git a/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/InputTypeAttribute.cs b/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/InputTypeAttribute.csnew file mode 100644index 000000000..78b8bd58f--- /dev/null+++ b/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/InputTypeAttribute.cs@@ -0,0 +1,23 @@+using System;+using System.Composition;+using System.IO;+using DevToys.Shared.Core.OOP;++namespace DevToys.OutOfProcService.API.Core.OOP+{+ [MetadataAttribute]+ [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]+ internal sealed class InputTypeAttribute : Attribute+ {+ public Type? InputType { get; set; }++ public InputTypeAttribute(Type type)+ {+ InputType = type;+ if (!type.IsSubclassOf(typeof(AppServiceMessageBase)))+ {+ throw new InvalidDataException();+ }+ }+ }+}diff --git a/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/OutOfProcServiceMetadata.cs b/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/OutOfProcServiceMetadata.csnew file mode 100644index 000000000..a3a24f12a--- /dev/null+++ b/src/dev/impl/DevToys.OutOfProcService/API/Core/OOP/OutOfProcServiceMetadata.cs@@ -0,0 +1,12 @@+using System;+using System.ComponentModel;+using DevToys.Shared.Core.OOP;++namespace DevToys.OutOfProcService.API.Core.OOP+{+ internal sealed class OutOfProcServiceMetadata+ {+ [DefaultValue(typeof(AppServiceMessageBase))]+ public Type InputType { get; set; } = typeof(AppServiceMessageBase);+ }+}diff --git a/src/dev/impl/DevToys.OutOfProcService/Core/NativeMethods.cs b/src/dev/impl/DevToys.OutOfProcService/Core/NativeMethods.csnew file mode 100644index 000000000..0f0b358f9--- /dev/null+++ b/src/dev/impl/DevToys.OutOfProcService/Core/NativeMethods.cs@@ -0,0 +1,14 @@+using System;+using System.Runtime.InteropServices;++namespace DevToys.OutOfProcService.Core+{+ internal static class NativeMethods+ {+ [DllImport("userenv.dll", SetLastError = false, CharSet = CharSet.Unicode)]+ internal static extern int DeriveAppContainerSidFromAppContainerName(string appContainerName, out IntPtr sid);++ [DllImport("advapi32.dll", SetLastError = false)]+ internal static extern IntPtr FreeSid(IntPtr sid);+ }+}diff --git a/src/dev/impl/DevToys.OutOfProcService/Core/OOP/AppService.cs b/src/dev/impl/DevToys.OutOfProcService/Core/OOP/AppService.csnew file mode 100644index 000000000..698667f75--- /dev/null+++ b/src/dev/impl/DevToys.OutOfProcService/Core/OOP/AppService.cs@@ -0,0 +1,258 @@+#nullable enable++using System;+using System.Collections.Generic;+using System.Composition;+using System.Diagnostics;+using System.IO.Pipes;+using System.Linq;+using System.Security.Principal;+using System.Text;+using System.Threading;+using System.Threading.Tasks;+using DevToys.OutOfProcService.API.Core.OOP;+using DevToys.Shared.Api.Core;+using DevToys.Shared.Core;+using DevToys.Shared.Core.OOP;+using DevToys.Shared.Core.Threading;+using Newtonsoft.Json;+using Windows.ApplicationModel;++namespace DevToys.OutOfProcService.Core.OOP+{+ [Export(typeof(AppService))]+ [Shared]+ internal sealed class AppService+ {+ private const string PipeName = @"Sessions\{0}\AppContainerNamedObjects\{1}\{2}";++ private readonly TaskCompletionSource _appServiceConnectionClosedTask = new();+ private readonly IMefProvider _mefProvider;++ private NamedPipeClientStream? _pipeClientStream;++ [ImportingConstructor]+ public AppService(IMefProvider mefProvider)+ {+ _mefProvider = mefProvider;+ ConnectAsync().Forget();+ }++ internal void IndicateAppServiceConnectionLost()+ {+ Disconnect();+ _appServiceConnectionClosedTask.TrySetResult();+ }++ internal Task WaitAppServiceConnectionCloseAsync()+ {+ return _appServiceConnectionClosedTask.Task;+ }++ private void ThrowIfNotConnected()+ {+ if (_pipeClientStream is null || !_pipeClientStream.IsConnected)+ {+ throw new Exception("The app isn't connected to the app service.");+ }+ }++ private void Disconnect()+ {+ _pipeClientStream?.Dispose();+ _pipeClientStream = null;+ }++ private async Task ConnectAsync()+ {+ try+ {+ if (_pipeClientStream is not null && _pipeClientStream.IsConnected)+ {+ return;+ }++ await TaskScheduler.Default;++ Disconnect();++ string packageSid = GetPackageSid();++ _pipeClientStream+ = new NamedPipeClientStream(+ serverName: ".",+ pipeName: string.Format(PipeName, Process.GetCurrentProcess().SessionId, packageSid, Shared.Constants.AppServiceName),+ PipeDirection.InOut,+ PipeOptions.Asynchronous);++ using var cancellationTokenSource = new CancellationTokenSource();+ cancellationTokenSource.CancelAfter(Shared.Constants.AppServiceTimeout);++ // Connect to the UWP process+ await _pipeClientStream.ConnectAsync(cancellationTokenSource.Token);+ _pipeClientStream.ReadMode = PipeTransmissionMode.Message;++ if (_pipeClientStream.IsConnected)+ {+ // Let's start reading messages.+ QueueReadMessage();+ }++ if (!_pipeClientStream.IsConnected)+ {+ IndicateAppServiceConnectionLost();+ }+ }+ catch (Exception)+ {+ // TODO: Log this.+ }+ }++ private void QueueReadMessage(StringBuilder? partialMessage = null)+ {+ ThrowIfNotConnected();++ var lowLevelMessage = new LowLevelAppServiceMessage(_pipeClientStream!.InBufferSize, partialMessage);+ _pipeClientStream.BeginRead(lowLevelMessage.Buffer, 0, lowLevelMessage.Buffer.Length, ReadMessageCallback, lowLevelMessage);+ }++ private void ReadMessageCallback(IAsyncResult result)+ {+ ThrowIfNotConnected();++ int readLength = _pipeClientStream!.EndRead(result);+ if (readLength == 0)+ {+ return;+ }++ try+ {+ var lowLevelMessage = (LowLevelAppServiceMessage)result.AsyncState!;+ Assumes.NotNull(lowLevelMessage, nameof(lowLevelMessage));++ // Read the message+ lowLevelMessage.Message.Append(Encoding.UTF8.GetString(lowLevelMessage.Buffer, 0, readLength));++ if (!_pipeClientStream.IsMessageComplete)+ {+ // We're not done reading the message. Let's keep reading it.+ QueueReadMessage(lowLevelMessage.Message);+ return;+ }++ // We're done reading the message.++ // Let's treat the current received message.+ string jsonMessage = lowLevelMessage.Message.ToString().TrimEnd('\0');++ AppServiceMessageBase inputMessage+ = JsonConvert.DeserializeObject<AppServiceMessageBase>(+ jsonMessage,+ Shared.Constants.AppServiceJsonSerializerSettings)!;++ Assumes.NotNull(inputMessage, nameof(inputMessage));++ if (inputMessage.MessageId.HasValue)+ {+ ProcessMessageAsync(inputMessage).Forget();+ }+ else+ {+ // TODO (if needed).+ throw new InvalidOperationException();+ }++ // Let's queue reading the next message.+ QueueReadMessage();+ }+ catch (Exception)+ {+ // TODO: Log this+ }+ }++ private async Task ProcessMessageAsync(AppServiceMessageBase inputMessage)+ {+ ThrowIfNotConnected();+ IOutOfProcService? service = null;++ try+ {+ // Get the service that corresponds to the message.+ IEnumerable<Lazy<IOutOfProcService, OutOfProcServiceMetadata>> services+ = _mefProvider.ImportMany<Lazy<IOutOfProcService, OutOfProcServiceMetadata>>();+ service = services.Single(service => service.Metadata.InputType == inputMessage.GetType()).Value;+ service.ReportProgress += Service_ReportProgress;++ // Invoke the service.+ AppServiceMessageBase outputMessage = await service.ProcessMessageAsync(inputMessage);+ outputMessage.MessageId = inputMessage.MessageId;++ // Send the service result as a response to the UWP app.+ await SendMessageAsync(outputMessage);+ }+ catch (Exception)+ {+ // TODO: Log this.+ }+ finally+ {+ if (service is not null)+ {+ service.ReportProgress -= Service_ReportProgress;+ if (service is IDisposable disposableService)+ {+ disposableService.Dispose();+ }+ }+ }+ }++ private void Service_ReportProgress(object? sender, AppServiceProgressMessageEventArgs e)+ {+ Assumes.NotNull(e.Message.MessageId, nameof(e.Message.MessageId));+ SendMessageAsync(e.Message)+ .ContinueWith(t =>+ {+ e.MessageCompletedTask.TrySetResult();+ });+ }++ private async Task SendMessageAsync(AppServiceMessageBase inputMessage)+ {+ ThrowIfNotConnected();++ string jsonMessage = JsonConvert.SerializeObject(inputMessage, Shared.Constants.AppServiceJsonSerializerSettings);+ byte[] messageBuffer = Encoding.UTF8.GetBytes(jsonMessage);++ await _pipeClientStream!.WriteAsync(messageBuffer, 0, messageBuffer.Length);+ await _pipeClientStream.FlushAsync();+ _pipeClientStream.WaitForPipeDrain();+ }++ private static string GetPackageSid()+ {+ IntPtr sid = IntPtr.Zero;+ try+ {+ if (NativeMethods.DeriveAppContainerSidFromAppContainerName(Package.Current.Id.Name, out sid) == 0)+ {+ string sidString = new SecurityIdentifier(sid).Value;+ sidString = string.Join("-", sidString.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries).Take(11));+ return sidString;+ }+ }+ finally+ {+ if (sid != IntPtr.Zero)+ {+ NativeMethods.FreeSid(sid);+ }+ }++ throw new Exception("Unable to retrieve the package security identifier.");+ }+ }+}diff --git a/src/dev/impl/DevToys.OutOfProcService/DevToys.OutOfProcService.csproj b/src/dev/impl/DevToys.OutOfProcService/DevToys.OutOfProcService.csprojnew file mode 100644index 000000000..807d2f4bd--- /dev/null+++ b/src/dev/impl/DevToys.OutOfProcService/DevToys.OutOfProcService.csproj@@ -0,0 +1,35 @@+<Project Sdk="Microsoft.NET.Sdk">++ <PropertyGroup>+ <OutputType>WinExe</OutputType>+ <TargetFramework>net6.0-windows$(Windows10MinSDKVersion)</TargetFramework>++ <Platforms>x86;x64;arm64</Platforms>+ <RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>+ </PropertyGroup>++ <PropertyGroup Condition="'$(Platform)' == 'arm64'">+ <PlatformTarget>arm64</PlatformTarget>+ </PropertyGroup>++ <ItemGroup>+ <PackageReference Include="Microsoft.Windows.CsWinRT" Version="$(NuGet_MicrosoftWindowsCsWinRT)" />+ <PackageReference Include="Newtonsoft.Json" Version="$(NuGet_NewtonsoftJson)" />+ </ItemGroup>++ <ItemGroup>+ <Compile Include="..\..\shared\SharedAssemblyInfo.cs" Link="Properties\SharedAssemblyInfo.cs" />+ </ItemGroup>++ <ItemGroup>+ <ProjectReference Include="..\..\shared\DevToys.Shared\DevToys.Shared.csproj" />+ </ItemGroup>++ <ItemGroup>+ <Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />+ </ItemGroup>++ <PropertyGroup>+ <CsWinRTWindowsMetadata>sdk</CsWinRTWindowsMetadata>+ </PropertyGroup>+</Project>diff --git a/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/OutOfProcServiceBase.cs b/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/OutOfProcServiceBase.csnew file mode 100644index 000000000..056bffbd6--- /dev/null+++ b/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/OutOfProcServiceBase.cs@@ -0,0 +1,45 @@+using System;+using System.Threading;+using System.Threading.Tasks;+using DevToys.OutOfProcService.API.Core.OOP;+using DevToys.Shared.Core;+using DevToys.Shared.Core.OOP;+using DevToys.Shared.Core.Threading;++namespace DevToys.OutOfProcService.OutOfProcServices+{+ internal abstract class OutOfProcServiceBase<TInput, TOutput> : IOutOfProcService+ where TInput : AppServiceMessageBase+ where TOutput : AppServiceMessageBase+ {+ private readonly DisposableSempahore _sempahore = new();+ private Guid? _messageId;+ private bool _messageIsProcessing;++ public event EventHandler<AppServiceProgressMessageEventArgs>? ReportProgress;++ public async Task<AppServiceMessageBase> ProcessMessageAsync(AppServiceMessageBase inputMessage)+ {+ _messageIsProcessing = true;+ _messageId = inputMessage.MessageId;+ TOutput result = await ProcessMessageAsync((TInput)inputMessage);+ _messageIsProcessing = false;+ return result;+ }++ protected abstract Task<TOutput> ProcessMessageAsync(TInput inputMessage);++ protected async Task ReportProgressAsync(int progressPercentage, string? message = null)+ {+ await TaskScheduler.Default;++ using (await _sempahore.WaitAsync(CancellationToken.None))+ {+ Assumes.IsTrue(_messageIsProcessing, nameof(_messageIsProcessing));+ var eventArgs = new AppServiceProgressMessageEventArgs(_messageId!.Value, progressPercentage, message);+ ReportProgress?.Invoke(this, eventArgs);+ await eventArgs.MessageCompletedTask.Task;+ }+ }+ }+}diff --git a/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/ShutdownService.cs b/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/ShutdownService.csnew file mode 100644index 000000000..578337635--- /dev/null+++ b/src/dev/impl/DevToys.OutOfProcService/OutOfProcServices/ShutdownService.cs@@ -0,0 +1,26 @@+using System.Composition;+using System.Threading.Tasks;+using DevToys.OutOfProcService.API.Core.OOP;+using DevToys.OutOfProcService.Core.OOP;++namespace DevToys.OutOfProcService.OutOfProcServices+{+ [Export(typeof(IOutOfProcService))]+ [InputType(typeof(ShutdownMessage))]+ internal sealed class ShutdownService : OutOfProcServiceBase<ShutdownMessage, ShutdownMessage>+ {+ private readonly AppService _appService;++ [ImportingConstructor]+ public ShutdownService(AppService appService)+ {+ _appService = appService;+ }++ protected override Task<ShutdownMessage> ProcessMessageAsync(ShutdownMessage inputMessage)+ {+ _appService.IndicateAppServiceConnectionLost();+ return Task.FromResult(inputMessage);+ }+ }+}diff --git a/src/dev/impl/DevToys.OutOfProcService/Program.cs b/src/dev/impl/DevToys.OutOfProcService/Program.csnew file mode 100644index 000000000..1cbffe60a--- /dev/null+++ b/src/dev/impl/DevToys.OutOfProcService/Program.cs@@ -0,0 +1,25 @@+using System.Threading.Tasks;+using DevToys.OutOfProcService.Core.OOP;+using DevToys.Shared.Api.Core;+using DevToys.Shared.Core;++namespace DevToys.OutOfProcService+{+ internal sealed class Program+ {+ private static MefComposer? _mefComposer;+ private static IMefProvider? _mefProvider;++ public static async Task Main(string[] args)+ {+ _mefComposer+ = new MefComposer(+ typeof(Program).Assembly,+ typeof(Shared.Constants).Assembly);++ _mefProvider = _mefComposer.ExportProvider.GetExport<IMefProvider>();++ await _mefProvider.Import<AppService>().WaitAppServiceConnectionCloseAsync();+ }+ }+}diff --git a/src/dev/impl/DevToys.OutOfProcService/Properties/AssemblyInfo.cs b/src/dev/impl/DevToys.OutOfProcService/Properties/AssemblyInfo.csnew file mode 100644index 000000000..ced135d29--- /dev/null+++ b/src/dev/impl/DevToys.OutOfProcService/Properties/AssemblyInfo.cs@@ -0,0 +1,6 @@+using System.Reflection;+using System.Runtime.Versioning;++[assembly: AssemblyTitle("DevToys.OutOfProcService")]++[assembly: SupportedOSPlatform("windows10.0.18362.0")]diff --git a/src/dev/impl/DevToys/Api/Core/InAppNotificationAddedEventArgs.cs b/src/dev/impl/DevToys/Api/Core/InAppNotificationAddedEventArgs.csindex 1081feb63..e218589d4 100644--- a/src/dev/impl/DevToys/Api/Core/InAppNotificationAddedEventArgs.cs+++ b/src/dev/impl/DevToys/Api/Core/InAppNotificationAddedEventArgs.cs@@ -1,7 +1,7 @@#nullable enableusing System;-using DevToys.Core;+using DevToys.Shared.Core;namespace DevToys.Api.Core{diff --git a/src/dev/impl/DevToys/Api/Core/Navigation/NavigationParameter.cs b/src/dev/impl/DevToys/Api/Core/Navigation/NavigationParameter.csindex 929a1d89b..b694c1f87 100644--- a/src/dev/impl/DevToys/Api/Core/Navigation/NavigationParameter.cs+++ b/src/dev/impl/DevToys/Api/Core/Navigation/NavigationParameter.cs@@ -1,8 +1,8 @@#nullable enableusing System.ComponentModel;-using DevToys.Api.Core.Injection;-using DevToys.Core;+using DevToys.Shared.Api.Core;+using DevToys.Shared.Core;namespace DevToys.Api.Core.Navigation{diff --git a/src/dev/impl/DevToys/Api/Core/OOP/IAppService.cs b/src/dev/impl/DevToys/Api/Core/OOP/IAppService.csnew file mode 100644index 000000000..19dfb71b0--- /dev/null+++ b/src/dev/impl/DevToys/Api/Core/OOP/IAppService.cs@@ -0,0 +1,16 @@+using System;+using System.Threading.Tasks;+using DevToys.Shared.Core.OOP;++namespace DevToys.Api.Core.OOP+{+ /// <summary>+ /// Provides a service to interact with the Win32 process (DevToys.OutOfProcService.exe).+ /// </summary>+ public interface IAppService+ {+ Task<T> SendMessageAndGetResponseAsync<T>(AppServiceMessageBase message) where T : AppServiceMessageBase;++ Task<T> SendMessageAndGetResponseAsync<T>(AppServiceMessageBase message, IProgress<AppServiceProgressMessage> progress) where T : AppServiceMessageBase;+ }+}diff --git a/src/dev/impl/DevToys/Api/Tools/MatchedToolProvider.cs b/src/dev/impl/DevToys/Api/Tools/MatchedToolProvider.csindex ef7f4cd78..34de2e9e6 100644--- a/src/dev/impl/DevToys/Api/Tools/MatchedToolProvider.cs+++ b/src/dev/impl/DevToys/Api/Tools/MatchedToolProvider.cs@@ -2,7 +2,7 @@using System;using System.ComponentModel;-using DevToys.Core;+using DevToys.Shared.Core;namespace DevToys.Api.Tools{diff --git a/src/dev/impl/DevToys/App.xaml.cs b/src/dev/impl/DevToys/App.xaml.csindex d05604d91..43385a0e2 100644--- a/src/dev/impl/DevToys/App.xaml.cs+++ b/src/dev/impl/DevToys/App.xaml.cs@@ -4,13 +4,15 @@ using System;using System.Linq;using System.Threading.Tasks;using DevToys.Api.Core;-using DevToys.Api.Core.Injection;using DevToys.Api.Core.Navigation;using DevToys.Api.Core.Settings;using DevToys.Api.Core.Theme;using DevToys.Core;using DevToys.Core.Settings;using DevToys.Core.Threading;+using DevToys.Shared.Api.Core;+using DevToys.Shared.Core;+using DevToys.Shared.Core.Threading;using DevToys.Views;using Microsoft.Graphics.Canvas.Text;using Windows.ApplicationModel;@@ -51,7 +53,8 @@ namespace DevToys= Task.Run(() =>{return new MefComposer(- typeof(MefComposer).Assembly);+ typeof(App).Assembly,+ typeof(Shared.Constants).Assembly);});UnhandledException += OnUnhandledException;diff --git a/src/dev/impl/DevToys/Core/AssetsHelper.cs b/src/dev/impl/DevToys/Core/AssetsHelper.csindex 889d3ac8c..af93fbd20 100644--- a/src/dev/impl/DevToys/Core/AssetsHelper.cs+++ b/src/dev/impl/DevToys/Core/AssetsHelper.cs@@ -4,7 +4,7 @@ using System;using System.IO;using System.Text;using System.Threading.Tasks;-using DevToys.Core.Threading;+using DevToys.Shared.Core.Threading;using Windows.Storage;namespace DevToys.Corediff --git a/src/dev/impl/DevToys/Core/Logger.cs b/src/dev/impl/DevToys/Core/Logger.csindex 44ac9ffc3..2b0a4b690 100644--- a/src/dev/impl/DevToys/Core/Logger.cs+++ b/src/dev/impl/DevToys/Core/Logger.cs@@ -6,6 +6,7 @@ using System.Globalization;using System.Threading;using System.Threading.Tasks;using DevToys.Core.Threading;+using DevToys.Shared.Core.Threading;using Windows.Storage;using Windows.System;diff --git a/src/dev/impl/DevToys/Core/MarketingService.cs b/src/dev/impl/DevToys/Core/MarketingService.csindex da105d9f4..0e4e51999 100644--- a/src/dev/impl/DevToys/Core/MarketingService.cs+++ b/src/dev/impl/DevToys/Core/MarketingService.cs@@ -7,6 +7,7 @@ using System.Threading.Tasks;using DevToys.Api.Core;using DevToys.Core.Threading;using DevToys.Models;+using DevToys.Shared.Core.Threading;using Newtonsoft.Json;using Windows.Services.Store;using Windows.Storage;@@ -99,6 +100,12 @@ namespace DevToys.Core{_rateOfferInProgress = true;+ UpdateMarketingStateAsync(state =>+ {+ state.AppRatingOfferCount++;+ state.LastAppRatingOfferDate = DateTime.Now;+ }).ForgetSafely();+_notificationService.ShowInAppNotification(LanguageManager.Instance.MainPage.NotificationRateAppTitle,LanguageManager.Instance.MainPage.NotificationRateAppActionableActionText,@@ -113,12 +120,6 @@ namespace DevToys.Coreprivate async Task RateAsync(){- await UpdateMarketingStateAsync(state =>- {- state.AppRatingOfferCount++;- state.LastAppRatingOfferDate = DateTime.Now;- });-var storeContext = StoreContext.GetDefault();StoreRateAndReviewResult result = await ThreadHelper.RunOnUIThreadAsync(async () =>diff --git a/src/dev/impl/DevToys/Core/Navigation/WindowManager.cs b/src/dev/impl/DevToys/Core/Navigation/WindowManager.csindex dbeaec091..4b432f895 100644--- a/src/dev/impl/DevToys/Core/Navigation/WindowManager.cs+++ b/src/dev/impl/DevToys/Core/Navigation/WindowManager.cs@@ -5,6 +5,7 @@ using System.Composition;using System.Threading.Tasks;using DevToys.Api.Core.Navigation;using DevToys.Core.Threading;+using DevToys.Shared.Core;using Windows.ApplicationModel;using Windows.UI.Xaml.Controls;diff --git a/src/dev/impl/DevToys/Core/OOP/AppService.cs b/src/dev/impl/DevToys/Core/OOP/AppService.csnew file mode 100644index 000000000..83a012ba3--- /dev/null+++ b/src/dev/impl/DevToys/Core/OOP/AppService.cs@@ -0,0 +1,277 @@+#nullable enable++using System;+using System.Collections.Concurrent;+using System.Composition;+using System.IO.Pipes;+using System.Text;+using System.Threading;+using System.Threading.Tasks;+using DevToys.Api.Core.OOP;+using DevToys.OutOfProcService.OutOfProcServices;+using DevToys.Shared.Core;+using DevToys.Shared.Core.OOP;+using DevToys.Shared.Core.Threading;+using Newtonsoft.Json;+using Windows.ApplicationModel;+using Windows.Foundation.Metadata;++namespace DevToys.Core.OOP+{+ [Export(typeof(IAppService))]+ [Shared]+ internal sealed class AppService : IAppService+ {+ private const string FullTrustAppContractName = "Windows.ApplicationModel.FullTrustAppContract";+ private const string PipeName = "LOCAL\\{0}";++ private readonly ConcurrentDictionary<Guid, TaskCompletionSource<AppServiceMessageBase>> _inProgressMessages = new();+ private readonly ConcurrentDictionary<Guid, IProgress<AppServiceProgressMessage>> _progressReporters = new();+ private NamedPipeServerStream? _pipeServerStream;++ [ImportingConstructor]+ public AppService()+ {+ App.Current.Suspending += OnAppSuspending;+ }++ public Task<T> SendMessageAndGetResponseAsync<T>(AppServiceMessageBase message) where T : AppServiceMessageBase+ {+ return SendMessageAndGetResponseAsync<T>(message, DummyProgress.DefaultInstance);+ }++ public async Task<T> SendMessageAndGetResponseAsync<T>(AppServiceMessageBase message, IProgress<AppServiceProgressMessage> progress) where T : AppServiceMessageBase+ {+ Arguments.NotNull(progress, nameof(progress));++ AppServiceMessageBase? result = await SendMessageAsync(message, progress);+ if (result is null)+ {+ throw new Exception("Unable to send a message to the app service.");+ }++ return (T)result;+ }++ private async void OnAppSuspending(object sender, SuspendingEventArgs e)+ {+ SuspendingDeferral? deferral = e.SuspendingOperation.GetDeferral();++ // Shut down the Win32 app.+ await SendMessageAndGetResponseAsync<ShutdownMessage>(new ShutdownMessage());++ Disconnect();++ deferral.Complete();+ }++ private async Task<AppServiceMessageBase?> SendMessageAsync(AppServiceMessageBase message, IProgress<AppServiceProgressMessage> progress)+ {+ Arguments.NotNull(message, nameof(message));+ Arguments.NotNull(progress, nameof(progress));++ try+ {+ await TaskScheduler.Default;++ // Make sure we're connected to the app service.+ await ConnectAsync();+ ThrowIfNotConnected();++ // Give a unique ID to the message.+ message.MessageId = Guid.NewGuid();++ // start tracking the message.+ var messageCompletionSource = new TaskCompletionSource<AppServiceMessageBase>();+ _inProgressMessages.TryAdd(message.MessageId.Value, messageCompletionSource);+ _progressReporters.TryAdd(message.MessageId.Value, progress);++ // Send the message.+ string jsonMessage = JsonConvert.SerializeObject(message, Shared.Constants.AppServiceJsonSerializerSettings);+ byte[] messageBuffer = Encoding.UTF8.GetBytes(jsonMessage);++ _pipeServerStream!.Write(messageBuffer, 0, messageBuffer.Length);+ _pipeServerStream.Flush();+ _pipeServerStream.WaitForPipeDrain();++ // Wait for the answer of the app service.+ AppServiceMessageBase result = await messageCompletionSource.Task;+ _progressReporters.TryRemove(message.MessageId.Value, out _);+ return result;+ }+ catch (Exception ex)+ {+ Logger.LogFault(nameof(AppService), ex, "Unable to send a message to the app service.");+ }++ return null;+ }++ internal void Disconnect()+ {+ foreach (TaskCompletionSource<AppServiceMessageBase>? messageCompletionSource in _inProgressMessages.Values)+ {+ messageCompletionSource.TrySetCanceled();+ }+ _pipeServerStream?.Dispose();+ _pipeServerStream = null;+ _inProgressMessages.Clear();+ _progressReporters.Clear();+ }++ private async Task<bool> ConnectAsync()+ {+ try+ {+ if (_pipeServerStream is not null && _pipeServerStream.IsConnected)+ {+ return true;+ }++ await TaskScheduler.Default;++ Disconnect();++ if (!ApiInformation.IsApiContractPresent(FullTrustAppContractName, 1, 0))+ {+ throw new Exception("API Contract for full trust app isn't found.");+ }++ // Launch DevToys.OutOfProcService.exe+ await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();++ _pipeServerStream+ = new NamedPipeServerStream(+ string.Format(PipeName, Shared.Constants.AppServiceName),+ PipeDirection.InOut,+ NamedPipeServerStream.MaxAllowedServerInstances,+ PipeTransmissionMode.Message,+ PipeOptions.Asynchronous,+ inBufferSize: Shared.Constants.AppServiceBufferSize,+ outBufferSize: Shared.Constants.AppServiceBufferSize);++ using var cancellationTokenSource = new CancellationTokenSource();+ cancellationTokenSource.CancelAfter(Shared.Constants.AppServiceTimeout);++ // Connect to the process+ await _pipeServerStream.WaitForConnectionAsync(cancellationTokenSource.Token);++ if (_pipeServerStream.IsConnected)+ {+ // Let's start reading messages.+ QueueReadMessage();+ }++ return _pipeServerStream.IsConnected;+ }+ catch (Exception ex)+ {+ Logger.LogFault(nameof(AppService), ex, "Unable to connect to the app service.");+ }++ return false;+ }++ private void ThrowIfNotConnected()+ {+ if (_pipeServerStream is null || !_pipeServerStream.IsConnected)+ {+ throw new Exception("The app isn't connected to the app service.");+ }+ }++ private void QueueReadMessage(StringBuilder? partialMessage = null)+ {+ ThrowIfNotConnected();++ var lowLevelMessage = new LowLevelAppServiceMessage(_pipeServerStream!.InBufferSize, partialMessage);+ _pipeServerStream.BeginRead(lowLevelMessage.Buffer, 0, lowLevelMessage.Buffer.Length, ReadMessageCallback, lowLevelMessage);+ }++ private void ReadMessageCallback(IAsyncResult result)+ {+ if (_pipeServerStream is null || !_pipeServerStream.IsConnected)+ {+ // We're disconnected.+ return;+ }++ int readLength = _pipeServerStream!.EndRead(result);+ if (readLength == 0)+ {+ // There's nothing to read.+ return;+ }++ try+ {+ var lowLevelMessage = (LowLevelAppServiceMessage)result.AsyncState!;+ Assumes.NotNull(lowLevelMessage, nameof(lowLevelMessage));++ // Read the message+ lowLevelMessage.Message.Append(Encoding.UTF8.GetString(lowLevelMessage.Buffer, 0, readLength));++ if (!_pipeServerStream.IsMessageComplete)+ {+ // We're not done reading the message. Let's keep reading it.+ QueueReadMessage(lowLevelMessage.Message);+ return;+ }++ // We're done reading the message.++ // Let's treat the current received message.+ string jsonMessage = lowLevelMessage.Message.ToString().TrimEnd('\0');++ AppServiceMessageBase messageBase+ = JsonConvert.DeserializeObject<AppServiceMessageBase>(+ jsonMessage,+ Shared.Constants.AppServiceJsonSerializerSettings)!;++ Assumes.NotNull(messageBase, nameof(messageBase));++ if (messageBase.MessageId.HasValue)+ {+ if (messageBase is AppServiceProgressMessage progressMessage)+ {+ // The message is here to indicate report a progression of a message previously sent through SendMessageAsync.+ if (_progressReporters.TryGetValue(messageBase.MessageId.Value, out IProgress<AppServiceProgressMessage> progress))+ {+ progress.Report(progressMessage);+ }+ }+ else+ {+ // This message is the reponse to a message we previously sent through SendMessageAsync.+ // Let's unblock the TaskCompletionSource of the SendMessageAsync that sent the initial message.+ if (_inProgressMessages.TryRemove(messageBase.MessageId.Value, out TaskCompletionSource<AppServiceMessageBase> messageCompletionSource))+ {+ messageCompletionSource.TrySetResult(messageBase);+ }+ }+ }+ else+ {+ // TODO (if needed).+ throw new InvalidOperationException();+ }++ // Let's queue reading the next message.+ QueueReadMessage();+ }+ catch (Exception ex)+ {+ Logger.LogFault(nameof(AppService), ex, "Unable to read a message from the app service.");+ }+ }++ private class DummyProgress : IProgress<AppServiceProgressMessage>+ {+ internal static readonly DummyProgress DefaultInstance = new();++ public void Report(AppServiceProgressMessage value)+ {+ }+ }+ }+}diff --git a/src/dev/impl/DevToys/Core/Settings/SettingsProvider.cs b/src/dev/impl/DevToys/Core/Settings/SettingsProvider.csindex 1d1cc52f3..4ccc959fd 100644--- a/src/dev/impl/DevToys/Core/Settings/SettingsProvider.cs+++ b/src/dev/impl/DevToys/Core/Settings/SettingsProvider.cs@@ -39,7 +39,7 @@ namespace DevToys.Core.Settings}else if (typeof(IList).IsAssignableFrom(typeof(T))){- return JsonConvert.DeserializeObject<T>(applicationDataContainer.Values[settingDefinition.Name]?.ToString() ?? string.Empty);+ return JsonConvert.DeserializeObject<T>(applicationDataContainer.Values[settingDefinition.Name]?.ToString() ?? string.Empty)!;}return (T)Convert.ChangeType(applicationDataContainer.Values[settingDefinition.Name], typeof(T), CultureInfo.InvariantCulture);diff --git a/src/dev/impl/DevToys/Core/Theme/ThemeListener.cs b/src/dev/impl/DevToys/Core/Theme/ThemeListener.csindex bcf6b8b46..51784c80d 100644--- a/src/dev/impl/DevToys/Core/Theme/ThemeListener.cs+++ b/src/dev/impl/DevToys/Core/Theme/ThemeListener.cs@@ -8,6 +8,7 @@ using DevToys.Core.Settings;using DevToys.Core.Threading;using Windows.UI.ViewManagement;using Windows.UI.Xaml;+using DevToys.Shared.Core.Threading;namespace DevToys.Core.Theme{@@ -128,4 +129,4 @@ namespace DevToys.Core.ThemeThemeChanged?.Invoke(this, EventArgs.Empty);}}-}\ No newline at end of file+}diff --git a/src/dev/impl/DevToys/Core/Threading/TaskCompletionNotifier.cs b/src/dev/impl/DevToys/Core/Threading/TaskCompletionNotifier.csindex e31a8834d..6ca7ca48e 100644--- a/src/dev/impl/DevToys/Core/Threading/TaskCompletionNotifier.cs+++ b/src/dev/impl/DevToys/Core/Threading/TaskCompletionNotifier.cs@@ -3,6 +3,7 @@using System.ComponentModel;using System.Threading;using System.Threading.Tasks;+using DevToys.Shared.Core.Threading;namespace DevToys.Core.Threading{diff --git a/src/dev/impl/DevToys/Core/Threading/ThreadHelper.cs b/src/dev/impl/DevToys/Core/Threading/ThreadHelper.csindex 67dcce977..74d8eab32 100644--- a/src/dev/impl/DevToys/Core/Threading/ThreadHelper.cs+++ b/src/dev/impl/DevToys/Core/Threading/ThreadHelper.cs@@ -4,6 +4,8 @@ using System;using System.Threading.Tasks;using Windows.ApplicationModel.Core;using Windows.UI.Core;+using DevToys.Shared.Core.Threading;+using DevToys.Shared.Core;namespace DevToys.Core.Threading{diff --git a/src/dev/impl/DevToys/Core/TitleBar.cs b/src/dev/impl/DevToys/Core/TitleBar.csindex e17a174f7..6d8b9084b 100644--- a/src/dev/impl/DevToys/Core/TitleBar.cs+++ b/src/dev/impl/DevToys/Core/TitleBar.cs@@ -8,6 +8,7 @@ using DevToys.Api.Core.Settings;using DevToys.Api.Core.Theme;using DevToys.Core.Settings;using DevToys.Core.Threading;+using DevToys.Shared.Core;using Windows.ApplicationModel.Core;using Windows.UI;using Windows.UI.Core;diff --git a/src/dev/impl/DevToys/DevToys.csproj b/src/dev/impl/DevToys/DevToys.csprojindex 95a94de26..76d399490 100644--- a/src/dev/impl/DevToys/DevToys.csproj+++ b/src/dev/impl/DevToys/DevToys.csproj@@ -21,6 +21,9 @@<Compile Include="..\..\shared\SharedAssemblyInfo.cs"><Link>Properties\SharedAssemblyInfo.cs</Link></Compile>+ <Compile Include="Api\Core\OOP\IAppService.cs" />+ <Compile Include="Core\OOP\AppService.cs" />+ <Compile Include="Core\Threading\AsyncLazy.cs" /><Compile Include="ViewModels\Tools\HtmlEncoderDecoder\HtmlEncoderDecoderToolProvider.cs" /><Compile Include="ViewModels\Tools\HtmlEncoderDecoder\HtmlEncoderDecoderToolViewModel.cs" /><Compile Include="Views\Tools\HtmlEncoderDecoder\HtmlEncoderDecoderToolPage.xaml.cs">@@ -160,7 +163,6 @@<Content Include="Properties\Default.rd.rd.xml" /><Compile Include="Api\Core\IClipboard.cs" /><Compile Include="Api\Core\IMarketingService.cs" />- <Compile Include="Api\Core\IMefProvider.cs" /><Compile Include="Api\Core\InAppNotificationAddedEventArgs.cs" /><Compile Include="Api\Core\ITitleBar.cs" /><Compile Include="Api\Core\IUriActivationProtocolService.cs" />@@ -185,25 +187,17 @@<Compile Include="Api\Tools\ProtocolNameAttribute.cs" /><Compile Include="Api\Tools\ToolProviderMetadata.cs" /><Compile Include="Core\AssetsHelper.cs" />- <Compile Include="Core\Arguments.cs" />- <Compile Include="Core\Assumes.cs" /><Compile Include="Core\Clipboard.cs" /><Compile Include="Core\Collections\OrderedObservableCollection.cs" /><Compile Include="Core\Constants.cs" /><Compile Include="Core\Logger.cs" /><Compile Include="Core\MarketingService.cs" />- <Compile Include="Core\MefComposer.cs" />- <Compile Include="Core\MefProvider.cs" /><Compile Include="Core\Navigation\WindowManager.cs" /><Compile Include="Core\NotificationService.cs" /><Compile Include="Core\Settings\PredefinedSettings.cs" /><Compile Include="Core\Settings\SettingsProvider.cs" /><Compile Include="Core\Theme\ThemeListener.cs" />- <Compile Include="Core\Threading\AsyncLazy.cs" />- <Compile Include="Core\Threading\DisposableSempahore.cs" /><Compile Include="Core\Threading\TaskCompletionNotifier.cs" />- <Compile Include="Core\Threading\TaskExtension.cs" />- <Compile Include="Core\Threading\TaskSchedulerAwaiter.cs" /><Compile Include="Core\Threading\ThreadHelper.cs" /><Compile Include="Core\Threading\ThreadPriority.cs" /><Compile Include="Core\TitleBar.cs" />@@ -349,8 +343,7 @@<Generator>MSBuild:Compile</Generator><SubType>Designer</SubType></ApplicationDefinition>- <AppxManifest Include="..\..\shared\Package.appxmanifest">- <Link>Package.appxmanifest</Link>+ <AppxManifest Include="Package.appxmanifest"><SubType>Designer</SubType></AppxManifest><Page Include="Themes\Custom.xaml">@@ -452,7 +445,7 @@<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls" Version="$(Nuget_MicrosoftToolkitUwpUIControls)" /><PackageReference Include="Microsoft.UI.Xaml" Version="$(NuGet_MicrosoftUIXaml)" /><PackageReference Include="Newtonsoft.Json" Version="$(NuGet_NewtonsoftJson)" />- <PackageReference Include="System.Composition" Version="$(NuGet_SystemComposition)" />+ <PackageReference Include="System.Composition" Version="$(NuGet_DotNet)" /><PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="$(NuGet_IdentityModelTokenJwt)" /><PackageReference Include="YamlDotNet" Version="$(NuGet_YamlDotNet)" /><PackageReference Include="Win2D.uwp" Version="$(Nuget_Win2D)" />@@ -461,12 +454,20 @@<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" /></ItemGroup><ItemGroup>+ <ProjectReference Include="..\..\shared\DevToys.Shared\DevToys.Shared.csproj">+ <Project>{ccbcaefe-b245-413a-9c37-a21ce99eecb9}</Project>+ <Name>DevToys.Shared</Name>+ </ProjectReference><ProjectReference Include="..\DevToys.MonacoEditor\DevToys.MonacoEditor.csproj"><Project>{0fe678bb-9f9b-4495-b777-f9b1e11da20c}</Project><Name>DevToys.MonacoEditor</Name></ProjectReference></ItemGroup>- <ItemGroup />+ <ItemGroup>+ <SDKReference Include="WindowsDesktop, Version=10.0.19041.0">+ <Name>Windows Desktop Extensions for the UWP</Name>+ </SDKReference>+ </ItemGroup><Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" /><!-- To modify your build process, add your task inside one of the targets below and uncomment it.Other similar extension points exist, see Microsoft.Common.targets.diff --git a/src/dev/impl/DevToys/Messages/NavigateToToolMessage.cs b/src/dev/impl/DevToys/Messages/NavigateToToolMessage.csindex 519f75808..4afedc922 100644--- a/src/dev/impl/DevToys/Messages/NavigateToToolMessage.cs+++ b/src/dev/impl/DevToys/Messages/NavigateToToolMessage.cs@@ -1,7 +1,7 @@#nullable enableusing DevToys.Api.Tools;-using DevToys.Core;+using DevToys.Shared.Core;namespace DevToys.Messages{diff --git a/src/dev/impl/DevToys/Models/MatchedToolProviderViewData.cs b/src/dev/impl/DevToys/Models/MatchedToolProviderViewData.csindex 293f33404..412957100 100644--- a/src/dev/impl/DevToys/Models/MatchedToolProviderViewData.cs+++ b/src/dev/impl/DevToys/Models/MatchedToolProviderViewData.cs@@ -3,6 +3,7 @@using System.Threading.Tasks;using DevToys.Api.Tools;using DevToys.Core.Threading;+using DevToys.Shared.Core.Threading;using Windows.UI.Xaml.Controls;namespace DevToys.Modelsdiff --git a/src/dev/impl/DevToys/Package.appxmanifest b/src/dev/impl/DevToys/Package.appxmanifestnew file mode 100644index 000000000..6975c00c1--- /dev/null+++ b/src/dev/impl/DevToys/Package.appxmanifest@@ -0,0 +1,45 @@+<?xml version="1.0" encoding="utf-8"?>++<Package+ xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"+ xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"+ xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"+ xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"+ IgnorableNamespaces="uap uap5 mp">++ <!-- Please DO NOT commit changes on the version number below unless you're about to release a new version of the app on the Store. -->+ <Identity+ Name="f668c062-a3c9-41d6-a9f7-c06fad5f1049"+ Publisher="CN=etiennebaudoux"+ Version="0.0.0.0" />++ <mp:PhoneIdentity PhoneProductId="f668c062-a3c9-41d6-a9f7-c06fad5f1049" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>++ <Properties>+ <DisplayName>DevToys</DisplayName>+ <PublisherDisplayName>etiennebaudoux</PublisherDisplayName>+ <Logo>Assets\Logo\StoreLogo.png</Logo>+ </Properties>++ <Dependencies>+ <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />+ </Dependencies>++ <Resources>+ <Resource Language="x-generate"/>+ </Resources>++ <Applications>+ <Application Id="App"+ Executable="$targetnametoken$.exe"+ EntryPoint="DevToys.App">+ <uap:VisualElements+ DisplayName="DevToys"+ Description="A Swiss Army knife for developers."+ BackgroundColor="transparent"+ Square150x150Logo="Assets\Logo\Square150x150Logo.png"+ Square44x44Logo="Assets\Logo\Square44x44Logo.png">+ </uap:VisualElements>+ </Application>+ </Applications>+</Package>\ No newline at end of filediff --git a/src/dev/impl/DevToys/UI/Controls/CodeEditor.xaml.cs b/src/dev/impl/DevToys/UI/Controls/CodeEditor.xaml.csindex 7e2518047..cd85ee48a 100644--- a/src/dev/impl/DevToys/UI/Controls/CodeEditor.xaml.cs+++ b/src/dev/impl/DevToys/UI/Controls/CodeEditor.xaml.cs@@ -164,7 +164,7 @@ namespace DevToys.UI.Controls{InitializeComponent();- CodeEditorCore.Loading += CodeEditorCore_Loading;+ CodeEditorCore.EditorLoading += CodeEditorCore_Loading;CodeEditorCore.InternalException += CodeEditorCore_InternalException;UpdateUI();@@ -182,7 +182,7 @@ namespace DevToys.UI.Controlsprivate void CodeEditorCore_Loading(object sender, RoutedEventArgs e){- CodeEditorCore.Loading -= CodeEditorCore_Loading;+ CodeEditorCore.EditorLoading -= CodeEditorCore_Loading;CodeEditorCore.HasGlyphMargin = false;CodeEditorCore.Options.GlyphMargin = false;diff --git a/src/dev/impl/DevToys/ViewModels/MainPageViewModel.cs b/src/dev/impl/DevToys/ViewModels/MainPageViewModel.csindex d5da6ff94..b4fd42454 100644--- a/src/dev/impl/DevToys/ViewModels/MainPageViewModel.cs+++ b/src/dev/impl/DevToys/ViewModels/MainPageViewModel.cs@@ -19,6 +19,8 @@ using DevToys.Core.Settings;using DevToys.Core.Threading;using DevToys.Messages;using DevToys.Models;+using DevToys.Shared.Core;+using DevToys.Shared.Core.Threading;using Microsoft.Toolkit.Mvvm.ComponentModel;using Microsoft.Toolkit.Mvvm.Input;using Microsoft.Toolkit.Mvvm.Messaging;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolProvider.csindex cc5b65ee0..649229711 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolProvider.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolProvider.cs@@ -4,7 +4,7 @@ using System;using System.Composition;using System.Text;using System.Text.RegularExpressions;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;using DevToys.Api.Tools;namespace DevToys.ViewModels.Tools.Base64EncoderDecoderdiff --git a/src/dev/impl/DevToys/ViewModels/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolViewModel.csindex fee8eec21..f00abbc8b 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolViewModel.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolViewModel.cs@@ -10,6 +10,7 @@ using DevToys.Api.Core.Settings;using DevToys.Api.Tools;using DevToys.Core;using DevToys.Core.Threading;+using DevToys.Shared.Core.Threading;using DevToys.Views.Tools.Base64EncoderDecoder;using Microsoft.Toolkit.Mvvm.ComponentModel;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/GuidGenerator/GuidGeneratorToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/GuidGenerator/GuidGeneratorToolProvider.csindex dd771b817..88eebc77d 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/GuidGenerator/GuidGeneratorToolProvider.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/GuidGenerator/GuidGeneratorToolProvider.cs@@ -1,7 +1,7 @@#nullable enableusing System.Composition;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;using DevToys.Api.Tools;namespace DevToys.ViewModels.Tools.GuidGeneratordiff --git a/src/dev/impl/DevToys/ViewModels/Tools/HashGenerator/HashGeneratorToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/HashGenerator/HashGeneratorToolProvider.csindex 655bcee46..1c477df8a 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/HashGenerator/HashGeneratorToolProvider.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/HashGenerator/HashGeneratorToolProvider.cs@@ -2,7 +2,7 @@using System.Composition;using System.Threading.Tasks;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;using DevToys.Api.Tools;using DevToys.Core.Threading;using Windows.UI.Xaml.Controls;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/HashGenerator/HashGeneratorToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/HashGenerator/HashGeneratorToolViewModel.csindex dd588cc17..8bd8b682d 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/HashGenerator/HashGeneratorToolViewModel.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/HashGenerator/HashGeneratorToolViewModel.cs@@ -9,6 +9,7 @@ using DevToys.Api.Core.Settings;using DevToys.Api.Tools;using DevToys.Core;using DevToys.Core.Threading;+using DevToys.Shared.Core.Threading;using DevToys.Views.Tools.HashGenerator;using Microsoft.Toolkit.Mvvm.ComponentModel;using Windows.Security.Cryptography;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/HtmlEncoderDecoder/HtmlEncoderDecoderToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/HtmlEncoderDecoder/HtmlEncoderDecoderToolProvider.csindex a0c956572..7f030cdb3 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/HtmlEncoderDecoder/HtmlEncoderDecoderToolProvider.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/HtmlEncoderDecoder/HtmlEncoderDecoderToolProvider.cs@@ -1,7 +1,7 @@#nullable enableusing System.Composition;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;using DevToys.Api.Tools;namespace DevToys.ViewModels.Tools.HtmlEncoderDecoderdiff --git a/src/dev/impl/DevToys/ViewModels/Tools/HtmlEncoderDecoder/HtmlEncoderDecoderToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/HtmlEncoderDecoder/HtmlEncoderDecoderToolViewModel.csindex 73563a036..5683e3235 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/HtmlEncoderDecoder/HtmlEncoderDecoderToolViewModel.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/HtmlEncoderDecoder/HtmlEncoderDecoderToolViewModel.cs@@ -10,6 +10,7 @@ using DevToys.Api.Core.Settings;using DevToys.Api.Tools;using DevToys.Core;using DevToys.Core.Threading;+using DevToys.Shared.Core.Threading;using DevToys.Views.Tools.HtmlEncoderDecoder;using Microsoft.Toolkit.Mvvm.ComponentModel;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/JsonFormatter/JsonFormatterToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/JsonFormatter/JsonFormatterToolProvider.csindex 8c9b846d5..0a0a47093 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/JsonFormatter/JsonFormatterToolProvider.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/JsonFormatter/JsonFormatterToolProvider.cs@@ -1,7 +1,7 @@#nullable enableusing System.Composition;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;using DevToys.Api.Tools;using DevToys.Helpers;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/JsonFormatter/JsonFormatterToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/JsonFormatter/JsonFormatterToolViewModel.csindex 415f7392a..22c5fa8a9 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/JsonFormatter/JsonFormatterToolViewModel.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/JsonFormatter/JsonFormatterToolViewModel.cs@@ -10,6 +10,7 @@ using DevToys.Api.Core;using DevToys.Api.Core.Settings;using DevToys.Api.Tools;using DevToys.Core.Threading;+using DevToys.Shared.Core.Threading;using DevToys.Helpers;using DevToys.Models;using DevToys.Views.Tools.JsonFormatter;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/JsonYaml/JsonYamlToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/JsonYaml/JsonYamlToolProvider.csindex 7fa456ac0..6a7e5605d 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/JsonYaml/JsonYamlToolProvider.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/JsonYaml/JsonYamlToolProvider.cs@@ -1,7 +1,7 @@#nullable enableusing System.Composition;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;using DevToys.Api.Tools;using DevToys.Helpers;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/JsonYaml/JsonYamlToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/JsonYaml/JsonYamlToolViewModel.csindex 66ea5090b..37dd4cedf 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/JsonYaml/JsonYamlToolViewModel.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/JsonYaml/JsonYamlToolViewModel.cs@@ -12,6 +12,7 @@ using DevToys.Api.Core.Settings;using DevToys.Api.Tools;using DevToys.Core;using DevToys.Core.Threading;+using DevToys.Shared.Core.Threading;using DevToys.Helpers;using DevToys.Views.Tools.JsonYaml;using Microsoft.Toolkit.Mvvm.ComponentModel;@@ -229,7 +230,7 @@ namespace DevToys.ViewModels.Tools.JsonYamltry{- dynamic jsonObject = JsonConvert.DeserializeObject<ExpandoObject>(input);+ dynamic? jsonObject = JsonConvert.DeserializeObject<ExpandoObject>(input);if (jsonObject is not null and not string){int indent = 0;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolProvider.csindex 6eaa36199..df947a1d1 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolProvider.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolProvider.cs@@ -1,7 +1,7 @@#nullable enableusing System.Composition;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;using DevToys.Api.Tools;using DevToys.Helpers;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolViewModel.csindex 788ec8312..288cbdabd 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolViewModel.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolViewModel.cs@@ -8,6 +8,7 @@ using System.Threading.Tasks;using DevToys.Api.Core;using DevToys.Api.Tools;using DevToys.Core.Threading;+using DevToys.Shared.Core.Threading;using DevToys.Helpers;using DevToys.Models;using DevToys.Views.Tools.JwtDecoderEncoder;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/MarkdownPreview/MarkdownPreviewToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/MarkdownPreview/MarkdownPreviewToolProvider.csindex 1f869877a..9094ee1cf 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/MarkdownPreview/MarkdownPreviewToolProvider.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/MarkdownPreview/MarkdownPreviewToolProvider.cs@@ -2,7 +2,7 @@using System.Composition;using System.Text.RegularExpressions;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;using DevToys.Api.Tools;namespace DevToys.ViewModels.Tools.MarkdownPreviewdiff --git a/src/dev/impl/DevToys/ViewModels/Tools/MarkdownPreview/MarkdownPreviewToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/MarkdownPreview/MarkdownPreviewToolViewModel.csindex a836044b2..f0970ced0 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/MarkdownPreview/MarkdownPreviewToolViewModel.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/MarkdownPreview/MarkdownPreviewToolViewModel.cs@@ -8,8 +8,8 @@ using DevToys.Api.Core;using DevToys.Api.Core.Settings;using DevToys.Api.Core.Theme;using DevToys.Api.Tools;-using DevToys.Core;using DevToys.Core.Threading;+using DevToys.Shared.Core.Threading;using DevToys.Messages;using DevToys.Views.Tools.MarkdownPreview;using Markdig;@@ -17,6 +17,7 @@ using Microsoft.Toolkit.Mvvm.ComponentModel;using Microsoft.Toolkit.Mvvm.Messaging;using Windows.Storage;using Windows.UI.Xaml;+using DevToys.Shared.Core;namespace DevToys.ViewModels.Tools.MarkdownPreview{diff --git a/src/dev/impl/DevToys/ViewModels/Tools/RegEx/RegExToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/RegEx/RegExToolProvider.csindex 5f9c1a6e8..7c4ee99d5 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/RegEx/RegExToolProvider.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/RegEx/RegExToolProvider.cs@@ -1,7 +1,7 @@#nullable enableusing System.Composition;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;using DevToys.Api.Tools;namespace DevToys.ViewModels.Tools.RegExdiff --git a/src/dev/impl/DevToys/ViewModels/Tools/RegEx/RegExToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/RegEx/RegExToolViewModel.csindex b5cb293e4..b9184aa2c 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/RegEx/RegExToolViewModel.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/RegEx/RegExToolViewModel.cs@@ -9,6 +9,7 @@ using DevToys.Api.Core;using DevToys.Api.Core.Settings;using DevToys.Api.Tools;using DevToys.Core.Threading;+using DevToys.Shared.Core.Threading;using DevToys.UI.Controls;using DevToys.Views.Tools.RegEx;using Microsoft.Toolkit.Mvvm.ComponentModel;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/Settings/SettingsToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/Settings/SettingsToolProvider.csindex a9e615dc6..a2a95a749 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/Settings/SettingsToolProvider.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/Settings/SettingsToolProvider.cs@@ -2,7 +2,7 @@using System.Composition;using System.Threading.Tasks;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;using DevToys.Api.Tools;using DevToys.Core.Threading;using Microsoft.Toolkit.Mvvm.ComponentModel;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/StringUtilities/StringUtilitiesToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/StringUtilities/StringUtilitiesToolProvider.csindex 33c704dff..e6ba38898 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/StringUtilities/StringUtilitiesToolProvider.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/StringUtilities/StringUtilitiesToolProvider.cs@@ -2,7 +2,7 @@using System.Composition;using System.Threading.Tasks;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;using DevToys.Api.Tools;using DevToys.Core.Threading;using Windows.UI.Xaml.Controls;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/StringUtilities/StringUtilitiesToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/StringUtilities/StringUtilitiesToolViewModel.csindex d7dcb2fde..61fae9d6e 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/StringUtilities/StringUtilitiesToolViewModel.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/StringUtilities/StringUtilitiesToolViewModel.cs@@ -10,6 +10,7 @@ using System.Threading.Tasks;using DevToys.Api.Core;using DevToys.Api.Tools;using DevToys.Core.Threading;+using DevToys.Shared.Core.Threading;using DevToys.Views.Tools.StringUtilities;using Microsoft.Toolkit.Mvvm.ComponentModel;using Microsoft.Toolkit.Mvvm.Input;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/TextDiff/TextDiffToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/TextDiff/TextDiffToolProvider.csindex 8319fc2e0..0ef82acc0 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/TextDiff/TextDiffToolProvider.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/TextDiff/TextDiffToolProvider.cs@@ -1,7 +1,7 @@#nullable enableusing System.Composition;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;using DevToys.Api.Tools;namespace DevToys.ViewModels.Tools.TextDiffdiff --git a/src/dev/impl/DevToys/ViewModels/Tools/ToolProviderBase.cs b/src/dev/impl/DevToys/ViewModels/Tools/ToolProviderBase.csindex c3ddc1de0..6170a677b 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/ToolProviderBase.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/ToolProviderBase.cs@@ -1,8 +1,8 @@#nullable enableusing System.Threading.Tasks;-using DevToys.Core;using DevToys.Core.Threading;+using DevToys.Shared.Core;using Microsoft.Toolkit.Mvvm.ComponentModel;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/UrlEncoderDecoder/UrlEncoderDecoderToolProvider.cs b/src/dev/impl/DevToys/ViewModels/Tools/UrlEncoderDecoder/UrlEncoderDecoderToolProvider.csindex 4ef019a7b..854c8f5cb 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/UrlEncoderDecoder/UrlEncoderDecoderToolProvider.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/UrlEncoderDecoder/UrlEncoderDecoderToolProvider.cs@@ -2,7 +2,7 @@using System.Composition;using System.Threading.Tasks;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;using DevToys.Api.Tools;using DevToys.Core.Threading;using Windows.UI.Xaml.Controls;diff --git a/src/dev/impl/DevToys/ViewModels/Tools/UrlEncoderDecoder/UrlEncoderDecoderToolViewModel.cs b/src/dev/impl/DevToys/ViewModels/Tools/UrlEncoderDecoder/UrlEncoderDecoderToolViewModel.csindex 4c201e149..624008f74 100644--- a/src/dev/impl/DevToys/ViewModels/Tools/UrlEncoderDecoder/UrlEncoderDecoderToolViewModel.cs+++ b/src/dev/impl/DevToys/ViewModels/Tools/UrlEncoderDecoder/UrlEncoderDecoderToolViewModel.cs@@ -9,6 +9,7 @@ using DevToys.Api.Core.Settings;using DevToys.Api.Tools;using DevToys.Core;using DevToys.Core.Threading;+using DevToys.Shared.Core.Threading;using DevToys.Views.Tools.UrlEncoderDecoder;using Microsoft.Toolkit.Mvvm.ComponentModel;diff --git a/src/dev/impl/DevToys/Views/MainPage.xaml.cs b/src/dev/impl/DevToys/Views/MainPage.xaml.csindex b75ee2b33..8fbae6f9e 100644--- a/src/dev/impl/DevToys/Views/MainPage.xaml.cs+++ b/src/dev/impl/DevToys/Views/MainPage.xaml.cs@@ -1,11 +1,12 @@#nullable enableusing DevToys.Api.Core;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;using DevToys.Api.Core.Navigation;-using DevToys.Core;+using DevToys.Shared.Core.Threading;using DevToys.Core.Threading;using DevToys.Messages;+using DevToys.Shared.Core;using DevToys.ViewModels;using Microsoft.Toolkit.Mvvm.Messaging;using Windows.UI.ViewManagement;diff --git a/src/dev/impl/DevToys/Views/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolPage.xaml.csindex 3db6728ec..6a5597aaa 100644--- a/src/dev/impl/DevToys/Views/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolPage.xaml.cs+++ b/src/dev/impl/DevToys/Views/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolPage.xaml.cs@@ -1,7 +1,7 @@#nullable enableusing DevToys.Api.Core.Navigation;-using DevToys.Core;+using DevToys.Shared.Core;using DevToys.ViewModels.Tools.Base64EncoderDecoder;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;diff --git a/src/dev/impl/DevToys/Views/Tools/GuidGenerator/GuidGeneratoToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/GuidGenerator/GuidGeneratoToolPage.xaml.csindex 81fb5fedf..390335006 100644--- a/src/dev/impl/DevToys/Views/Tools/GuidGenerator/GuidGeneratoToolPage.xaml.cs+++ b/src/dev/impl/DevToys/Views/Tools/GuidGenerator/GuidGeneratoToolPage.xaml.cs@@ -1,7 +1,7 @@#nullable enableusing DevToys.Api.Core.Navigation;-using DevToys.Core;+using DevToys.Shared.Core;using DevToys.ViewModels.Tools.GuidGenerator;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;diff --git a/src/dev/impl/DevToys/Views/Tools/HashGenerator/HashGeneratorToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/HashGenerator/HashGeneratorToolPage.xaml.csindex c658fd682..eef81917b 100644--- a/src/dev/impl/DevToys/Views/Tools/HashGenerator/HashGeneratorToolPage.xaml.cs+++ b/src/dev/impl/DevToys/Views/Tools/HashGenerator/HashGeneratorToolPage.xaml.cs@@ -1,7 +1,7 @@#nullable enableusing DevToys.Api.Core.Navigation;-using DevToys.Core;+using DevToys.Shared.Core;using DevToys.ViewModels.Tools.HashGenerator;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;@@ -47,4 +47,4 @@ namespace DevToys.Views.Tools.HashGeneratorbase.OnNavigatedTo(e);}}-}\ No newline at end of file+}diff --git a/src/dev/impl/DevToys/Views/Tools/HtmlEncoderDecoder/HtmlEncoderDecoderToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/HtmlEncoderDecoder/HtmlEncoderDecoderToolPage.xaml.csindex d514cf28e..db346d79d 100644--- a/src/dev/impl/DevToys/Views/Tools/HtmlEncoderDecoder/HtmlEncoderDecoderToolPage.xaml.cs+++ b/src/dev/impl/DevToys/Views/Tools/HtmlEncoderDecoder/HtmlEncoderDecoderToolPage.xaml.cs@@ -1,7 +1,7 @@#nullable enableusing DevToys.Api.Core.Navigation;-using DevToys.Core;+using DevToys.Shared.Core;using DevToys.ViewModels.Tools.HtmlEncoderDecoder;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;diff --git a/src/dev/impl/DevToys/Views/Tools/JsonFormatter/JsonFormatterToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/JsonFormatter/JsonFormatterToolPage.xaml.csindex ed9866e7c..acbe5f66f 100644--- a/src/dev/impl/DevToys/Views/Tools/JsonFormatter/JsonFormatterToolPage.xaml.cs+++ b/src/dev/impl/DevToys/Views/Tools/JsonFormatter/JsonFormatterToolPage.xaml.cs@@ -1,7 +1,7 @@#nullable enableusing DevToys.Api.Core.Navigation;-using DevToys.Core;+using DevToys.Shared.Core;using DevToys.ViewModels.Tools.JsonFormatter;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;diff --git a/src/dev/impl/DevToys/Views/Tools/JsonYaml/JsonYamlToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/JsonYaml/JsonYamlToolPage.xaml.csindex de6705093..004015972 100644--- a/src/dev/impl/DevToys/Views/Tools/JsonYaml/JsonYamlToolPage.xaml.cs+++ b/src/dev/impl/DevToys/Views/Tools/JsonYaml/JsonYamlToolPage.xaml.cs@@ -1,8 +1,8 @@#nullable enableusing DevToys.Api.Core.Navigation;-using DevToys.Core;using DevToys.Helpers;+using DevToys.Shared.Core;using DevToys.ViewModels.Tools.JsonYaml;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;diff --git a/src/dev/impl/DevToys/Views/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolPage.xaml.csindex ffc7df4c7..c3b04f6bd 100644--- a/src/dev/impl/DevToys/Views/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolPage.xaml.cs+++ b/src/dev/impl/DevToys/Views/Tools/JwtDecoderEncoder/JwtDecoderEncoderToolPage.xaml.cs@@ -1,7 +1,7 @@#nullable enableusing DevToys.Api.Core.Navigation;-using DevToys.Core;+using DevToys.Shared.Core;using DevToys.ViewModels.Tools.JwtDecoderEncoder;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;diff --git a/src/dev/impl/DevToys/Views/Tools/MarkdownPreview/MarkdownPreviewToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/MarkdownPreview/MarkdownPreviewToolPage.xaml.csindex 7ecf8e81f..00cfc14be 100644--- a/src/dev/impl/DevToys/Views/Tools/MarkdownPreview/MarkdownPreviewToolPage.xaml.cs+++ b/src/dev/impl/DevToys/Views/Tools/MarkdownPreview/MarkdownPreviewToolPage.xaml.cs@@ -1,8 +1,8 @@#nullable enableusing DevToys.Api.Core.Navigation;-using DevToys.Core;using DevToys.Messages;+using DevToys.Shared.Core;using DevToys.ViewModels.Tools.MarkdownPreview;using Microsoft.Toolkit.Mvvm.Messaging;using Windows.UI.Xaml;diff --git a/src/dev/impl/DevToys/Views/Tools/RegEx/RegExToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/RegEx/RegExToolPage.xaml.csindex cd1c87249..649866255 100644--- a/src/dev/impl/DevToys/Views/Tools/RegEx/RegExToolPage.xaml.cs+++ b/src/dev/impl/DevToys/Views/Tools/RegEx/RegExToolPage.xaml.cs@@ -1,7 +1,7 @@#nullable enableusing DevToys.Api.Core.Navigation;-using DevToys.Core;+using DevToys.Shared.Core;using DevToys.ViewModels.Tools.RegEx;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;@@ -49,4 +49,4 @@ namespace DevToys.Views.Tools.RegExbase.OnNavigatedTo(e);}}-}\ No newline at end of file+}diff --git a/src/dev/impl/DevToys/Views/Tools/Settings/SettingsToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/Settings/SettingsToolPage.xaml.csindex db106a4a1..bc6e829ba 100644--- a/src/dev/impl/DevToys/Views/Tools/Settings/SettingsToolPage.xaml.cs+++ b/src/dev/impl/DevToys/Views/Tools/Settings/SettingsToolPage.xaml.cs@@ -1,7 +1,7 @@#nullable enableusing DevToys.Api.Core.Navigation;-using DevToys.Core;+using DevToys.Shared.Core;using DevToys.ViewModels.Settings;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;diff --git a/src/dev/impl/DevToys/Views/Tools/StringUtilities/StringUtilitiesToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/StringUtilities/StringUtilitiesToolPage.xaml.csindex e99969cc6..b2e21252f 100644--- a/src/dev/impl/DevToys/Views/Tools/StringUtilities/StringUtilitiesToolPage.xaml.cs+++ b/src/dev/impl/DevToys/Views/Tools/StringUtilities/StringUtilitiesToolPage.xaml.cs@@ -1,7 +1,7 @@#nullable enableusing DevToys.Api.Core.Navigation;-using DevToys.Core;+using DevToys.Shared.Core;using DevToys.ViewModels.Tools.StringUtilities;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;diff --git a/src/dev/impl/DevToys/Views/Tools/TextDiff/TextDiffToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/TextDiff/TextDiffToolPage.xaml.csindex d5d77bba6..3683ae247 100644--- a/src/dev/impl/DevToys/Views/Tools/TextDiff/TextDiffToolPage.xaml.cs+++ b/src/dev/impl/DevToys/Views/Tools/TextDiff/TextDiffToolPage.xaml.cs@@ -1,7 +1,7 @@#nullable enableusing DevToys.Api.Core.Navigation;-using DevToys.Core;+using DevToys.Shared.Core;using DevToys.ViewModels.Tools.TextDiff;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;diff --git a/src/dev/impl/DevToys/Views/Tools/URLEncoderDecoder/UrlEncoderDecoderToolPage.xaml.cs b/src/dev/impl/DevToys/Views/Tools/URLEncoderDecoder/UrlEncoderDecoderToolPage.xaml.csindex e4743b102..d60907ed6 100644--- a/src/dev/impl/DevToys/Views/Tools/URLEncoderDecoder/UrlEncoderDecoderToolPage.xaml.cs+++ b/src/dev/impl/DevToys/Views/Tools/URLEncoderDecoder/UrlEncoderDecoderToolPage.xaml.cs@@ -1,7 +1,7 @@#nullable enableusing DevToys.Api.Core.Navigation;-using DevToys.Core;+using DevToys.Shared.Core;using DevToys.ViewModels.Tools.UrlEncoderDecoder;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;diff --git a/src/dev/impl/Directory.Build.props b/src/dev/impl/Directory.Build.propsindex fc285ff04..9fa328088 100644--- a/src/dev/impl/Directory.Build.props+++ b/src/dev/impl/Directory.Build.props@@ -1,27 +1,6 @@<Project><Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />- <PropertyGroup>- <LangVersion>latest</LangVersion>- <Nullable>enable</Nullable>-- <GenerateAssemblyInfo>false</GenerateAssemblyInfo>-- <!-- Enable generation of .tt files -->- <TransformOnBuild>true</TransformOnBuild>- <OverwriteReadOnlyOutputFiles>true</OverwriteReadOnlyOutputFiles>- <TransformOutOfDateOnly>false</TransformOutOfDateOnly>- </PropertyGroup>-- <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '16.0' ">- <VisualStudioVersion>16.0</VisualStudioVersion>- </PropertyGroup>-- <PropertyGroup Condition="'$(Configuration)' == 'Debug'">- <!-- In Debug mode, don't generate .tt files at each build. -->- <TransformOutOfDateOnly>true</TransformOutOfDateOnly>- </PropertyGroup>-<PropertyGroup Condition="'$(Configuration)' == 'Debug'"><DebugSymbols>true</DebugSymbols><DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>@@ -43,11 +22,11 @@<PlatformTarget>x64</PlatformTarget></PropertyGroup>- <PropertyGroup Condition="'$(Platform)' == 'ARM'">- <PlatformTarget>ARM</PlatformTarget>+ <PropertyGroup Condition="'$(Platform)' == 'arm64'">+ <PlatformTarget>arm64</PlatformTarget></PropertyGroup>- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|arm64'"><DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;ARM</DefineConstants></PropertyGroup>diff --git a/src/dev/impl/Directory.Build.targets b/src/dev/impl/Directory.Build.targetsindex c91a42a06..6b980588d 100644--- a/src/dev/impl/Directory.Build.targets+++ b/src/dev/impl/Directory.Build.targets@@ -12,7 +12,7 @@FileName="$(RepoRoot)src\dev\shared\SharedAssemblyInfo.cs"Version="$(AppVersionNumber)" /><SetVersion- FileName="$(RepoRoot)src\dev\shared\Package.appxmanifest"+ FileName="$(RepoRoot)src\dev\DevToys.Startup\Package.appxmanifest"Version="$(AppVersionNumber)" /></Target><Target Name="BeforeBuild" DependsOnTargets="UpdateVersionNumber"/>diff --git a/src/dev/impl/DevToys/Api/Core/IMefProvider.cs b/src/dev/shared/DevToys.Shared/API/Core/IMefProvider.cssimilarity index 81%rename from src/dev/impl/DevToys/Api/Core/IMefProvider.csrename to src/dev/shared/DevToys.Shared/API/Core/IMefProvider.csindex b242bda54..aff975ff4 100644--- a/src/dev/impl/DevToys/Api/Core/IMefProvider.cs+++ b/src/dev/shared/DevToys.Shared/API/Core/IMefProvider.cs@@ -1,8 +1,6 @@-#nullable enable+using System.Collections.Generic;-using System.Collections.Generic;--namespace DevToys.Api.Core.Injection+namespace DevToys.Shared.Api.Core{/// <summary>/// Provides a way to import MEF components on the fly.diff --git a/src/dev/shared/DevToys.Shared/AppServiceMessages/ShutdownMessage.cs b/src/dev/shared/DevToys.Shared/AppServiceMessages/ShutdownMessage.csnew file mode 100644index 000000000..152d8d727--- /dev/null+++ b/src/dev/shared/DevToys.Shared/AppServiceMessages/ShutdownMessage.cs@@ -0,0 +1,8 @@+using DevToys.Shared.Core.OOP;++namespace DevToys.OutOfProcService.OutOfProcServices+{+ internal class ShutdownMessage : AppServiceMessageBase+ {+ }+}diff --git a/src/dev/shared/DevToys.Shared/Constants.cs b/src/dev/shared/DevToys.Shared/Constants.csnew file mode 100644index 000000000..276ba8782--- /dev/null+++ b/src/dev/shared/DevToys.Shared/Constants.cs@@ -0,0 +1,24 @@+#nullable enable++using System;+using Newtonsoft.Json;++namespace DevToys.Shared+{+ internal static class Constants+ {+ internal const string AppServiceName = "DevToysOOPService";++ internal const int AppServiceBufferSize = 2048;++ internal static readonly TimeSpan AppServiceTimeout = TimeSpan.FromSeconds(10);++ internal static readonly JsonSerializerSettings AppServiceJsonSerializerSettings+ = new()+ {+ TypeNameHandling = TypeNameHandling.All,+ NullValueHandling = NullValueHandling.Ignore,+ Formatting = Formatting.None+ };+ }+}diff --git a/src/dev/impl/DevToys/Core/Arguments.cs b/src/dev/shared/DevToys.Shared/Core/Arguments.cssimilarity index 93%rename from src/dev/impl/DevToys/Core/Arguments.csrename to src/dev/shared/DevToys.Shared/Core/Arguments.csindex 871c96a89..db8e9b871 100644--- a/src/dev/impl/DevToys/Core/Arguments.cs+++ b/src/dev/shared/DevToys.Shared/Core/Arguments.cs@@ -1,8 +1,6 @@-#nullable enable+using System;-using System;--namespace DevToys.Core+namespace DevToys.Shared.Core{public static class Arguments{diff --git a/src/dev/impl/DevToys/Core/Assumes.cs b/src/dev/shared/DevToys.Shared/Core/Assumes.cssimilarity index 94%rename from src/dev/impl/DevToys/Core/Assumes.csrename to src/dev/shared/DevToys.Shared/Core/Assumes.csindex 5d2b13f21..187cf5b9e 100644--- a/src/dev/impl/DevToys/Core/Assumes.cs+++ b/src/dev/shared/DevToys.Shared/Core/Assumes.cs@@ -1,8 +1,6 @@-#nullable enable+using System;-using System;--namespace DevToys.Core+namespace DevToys.Shared.Core{public static class Assumes{diff --git a/src/dev/impl/DevToys/Core/MefComposer.cs b/src/dev/shared/DevToys.Shared/Core/MefComposer.cssimilarity index 97%rename from src/dev/impl/DevToys/Core/MefComposer.csrename to src/dev/shared/DevToys.Shared/Core/MefComposer.csindex 0243a906c..9286dd570 100644--- a/src/dev/impl/DevToys/Core/MefComposer.cs+++ b/src/dev/shared/DevToys.Shared/Core/MefComposer.cs@@ -4,9 +4,9 @@ using System;using System.Collections.Generic;using System.Composition.Hosting;using System.Reflection;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;-namespace DevToys.Core+namespace DevToys.Shared.Core{/// <summary>/// Provides a set of methods to initialize and manage MEF.diff --git a/src/dev/impl/DevToys/Core/MefProvider.cs b/src/dev/shared/DevToys.Shared/Core/MefProvider.cssimilarity index 90%rename from src/dev/impl/DevToys/Core/MefProvider.csrename to src/dev/shared/DevToys.Shared/Core/MefProvider.csindex 80083a97a..b4db24ab3 100644--- a/src/dev/impl/DevToys/Core/MefProvider.cs+++ b/src/dev/shared/DevToys.Shared/Core/MefProvider.cs@@ -3,9 +3,9 @@using System.Collections.Generic;using System.Composition;using System.Composition.Hosting;-using DevToys.Api.Core.Injection;+using DevToys.Shared.Api.Core;-namespace DevToys.Core+namespace DevToys.Shared.Core{[Export(typeof(IMefProvider))][Shared]diff --git a/src/dev/shared/DevToys.Shared/Core/OOP/AppServiceMessageBase.cs b/src/dev/shared/DevToys.Shared/Core/OOP/AppServiceMessageBase.csnew file mode 100644index 000000000..aea6b96fa--- /dev/null+++ b/src/dev/shared/DevToys.Shared/Core/OOP/AppServiceMessageBase.cs@@ -0,0 +1,13 @@+#nullable enable++using System;+using Newtonsoft.Json;++namespace DevToys.Shared.Core.OOP+{+ public abstract class AppServiceMessageBase+ {+ [JsonProperty]+ internal Guid? MessageId { get; set; }+ }+}diff --git a/src/dev/shared/DevToys.Shared/Core/OOP/AppServiceProgressMessage.cs b/src/dev/shared/DevToys.Shared/Core/OOP/AppServiceProgressMessage.csnew file mode 100644index 000000000..46f96c3a4--- /dev/null+++ b/src/dev/shared/DevToys.Shared/Core/OOP/AppServiceProgressMessage.cs@@ -0,0 +1,15 @@+#nullable enable++using Newtonsoft.Json;++namespace DevToys.Shared.Core.OOP+{+ public sealed class AppServiceProgressMessage : AppServiceMessageBase+ {+ [JsonProperty]+ internal int ProgressPercentage { get; set; }++ [JsonProperty]+ internal string? Message { get; set; }+ }+}diff --git a/src/dev/shared/DevToys.Shared/Core/OOP/LowLevelAppServiceMessage.cs b/src/dev/shared/DevToys.Shared/Core/OOP/LowLevelAppServiceMessage.csnew file mode 100644index 000000000..2fa66644f--- /dev/null+++ b/src/dev/shared/DevToys.Shared/Core/OOP/LowLevelAppServiceMessage.cs@@ -0,0 +1,19 @@+#nullable enable++using System.Text;++namespace DevToys.Shared.Core.OOP+{+ internal class LowLevelAppServiceMessage+ {+ internal byte[] Buffer { get; }++ internal StringBuilder Message { get; }++ internal LowLevelAppServiceMessage(int bufferSize, StringBuilder? stringBuilder)+ {+ Buffer = new byte[bufferSize];+ Message = stringBuilder ?? new StringBuilder();+ }+ }+}diff --git a/src/dev/impl/DevToys/Core/Threading/DisposableSempahore.cs b/src/dev/shared/DevToys.Shared/Core/Threading/DisposableSempahore.cssimilarity index 95%rename from src/dev/impl/DevToys/Core/Threading/DisposableSempahore.csrename to src/dev/shared/DevToys.Shared/Core/Threading/DisposableSempahore.csindex a8f8de7cd..ed6a79d27 100644--- a/src/dev/impl/DevToys/Core/Threading/DisposableSempahore.cs+++ b/src/dev/shared/DevToys.Shared/Core/Threading/DisposableSempahore.cs@@ -1,10 +1,8 @@-#nullable enable--using System;+using System;using System.Threading;using System.Threading.Tasks;-namespace DevToys.Core.Threading+namespace DevToys.Shared.Core.Threading{/// <summary>/// Represents a semaphore that free other threads when disposing the result of the <see cref="WaitAsync(CancellationToken)"/> method..diff --git a/src/dev/impl/DevToys/Core/Threading/TaskExtension.cs b/src/dev/shared/DevToys.Shared/Core/Threading/TaskExtension.cssimilarity index 96%rename from src/dev/impl/DevToys/Core/Threading/TaskExtension.csrename to src/dev/shared/DevToys.Shared/Core/Threading/TaskExtension.csindex ca2e6c8f2..d1611547d 100644--- a/src/dev/impl/DevToys/Core/Threading/TaskExtension.cs+++ b/src/dev/shared/DevToys.Shared/Core/Threading/TaskExtension.cs@@ -1,10 +1,8 @@-#nullable enable--using System;+using System;using System.Diagnostics;using System.Threading.Tasks;-namespace DevToys.Core.Threading+namespace DevToys.Shared.Core.Threading{/// <summary>/// Provides a set of helper method to play around with threads.diff --git a/src/dev/impl/DevToys/Core/Threading/TaskSchedulerAwaiter.cs b/src/dev/shared/DevToys.Shared/Core/Threading/TaskSchedulerAwaiter.cssimilarity index 98%rename from src/dev/impl/DevToys/Core/Threading/TaskSchedulerAwaiter.csrename to src/dev/shared/DevToys.Shared/Core/Threading/TaskSchedulerAwaiter.csindex 9ab66027f..78b5ebe4e 100644--- a/src/dev/impl/DevToys/Core/Threading/TaskSchedulerAwaiter.cs+++ b/src/dev/shared/DevToys.Shared/Core/Threading/TaskSchedulerAwaiter.cs@@ -1,11 +1,9 @@-#nullable enable--using System;+using System;using System.Runtime.CompilerServices;using System.Threading;using System.Threading.Tasks;-namespace DevToys.Core.Threading+namespace DevToys.Shared.Core.Threading{/// <summary>/// An awaiter returned from <see cref="GetAwaiter(TaskScheduler)"/>.diff --git a/src/dev/shared/DevToys.Shared/DevToys.Shared.csproj b/src/dev/shared/DevToys.Shared/DevToys.Shared.csprojnew file mode 100644index 000000000..9d0652b07--- /dev/null+++ b/src/dev/shared/DevToys.Shared/DevToys.Shared.csproj@@ -0,0 +1,17 @@+<Project Sdk="Microsoft.NET.Sdk">++ <PropertyGroup>+ <TargetFramework>netstandard2.0</TargetFramework>+ <RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>+ </PropertyGroup>++ <ItemGroup>+ <Compile Include="..\SharedAssemblyInfo.cs" Link="Properties\SharedAssemblyInfo.cs" />+ </ItemGroup>++ <ItemGroup>+ <PackageReference Include="Newtonsoft.Json" Version="$(NuGet_NewtonsoftJson)" />+ <PackageReference Include="System.Composition" Version="$(NuGet_DotNet)" />+ </ItemGroup>++</Project>diff --git a/src/dev/shared/DevToys.Shared/Properties/AssemblyInfo.cs b/src/dev/shared/DevToys.Shared/Properties/AssemblyInfo.csnew file mode 100644index 000000000..86450ba90--- /dev/null+++ b/src/dev/shared/DevToys.Shared/Properties/AssemblyInfo.cs@@ -0,0 +1,8 @@+using System.Reflection;+using System.Runtime.CompilerServices;++[assembly: AssemblyTitle("DevToys.Shared")]++[assembly: InternalsVisibleTo("DevToys")]+[assembly: InternalsVisibleTo("DevToys.MonacoEditor")]+[assembly: InternalsVisibleTo("DevToys.OutOfProcService")]diff --git a/src/tests/DevToys.Tests/DevToys.Tests.csproj b/src/tests/DevToys.Tests/DevToys.Tests.csprojindex aa37c05d1..8b6221b0a 100644--- a/src/tests/DevToys.Tests/DevToys.Tests.csproj+++ b/src/tests/DevToys.Tests/DevToys.Tests.csproj@@ -37,8 +37,8 @@<PropertyGroup Condition="'$(Platform)' == 'x64'"><PlatformTarget>x64</PlatformTarget></PropertyGroup>- <PropertyGroup Condition="'$(Platform)' == 'ARM'">- <PlatformTarget>ARM</PlatformTarget>+ <PropertyGroup Condition="'$(Platform)' == 'arm64'">+ <PlatformTarget>arm64</PlatformTarget></PropertyGroup><ItemGroup><SDKReference Include="TestPlatform.Universal, Version=$(UnitTestPlatformVersion)" />@@ -84,13 +84,17 @@<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="$(NuGet_MicrosoftToolkitMvvm)" /><PackageReference Include="MSTest.TestAdapter" Version="$(NuGet_MSTestTestAdapter)" /><PackageReference Include="MSTest.TestFramework" Version="$(NuGet_MSTestTestFramework)" />- <PackageReference Include="System.Composition" Version="$(NuGet_SystemComposition)" />+ <PackageReference Include="System.Composition" Version="$(NuGet_DotNet)" /></ItemGroup><ItemGroup><ProjectReference Include="..\..\dev\impl\DevToys\DevToys.csproj"><Project>{E3E4E200-B380-4207-9A7E-4C9421904502}</Project><Name>DevToys</Name></ProjectReference>+ <ProjectReference Include="..\..\dev\shared\DevToys.Shared\DevToys.Shared.csproj">+ <Project>{ccbcaefe-b245-413a-9c37-a21ce99eecb9}</Project>+ <Name>DevToys.Shared</Name>+ </ProjectReference></ItemGroup><Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" /><!-- To modify your build process, add your task inside one of the targets below and uncomment it.diff --git a/src/tests/DevToys.Tests/MefBaseTest.cs b/src/tests/DevToys.Tests/MefBaseTest.csindex ae94c403b..aae0ae6d7 100644--- a/src/tests/DevToys.Tests/MefBaseTest.cs+++ b/src/tests/DevToys.Tests/MefBaseTest.cs@@ -1,6 +1,7 @@using System;-using DevToys.Api.Core.Injection;-using DevToys.Core;+using DevToys.Shared.Api.Core;+using DevToys.Shared.Core;+using DevToys.ViewModels;namespace DevToys.Tests{@@ -19,6 +20,7 @@ namespace DevToys.Tests_mefComposer= new MefComposer(+ typeof(MainPageViewModel).Assembly,typeof(MefComposer).Assembly);ExportProvider = _mefComposer.ExportProvider.GetExport<IMefProvider>();diff --git a/tools/Restore-NuGetPackages.ps1 b/tools/Restore-NuGetPackages.ps1index 3faa0a432..8a26d334c 100644--- a/tools/Restore-NuGetPackages.ps1+++ b/tools/Restore-NuGetPackages.ps1@@ -28,10 +28,10 @@ if ($Path.EndsWith('.sln')) {Write-Verbose "Restoring NuGet packages for $Path with verbosity $Verbosity"Invoke-Expression '& "$MSBuildPath" $Path /t:restore /p:Configuration=Release /p:platform=x86 /v:$Verbosity'Invoke-Expression '& "$MSBuildPath" $Path /t:restore /p:Configuration=Release /p:platform=x64 /v:$Verbosity'- Invoke-Expression '& "$MSBuildPath" $Path /t:restore /p:Configuration=Release /p:platform=arm /v:$Verbosity'+ Invoke-Expression '& "$MSBuildPath" $Path /t:restore /p:Configuration=Release /p:platform=arm64 /v:$Verbosity'Invoke-Expression '& "$MSBuildPath" $Path /t:restore /p:Configuration=Debug /p:platform=x86 /v:$Verbosity'Invoke-Expression '& "$MSBuildPath" $Path /t:restore /p:Configuration=Debug /p:platform=x64 /v:$Verbosity'- Invoke-Expression '& "$MSBuildPath" $Path /t:restore /p:Configuration=Debug /p:platform=arm /v:$Verbosity'+ Invoke-Expression '& "$MSBuildPath" $Path /t:restore /p:Configuration=Debug /p:platform=arm64 /v:$Verbosity'if ($lastexitcode -ne 0) { throw }$slnDir = Split-Path -Path $Path -Parent