PackageInstallerInfo.cpp (2332B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #include "pch.h" 4 #include "PackageInstallerInfo.h" 5 #include "PackageInstallerInfo.g.cpp" 6 #include "AuthenticationInfo.h" 7 #include "Converters.h" 8 #include <wil\cppwinrt_wrl.h> 9 10 namespace winrt::Microsoft::Management::Deployment::implementation 11 { 12 void PackageInstallerInfo::Initialize(const ::AppInstaller::Manifest::ManifestInstaller& manifestInstaller) 13 { 14 m_manifestInstaller = manifestInstaller; 15 } 16 winrt::Microsoft::Management::Deployment::PackageInstallerType PackageInstallerInfo::InstallerType() 17 { 18 return GetDeploymentInstallerType(m_manifestInstaller.BaseInstallerType); 19 } 20 winrt::Microsoft::Management::Deployment::PackageInstallerType PackageInstallerInfo::NestedInstallerType() 21 { 22 return GetDeploymentInstallerType(m_manifestInstaller.NestedInstallerType); 23 } 24 winrt::Windows::System::ProcessorArchitecture PackageInstallerInfo::Architecture() 25 { 26 auto convertedArchitecture = GetWindowsSystemProcessorArchitecture(m_manifestInstaller.Arch); 27 return convertedArchitecture ? convertedArchitecture.value() : Windows::System::ProcessorArchitecture::Unknown; 28 } 29 winrt::Microsoft::Management::Deployment::PackageInstallerScope PackageInstallerInfo::Scope() 30 { 31 return GetDeploymentInstallerScope(m_manifestInstaller.Scope); 32 } 33 hstring PackageInstallerInfo::Locale() 34 { 35 return winrt::to_hstring(m_manifestInstaller.Locale); 36 } 37 winrt::Microsoft::Management::Deployment::ElevationRequirement PackageInstallerInfo::ElevationRequirement() 38 { 39 return GetDeploymentElevationRequirement(m_manifestInstaller.ElevationRequirement); 40 } 41 winrt::Microsoft::Management::Deployment::AuthenticationInfo PackageInstallerInfo::AuthenticationInfo() 42 { 43 std::call_once(m_authenticationInfoOnceFlag, 44 [&]() 45 { 46 auto authenticationInfo = winrt::make_self<wil::details::module_count_wrapper<winrt::Microsoft::Management::Deployment::implementation::AuthenticationInfo>>(); 47 authenticationInfo->Initialize(m_manifestInstaller.AuthInfo); 48 m_authenticationInfo = *authenticationInfo; 49 }); 50 return m_authenticationInfo; 51 } 52 }