mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
[Registry Preview] Update value parsing for split hex values (#25559)
* Update value parsing for split hex values * Fixing spelling typo in comments
This commit is contained in:
@@ -318,7 +318,7 @@ namespace RegistryPreview
|
|||||||
}
|
}
|
||||||
else if (value.StartsWith("hex(2):", StringComparison.InvariantCultureIgnoreCase))
|
else if (value.StartsWith("hex(2):", StringComparison.InvariantCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
registryValue.Type = "REG_EXAND_SZ";
|
registryValue.Type = "REG_EXPAND_SZ";
|
||||||
value = value.Replace("hex(2):", string.Empty);
|
value = value.Replace("hex(2):", string.Empty);
|
||||||
}
|
}
|
||||||
else if (value.StartsWith("hex(7):", StringComparison.InvariantCultureIgnoreCase))
|
else if (value.StartsWith("hex(7):", StringComparison.InvariantCultureIgnoreCase))
|
||||||
@@ -327,11 +327,34 @@ namespace RegistryPreview
|
|||||||
value = value.Replace("hex(7):", string.Empty);
|
value = value.Replace("hex(7):", string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse for the case where a \ is added immediately after hex is declared
|
||||||
|
switch (registryValue.Type)
|
||||||
|
{
|
||||||
|
case "REG_QWORD":
|
||||||
|
case "REG_BINARY":
|
||||||
|
case "REG_EXPAND_SZ":
|
||||||
|
case "REG_MULTI_SZ":
|
||||||
|
if (value == @"\")
|
||||||
|
{
|
||||||
|
// pad the value, so the parsing below is triggered
|
||||||
|
value = @",\";
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// If the end of a decimal line ends in a \ then you have to keep
|
// If the end of a decimal line ends in a \ then you have to keep
|
||||||
// reading the block as a single value!
|
// reading the block as a single value!
|
||||||
while (value.EndsWith(@",\", StringComparison.InvariantCulture))
|
while (value.EndsWith(@",\", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
value = value.TrimEnd('\\');
|
value = value.TrimEnd('\\');
|
||||||
|
|
||||||
|
// checking for a "blank" hex value so we can skip t
|
||||||
|
if (value == @",")
|
||||||
|
{
|
||||||
|
value = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
if (index >= registryLines.Length)
|
if (index >= registryLines.Length)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user