mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
[PowerToys Run] Update to net5 (#12434)
* [Setup] Add support for installing both dotnet 3 and 5 (#12306) * [PowerToys Run] Update to net5 (#12286) * Change targets of projects * Update Microsoft.Toolkit.Uwp.Notifications, changed TargetFramework for PowerLauncher project in order to resolve an issue with ModernWpf * Specify windows version in order to fix build errors * Fixed suppressed warnings * Updated sdk * Removed usage of obsolete GlobalAssemblyCache * Removed obsolete DesktopNotificationManagerCompat * Update nuget versions * Update installer * [PowerToys Run] Obsolete APIs and warnings introduced in .net5 (#12423) * Change targets of projects * Update Microsoft.Toolkit.Uwp.Notifications, changed TargetFramework for PowerLauncher project in order to resolve an issue with ModernWpf * Fixed suppressed warnings * Removed obsolete DesktopNotificationManagerCompat * Get rid of binary formatter * Update tests * Don't include new image cache file to the report * There's no need to call IsOwner as it doesn't make sense * Fix different nullability exception * Exclude extra dlls from tests Co-authored-by: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com>
This commit is contained in:
@@ -50,8 +50,8 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
||||
|
||||
var querySplit = query.Split(QuerySplitCharacter);
|
||||
|
||||
queryKey = querySplit.FirstOrDefault();
|
||||
queryValueName = querySplit.LastOrDefault();
|
||||
queryKey = querySplit.FirstOrDefault() ?? string.Empty;
|
||||
queryValueName = querySplit.LastOrDefault() ?? string.Empty;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,9 +51,8 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
||||
return (null, string.Empty);
|
||||
}
|
||||
|
||||
var baseKey = query.Split('\\').FirstOrDefault();
|
||||
var baseKey = query.Split('\\').FirstOrDefault() ?? string.Empty;
|
||||
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)
|
||||
@@ -100,7 +99,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
||||
|
||||
do
|
||||
{
|
||||
result = FindSubKey(subKey, subKeysNames.ElementAtOrDefault(index));
|
||||
result = FindSubKey(subKey, subKeysNames.ElementAtOrDefault(index) ?? string.Empty);
|
||||
|
||||
if (result.Count == 0)
|
||||
{
|
||||
@@ -168,13 +167,22 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
||||
|
||||
if (string.Equals(subKey, searchSubKey, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
list.Add(new RegistryEntry(parentKey.OpenSubKey(subKey, RegistryKeyPermissionCheck.ReadSubTree)));
|
||||
var key = parentKey.OpenSubKey(subKey, RegistryKeyPermissionCheck.ReadSubTree);
|
||||
if (key != null)
|
||||
{
|
||||
list.Add(new RegistryEntry(key));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
list.Add(new RegistryEntry(parentKey.OpenSubKey(subKey, RegistryKeyPermissionCheck.ReadSubTree)));
|
||||
var key = parentKey.OpenSubKey(subKey, RegistryKeyPermissionCheck.ReadSubTree);
|
||||
if (key != null)
|
||||
{
|
||||
list.Add(new RegistryEntry(key));
|
||||
}
|
||||
}
|
||||
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,11 +25,13 @@ 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} ({(uint)(int)unformattedValue})",
|
||||
RegistryValueKind.QWord => $"0x{unformattedValue:X16} ({(ulong)(long)unformattedValue})",
|
||||
RegistryValueKind.Binary => (unformattedValue as byte[]).Aggregate(string.Empty, (current, singleByte) => $"{current} {singleByte:X2}"),
|
||||
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}"),
|
||||
_ => $"{unformattedValue}",
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user