mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-27 23:19:13 +08:00
[PT Run] System plugin: Add IP and MAC (#17023)
* first test and changes * last changes * last changes * last changes * improve exception * fix spellings * spell fixes * search improvements, installer, tests, code cleanup * remove left-over * update dev docs * fix spelling * update namings * improve scoring * spell checker * dev docs * update images * update expect.txt for this pr
This commit is contained in:
parent
42ba008323
commit
4c067bb728
7
.github/actions/spell-check/expect.txt
vendored
7
.github/actions/spell-check/expect.txt
vendored
@ -453,6 +453,7 @@ dllhost
|
||||
dllmain
|
||||
dlls
|
||||
DNLEN
|
||||
Dns
|
||||
doctype
|
||||
DONOTROUND
|
||||
DONTVALIDATEPATH
|
||||
@ -629,6 +630,8 @@ gabime
|
||||
GAC
|
||||
gacutil
|
||||
GBarm
|
||||
Gbits
|
||||
Gbps
|
||||
GBs
|
||||
GCLP
|
||||
gcnew
|
||||
@ -1150,6 +1153,7 @@ Mato
|
||||
MAXIMIZEBOX
|
||||
MAXSHORTCUTSIZE
|
||||
maxversiontested
|
||||
Mbits
|
||||
MBs
|
||||
mdtext
|
||||
mdtxt
|
||||
@ -2083,6 +2087,7 @@ UNCPRIORITY
|
||||
undef
|
||||
UNDNAME
|
||||
unescape
|
||||
Unicast
|
||||
Unindent
|
||||
Uninitialize
|
||||
uninstall
|
||||
@ -2267,6 +2272,7 @@ WIXUI
|
||||
WKSG
|
||||
Wlkr
|
||||
wmain
|
||||
Wman
|
||||
WMKEYDOWN
|
||||
WMKEYUP
|
||||
wmp
|
||||
@ -2309,6 +2315,7 @@ WTSAT
|
||||
Wubi
|
||||
WVC
|
||||
Wwan
|
||||
Wwanpp
|
||||
xamarin
|
||||
XAttribute
|
||||
xbf
|
||||
|
4
.github/actions/spell-check/patterns.txt
vendored
4
.github/actions/spell-check/patterns.txt
vendored
@ -52,10 +52,14 @@ TestCase\("[^"]+"
|
||||
\[DataRow\("[0-9A-F]{6}", \d{3}.\d{1}, \d{3}.\d{1}, \d{3}.\d{1}\)\]
|
||||
\[DataRow\("[0-9A-F]{6}", "[BCGMRY]\d\d?", \d{3}, \d{3}\)\]
|
||||
|
||||
# version suffix <word>v#
|
||||
[Vv]\d+(?:\b|(?=[a-zA-Z_]))
|
||||
|
||||
# Windows paths
|
||||
\\native
|
||||
\\netcoreapp
|
||||
\\netstandard
|
||||
\\network
|
||||
\\notifications
|
||||
\\recyclebin
|
||||
\\Registry
|
||||
|
@ -15,6 +15,7 @@ Available commands:
|
||||
* Hibernate
|
||||
* Empty Recycle Bin
|
||||
* UEFI Firmware Settings (Only available on systems, that boot in UEFI mode.)
|
||||
* IP / MAC / Address => Show informations about network connections.
|
||||
|
||||
## Optional plugin settings
|
||||
|
||||
@ -24,6 +25,7 @@ Available commands:
|
||||
|--------------|-----------|------------|
|
||||
| `ConfirmSystemCommands` | `false` | Show a dialog to confirm system commands |
|
||||
| `LocalizeSystemCommands` | `true` | Use localized system commands instead of English ones |
|
||||
| `ReduceNetworkResultScore` | `true` | Reduce the priority of 'IP' and 'MAC' results to improve the order in the global results |
|
||||
|
||||
* The optional plugin settings are implemented via the [`ISettingProvider`](/src/modules/launcher/Wox.Plugin/ISettingProvider.cs) interface from `Wox.Plugin` project. All available settings for the plugin are defined in the [`Main`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Main.cs) class of the plugin.
|
||||
|
||||
@ -35,12 +37,43 @@ Available commands:
|
||||
|
||||
* While parsing, the plugin uses [`FuzzyMatch`](/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs) to get characters matching a result in the list.
|
||||
|
||||
### [`Commands.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/Commands.cs)
|
||||
- The [`Commands`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/Commands.cs) class contains the definition of all available commands/results.
|
||||
|
||||
### [`ResultHelper.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/ResultHelper.cs)
|
||||
- The [`ResultHelper`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/ResultHelper.cs) class contains methods for working with the results and some of the result features (tool tip, copy to clipboard, execute command).
|
||||
|
||||
### [`NetworkConnectionProperties.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/NetworkConnectionProperties.cs)
|
||||
- The [`NetworkConnectionProperties`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/NetworkConnectionProperties.cs) class contains methods to get the properties of a network interface/connection.
|
||||
- An instance of this class collects/provides all required informations about one connection/adapter.
|
||||
|
||||
### [`SystemPluginContext.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/SystemPluginContext.cs)
|
||||
- An instance of the class [`SystemPluginContext`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/SystemPluginContext.cs) contains/defines the context data of a system plugin result. We select the context menu based on the defined properties.
|
||||
- It is used for the `ContextData` property of the [`Wox.Plugin.Result`](/src/modules/launcher/Wox.Plugin/Result.cs).
|
||||
|
||||
|
||||
### UEFI command
|
||||
|
||||
* The UEFI command is only available on systems, that boot in UEFI mode.
|
||||
|
||||
* This is validated by checking the result of the method [`GetSystemFirmwareType`](/src/modules/launcher/Wox.Plugin/Common/Win32/Win32Helpers.cs), which uses the native method [`GetFirmwareType`](/src/modules/launcher/Wox.Plugin/Common/Win32/NativeMethods.cs) in `kernel32.dll`.
|
||||
|
||||
## Search
|
||||
|
||||
### Score
|
||||
|
||||
* [`CalculateSearchScore`](/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs) A match found near the beginning of a string is scored more than a match found near the end. A match is scored more if the characters in the patterns are closer to each other, while the score is lower if they are more spread out.
|
||||
* For network results (IP address and MAC address) the score is reduced by 25 percent.
|
||||
|
||||
### Network results on global queries
|
||||
- The network results (IP and MAC address) are only shown on global queries, if the search term starts with either IP, MAC or Address. (We compare case-insensitive.)
|
||||
|
||||
## [Unit Tests](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System.UnitTests)
|
||||
We have a [Unit Test project](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System.UnitTests) that executes various test to ensure that the plugin works as expected.
|
||||
|
||||
### [`ImageTests.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System.UnitTests/ImageTests.cs)
|
||||
- The [`ImageTests.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System.UnitTests/ImageTests.cs) class contains tests to validate that each result shows the expected and correct image.
|
||||
|
||||
### [`QueryTests.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System.UnitTests/QueryTests.cs)
|
||||
- The [`QueryTests.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System.UnitTests/QueryTests.cs) class contains tests to validate that the user gets the correct results when searching.
|
||||
|
||||
|
@ -88,7 +88,7 @@
|
||||
|
||||
<?define SystemComponentFiles=plugin.json;Microsoft.PowerToys.Run.Plugin.System.deps.json;Microsoft.PowerToys.Run.Plugin.System.dll?>
|
||||
|
||||
<?define SystemImagesComponentFiles=lock.dark.png;lock.light.png;logoff.dark.png;logoff.light.png;recyclebin.dark.png;recyclebin.light.png;restart.dark.png;restart.light.png;shutdown.dark.png;shutdown.light.png;sleep.dark.png;sleep.light.png;firmwareSettings.dark.png;firmwareSettings.light.png?>
|
||||
<?define SystemImagesComponentFiles=lock.dark.png;lock.light.png;logoff.dark.png;logoff.light.png;recyclebin.dark.png;recyclebin.light.png;restart.dark.png;restart.light.png;shutdown.dark.png;shutdown.light.png;sleep.dark.png;sleep.light.png;firmwareSettings.dark.png;firmwareSettings.light.png;networkAdapter.dark.png;networkAdapter.light.png?>
|
||||
|
||||
<?define TimeDateComponentFiles=Microsoft.PowerToys.Run.Plugin.TimeDate.deps.json;Microsoft.PowerToys.Run.Plugin.TimeDate.dll;plugin.json;PowerToys.ManagedTelemetry.dll?>
|
||||
|
||||
|
@ -28,6 +28,9 @@ namespace Microsoft.PowerToys.Run.Plugin.System.UnitTests
|
||||
[DataRow("hibernate", "Images\\sleep.dark.png")]
|
||||
[DataRow("empty recycle", "Images\\recyclebin.dark.png")]
|
||||
[DataRow("uefi firmware settings", "Images\\firmwareSettings.dark.png")]
|
||||
[DataRow("ip v4 addr", "Images\\networkAdapter.dark.png")]
|
||||
[DataRow("ip v6 addr", "Images\\networkAdapter.dark.png")]
|
||||
[DataRow("mac addr", "Images\\networkAdapter.dark.png")]
|
||||
public void IconThemeDarkTest(string typedString, string expectedResult)
|
||||
{
|
||||
// Setup
|
||||
@ -52,6 +55,9 @@ namespace Microsoft.PowerToys.Run.Plugin.System.UnitTests
|
||||
[DataRow("hibernate", "Images\\sleep.light.png")]
|
||||
[DataRow("empty recycle", "Images\\recyclebin.light.png")]
|
||||
[DataRow("uefi firmware settings", "Images\\firmwareSettings.light.png")]
|
||||
[DataRow("ipv4 addr", "Images\\networkAdapter.light.png")]
|
||||
[DataRow("ipv6 addr", "Images\\networkAdapter.light.png")]
|
||||
[DataRow("mac addr", "Images\\networkAdapter.light.png")]
|
||||
public void IconThemeLightTest(string typedString, string expectedResult)
|
||||
{
|
||||
// Setup
|
||||
|
@ -2,6 +2,7 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
@ -27,6 +28,11 @@ namespace Microsoft.PowerToys.Run.Plugin.System.UnitTests
|
||||
[DataRow("sleep", "Put computer to sleep")]
|
||||
[DataRow("hibernate", "Hibernate computer")]
|
||||
[DataRow("empty recycle", "Empty Recycle Bin")]
|
||||
[DataRow("ip", "IPv4 address of")]
|
||||
[DataRow("address", "IPv4 address of")] // searching for address should show ipv4 first
|
||||
[DataRow("ip v4", "IPv4 address of")]
|
||||
[DataRow("ip v6", "IPv6 address of")]
|
||||
[DataRow("mac addr", "MAC address of")]
|
||||
public void EnvironmentIndependentQueryResults(string typedString, string expectedResult)
|
||||
{
|
||||
// Setup
|
||||
@ -37,7 +43,7 @@ namespace Microsoft.PowerToys.Run.Plugin.System.UnitTests
|
||||
var result = main.Object.Query(expectedQuery).FirstOrDefault().SubTitle;
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
Assert.IsTrue(result.StartsWith(expectedResult, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -0,0 +1,205 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using Microsoft.PowerToys.Run.Plugin.System.Properties;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Plugin;
|
||||
using Wox.Plugin.Common.Win32;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
namespace Microsoft.PowerToys.Run.Plugin.System.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// This class holds all available results
|
||||
/// </summary>
|
||||
internal static class Commands
|
||||
{
|
||||
internal const int EWXLOGOFF = 0x00000000;
|
||||
internal const int EWXSHUTDOWN = 0x00000001;
|
||||
internal const int EWXREBOOT = 0x00000002;
|
||||
internal const int EWXFORCE = 0x00000004;
|
||||
internal const int EWXPOWEROFF = 0x00000008;
|
||||
internal const int EWXFORCEIFHUNG = 0x00000010;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list with all system command results
|
||||
/// </summary>
|
||||
/// <param name="isUefi">Value indicating if the system is booted in uefi mode</param>
|
||||
/// <param name="iconTheme">The current theme to use for the icons</param>
|
||||
/// <param name="culture">The culture to use for the result's title and sub title</param>
|
||||
/// <param name="confirmCommands">A value indicating if the user should confirm the system commands</param>
|
||||
/// <returns>A list of all results</returns>
|
||||
internal static List<Result> GetSystemCommands(bool isUefi, string iconTheme, CultureInfo culture, bool confirmCommands)
|
||||
{
|
||||
var results = new List<Result>();
|
||||
results.AddRange(new[]
|
||||
{
|
||||
new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString("Microsoft_plugin_sys_shutdown_computer", culture),
|
||||
SubTitle = Resources.ResourceManager.GetString("Microsoft_plugin_sys_shutdown_computer_description", culture),
|
||||
IcoPath = $"Images\\shutdown.{iconTheme}.png",
|
||||
Action = c =>
|
||||
{
|
||||
return ResultHelper.ExecuteCommand(confirmCommands, Resources.Microsoft_plugin_sys_shutdown_computer_confirmation, () => Helper.OpenInShell("shutdown", "/s /hybrid /t 0"));
|
||||
},
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString("Microsoft_plugin_sys_restart_computer", culture),
|
||||
SubTitle = Resources.ResourceManager.GetString("Microsoft_plugin_sys_restart_computer_description", culture),
|
||||
IcoPath = $"Images\\restart.{iconTheme}.png",
|
||||
Action = c =>
|
||||
{
|
||||
return ResultHelper.ExecuteCommand(confirmCommands, Resources.Microsoft_plugin_sys_restart_computer_confirmation, () => Helper.OpenInShell("shutdown", "/r /t 0"));
|
||||
},
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString("Microsoft_plugin_sys_sign_out", culture),
|
||||
SubTitle = Resources.ResourceManager.GetString("Microsoft_plugin_sys_sign_out_description", culture),
|
||||
IcoPath = $"Images\\logoff.{iconTheme}.png",
|
||||
Action = c =>
|
||||
{
|
||||
return ResultHelper.ExecuteCommand(confirmCommands, Resources.Microsoft_plugin_sys_sign_out_confirmation, () => NativeMethods.ExitWindowsEx(EWXLOGOFF, 0));
|
||||
},
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString("Microsoft_plugin_sys_lock", culture),
|
||||
SubTitle = Resources.ResourceManager.GetString("Microsoft_plugin_sys_lock_description", culture),
|
||||
IcoPath = $"Images\\lock.{iconTheme}.png",
|
||||
Action = c =>
|
||||
{
|
||||
return ResultHelper.ExecuteCommand(confirmCommands, Resources.Microsoft_plugin_sys_lock_confirmation, () => NativeMethods.LockWorkStation());
|
||||
},
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString("Microsoft_plugin_sys_sleep", culture),
|
||||
SubTitle = Resources.ResourceManager.GetString("Microsoft_plugin_sys_sleep_description", culture),
|
||||
IcoPath = $"Images\\sleep.{iconTheme}.png",
|
||||
Action = c =>
|
||||
{
|
||||
return ResultHelper.ExecuteCommand(confirmCommands, Resources.Microsoft_plugin_sys_sleep_confirmation, () => NativeMethods.SetSuspendState(false, true, true));
|
||||
},
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString("Microsoft_plugin_sys_hibernate", culture),
|
||||
SubTitle = Resources.ResourceManager.GetString("Microsoft_plugin_sys_hibernate_description", culture),
|
||||
IcoPath = $"Images\\sleep.{iconTheme}.png", // Icon change needed
|
||||
Action = c =>
|
||||
{
|
||||
return ResultHelper.ExecuteCommand(confirmCommands, Resources.Microsoft_plugin_sys_hibernate_confirmation, () => NativeMethods.SetSuspendState(true, true, true));
|
||||
},
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString("Microsoft_plugin_sys_emptyrecyclebin", culture),
|
||||
SubTitle = Resources.ResourceManager.GetString("Microsoft_plugin_sys_emptyrecyclebin_description", culture),
|
||||
IcoPath = $"Images\\recyclebin.{iconTheme}.png",
|
||||
Action = c =>
|
||||
{
|
||||
// http://www.pinvoke.net/default.aspx/shell32/SHEmptyRecycleBin.html
|
||||
// FYI, couldn't find documentation for this but if the recycle bin is already empty, it will return -2147418113 (0x8000FFFF (E_UNEXPECTED))
|
||||
// 0 for nothing
|
||||
var result = NativeMethods.SHEmptyRecycleBin(new WindowInteropHelper(Application.Current.MainWindow).Handle, 0);
|
||||
if (result != (uint)HRESULT.S_OK && result != 0x8000FFFF)
|
||||
{
|
||||
var name = "Plugin: " + Resources.Microsoft_plugin_sys_plugin_name;
|
||||
var message = $"Error emptying recycle bin, error code: {result}\n" +
|
||||
"please refer to https://msdn.microsoft.com/en-us/library/windows/desktop/aa378137";
|
||||
Log.Error(message, typeof(Commands));
|
||||
_ = MessageBox.Show(message, name);
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// UEFI command/result. It is only available on systems booted in UEFI mode.
|
||||
if (isUefi)
|
||||
{
|
||||
results.Add(new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString("Microsoft_plugin_sys_uefi", culture),
|
||||
SubTitle = Resources.ResourceManager.GetString("Microsoft_plugin_sys_uefi_description", culture),
|
||||
IcoPath = $"Images\\firmwareSettings.{iconTheme}.png",
|
||||
Action = c =>
|
||||
{
|
||||
return ResultHelper.ExecuteCommand(confirmCommands, Resources.Microsoft_plugin_sys_uefi_confirmation, () => Helper.OpenInShell("shutdown", "/r /fw /t 0", null, true));
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of all ip and mac results
|
||||
/// </summary>
|
||||
/// <param name="iconTheme">The theme to use for the icons</param>
|
||||
/// <param name="culture">The culture to use for the result's title and sub title</param>
|
||||
/// <returns>The list of available results</returns>
|
||||
internal static List<Result> GetNetworkConnectionResults(string iconTheme, CultureInfo culture)
|
||||
{
|
||||
var results = new List<Result>();
|
||||
|
||||
var interfaces = NetworkInterface.GetAllNetworkInterfaces().Where(x => x.NetworkInterfaceType != NetworkInterfaceType.Loopback && x.GetPhysicalAddress() != null);
|
||||
foreach (NetworkInterface i in interfaces)
|
||||
{
|
||||
NetworkConnectionProperties intInfo = new NetworkConnectionProperties(i);
|
||||
|
||||
if (!string.IsNullOrEmpty(intInfo.IPv4))
|
||||
{
|
||||
results.Add(new Result()
|
||||
{
|
||||
Title = intInfo.IPv4,
|
||||
SubTitle = string.Format(CultureInfo.InvariantCulture, Resources.ResourceManager.GetString("Microsoft_plugin_sys_ip4_description", culture), intInfo.ConnectionName) + " - " + Resources.ResourceManager.GetString("Microsoft_plugin_sys_SubTitle_CopyHint", culture),
|
||||
IcoPath = $"Images\\networkAdapter.{iconTheme}.png",
|
||||
ToolTipData = new ToolTipData(Resources.Microsoft_plugin_sys_ConnectionDetails, intInfo.GetConnectionDetails()),
|
||||
ContextData = new SystemPluginContext { Type = ResultContextType.NetworkAdapterInfo, Data = intInfo.GetConnectionDetails() },
|
||||
Action = _ => ResultHelper.CopyToClipBoard(intInfo.IPv4),
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(intInfo.IPv6Primary))
|
||||
{
|
||||
results.Add(new Result()
|
||||
{
|
||||
Title = intInfo.IPv6Primary,
|
||||
SubTitle = string.Format(CultureInfo.InvariantCulture, Resources.ResourceManager.GetString("Microsoft_plugin_sys_ip6_description", culture), intInfo.ConnectionName) + " - " + Resources.ResourceManager.GetString("Microsoft_plugin_sys_SubTitle_CopyHint", culture),
|
||||
IcoPath = $"Images\\networkAdapter.{iconTheme}.png",
|
||||
ToolTipData = new ToolTipData(Resources.Microsoft_plugin_sys_ConnectionDetails, intInfo.GetConnectionDetails()),
|
||||
ContextData = new SystemPluginContext { Type = ResultContextType.NetworkAdapterInfo, Data = intInfo.GetConnectionDetails() },
|
||||
Action = _ => ResultHelper.CopyToClipBoard(intInfo.IPv6Primary),
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(intInfo.PhysicalAddress))
|
||||
{
|
||||
results.Add(new Result()
|
||||
{
|
||||
Title = intInfo.PhysicalAddress,
|
||||
SubTitle = string.Format(CultureInfo.InvariantCulture, Resources.ResourceManager.GetString("Microsoft_plugin_sys_mac_description", culture), intInfo.Adapter, intInfo.ConnectionName) + " - " + Resources.ResourceManager.GetString("Microsoft_plugin_sys_SubTitle_CopyHint", culture),
|
||||
IcoPath = $"Images\\networkAdapter.{iconTheme}.png",
|
||||
ToolTipData = new ToolTipData(Resources.Microsoft_plugin_sys_AdapterDetails, intInfo.GetAdapterDetails()),
|
||||
ContextData = new SystemPluginContext { Type = ResultContextType.NetworkAdapterInfo, Data = intInfo.GetAdapterDetails() },
|
||||
Action = _ => ResultHelper.CopyToClipBoard(intInfo.PhysicalAddress),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,305 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using Microsoft.PowerToys.Run.Plugin.System.Properties;
|
||||
|
||||
namespace Microsoft.PowerToys.Run.Plugin.System.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents the informations for a network connection/interface
|
||||
/// </summary>
|
||||
internal class NetworkConnectionProperties
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the name of the adapter
|
||||
/// </summary>
|
||||
internal string Adapter { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the physical address (MAC) of the adapter
|
||||
/// </summary>
|
||||
internal string PhysicalAddress { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating the interface type
|
||||
/// </summary>
|
||||
internal NetworkInterfaceType Type { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the speed of the adapter as unformatted value (Static information form the adapter device)
|
||||
/// </summary>
|
||||
internal long Speed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating the operational state of the adapter
|
||||
/// </summary>
|
||||
internal OperationalStatus State { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the network connection
|
||||
/// </summary>
|
||||
internal string ConnectionName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a string with the suffix of the connection
|
||||
/// </summary>
|
||||
internal string Suffix { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the IPv4 address
|
||||
/// </summary>
|
||||
internal string IPv4 { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the IPv4 subnet mask
|
||||
/// </summary>
|
||||
internal string IPv4Mask { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the primarily used IPv6 address
|
||||
/// </summary>
|
||||
internal string IPv6Primary { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the global IPv6 address
|
||||
/// </summary>
|
||||
internal string IPv6Global { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the temporary IPv6 address
|
||||
/// </summary>
|
||||
internal string IPv6Temporary { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the link local IPv6 address
|
||||
/// </summary>
|
||||
internal string IPv6LinkLocal { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the site local IPv6 address
|
||||
/// </summary>
|
||||
internal string IPv6SiteLocal { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique local IPv6 address
|
||||
/// </summary>
|
||||
internal string IPv6UniqueLocal { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of gateway IPs as string
|
||||
/// </summary>
|
||||
internal List<string> Gateways { get; private set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of DHCP server IPs as string
|
||||
/// </summary>
|
||||
internal List<string> DhcpServers { get; private set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of DNS server IPs as string
|
||||
/// </summary>
|
||||
internal List<string> DnsServers { get; private set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of WINS server IPs as string
|
||||
/// </summary>
|
||||
internal List<string> WinsServers { get; private set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NetworkConnectionProperties"/> class.
|
||||
/// </summary>
|
||||
/// <param name="networkInterface">Network interface of the connection</param>
|
||||
internal NetworkConnectionProperties(NetworkInterface networkInterface)
|
||||
{
|
||||
// Setting adapter properties
|
||||
Adapter = networkInterface.Description;
|
||||
PhysicalAddress = networkInterface.GetPhysicalAddress().ToString();
|
||||
Type = networkInterface.NetworkInterfaceType;
|
||||
Speed = networkInterface.Speed;
|
||||
State = networkInterface.OperationalStatus;
|
||||
|
||||
// Connection properties
|
||||
ConnectionName = networkInterface.Name;
|
||||
if (State == OperationalStatus.Up)
|
||||
{
|
||||
Suffix = networkInterface.GetIPProperties().DnsSuffix;
|
||||
SetIpProperties(networkInterface.GetIPProperties());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a formatted string with the adapter details
|
||||
/// </summary>
|
||||
/// <returns>String with the details</returns>
|
||||
internal string GetAdapterDetails()
|
||||
{
|
||||
return $"{Resources.Microsoft_plugin_sys_AdapterName}: {Adapter}" +
|
||||
$"\n{Resources.Microsoft_plugin_sys_PhysicalAddress}: {PhysicalAddress}" +
|
||||
$"\n{Resources.Microsoft_plugin_sys_Speed}: {GetFormattedSpeedValue(Speed)}" +
|
||||
$"\n{Resources.Microsoft_plugin_sys_Type}: {GetAdapterTypeAsString(Type)}" +
|
||||
$"\n{Resources.Microsoft_plugin_sys_State}: " + (State == OperationalStatus.Up ? Resources.Microsoft_plugin_sys_Connected : Resources.Microsoft_plugin_sys_Disconnected) +
|
||||
$"\n{Resources.Microsoft_plugin_sys_ConnectionName}: {ConnectionName}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a formatted string with the connection details
|
||||
/// </summary>
|
||||
/// <returns>String with the details</returns>
|
||||
internal string GetConnectionDetails()
|
||||
{
|
||||
return $"{Resources.Microsoft_plugin_sys_ConnectionName}: {ConnectionName}" +
|
||||
$"\n{Resources.Microsoft_plugin_sys_State}: " + (State == OperationalStatus.Up ? Resources.Microsoft_plugin_sys_Connected : Resources.Microsoft_plugin_sys_Disconnected) +
|
||||
$"\n{Resources.Microsoft_plugin_sys_Type}: {GetAdapterTypeAsString(Type)}" +
|
||||
$"\n{Resources.Microsoft_plugin_sys_Suffix}: {Suffix}" +
|
||||
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Ip4Address}: ", IPv4) +
|
||||
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Ip4SubnetMask}: ", IPv4Mask) +
|
||||
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Ip6Address}:\n\t", IPv6Global) +
|
||||
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Ip6Temp}:\n\t", IPv6Temporary) +
|
||||
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Ip6Link}:\n\t", IPv6LinkLocal) +
|
||||
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Ip6Site}:\n\t", IPv6SiteLocal) +
|
||||
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Ip6Unique}:\n\t", IPv6UniqueLocal) +
|
||||
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Gateways}:\n\t", Gateways) +
|
||||
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Dhcp}:\n\t", DhcpServers) +
|
||||
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Dns}:\n\t", DnsServers) +
|
||||
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Wins}:\n\t", WinsServers) +
|
||||
$"\n\n{Resources.Microsoft_plugin_sys_AdapterName}: {Adapter}" +
|
||||
$"\n{Resources.Microsoft_plugin_sys_PhysicalAddress}: {PhysicalAddress}" +
|
||||
$"\n{Resources.Microsoft_plugin_sys_Speed}: {GetFormattedSpeedValue(Speed)}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the ip address properties of the <see cref="NetworkConnectionProperties"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="properties">Element of the type <see cref="IPInterfaceProperties"/>.</param>
|
||||
private void SetIpProperties(IPInterfaceProperties properties)
|
||||
{
|
||||
var ipList = properties.UnicastAddresses;
|
||||
|
||||
foreach (var ip in ipList)
|
||||
{
|
||||
if (ip.Address.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
IPv4 = ip.Address.ToString();
|
||||
IPv4Mask = ip.IPv4Mask.ToString();
|
||||
}
|
||||
else if (ip.Address.AddressFamily == AddressFamily.InterNetworkV6)
|
||||
{
|
||||
if (string.IsNullOrEmpty(IPv6Primary))
|
||||
{
|
||||
IPv6Primary = ip.Address.ToString();
|
||||
}
|
||||
|
||||
if (ip.Address.IsIPv6LinkLocal)
|
||||
{
|
||||
IPv6LinkLocal = ip.Address.ToString();
|
||||
}
|
||||
else if (ip.Address.IsIPv6SiteLocal)
|
||||
{
|
||||
IPv6SiteLocal = ip.Address.ToString();
|
||||
}
|
||||
else if (ip.Address.IsIPv6UniqueLocal)
|
||||
{
|
||||
IPv6UniqueLocal = ip.Address.ToString();
|
||||
}
|
||||
else if (ip.SuffixOrigin == SuffixOrigin.Random)
|
||||
{
|
||||
IPv6Temporary = ip.Address.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
IPv6Global = ip.Address.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var ip in properties.GatewayAddresses)
|
||||
{
|
||||
Gateways.Add(ip.Address.ToString());
|
||||
}
|
||||
|
||||
foreach (var ip in properties.DhcpServerAddresses)
|
||||
{
|
||||
DhcpServers.Add(ip.ToString());
|
||||
}
|
||||
|
||||
foreach (var ip in properties.DnsAddresses)
|
||||
{
|
||||
DnsServers.Add(ip.ToString());
|
||||
}
|
||||
|
||||
foreach (var ip in properties.WinsServersAddresses)
|
||||
{
|
||||
WinsServers.Add(ip.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the interface type as string
|
||||
/// </summary>
|
||||
/// <param name="type">The type to convert</param>
|
||||
/// <returns>A string indicating the interface type</returns>
|
||||
private string GetAdapterTypeAsString(NetworkInterfaceType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case NetworkInterfaceType.Wman:
|
||||
case NetworkInterfaceType.Wwanpp:
|
||||
case NetworkInterfaceType.Wwanpp2:
|
||||
return Resources.Microsoft_plugin_sys_MobileBroadband;
|
||||
case NetworkInterfaceType.Wireless80211:
|
||||
return Resources.Microsoft_plugin_sys_WirelessLan;
|
||||
case NetworkInterfaceType.Loopback:
|
||||
return Resources.Microsoft_plugin_sys_Loopback;
|
||||
case NetworkInterfaceType.Tunnel:
|
||||
return Resources.Microsoft_plugin_sys_TunnelConnection;
|
||||
case NetworkInterfaceType.Unknown:
|
||||
return Resources.Microsoft_plugin_sys_Unknown;
|
||||
default:
|
||||
return Resources.Microsoft_plugin_sys_Cable;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the speed as formatted text value
|
||||
/// </summary>
|
||||
/// <param name="speed">The adapter speed as <see langword="long"/>.</param>
|
||||
/// <returns>A formatted string like `100 MB/s`</returns>
|
||||
private static string GetFormattedSpeedValue(long speed)
|
||||
{
|
||||
return (speed >= 1000000000) ? string.Format(CultureInfo.InvariantCulture, Resources.Microsoft_plugin_sys_Gbps, speed / 1000000000) : string.Format(CultureInfo.InvariantCulture, Resources.Microsoft_plugin_sys_Mbps, speed / 1000000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns IP info or an empty string
|
||||
/// </summary>
|
||||
/// <param name="title">Descriptive header for the information.</param>
|
||||
/// <param name="property">IP value as <see cref="string"/> or <see cref="List{String}"/>.</param>
|
||||
/// <returns>Formatted string or an empty string.</returns>
|
||||
/// <exception cref="ArgumentException">If the parameter <paramref name="property"/> is not of the type <see cref="string"/> or <see cref="List{String}"/>.</exception>
|
||||
private static string CreateIpInfoForDetailsText(string title, dynamic property)
|
||||
{
|
||||
if (property is string)
|
||||
{
|
||||
return $"\n{title}{property}";
|
||||
}
|
||||
else if (property is List<string> list)
|
||||
{
|
||||
return list.Count == 0 ? string.Empty : $"\n{title}{string.Join("\n\t", property)}";
|
||||
}
|
||||
else if (property is null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException($"'{property}' is not of type 'string' or 'List<string>'.", nameof(property));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Microsoft.PowerToys.Run.Plugin.System.Properties;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Plugin;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
namespace Microsoft.PowerToys.Run.Plugin.System.Components
|
||||
{
|
||||
internal static class ResultHelper
|
||||
{
|
||||
internal static bool ExecuteCommand(bool confirm, string confirmationMessage, Action command)
|
||||
{
|
||||
if (confirm)
|
||||
{
|
||||
MessageBoxResult messageBoxResult = MessageBox.Show(
|
||||
confirmationMessage,
|
||||
Resources.Microsoft_plugin_sys_confirmation,
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Warning);
|
||||
|
||||
if (messageBoxResult == MessageBoxResult.No)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
command();
|
||||
return true;
|
||||
}
|
||||
|
||||
internal static bool CopyToClipBoard(in string text)
|
||||
{
|
||||
try
|
||||
{
|
||||
Clipboard.Clear();
|
||||
Clipboard.SetText(text);
|
||||
return true;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.Exception("Can't copy to clipboard", exception, typeof(ResultHelper));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
internal static List<ContextMenuResult> GetContextMenuForResult(Result result)
|
||||
{
|
||||
var contextMenu = new List<ContextMenuResult>();
|
||||
|
||||
if (!(result?.ContextData is SystemPluginContext contextData))
|
||||
{
|
||||
return contextMenu;
|
||||
}
|
||||
|
||||
if (contextData.Type == ResultContextType.NetworkAdapterInfo)
|
||||
{
|
||||
contextMenu.Add(new ContextMenuResult()
|
||||
{
|
||||
AcceleratorKey = Key.C,
|
||||
AcceleratorModifiers = ModifierKeys.Control,
|
||||
FontFamily = "Segoe MDL2 Assets",
|
||||
Glyph = "\xE8C8", // E8C8 => Symbol: Copy
|
||||
Title = Resources.Microsoft_plugin_sys_CopyDetails,
|
||||
Action = _ => ResultHelper.CopyToClipBoard(contextData.Data),
|
||||
});
|
||||
}
|
||||
|
||||
return contextMenu;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace Microsoft.PowerToys.Run.Plugin.System.Components
|
||||
{
|
||||
internal class SystemPluginContext
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the result
|
||||
/// </summary>
|
||||
public ResultContextType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the context data for the command/results
|
||||
/// </summary>
|
||||
public string Data { get; set; }
|
||||
}
|
||||
|
||||
internal enum ResultContextType
|
||||
{
|
||||
Command, // Reserved for later usage
|
||||
NetworkAdapterInfo,
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 687 B |
Binary file not shown.
After Width: | Height: | Size: 662 B |
@ -6,10 +6,9 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interop;
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Run.Plugin.System.Components;
|
||||
using Microsoft.PowerToys.Run.Plugin.System.Properties;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Wox.Infrastructure;
|
||||
@ -18,44 +17,42 @@ using Wox.Plugin.Common.Win32;
|
||||
|
||||
namespace Microsoft.PowerToys.Run.Plugin.System
|
||||
{
|
||||
public class Main : IPlugin, IPluginI18n, ISettingProvider
|
||||
public class Main : IPlugin, IPluginI18n, ISettingProvider, IContextMenu
|
||||
{
|
||||
private PluginInitContext _context;
|
||||
private const string ConfirmSystemCommands = nameof(ConfirmSystemCommands);
|
||||
private const string LocalizeSystemCommands = nameof(LocalizeSystemCommands);
|
||||
|
||||
internal const int EWXLOGOFF = 0x00000000;
|
||||
internal const int EWXSHUTDOWN = 0x00000001;
|
||||
internal const int EWXREBOOT = 0x00000002;
|
||||
internal const int EWXFORCE = 0x00000004;
|
||||
internal const int EWXPOWEROFF = 0x00000008;
|
||||
internal const int EWXFORCEIFHUNG = 0x00000010;
|
||||
|
||||
public string IconTheme { get; set; }
|
||||
|
||||
public bool IsBootedInUefiMode { get; set; }
|
||||
private bool _confirmSystemCommands;
|
||||
private bool _localizeSystemCommands;
|
||||
private bool _reduceNetworkResultScore;
|
||||
|
||||
public string Name => Resources.Microsoft_plugin_sys_plugin_name;
|
||||
|
||||
public string Description => Resources.Microsoft_plugin_sys_plugin_description;
|
||||
|
||||
private bool _confirmSystemCommands;
|
||||
private bool _localizeSystemCommands;
|
||||
public string IconTheme { get; set; }
|
||||
|
||||
public bool IsBootedInUefiMode { get; set; }
|
||||
|
||||
public IEnumerable<PluginAdditionalOption> AdditionalOptions => new List<PluginAdditionalOption>()
|
||||
{
|
||||
new PluginAdditionalOption()
|
||||
{
|
||||
Key = ConfirmSystemCommands,
|
||||
Key = "ConfirmSystemCommands",
|
||||
DisplayLabel = Resources.confirm_system_commands,
|
||||
Value = false,
|
||||
},
|
||||
new PluginAdditionalOption()
|
||||
{
|
||||
Key = LocalizeSystemCommands,
|
||||
Key = "LocalizeSystemCommands",
|
||||
DisplayLabel = Resources.Use_localized_system_commands,
|
||||
Value = true,
|
||||
},
|
||||
new PluginAdditionalOption()
|
||||
{
|
||||
Key = "ReduceNetworkResultScore",
|
||||
DisplayLabel = Resources.Reduce_Network_Result_Score,
|
||||
Value = true,
|
||||
},
|
||||
};
|
||||
|
||||
public void Init(PluginInitContext context)
|
||||
@ -75,140 +72,55 @@ namespace Microsoft.PowerToys.Run.Plugin.System
|
||||
|
||||
public List<Result> Query(Query query)
|
||||
{
|
||||
if (query == null)
|
||||
{
|
||||
throw new ArgumentNullException(paramName: nameof(query));
|
||||
}
|
||||
|
||||
var commands = Commands();
|
||||
var results = new List<Result>();
|
||||
|
||||
foreach (var c in commands)
|
||||
if (query == null)
|
||||
{
|
||||
var titleMatch = StringMatcher.FuzzySearch(query.Search, c.Title);
|
||||
if (titleMatch.Score > 0)
|
||||
return results;
|
||||
}
|
||||
|
||||
CultureInfo culture = _localizeSystemCommands ? CultureInfo.CurrentUICulture : new CultureInfo("en-US");
|
||||
var systemCommands = Commands.GetSystemCommands(IsBootedInUefiMode, IconTheme, culture, _confirmSystemCommands);
|
||||
var networkConnectionResults = Commands.GetNetworkConnectionResults(IconTheme, culture);
|
||||
|
||||
foreach (var c in systemCommands)
|
||||
{
|
||||
var resultMatch = StringMatcher.FuzzySearch(query.Search, c.Title);
|
||||
if (resultMatch.Score > 0)
|
||||
{
|
||||
c.Score = titleMatch.Score;
|
||||
c.TitleHighlightData = titleMatch.MatchData;
|
||||
c.Score = resultMatch.Score;
|
||||
c.TitleHighlightData = resultMatch.MatchData;
|
||||
results.Add(c);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var r in networkConnectionResults)
|
||||
{
|
||||
// On global queries the first word/part has to be 'ip', 'mac' or 'address'
|
||||
if (string.IsNullOrEmpty(query.ActionKeyword))
|
||||
{
|
||||
string[] keywordList = Resources.ResourceManager.GetString("Microsoft_plugin_sys_Search_NetworkKeywordList", culture).Split("; ");
|
||||
if (!keywordList.Any(x => query.Search.StartsWith(x, StringComparison.CurrentCultureIgnoreCase)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
var resultMatch = StringMatcher.FuzzySearch(query.Search, r.SubTitle);
|
||||
if (resultMatch.Score > 0)
|
||||
{
|
||||
r.Score = _reduceNetworkResultScore ? (int)(resultMatch.Score * 65 / 100) : resultMatch.Score; // Adjust score to improve user experience and priority order
|
||||
r.SubTitleHighlightData = resultMatch.MatchData;
|
||||
results.Add(r);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
private List<Result> Commands()
|
||||
public List<ContextMenuResult> LoadContextMenus(Result selectedResult)
|
||||
{
|
||||
CultureInfo culture = CultureInfo.CurrentUICulture;
|
||||
|
||||
if (!_localizeSystemCommands)
|
||||
{
|
||||
culture = new CultureInfo("en-US");
|
||||
}
|
||||
|
||||
var results = new List<Result>();
|
||||
results.AddRange(new[]
|
||||
{
|
||||
new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_shutdown_computer), culture),
|
||||
SubTitle = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_shutdown_computer_description), culture),
|
||||
IcoPath = $"Images\\shutdown.{IconTheme}.png",
|
||||
Action = c =>
|
||||
{
|
||||
return ExecuteCommand(Resources.Microsoft_plugin_sys_shutdown_computer_confirmation, () => Helper.OpenInShell("shutdown", "/s /hybrid /t 0"));
|
||||
},
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_restart_computer), culture),
|
||||
SubTitle = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_restart_computer_description), culture),
|
||||
IcoPath = $"Images\\restart.{IconTheme}.png",
|
||||
Action = c =>
|
||||
{
|
||||
return ExecuteCommand(Resources.Microsoft_plugin_sys_restart_computer_confirmation, () => Helper.OpenInShell("shutdown", "/r /t 0"));
|
||||
},
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_sign_out), culture),
|
||||
SubTitle = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_sign_out_description), culture),
|
||||
IcoPath = $"Images\\logoff.{IconTheme}.png",
|
||||
Action = c =>
|
||||
{
|
||||
return ExecuteCommand(Resources.Microsoft_plugin_sys_sign_out_confirmation, () => NativeMethods.ExitWindowsEx(EWXLOGOFF, 0));
|
||||
},
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_lock), culture),
|
||||
SubTitle = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_lock_description), culture),
|
||||
IcoPath = $"Images\\lock.{IconTheme}.png",
|
||||
Action = c =>
|
||||
{
|
||||
return ExecuteCommand(Resources.Microsoft_plugin_sys_lock_confirmation, () => NativeMethods.LockWorkStation());
|
||||
},
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_sleep), culture),
|
||||
SubTitle = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_sleep_description), culture),
|
||||
IcoPath = $"Images\\sleep.{IconTheme}.png",
|
||||
Action = c =>
|
||||
{
|
||||
return ExecuteCommand(Resources.Microsoft_plugin_sys_sleep_confirmation, () => NativeMethods.SetSuspendState(false, true, true));
|
||||
},
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_hibernate), culture),
|
||||
SubTitle = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_hibernate_description), culture),
|
||||
IcoPath = $"Images\\sleep.{IconTheme}.png", // Icon change needed
|
||||
Action = c =>
|
||||
{
|
||||
return ExecuteCommand(Resources.Microsoft_plugin_sys_hibernate_confirmation, () => NativeMethods.SetSuspendState(true, true, true));
|
||||
},
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_emptyrecyclebin), culture),
|
||||
SubTitle = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_emptyrecyclebin_description), culture),
|
||||
IcoPath = $"Images\\recyclebin.{IconTheme}.png",
|
||||
Action = c =>
|
||||
{
|
||||
// http://www.pinvoke.net/default.aspx/shell32/SHEmptyRecycleBin.html
|
||||
// FYI, couldn't find documentation for this but if the recycle bin is already empty, it will return -2147418113 (0x8000FFFF (E_UNEXPECTED))
|
||||
// 0 for nothing
|
||||
var result = NativeMethods.SHEmptyRecycleBin(new WindowInteropHelper(Application.Current.MainWindow).Handle, 0);
|
||||
if (result != (uint)HRESULT.S_OK && result != 0x8000FFFF)
|
||||
{
|
||||
var name = "Plugin: " + Resources.Microsoft_plugin_sys_plugin_name;
|
||||
var message = $"Error emptying recycle bin, error code: {result}\n" +
|
||||
"please refer to https://msdn.microsoft.com/en-us/library/windows/desktop/aa378137";
|
||||
_context.API.ShowMsg(name, message);
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// UEFI command/result. It is only available on systems booted in UEFI mode.
|
||||
if (IsBootedInUefiMode)
|
||||
{
|
||||
results.Add(new Result
|
||||
{
|
||||
Title = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_uefi), culture),
|
||||
SubTitle = Resources.ResourceManager.GetString(nameof(Resources.Microsoft_plugin_sys_uefi_description), culture),
|
||||
IcoPath = $"Images\\firmwareSettings.{IconTheme}.png",
|
||||
Action = c =>
|
||||
{
|
||||
return ExecuteCommand(Resources.Microsoft_plugin_sys_uefi_confirmation, () => Helper.OpenInShell("shutdown", "/r /fw /t 0", null, true));
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return results;
|
||||
return ResultHelper.GetContextMenuForResult(selectedResult);
|
||||
}
|
||||
|
||||
private void UpdateIconTheme(Theme theme)
|
||||
@ -238,26 +150,6 @@ namespace Microsoft.PowerToys.Run.Plugin.System
|
||||
return Resources.Microsoft_plugin_sys_plugin_name;
|
||||
}
|
||||
|
||||
private bool ExecuteCommand(string confirmationMessage, Action command)
|
||||
{
|
||||
if (_confirmSystemCommands)
|
||||
{
|
||||
MessageBoxResult messageBoxResult = MessageBox.Show(
|
||||
confirmationMessage,
|
||||
Resources.Microsoft_plugin_sys_confirmation,
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Warning);
|
||||
|
||||
if (messageBoxResult == MessageBoxResult.No)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
command();
|
||||
return true;
|
||||
}
|
||||
|
||||
public Control CreateSettingPanel()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@ -267,18 +159,23 @@ namespace Microsoft.PowerToys.Run.Plugin.System
|
||||
{
|
||||
var confirmSystemCommands = false;
|
||||
var localizeSystemCommands = true;
|
||||
var reduceNetworkResultScore = true;
|
||||
|
||||
if (settings != null && settings.AdditionalOptions != null)
|
||||
{
|
||||
var optionConfirm = settings.AdditionalOptions.FirstOrDefault(x => x.Key == ConfirmSystemCommands);
|
||||
confirmSystemCommands = optionConfirm?.Value ?? false;
|
||||
var optionConfirm = settings.AdditionalOptions.FirstOrDefault(x => x.Key == "ConfirmSystemCommands");
|
||||
confirmSystemCommands = optionConfirm?.Value ?? confirmSystemCommands;
|
||||
|
||||
var optionLocalize = settings.AdditionalOptions.FirstOrDefault(x => x.Key == LocalizeSystemCommands);
|
||||
localizeSystemCommands = optionLocalize?.Value ?? true;
|
||||
var optionLocalize = settings.AdditionalOptions.FirstOrDefault(x => x.Key == "LocalizeSystemCommands");
|
||||
localizeSystemCommands = optionLocalize?.Value ?? localizeSystemCommands;
|
||||
|
||||
var optionNetworkScore = settings.AdditionalOptions.FirstOrDefault(x => x.Key == "ReduceNetworkResultScore");
|
||||
reduceNetworkResultScore = optionNetworkScore?.Value ?? reduceNetworkResultScore;
|
||||
}
|
||||
|
||||
_confirmSystemCommands = confirmSystemCommands;
|
||||
_localizeSystemCommands = localizeSystemCommands;
|
||||
_reduceNetworkResultScore = reduceNetworkResultScore;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,6 +124,12 @@
|
||||
<None Update="Images\firmwareSettings.dark.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Images\networkAdapter.light.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Images\networkAdapter.dark.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -19,7 +19,7 @@ namespace Microsoft.PowerToys.Run.Plugin.System.Properties {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
@ -69,6 +69,33 @@ namespace Microsoft.PowerToys.Run.Plugin.System.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Adapter details.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_AdapterDetails {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_AdapterDetails", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Adapter name.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_AdapterName {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_AdapterName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cable.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Cable {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Cable", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Please confirm..
|
||||
/// </summary>
|
||||
@ -78,6 +105,69 @@ namespace Microsoft.PowerToys.Run.Plugin.System.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Connected.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Connected {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Connected", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Connection details.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_ConnectionDetails {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_ConnectionDetails", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Connection name.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_ConnectionName {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_ConnectionName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Copy details (Ctrl+C).
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_CopyDetails {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_CopyDetails", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to DHCP servers.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Dhcp {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Dhcp", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Disconnected.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Disconnected {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Disconnected", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to DNS servers.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Dns {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Dns", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Empty Recycle Bin.
|
||||
/// </summary>
|
||||
@ -96,6 +186,24 @@ namespace Microsoft.PowerToys.Run.Plugin.System.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Default Gateway.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Gateways {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Gateways", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} Gbps.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Gbps {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Gbps", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Hibernate.
|
||||
/// </summary>
|
||||
@ -123,6 +231,87 @@ namespace Microsoft.PowerToys.Run.Plugin.System.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to IPv4 address of {0}.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_ip4_description {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_ip4_description", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to IPv4 address.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Ip4Address {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Ip4Address", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to IPv4 subnet mask.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Ip4SubnetMask {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Ip4SubnetMask", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to IPv6 address of {0}.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_ip6_description {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_ip6_description", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to IPv6 Address.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Ip6Address {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Ip6Address", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to IPv6 link-local address.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Ip6Link {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Ip6Link", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to IPv6 site-local address.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Ip6Site {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Ip6Site", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to IPv6 temporary address.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Ip6Temp {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Ip6Temp", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to IPv6 unique local address.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Ip6Unique {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Ip6Unique", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Lock.
|
||||
/// </summary>
|
||||
@ -150,6 +339,51 @@ namespace Microsoft.PowerToys.Run.Plugin.System.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Loopback.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Loopback {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Loopback", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to MAC address of {0} ({1}).
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_mac_description {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_mac_description", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} Mbps.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Mbps {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Mbps", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Mobile broadband.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_MobileBroadband {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_MobileBroadband", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Physical address (MAC).
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_PhysicalAddress {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_PhysicalAddress", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Executes system commands (e.g. 'shutdown', 'lock', 'sleep')..
|
||||
/// </summary>
|
||||
@ -195,6 +429,15 @@ namespace Microsoft.PowerToys.Run.Plugin.System.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ip; mac; address.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Search_NetworkKeywordList {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Search_NetworkKeywordList", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Shutdown.
|
||||
/// </summary>
|
||||
@ -276,6 +519,60 @@ namespace Microsoft.PowerToys.Run.Plugin.System.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Speed.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Speed {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Speed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to State.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_State {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_State", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Select to copy.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_SubTitle_CopyHint {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_SubTitle_CopyHint", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to DNS Suffix.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Suffix {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Suffix", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Tunnel.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_TunnelConnection {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_TunnelConnection", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Type.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Type {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Type", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to UEFI Firmware Settings.
|
||||
/// </summary>
|
||||
@ -303,6 +600,43 @@ namespace Microsoft.PowerToys.Run.Plugin.System.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unknown.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Unknown {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Unknown", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to WINS servers.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_Wins {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_Wins", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Wireless LAN.
|
||||
/// </summary>
|
||||
internal static string Microsoft_plugin_sys_WirelessLan {
|
||||
get {
|
||||
return ResourceManager.GetString("Microsoft_plugin_sys_WirelessLan", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Reduce the priority of 'IP' and 'MAC' results to improve the order in the global results
|
||||
///(With this setting enabled, you have to type more characters to find the results.).
|
||||
/// </summary>
|
||||
internal static string Reduce_Network_Result_Score {
|
||||
get {
|
||||
return ResourceManager.GetString("Reduce_Network_Result_Score", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Use localized system commands instead of English ones.
|
||||
/// </summary>
|
||||
|
@ -120,10 +120,41 @@
|
||||
<data name="confirm_system_commands" xml:space="preserve">
|
||||
<value>Show a dialog to confirm system commands</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_AdapterDetails" xml:space="preserve">
|
||||
<value>Adapter details</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_AdapterName" xml:space="preserve">
|
||||
<value>Adapter name</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Cable" xml:space="preserve">
|
||||
<value>Cable</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_confirmation" xml:space="preserve">
|
||||
<value>Please confirm.</value>
|
||||
<comment>Request confirmation</comment>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Connected" xml:space="preserve">
|
||||
<value>Connected</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_ConnectionDetails" xml:space="preserve">
|
||||
<value>Connection details</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_ConnectionName" xml:space="preserve">
|
||||
<value>Connection name</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_CopyDetails" xml:space="preserve">
|
||||
<value>Copy details (Ctrl+C)</value>
|
||||
<comment>'Ctrl+C' is a shortcut</comment>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Dhcp" xml:space="preserve">
|
||||
<value>DHCP servers</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Disconnected" xml:space="preserve">
|
||||
<value>Disconnected</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Dns" xml:space="preserve">
|
||||
<value>DNS servers</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_emptyrecyclebin" xml:space="preserve">
|
||||
<value>Empty Recycle Bin</value>
|
||||
<comment>This should align to the action in Windows of emptying the recycle bin on your computer.</comment>
|
||||
@ -132,6 +163,13 @@
|
||||
<value>Empty Recycle Bin</value>
|
||||
<comment>This should align to the action in Windows of emptying the recycle bin on your computer.</comment>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Gateways" xml:space="preserve">
|
||||
<value>Default Gateway</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Gbps" xml:space="preserve">
|
||||
<value>{0} Gbps</value>
|
||||
<comment>Abbreviation of 'Gbits per seconds'. Don't translate the placeholder '{0}' as it is replaced in code.</comment>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_hibernate" xml:space="preserve">
|
||||
<value>Hibernate</value>
|
||||
<comment>This should align to the action in Windows of a hibernating your computer.</comment>
|
||||
@ -144,6 +182,35 @@
|
||||
<value>Hibernate computer</value>
|
||||
<comment>This should align to the action in Windows of a hibernating your computer.</comment>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Ip4Address" xml:space="preserve">
|
||||
<value>IPv4 address</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Ip4SubnetMask" xml:space="preserve">
|
||||
<value>IPv4 subnet mask</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_ip4_description" xml:space="preserve">
|
||||
<value>IPv4 address of {0}</value>
|
||||
<comment>Don't translate the placeholder '{0}' as it is replaced in code.</comment>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Ip6Address" xml:space="preserve">
|
||||
<value>IPv6 Address</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Ip6Link" xml:space="preserve">
|
||||
<value>IPv6 link-local address</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Ip6Site" xml:space="preserve">
|
||||
<value>IPv6 site-local address</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Ip6Temp" xml:space="preserve">
|
||||
<value>IPv6 temporary address</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Ip6Unique" xml:space="preserve">
|
||||
<value>IPv6 unique local address</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_ip6_description" xml:space="preserve">
|
||||
<value>IPv6 address of {0}</value>
|
||||
<comment>Don't translate the placeholder '{0}' as it is replaced in code.</comment>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_lock" xml:space="preserve">
|
||||
<value>Lock</value>
|
||||
<comment>This should align to the action in Windows of a locking your computer.</comment>
|
||||
@ -156,6 +223,23 @@
|
||||
<value>Lock computer</value>
|
||||
<comment>This should align to the action in Windows of a locking your computer.</comment>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Loopback" xml:space="preserve">
|
||||
<value>Loopback</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_mac_description" xml:space="preserve">
|
||||
<value>MAC address of {0} ({1})</value>
|
||||
<comment>Don't translate the placeholders '{0}' and '{1}' as they are replaced in code.</comment>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Mbps" xml:space="preserve">
|
||||
<value>{0} Mbps</value>
|
||||
<comment>Abbreviation of 'Mbits per seconds'. Don't translate the placeholder '{0}' as it is replaced in code.</comment>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_MobileBroadband" xml:space="preserve">
|
||||
<value>Mobile broadband</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_PhysicalAddress" xml:space="preserve">
|
||||
<value>Physical address (MAC)</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_plugin_description" xml:space="preserve">
|
||||
<value>Executes system commands (e.g. 'shutdown', 'lock', 'sleep').</value>
|
||||
<comment>This should align to the actions in Windows relating to shutting down, signing out, locking, sleeping, restarting, emptying the recycle bin, and hibernating your computer. </comment>
|
||||
@ -176,6 +260,10 @@
|
||||
<value>Restart computer</value>
|
||||
<comment>This should align to the action in Windows of a restarting your computer.</comment>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Search_NetworkKeywordList" xml:space="preserve">
|
||||
<value>ip; mac; address</value>
|
||||
<comment>Translate 'ip' as 'ip' and not as 'ip address'. Same for 'mac'.)</comment>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_shutdown_computer" xml:space="preserve">
|
||||
<value>Shutdown</value>
|
||||
<comment>This should align to the action in Windows of a shutting down your computer.</comment>
|
||||
@ -212,6 +300,24 @@
|
||||
<value>Put computer to sleep</value>
|
||||
<comment>This should align to the action in Windows of a making your computer go to sleep.</comment>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Speed" xml:space="preserve">
|
||||
<value>Speed</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_State" xml:space="preserve">
|
||||
<value>State</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_SubTitle_CopyHint" xml:space="preserve">
|
||||
<value>Select to copy</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Suffix" xml:space="preserve">
|
||||
<value>DNS Suffix</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_TunnelConnection" xml:space="preserve">
|
||||
<value>Tunnel</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Type" xml:space="preserve">
|
||||
<value>Type</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_uefi" xml:space="preserve">
|
||||
<value>UEFI Firmware Settings</value>
|
||||
<comment>This should align to the action in Windows Recovery Environment that restart into uefi settings.</comment>
|
||||
@ -224,6 +330,19 @@
|
||||
<value>Reboot computer into UEFI Firmware Settings (Requires administrative permissions.)</value>
|
||||
<comment>This should align to the action in Windows Recovery Environment that restart into uefi settings.</comment>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Unknown" xml:space="preserve">
|
||||
<value>Unknown</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_Wins" xml:space="preserve">
|
||||
<value>WINS servers</value>
|
||||
</data>
|
||||
<data name="Microsoft_plugin_sys_WirelessLan" xml:space="preserve">
|
||||
<value>Wireless LAN</value>
|
||||
</data>
|
||||
<data name="Reduce_Network_Result_Score" xml:space="preserve">
|
||||
<value>Reduce the priority of 'IP' and 'MAC' results to improve the order in the global results
|
||||
(With this setting enabled, you have to type more characters to find the results.)</value>
|
||||
</data>
|
||||
<data name="Use_localized_system_commands" xml:space="preserve">
|
||||
<value>Use localized system commands instead of English ones</value>
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user