winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

PortableARPEntry.h (1816B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #pragma once
      4 #include <winget/Registry.h>
      5 #include "Manifest.h"
      6 
      7 namespace AppInstaller::Registry::Portable
      8 {
      9     enum class PortableValueName
     10     {
     11         DisplayName,
     12         DisplayVersion,
     13         HelpLink,
     14         InstallDate,
     15         InstallDirectoryCreated,
     16         InstallLocation,
     17         PortableSymlinkFullPath,
     18         PortableTargetFullPath,
     19         Publisher,
     20         SHA256,
     21         URLInfoAbout,
     22         UninstallString,
     23         WinGetInstallerType,
     24         WinGetPackageIdentifier,
     25         WinGetSourceIdentifier,
     26         InstallDirectoryAddedToPath,
     27     };
     28 
     29     std::wstring_view ToString(PortableValueName valueName);
     30 
     31     struct PortableARPEntry : Registry::Key
     32     {
     33         PortableARPEntry(Manifest::ScopeEnum scope, Utility::Architecture arch, const std::string& productCode);
     34 
     35         std::optional<Value> operator[](PortableValueName valueName) const;
     36 
     37         bool Exists() { return m_exists; }
     38 
     39         void SetValue(PortableValueName valueName, const std::wstring& value);
     40         void SetValue(PortableValueName valueName, const std::string_view& value);
     41         void SetValue(PortableValueName valueName, bool& value);
     42 
     43         void Delete();
     44 
     45         Registry::Key GetKey() { return m_key; };
     46         Manifest::ScopeEnum GetScope() { return m_scope; };
     47         Utility::Architecture GetArchitecture() { return m_arch; };
     48         std::string GetProductCode() { return m_productCode; };
     49 
     50     private:
     51         bool m_exists = false;
     52         std::string m_productCode;
     53         Key m_key;
     54         HKEY m_root;
     55         std::wstring m_subKey;
     56         DWORD m_samDesired;
     57         Manifest::ScopeEnum m_scope;
     58         Utility::Architecture m_arch;
     59     };
     60 
     61 }