mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
This reverts commit c651a4b36e.
This commit is contained in:
@@ -50,8 +50,8 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
||||
|
||||
var querySplit = query.Split(QuerySplitCharacter);
|
||||
|
||||
queryKey = querySplit.FirstOrDefault() ?? string.Empty;
|
||||
queryValueName = querySplit.LastOrDefault() ?? string.Empty;
|
||||
queryKey = querySplit.FirstOrDefault();
|
||||
queryValueName = querySplit.LastOrDefault();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,8 +51,9 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
||||
return (null, string.Empty);
|
||||
}
|
||||
|
||||
var baseKey = query.Split('\\').FirstOrDefault() ?? string.Empty;
|
||||
var baseKey = query.Split('\\').FirstOrDefault();
|
||||
var subKey = query.Replace(baseKey, string.Empty, StringComparison.InvariantCultureIgnoreCase).TrimStart('\\');
|
||||
|
||||
var baseKeyResult = _baseKeys
|
||||
.Where(found => found.Key.StartsWith(baseKey, StringComparison.InvariantCultureIgnoreCase))
|
||||
.Select(found => found.Value)
|
||||
@@ -99,7 +100,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
||||
|
||||
do
|
||||
{
|
||||
result = FindSubKey(subKey, subKeysNames.ElementAtOrDefault(index) ?? string.Empty);
|
||||
result = FindSubKey(subKey, subKeysNames.ElementAtOrDefault(index));
|
||||
|
||||
if (result.Count == 0)
|
||||
{
|
||||
@@ -167,22 +168,13 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
||||
|
||||
if (string.Equals(subKey, searchSubKey, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
var key = parentKey.OpenSubKey(subKey, RegistryKeyPermissionCheck.ReadSubTree);
|
||||
if (key != null)
|
||||
{
|
||||
list.Add(new RegistryEntry(key));
|
||||
}
|
||||
|
||||
list.Add(new RegistryEntry(parentKey.OpenSubKey(subKey, RegistryKeyPermissionCheck.ReadSubTree)));
|
||||
return list;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var key = parentKey.OpenSubKey(subKey, RegistryKeyPermissionCheck.ReadSubTree);
|
||||
if (key != null)
|
||||
{
|
||||
list.Add(new RegistryEntry(key));
|
||||
}
|
||||
list.Add(new RegistryEntry(parentKey.OpenSubKey(subKey, RegistryKeyPermissionCheck.ReadSubTree)));
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
||||
return new List<Result>(0);
|
||||
}
|
||||
|
||||
ICollection<KeyValuePair<string, object?>> valueList = new List<KeyValuePair<string, object?>>(key.ValueCount);
|
||||
ICollection<KeyValuePair<string, object>> valueList = new List<KeyValuePair<string, object>>(key.ValueCount);
|
||||
|
||||
var resultList = new List<Result>();
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
||||
if (!string.IsNullOrEmpty(searchValue))
|
||||
{
|
||||
var filteredValueName = valueList.Where(found => found.Key.Contains(searchValue, StringComparison.InvariantCultureIgnoreCase));
|
||||
var filteredValueList = valueList.Where(found => found.Value?.ToString()?.Contains(searchValue, StringComparison.InvariantCultureIgnoreCase) ?? false);
|
||||
var filteredValueList = valueList.Where(found => found.Value.ToString()?.Contains(searchValue, StringComparison.InvariantCultureIgnoreCase) ?? false);
|
||||
|
||||
valueList = filteredValueName.Concat(filteredValueList).Distinct().ToList();
|
||||
}
|
||||
@@ -196,7 +196,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
||||
/// <param name="key">The registry key for the tool-tip</param>
|
||||
/// <param name="valueEntry">The value name and value of the registry value</param>
|
||||
/// <returns>A tool-tip text</returns>
|
||||
private static string GetToolTipTextForRegistryValue(RegistryKey key, KeyValuePair<string, object?> valueEntry)
|
||||
private static string GetToolTipTextForRegistryValue(RegistryKey key, KeyValuePair<string, object> valueEntry)
|
||||
{
|
||||
return $"{Resources.KeyName}\t{key.Name}{Environment.NewLine}"
|
||||
+ $"{Resources.Name}\t{valueEntry.Key}{Environment.NewLine}"
|
||||
@@ -210,7 +210,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
||||
/// <param name="key">The registry key for the sub-title</param>
|
||||
/// <param name="valueEntry">The value name and value of the registry value</param>
|
||||
/// <returns>A sub-title text</returns>
|
||||
private static string GetSubTileForRegistryValue(RegistryKey key, KeyValuePair<string, object?> valueEntry)
|
||||
private static string GetSubTileForRegistryValue(RegistryKey key, KeyValuePair<string, object> valueEntry)
|
||||
{
|
||||
return $"{Resources.Type} {ValueHelper.GetType(key, valueEntry.Key)}"
|
||||
+ $" - {Resources.Value} {ValueHelper.GetValue(key, valueEntry.Key, 50)}";
|
||||
|
||||
@@ -25,13 +25,11 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
||||
{
|
||||
var unformattedValue = key.GetValue(valueName);
|
||||
|
||||
var unformattedValueInt = unformattedValue != null ? (uint)(int)unformattedValue : 0;
|
||||
var unformattedValueLong = unformattedValue != null ? (ulong)(long)unformattedValue : 0;
|
||||
var valueData = key.GetValueKind(valueName) switch
|
||||
{
|
||||
RegistryValueKind.DWord => $"0x{unformattedValue:X8} ({unformattedValueInt})",
|
||||
RegistryValueKind.QWord => $"0x{unformattedValue:X16} ({unformattedValueLong})",
|
||||
RegistryValueKind.Binary => (unformattedValue as byte[] ?? Array.Empty<byte>()).Aggregate(string.Empty, (current, singleByte) => $"{current} {singleByte:X2}"),
|
||||
RegistryValueKind.DWord => $"0x{unformattedValue:X8} ({(uint)(int)unformattedValue})",
|
||||
RegistryValueKind.QWord => $"0x{unformattedValue:X16} ({(ulong)(long)unformattedValue})",
|
||||
RegistryValueKind.Binary => (unformattedValue as byte[]).Aggregate(string.Empty, (current, singleByte) => $"{current} {singleByte:X2}"),
|
||||
_ => $"{unformattedValue}",
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user