mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
remove ControlPanel plugin
This commit is contained in:
parent
0250a28c9f
commit
7297c1be39
14 changed files with 0 additions and 605 deletions
|
|
@ -13,7 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{3A73
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher", "Flow.Launcher\Flow.Launcher.csproj", "{DB90F671-D861-46BB-93A3-F1304F5BA1C5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0} = {1EE20B48-82FB-48A2-8086-675D6DDAB4F0}
|
||||
{0B9DE348-9361-4940-ADB6-F5953BFFCCEC} = {0B9DE348-9361-4940-ADB6-F5953BFFCCEC}
|
||||
{4792A74A-0CEA-4173-A8B2-30E6764C6217} = {4792A74A-0CEA-4173-A8B2-30E6764C6217}
|
||||
{FDB3555B-58EF-4AE6-B5F1-904719637AB4} = {FDB3555B-58EF-4AE6-B5F1-904719637AB4}
|
||||
|
|
@ -36,8 +35,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.Progra
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.WebSearch", "Plugins\Flow.Launcher.Plugin.WebSearch\Flow.Launcher.Plugin.WebSearch.csproj", "{403B57F2-1856-4FC7-8A24-36AB346B763E}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.ControlPanel", "Plugins\Flow.Launcher.Plugin.ControlPanel\Flow.Launcher.Plugin.ControlPanel.csproj", "{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.PluginIndicator", "Plugins\Flow.Launcher.Plugin.PluginIndicator\Flow.Launcher.Plugin.PluginIndicator.csproj", "{FDED22C8-B637-42E8-824A-63B5B6E05A3A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.Sys", "Plugins\Flow.Launcher.Plugin.Sys\Flow.Launcher.Plugin.Sys.csproj", "{0B9DE348-9361-4940-ADB6-F5953BFFCCEC}"
|
||||
|
|
@ -165,18 +162,6 @@ Global
|
|||
{403B57F2-1856-4FC7-8A24-36AB346B763E}.Release|x64.Build.0 = Release|Any CPU
|
||||
{403B57F2-1856-4FC7-8A24-36AB346B763E}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{403B57F2-1856-4FC7-8A24-36AB346B763E}.Release|x86.Build.0 = Release|Any CPU
|
||||
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Release|x64.Build.0 = Release|Any CPU
|
||||
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Release|x86.Build.0 = Release|Any CPU
|
||||
{FDED22C8-B637-42E8-824A-63B5B6E05A3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FDED22C8-B637-42E8-824A-63B5B6E05A3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FDED22C8-B637-42E8-824A-63B5B6E05A3A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
|
|
@ -305,7 +290,6 @@ Global
|
|||
GlobalSection(NestedProjects) = preSolution
|
||||
{FDB3555B-58EF-4AE6-B5F1-904719637AB4} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
||||
{403B57F2-1856-4FC7-8A24-36AB346B763E} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
||||
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
||||
{FDED22C8-B637-42E8-824A-63B5B6E05A3A} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
||||
{0B9DE348-9361-4940-ADB6-F5953BFFCCEC} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
||||
{A3DCCBCA-ACC1-421D-B16E-210896234C26} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Flow.Launcher.Plugin.ControlPanel
|
||||
{
|
||||
//from:https://raw.githubusercontent.com/CoenraadS/Windows-Control-Panel-Items
|
||||
public class ControlPanelItem
|
||||
{
|
||||
public string LocalizedString { get; private set; }
|
||||
public string InfoTip { get; private set; }
|
||||
public string GUID { get; private set; }
|
||||
public ProcessStartInfo ExecutablePath { get; private set; }
|
||||
public Icon Icon { get; private set; }
|
||||
public int Score { get; set; }
|
||||
|
||||
public ControlPanelItem(string newLocalizedString, string newInfoTip, string newGUID, ProcessStartInfo newExecutablePath, Icon newIcon)
|
||||
{
|
||||
LocalizedString = newLocalizedString;
|
||||
InfoTip = newInfoTip;
|
||||
ExecutablePath = newExecutablePath;
|
||||
Icon = newIcon;
|
||||
GUID = newGUID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,339 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Flow.Launcher.Plugin.ControlPanel
|
||||
{
|
||||
//from:https://raw.githubusercontent.com/CoenraadS/Windows-Control-Panel-Items
|
||||
public static class ControlPanelList
|
||||
{
|
||||
private const uint GROUP_ICON = 14;
|
||||
private const uint LOAD_LIBRARY_AS_DATAFILE = 0x00000002;
|
||||
private const string CONTROL = @"%SystemRoot%\System32\control.exe";
|
||||
|
||||
private delegate bool EnumResNameDelegate(
|
||||
IntPtr hModule,
|
||||
IntPtr lpszType,
|
||||
IntPtr lpszName,
|
||||
IntPtr lParam);
|
||||
|
||||
[DllImport("kernel32.dll", EntryPoint = "EnumResourceNamesW", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
static extern bool EnumResourceNamesWithID(IntPtr hModule, uint lpszType, EnumResNameDelegate lpEnumFunc, IntPtr lParam);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
static extern IntPtr LoadLibraryEx(string lpFileName, IntPtr hFile, uint dwFlags);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
static extern bool FreeLibrary(IntPtr hModule);
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
static extern int LoadString(IntPtr hInstance, uint uID, StringBuilder lpBuffer, int nBufferMax);
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
||||
static extern IntPtr LoadImage(IntPtr hinst, IntPtr lpszName, uint uType,
|
||||
int cxDesired, int cyDesired, uint fuLoad);
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
static extern bool DestroyIcon(IntPtr handle);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
static extern IntPtr FindResource(IntPtr hModule, IntPtr lpName, IntPtr lpType);
|
||||
|
||||
static IntPtr defaultIconPtr;
|
||||
|
||||
|
||||
static RegistryKey nameSpace = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ControlPanel\\NameSpace");
|
||||
static RegistryKey clsid = Registry.ClassesRoot.OpenSubKey("CLSID");
|
||||
|
||||
public static List<ControlPanelItem> Create(uint iconSize)
|
||||
{
|
||||
int size = (int)iconSize;
|
||||
RegistryKey currentKey;
|
||||
ProcessStartInfo executablePath;
|
||||
List<ControlPanelItem> controlPanelItems = new List<ControlPanelItem>();
|
||||
string localizedString;
|
||||
string infoTip;
|
||||
Icon myIcon;
|
||||
|
||||
foreach (string key in nameSpace.GetSubKeyNames())
|
||||
{
|
||||
currentKey = clsid.OpenSubKey(key);
|
||||
if (currentKey != null)
|
||||
{
|
||||
executablePath = getExecutablePath(currentKey);
|
||||
|
||||
if (!(executablePath == null)) //Cannot have item without executable path
|
||||
{
|
||||
localizedString = getLocalizedString(currentKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(localizedString))//Cannot have item without Title
|
||||
{
|
||||
infoTip = getInfoTip(currentKey);
|
||||
|
||||
myIcon = getIcon(currentKey, size);
|
||||
|
||||
controlPanelItems.Add(new ControlPanelItem(localizedString, infoTip, key, executablePath, myIcon));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return controlPanelItems;
|
||||
}
|
||||
|
||||
private static ProcessStartInfo getExecutablePath(RegistryKey currentKey)
|
||||
{
|
||||
ProcessStartInfo executablePath = new ProcessStartInfo();
|
||||
string applicationName;
|
||||
|
||||
if (currentKey.GetValue("System.ApplicationName") != null)
|
||||
{
|
||||
//CPL Files (usually native MS items)
|
||||
applicationName = currentKey.GetValue("System.ApplicationName").ToString();
|
||||
executablePath.FileName = Environment.ExpandEnvironmentVariables(CONTROL);
|
||||
executablePath.Arguments = "-name " + applicationName;
|
||||
}
|
||||
else if (currentKey.OpenSubKey("Shell\\Open\\Command") != null && currentKey.OpenSubKey("Shell\\Open\\Command").GetValue(null) != null)
|
||||
{
|
||||
//Other files (usually third party items)
|
||||
string input = "\"" + Environment.ExpandEnvironmentVariables(currentKey.OpenSubKey("Shell\\Open\\Command").GetValue(null).ToString()) + "\"";
|
||||
executablePath.FileName = "cmd.exe";
|
||||
executablePath.Arguments = "/C " + input;
|
||||
executablePath.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return executablePath;
|
||||
}
|
||||
|
||||
private static string getLocalizedString(RegistryKey currentKey)
|
||||
{
|
||||
IntPtr dataFilePointer;
|
||||
string[] localizedStringRaw;
|
||||
uint stringTableIndex;
|
||||
StringBuilder resource;
|
||||
string localizedString;
|
||||
|
||||
if (currentKey.GetValue("LocalizedString") != null)
|
||||
{
|
||||
localizedStringRaw = currentKey.GetValue("LocalizedString").ToString().Split(new[] { ",-" }, StringSplitOptions.None);
|
||||
|
||||
if (localizedStringRaw.Length > 1)
|
||||
{
|
||||
if (localizedStringRaw[0][0] == '@')
|
||||
{
|
||||
localizedStringRaw[0] = localizedStringRaw[0].Substring(1);
|
||||
}
|
||||
|
||||
localizedStringRaw[0] = Environment.ExpandEnvironmentVariables(localizedStringRaw[0]);
|
||||
|
||||
dataFilePointer = LoadLibraryEx(localizedStringRaw[0], IntPtr.Zero, LOAD_LIBRARY_AS_DATAFILE); //Load file with strings
|
||||
|
||||
stringTableIndex = sanitizeUint(localizedStringRaw[1]);
|
||||
|
||||
resource = new StringBuilder(255);
|
||||
LoadString(dataFilePointer, stringTableIndex, resource, resource.Capacity + 1); //Extract needed string
|
||||
FreeLibrary(dataFilePointer);
|
||||
|
||||
localizedString = resource.ToString();
|
||||
|
||||
//Some apps don't return a string, although they do have a stringIndex. Use Default value.
|
||||
|
||||
if (String.IsNullOrEmpty(localizedString))
|
||||
{
|
||||
if (currentKey.GetValue(null) != null)
|
||||
{
|
||||
localizedString = currentKey.GetValue(null).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null; //Cannot have item without title.
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
localizedString = localizedStringRaw[0];
|
||||
}
|
||||
}
|
||||
else if (currentKey.GetValue(null) != null)
|
||||
{
|
||||
localizedString = currentKey.GetValue(null).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null; //Cannot have item without title.
|
||||
}
|
||||
return localizedString;
|
||||
}
|
||||
|
||||
private static string getInfoTip(RegistryKey currentKey)
|
||||
{
|
||||
IntPtr dataFilePointer;
|
||||
string[] infoTipRaw;
|
||||
uint stringTableIndex;
|
||||
StringBuilder resource;
|
||||
string infoTip = "";
|
||||
|
||||
if (currentKey.GetValue("InfoTip") != null)
|
||||
{
|
||||
infoTipRaw = currentKey.GetValue("InfoTip").ToString().Split(new[] { ",-" }, StringSplitOptions.None);
|
||||
|
||||
if (infoTipRaw.Length == 2)
|
||||
{
|
||||
if (infoTipRaw[0][0] == '@')
|
||||
{
|
||||
infoTipRaw[0] = infoTipRaw[0].Substring(1);
|
||||
}
|
||||
infoTipRaw[0] = Environment.ExpandEnvironmentVariables(infoTipRaw[0]);
|
||||
|
||||
dataFilePointer = LoadLibraryEx(infoTipRaw[0], IntPtr.Zero, LOAD_LIBRARY_AS_DATAFILE); //Load file with strings
|
||||
|
||||
stringTableIndex = sanitizeUint(infoTipRaw[1]);
|
||||
|
||||
resource = new StringBuilder(255);
|
||||
LoadString(dataFilePointer, stringTableIndex, resource, resource.Capacity + 1); //Extract needed string
|
||||
FreeLibrary(dataFilePointer);
|
||||
|
||||
infoTip = resource.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
infoTip = currentKey.GetValue("InfoTip").ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
infoTip = "";
|
||||
}
|
||||
|
||||
return infoTip;
|
||||
}
|
||||
|
||||
private static Icon getIcon(RegistryKey currentKey, int iconSize)
|
||||
{
|
||||
IntPtr iconPtr = IntPtr.Zero;
|
||||
List<string> iconString;
|
||||
IntPtr dataFilePointer;
|
||||
IntPtr iconIndex;
|
||||
Icon myIcon = null;
|
||||
|
||||
if (currentKey.OpenSubKey("DefaultIcon") != null)
|
||||
{
|
||||
if (currentKey.OpenSubKey("DefaultIcon").GetValue(null) != null)
|
||||
{
|
||||
iconString = new List<string>(currentKey.OpenSubKey("DefaultIcon").GetValue(null).ToString().Split(new[] { ',' }, 2));
|
||||
if (string.IsNullOrEmpty(iconString[0]))
|
||||
{
|
||||
// fallback to default icon
|
||||
return null;
|
||||
}
|
||||
|
||||
if (iconString[0][0] == '@')
|
||||
{
|
||||
iconString[0] = iconString[0].Substring(1);
|
||||
}
|
||||
|
||||
dataFilePointer = LoadLibraryEx(iconString[0], IntPtr.Zero, LOAD_LIBRARY_AS_DATAFILE);
|
||||
|
||||
if (iconString.Count == 2)
|
||||
{
|
||||
iconIndex = (IntPtr)sanitizeUint(iconString[1]);
|
||||
|
||||
iconPtr = LoadImage(dataFilePointer, iconIndex, 1, iconSize, iconSize, 0);
|
||||
}
|
||||
|
||||
if (iconPtr == IntPtr.Zero)
|
||||
{
|
||||
defaultIconPtr = IntPtr.Zero;
|
||||
EnumResourceNamesWithID(dataFilePointer, GROUP_ICON, EnumRes, IntPtr.Zero); //Iterate through resources.
|
||||
|
||||
iconPtr = LoadImage(dataFilePointer, defaultIconPtr, 1, iconSize, iconSize, 0);
|
||||
}
|
||||
|
||||
FreeLibrary(dataFilePointer);
|
||||
|
||||
if (iconPtr != IntPtr.Zero)
|
||||
{
|
||||
try
|
||||
{
|
||||
myIcon = Icon.FromHandle(iconPtr);
|
||||
myIcon = (Icon)myIcon.Clone(); //Remove pointer dependancy.
|
||||
}
|
||||
catch
|
||||
{
|
||||
//Silently fail for now.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (iconPtr != IntPtr.Zero)
|
||||
{
|
||||
DestroyIcon(iconPtr);
|
||||
}
|
||||
return myIcon;
|
||||
}
|
||||
|
||||
private static uint sanitizeUint(string args) //Remove all chars before and after first set of digits.
|
||||
{
|
||||
int x = 0;
|
||||
|
||||
while (x < args.Length && !Char.IsDigit(args[x]))
|
||||
{
|
||||
args = args.Substring(1);
|
||||
}
|
||||
|
||||
x = 0;
|
||||
|
||||
while (x < args.Length && Char.IsDigit(args[x]))
|
||||
{
|
||||
x++;
|
||||
}
|
||||
|
||||
if (x < args.Length)
|
||||
{
|
||||
args = args.Remove(x);
|
||||
}
|
||||
|
||||
/*If the logic is correct, this should never through an exception.
|
||||
* If there is an exception, then need to analyze what the input is.
|
||||
* Returning the wrong number will cause more errors */
|
||||
return Convert.ToUInt32(args);
|
||||
}
|
||||
|
||||
private static bool IS_INTRESOURCE(IntPtr value)
|
||||
{
|
||||
if (((uint)value) > ushort.MaxValue)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static uint GET_RESOURCE_ID(IntPtr value)
|
||||
{
|
||||
if (IS_INTRESOURCE(value))
|
||||
return (uint)value;
|
||||
throw new NotSupportedException("value is not an ID!");
|
||||
}
|
||||
|
||||
private static string GET_RESOURCE_NAME(IntPtr value)
|
||||
{
|
||||
if (IS_INTRESOURCE(value))
|
||||
return value.ToString();
|
||||
return Marshal.PtrToStringUni(value);
|
||||
}
|
||||
|
||||
private static bool EnumRes(IntPtr hModule, IntPtr lpszType, IntPtr lpszName, IntPtr lParam)
|
||||
{
|
||||
defaultIconPtr = lpszName;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<ProjectGuid>{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}</ProjectGuid>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Flow.Launcher.Plugin.ControlPanel</RootNamespace>
|
||||
<AssemblyName>Flow.Launcher.Plugin.ControlPanel</AssemblyName>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.ControlPanel\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Output\Release\Plugins\Flow.Launcher.Plugin.ControlPanel\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="plugin.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj" />
|
||||
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Images\*.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Languages\*.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB |
|
|
@ -1,8 +0,0 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_name">Systemsteuerung</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_description">Suche in der Systemsteuerung</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_name">Control Panel</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_description">Search within the Control Panel</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_name">Panel sterowania</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_description">Szybie wyszukiwanie ustawień w panelu sterowania</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_name">Ovládací panel</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_description">Vyhľadáva položky Ovládacieho panela</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_name">Denetim Masası</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_description">Denetim Masası'nda arama yapın.</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_name">控制面板</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_description">搜索控制面板</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_name">控制台</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_description">搜尋控制台</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
|
||||
namespace Flow.Launcher.Plugin.ControlPanel
|
||||
{
|
||||
public class Main : IPlugin, IPluginI18n
|
||||
{
|
||||
private PluginInitContext context;
|
||||
private List<ControlPanelItem> controlPanelItems = new List<ControlPanelItem>();
|
||||
private string iconFolder;
|
||||
private string fileType;
|
||||
|
||||
public void Init(PluginInitContext context)
|
||||
{
|
||||
this.context = context;
|
||||
controlPanelItems = ControlPanelList.Create(48);
|
||||
iconFolder = Path.Combine(context.CurrentPluginMetadata.PluginDirectory, @"Images\ControlPanelIcons\");
|
||||
fileType = ".bmp";
|
||||
|
||||
if (!Directory.Exists(iconFolder))
|
||||
{
|
||||
Directory.CreateDirectory(iconFolder);
|
||||
}
|
||||
|
||||
foreach (ControlPanelItem item in controlPanelItems)
|
||||
{
|
||||
if (!File.Exists(iconFolder + item.GUID + fileType) && item.Icon != null)
|
||||
{
|
||||
item.Icon.ToBitmap().Save(iconFolder + item.GUID + fileType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Result> Query(Query query)
|
||||
{
|
||||
List<Result> results = new List<Result>();
|
||||
|
||||
foreach (var item in controlPanelItems)
|
||||
{
|
||||
var titleMatch = StringMatcher.FuzzySearch(query.Search, item.LocalizedString);
|
||||
var subTitleMatch = StringMatcher.FuzzySearch(query.Search, item.InfoTip);
|
||||
|
||||
item.Score = Math.Max(titleMatch.Score, subTitleMatch.Score);
|
||||
if (item.Score > 0)
|
||||
{
|
||||
var result = new Result
|
||||
{
|
||||
Title = item.LocalizedString,
|
||||
SubTitle = item.InfoTip,
|
||||
Score = item.Score,
|
||||
IcoPath = Path.Combine(context.CurrentPluginMetadata.PluginDirectory,
|
||||
@"Images\\ControlPanelIcons\\" + item.GUID + fileType),
|
||||
Action = e =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start(item.ExecutablePath);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//Silently Fail for now.. todo
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
if (item.Score == titleMatch.Score)
|
||||
{
|
||||
result.TitleHighlightData = titleMatch.MatchData;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.SubTitleHighlightData = subTitleMatch.MatchData;
|
||||
}
|
||||
|
||||
results.Add(result);
|
||||
}
|
||||
}
|
||||
|
||||
List<Result> panelItems = results.OrderByDescending(o => o.Score).Take(5).ToList();
|
||||
return panelItems;
|
||||
}
|
||||
|
||||
public string GetTranslatedPluginTitle()
|
||||
{
|
||||
return context.API.GetTranslation("flowlauncher_plugin_controlpanel_plugin_name");
|
||||
}
|
||||
|
||||
public string GetTranslatedPluginDescription()
|
||||
{
|
||||
return context.API.GetTranslation("flowlauncher_plugin_controlpanel_plugin_description");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"ID": "209621585B9B4D81813913C507C058C6",
|
||||
"ActionKeyword": "*",
|
||||
"Name": "Control Panel",
|
||||
"Description": "Search within the Control Panel.",
|
||||
"Author": "CoenraadS",
|
||||
"Version": "1.1.2",
|
||||
"Language": "csharp",
|
||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||
"ExecuteFileName": "Flow.Launcher.Plugin.ControlPanel.dll",
|
||||
"IcoPath": "Images\\ControlPanel.png"
|
||||
}
|
||||
Loading…
Reference in a new issue