Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CameraCaptureUI API Implementation #4771

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageVersion Include="Microsoft.ProjectReunion.InteractiveExperiences.TransportPackage" Version="1.7.0-CI-26107.1716.240904-1440.0" />
<PackageVersion Include="Microsoft.Windows.CsWinRT" Version="$(MicrosoftWindowsCsWinRTPackageVersion)" />
<PackageVersion Include="Microsoft.SourceLink.Common" Version="$(MicrosoftSourceLinkCommonVersion)" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" />
Expand All @@ -21,4 +22,4 @@
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="$(WindowsSDKBuildToolsVersion)" Condition=" '$(WindowsSDKBuildToolsVersion)' != '' " />
<PackageVersion Include="Microsoft.Windows.ImplementationLibrary" Version="$(WILVersion)" Condition=" '$(WILVersion)' != '' " />
</ItemGroup>
</Project>
</Project>
66 changes: 66 additions & 0 deletions WindowsAppRuntime.sln
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PackageManager.Test.M.White
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PackageManager.Test.M.White.msix", "test\PackageManager\data\PackageManager.Test.M.White.msix\PackageManager.Test.M.White.msix.vcxproj", "{28DCF9CE-D9F4-4A7D-8AD1-F2EFC0D3B4DF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Interop", "Interop", "{3B706C5C-55E0-4B76-BF59-89E20FE46795}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CameraCaptureUI", "CameraCaptureUI", "{0833D8EF-6E11-4133-B0EE-9B7625CD615E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CameraCaptureUI", "dev\Interop\CameraCaptureUI\CameraCaptureUI\CameraCaptureUI.vcxitems", "{95409D1E-843F-4316-8D8E-471B3E203F94}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CameraCaptureUITests", "test\CameraCaptureUITests\CameraCaptureUITests.vcxproj", "{1DAA2342-CF55-48E5-B49C-982FA5C07014}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Windows.Media.Capture.Projection", "dev\Projections\CS\Microsoft.Windows.Media.Capture.Projection\Microsoft.Windows.Media.Capture.Projection.csproj", "{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ProjectReunion.InteractiveExperiences.TransportPackage.PackageReference", "eng\PackageReference\ProjectReunion.InteractiveExperiences\Microsoft.ProjectReunion.InteractiveExperiences.TransportPackage.PackageReference.csproj", "{EDD6D3BF-EBD9-4952-A9B7-76171031139B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1871,6 +1883,54 @@ Global
{28DCF9CE-D9F4-4A7D-8AD1-F2EFC0D3B4DF}.Release|x64.Build.0 = Release|x64
{28DCF9CE-D9F4-4A7D-8AD1-F2EFC0D3B4DF}.Release|x86.ActiveCfg = Release|Win32
{28DCF9CE-D9F4-4A7D-8AD1-F2EFC0D3B4DF}.Release|x86.Build.0 = Release|Win32
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Debug|Any CPU.ActiveCfg = Debug|x64
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Debug|Any CPU.Build.0 = Debug|x64
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Debug|ARM64.ActiveCfg = Debug|x64
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Debug|ARM64.Build.0 = Debug|x64
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Debug|x64.ActiveCfg = Debug|x64
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Debug|x64.Build.0 = Debug|x64
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Debug|x86.ActiveCfg = Debug|Win32
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Debug|x86.Build.0 = Debug|Win32
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Release|Any CPU.ActiveCfg = Release|x64
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Release|Any CPU.Build.0 = Release|x64
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Release|ARM64.ActiveCfg = Release|ARM64
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Release|ARM64.Build.0 = Release|ARM64
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Release|x64.ActiveCfg = Release|x64
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Release|x64.Build.0 = Release|x64
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Release|x86.ActiveCfg = Release|Win32
{1DAA2342-CF55-48E5-B49C-982FA5C07014}.Release|x86.Build.0 = Release|Win32
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Debug|Any CPU.ActiveCfg = Debug|x64
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Debug|Any CPU.Build.0 = Debug|x64
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Debug|ARM64.ActiveCfg = Debug|arm64
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Debug|ARM64.Build.0 = Debug|arm64
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Debug|x64.ActiveCfg = Debug|x64
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Debug|x64.Build.0 = Debug|x64
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Debug|x86.ActiveCfg = Debug|x86
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Debug|x86.Build.0 = Debug|x86
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Release|Any CPU.ActiveCfg = Release|x64
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Release|Any CPU.Build.0 = Release|x64
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Release|ARM64.ActiveCfg = Release|arm64
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Release|ARM64.Build.0 = Release|arm64
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Release|x64.ActiveCfg = Release|x64
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Release|x64.Build.0 = Release|x64
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Release|x86.ActiveCfg = Release|x86
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6}.Release|x86.Build.0 = Release|x86
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Debug|Any CPU.ActiveCfg = Debug|x64
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Debug|Any CPU.Build.0 = Debug|x64
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Debug|ARM64.ActiveCfg = Debug|x64
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Debug|ARM64.Build.0 = Debug|x64
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Debug|x64.ActiveCfg = Debug|x64
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Debug|x64.Build.0 = Debug|x64
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Debug|x86.ActiveCfg = Debug|x86
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Debug|x86.Build.0 = Debug|x86
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Release|Any CPU.ActiveCfg = Release|x64
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Release|Any CPU.Build.0 = Release|x64
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Release|ARM64.ActiveCfg = Release|x64
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Release|ARM64.Build.0 = Release|x64
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Release|x64.ActiveCfg = Release|x64
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Release|x64.Build.0 = Release|x64
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Release|x86.ActiveCfg = Release|x86
{EDD6D3BF-EBD9-4952-A9B7-76171031139B}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -2033,6 +2093,11 @@ Global
{7C240089-0F22-4247-9C91-51255C8DC18B} = {6213B1A3-E854-498F-AAFA-4CFC1E71023E}
{AC79B8FF-4C27-4326-AD20-BBC70059FF51} = {7C240089-0F22-4247-9C91-51255C8DC18B}
{28DCF9CE-D9F4-4A7D-8AD1-F2EFC0D3B4DF} = {6759ECC6-9381-4172-89E6-853F81A03D28}
{3B706C5C-55E0-4B76-BF59-89E20FE46795} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A}
{0833D8EF-6E11-4133-B0EE-9B7625CD615E} = {3B706C5C-55E0-4B76-BF59-89E20FE46795}
{95409D1E-843F-4316-8D8E-471B3E203F94} = {0833D8EF-6E11-4133-B0EE-9B7625CD615E}
{1DAA2342-CF55-48E5-B49C-982FA5C07014} = {8630F7AA-2969-4DC9-8700-9B468C1DC21D}
{97AB4F8D-DF7E-4BA8-9B06-E7B79AF616D6} = {716C26A0-E6B0-4981-8412-D14A4D410531}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4B3D7591-CFEC-4762-9A07-ABE99938FB77}
Expand All @@ -2052,6 +2117,7 @@ Global
dev\Licensing\Licensing.vcxitems*{885a43fa-052d-4b0d-a2dc-13ee15796435}*SharedItemsImports = 9
dev\PackageManager\API\PackageManager.vcxitems*{8a9a0c85-65a8-4bca-a49e-45fc4fdbc7d2}*SharedItemsImports = 9
test\inc\inc.vcxitems*{8e52d7ea-a200-4a6b-ba74-8efb49468caf}*SharedItemsImports = 4
dev\Interop\CameraCaptureUI\CameraCaptureUI\CameraCaptureUI.vcxitems*{95409d1e-843f-4316-8d8e-471b3e203f94}*SharedItemsImports = 9
dev\AppNotifications\AppNotifications.vcxitems*{b4824897-88e0-4927-8fb9-e60106f01ed9}*SharedItemsImports = 9
test\inc\inc.vcxitems*{b567fe2e-3a03-48d0-b2b5-760cdec35891}*SharedItemsImports = 9
dev\ApplicationData\ApplicationData.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4
Expand Down
4 changes: 4 additions & 0 deletions build/CopyFilesToStagingDir.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windo
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.AppNotifications.Builder.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.AppNotifications.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Management.Deployment.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Media.Capture.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.PushNotifications.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Security.AccessControl.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Storage.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
Expand Down Expand Up @@ -114,6 +115,8 @@ PublishFile $FullBuildOutput\Microsoft.Windows.AppNotifications.Projection\Micro
PublishFile $FullBuildOutput\Microsoft.Windows.AppNotifications.Projection\Microsoft.Windows.AppNotifications.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.Management.Deployment.Projection\Microsoft.Windows.Management.Deployment.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.Management.Deployment.Projection\Microsoft.Windows.Management.Deployment.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.Media.Capture.Projection\Microsoft.Windows.Media.Capture.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.Media.Capture.Projection\Microsoft.Windows.Media.Capture.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.PushNotifications.Projection\Microsoft.Windows.PushNotifications.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.PushNotifications.Projection\Microsoft.Windows.PushNotifications.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.Security.AccessControl.Projection\Microsoft.Windows.Security.AccessControl.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
Expand Down Expand Up @@ -184,6 +187,7 @@ PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windo
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.AppNotifications.Builder.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.AppNotifications.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Management.Deployment.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Media.Capture.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.PushNotifications.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Security.AccessControl.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Storage.winmd $NugetDir\lib\uap10.0
Expand Down
5 changes: 4 additions & 1 deletion build/NuSpecs/AppxManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:build="http://schemas.microsoft.com/developer/appx/2015/build" IgnorableNamespaces="uap build">
<Identity Name="Microsoft.WindowsAppRuntime.1.0" ProcessorArchitecture="x64" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" Version="0.52102.3000.0" />
<Properties>
Expand Down Expand Up @@ -100,6 +100,9 @@
<!-- PowerNotifications -->
<ActivatableClass ActivatableClassId="Microsoft.Windows.System.Power.PowerManager" ThreadingModel="both" />

<!-- CameraCaptureUI -->
<ActivatableClass ActivatableClassId="Microsoft.Windows.Media.Capture.CameraCaptureUI" ThreadingModel="both" />

</InProcessServer>
</Extension>
<Extension Category="windows.activatableClass.proxyStub">
Expand Down
8 changes: 7 additions & 1 deletion build/NuSpecs/WindowsAppSDK-Nuget-Native.WinRt.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
Expand Down Expand Up @@ -53,6 +53,12 @@
<Implementation Condition="'$(WindowsAppSDKFrameworkPackage)' != 'true'">$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.WindowsAppRuntime.dll</Implementation>
<IsWinMDFile>true</IsWinMDFile>
</Reference>
<Reference Include="Microsoft.Windows.Media.Capture.winmd"
Condition="Exists('$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.Media.Capture.winmd')">
<HintPath>$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.Media.Capture.winmd</HintPath>
<Implementation Condition="'$(WindowsAppSDKFrameworkPackage)' != 'true'">$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.WindowsAppRuntime.dll</Implementation>
<IsWinMDFile>true</IsWinMDFile>
</Reference>
</ItemGroup>

</Project>
10 changes: 9 additions & 1 deletion build/NuSpecs/WindowsAppSDK-Nuget-Native.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

Expand Down Expand Up @@ -75,6 +75,14 @@
</Reference>
</ItemGroup>

<ItemGroup>
<Reference Include="$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.Media.Capture.winmd"
Condition="Exists('$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.Media.Capture.winmd')">
<Private>false</Private>
<Implementation>Microsoft.WindowsAppRuntime.dll</Implementation>
</Reference>
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)..\Microsoft.WindowsAppSDK.BootstrapCommon.targets" />
<Import Project="$(MSBuildThisFileDirectory)WindowsAppSDK-Nuget-Native.Bootstrap.targets" Condition="'$(WindowsAppSdkBootstrapInitialize)' == 'true'"/>

Expand Down
1 change: 1 addition & 0 deletions dev/Common/Common.vcxitems
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<ClInclude Include="$(MSBuildThisFileDirectory)Microsoft.Utf8.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)NotificationTelemetryHelper.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)Security.IntegrityLevel.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)TelemetryHelper.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)WindowsAppRuntime.SelfContained.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)WindowsAppRuntime.VersionInfo.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)winrt_WindowsAppRuntime.h" />
Expand Down
3 changes: 3 additions & 0 deletions dev/Common/Common.vcxitems.filters
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<ClInclude Include="$(MSBuildThisFileDirectory)winrt_WindowsAppRuntime.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)TelemetryHelper.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MSBuildThisFileDirectory)WindowsAppRuntime.SelfContained.cpp">
Expand Down
48 changes: 48 additions & 0 deletions dev/Common/TelemetryHelper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.
#pragma once
class TelemetryHelper
{
public:
TelemetryHelper()
Saharsh979 marked this conversation as resolved.
Show resolved Hide resolved
: m_isPackagedApp(AppModel::Identity::IsPackagedProcess()),
m_appName(m_isPackagedApp ? GetAppNamePackaged() : GetAppNameUnpackaged())
{
}

inline bool IsPackagedApp() const
{
return m_isPackagedApp;
}

inline const std::wstring& GetAppName() const
{
return m_appName;
}

private:
const bool m_isPackagedApp{ false };
const std::wstring m_appName;

std::wstring GetAppNamePackaged() const
{
wchar_t appUserModelId[APPLICATION_USER_MODEL_ID_MAX_LENGTH]{};
UINT32 appUserModelIdSize{ ARRAYSIZE(appUserModelId) };
THROW_IF_WIN32_ERROR(::GetCurrentApplicationUserModelId(&appUserModelIdSize, appUserModelId));
return appUserModelId;
}

std::wstring CensorFilePath(const std::wstring& filepath) const
{
return { !PathIsFileSpecW(filepath.c_str()) ? PathFindFileNameW(filepath.c_str()) : filepath };
}

std::wstring GetAppNameUnpackaged() const
{
std::wstring appName;
wil::unique_cotaskmem_string processName;
THROW_IF_FAILED(wil::GetModuleFileNameExW(GetCurrentProcess(), nullptr, processName));
return CensorFilePath(processName.get());
}
};

Loading
Loading