mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-15 03:59:15 +08:00
b22a4501cc
1. introduce variable 2. part of #389 3. refactoring program suffix in program plugin 4. 全局变量一时爽,代码重构火葬场
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
|
|
namespace Wox.Plugin.Program.ProgramSources
|
|
{
|
|
[Serializable]
|
|
[Browsable(false)]
|
|
public class CommonStartMenuProgramSource : FileSystemProgramSource
|
|
{
|
|
[DllImport("shell32.dll")]
|
|
static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner, [Out] StringBuilder lpszPath, int nFolder, bool fCreate);
|
|
const int CSIDL_COMMON_PROGRAMS = 0x17;
|
|
|
|
private static string getPath()
|
|
{
|
|
StringBuilder commonStartMenuPath = new StringBuilder(560);
|
|
SHGetSpecialFolderPath(IntPtr.Zero, commonStartMenuPath, CSIDL_COMMON_PROGRAMS, false);
|
|
|
|
return commonStartMenuPath.ToString();
|
|
}
|
|
|
|
public CommonStartMenuProgramSource(string[] suffixes)
|
|
: base(getPath(), suffixes)
|
|
{
|
|
}
|
|
|
|
public CommonStartMenuProgramSource(ProgramSource source)
|
|
: this(source.Suffixes)
|
|
{
|
|
BonusPoints = source.BonusPoints;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return typeof(CommonStartMenuProgramSource).Name;
|
|
}
|
|
}
|
|
}
|