Skip to content

Commit

Permalink
More code clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
nefarius committed Aug 5, 2024
1 parent b7a4615 commit 1f6d510
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 28 deletions.
20 changes: 10 additions & 10 deletions src/models/ProductDetection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ namespace models
Invalid = -1
};

NLOHMANN_JSON_SERIALIZE_ENUM(
ProductVersionDetectionMethod,
{
{ProductVersionDetectionMethod::Invalid, nullptr},
{ProductVersionDetectionMethod::RegistryValue, magic_enum::enum_name(ProductVersionDetectionMethod::RegistryValue)},
{ProductVersionDetectionMethod::FileVersion, magic_enum::enum_name(ProductVersionDetectionMethod::FileVersion)},
{ProductVersionDetectionMethod::FileSize, magic_enum::enum_name(ProductVersionDetectionMethod::FileSize)},
{ProductVersionDetectionMethod::FileChecksum, magic_enum::enum_name(ProductVersionDetectionMethod::FileChecksum)},
{ProductVersionDetectionMethod::CustomExpression, magic_enum::enum_name(ProductVersionDetectionMethod::CustomExpression)},
})
using pvdm = ProductVersionDetectionMethod;

NLOHMANN_JSON_SERIALIZE_ENUM(ProductVersionDetectionMethod, {
{pvdm::Invalid, nullptr},
{pvdm::RegistryValue, magic_enum::enum_name(pvdm::RegistryValue)},
{pvdm::FileVersion, magic_enum::enum_name(pvdm::FileVersion)},
{pvdm::FileSize, magic_enum::enum_name(pvdm::FileSize)},
{pvdm::FileChecksum, magic_enum::enum_name(pvdm::FileChecksum)},
{pvdm::CustomExpression, magic_enum::enum_name(pvdm::CustomExpression)},
})

/**
* \brief Parameters for querying the registry.
Expand Down
25 changes: 12 additions & 13 deletions src/models/SignatureValidation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ namespace models
Invalid = -1
};

NLOHMANN_JSON_SERIALIZE_ENUM(SignatureComparisonPolicy,
{
{SignatureComparisonPolicy::Invalid, nullptr},
{SignatureComparisonPolicy::Relaxed,
magic_enum::enum_name(SignatureComparisonPolicy::Relaxed)},
{SignatureComparisonPolicy::Strict, magic_enum::enum_name(SignatureComparisonPolicy::Strict)},
using scp = SignatureComparisonPolicy;

NLOHMANN_JSON_SERIALIZE_ENUM(SignatureComparisonPolicy, {
{scp::Invalid, nullptr},
{scp::Relaxed, magic_enum::enum_name(scp::Relaxed)},
{scp::Strict, magic_enum::enum_name(scp::Strict)},
})

/**
Expand All @@ -32,13 +32,12 @@ namespace models
Invalid = -1
};

NLOHMANN_JSON_SERIALIZE_ENUM(SignatureVerificationStrategy,
{
{SignatureVerificationStrategy::Invalid, nullptr},
{SignatureVerificationStrategy::FromUpdaterBinary,
magic_enum::enum_name(SignatureVerificationStrategy::FromUpdaterBinary)},
{SignatureVerificationStrategy::FromConfiguration,
magic_enum::enum_name(SignatureVerificationStrategy::FromConfiguration)},
using svs = SignatureVerificationStrategy;

NLOHMANN_JSON_SERIALIZE_ENUM(SignatureVerificationStrategy, {
{svs::Invalid, nullptr},
{svs::FromUpdaterBinary, magic_enum::enum_name(svs::FromUpdaterBinary)},
{svs::FromConfiguration, magic_enum::enum_name(svs::FromConfiguration)},
})

/**
Expand Down
8 changes: 4 additions & 4 deletions src/models/UpdateRelease.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ namespace models
DeleteIfPresent,
};

using enum ZipExtractFileDisposition;
using zefd = ZipExtractFileDisposition;

NLOHMANN_JSON_SERIALIZE_ENUM(ZipExtractFileDisposition, {
{CreateIfAbsent, magic_enum::enum_name(CreateIfAbsent)},
{CreateOrReplace, magic_enum::enum_name(CreateOrReplace)},
{DeleteIfPresent, magic_enum::enum_name(DeleteIfPresent)}
{zefd::CreateIfAbsent, magic_enum::enum_name(zefd::CreateIfAbsent)},
{zefd::CreateOrReplace, magic_enum::enum_name(zefd::CreateOrReplace)},
{zefd::DeleteIfPresent, magic_enum::enum_name(zefd::DeleteIfPresent)}
})

/**
Expand Down
4 changes: 3 additions & 1 deletion vīcĭus.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=PSIGNATURE/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=PSPROG/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=PUBLISHERINFO/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=pvdm/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=regval/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ruda/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=runas/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -68,4 +69,5 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=winapi/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=windir/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=winprog/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Zabcdefghijklmnopqrstuvwxyz/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Zabcdefghijklmnopqrstuvwxyz/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=zefd/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

0 comments on commit 1f6d510

Please sign in to comment.