2014-03-18 20:05:27 +00:00
|
|
|
|
using System;
|
2016-01-06 21:34:42 +00:00
|
|
|
|
using System.ComponentModel;
|
2014-03-18 20:05:27 +00:00
|
|
|
|
using System.Runtime.InteropServices;
|
2014-03-30 03:16:44 +00:00
|
|
|
|
using System.Text;
|
2014-03-18 20:05:27 +00:00
|
|
|
|
|
2015-01-03 07:20:34 +00:00
|
|
|
|
namespace Wox.Plugin.Program.ProgramSources
|
2014-03-18 20:05:27 +00:00
|
|
|
|
{
|
2014-12-15 14:58:49 +00:00
|
|
|
|
[Serializable]
|
2016-01-06 21:34:42 +00:00
|
|
|
|
[Browsable(false)]
|
2014-03-18 20:05:27 +00:00
|
|
|
|
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();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-03-28 02:09:57 +00:00
|
|
|
|
public CommonStartMenuProgramSource(string[] suffixes)
|
|
|
|
|
|
: base(getPath(), suffixes)
|
2014-03-18 20:05:27 +00:00
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2014-03-23 08:17:41 +00:00
|
|
|
|
public CommonStartMenuProgramSource(ProgramSource source)
|
2016-03-28 02:09:57 +00:00
|
|
|
|
: this(source.Suffixes)
|
2014-03-18 20:05:27 +00:00
|
|
|
|
{
|
2016-01-06 21:34:42 +00:00
|
|
|
|
BonusPoints = source.BonusPoints;
|
2014-03-18 20:05:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-03-19 12:16:20 +00:00
|
|
|
|
public override string ToString()
|
|
|
|
|
|
{
|
|
|
|
|
|
return typeof(CommonStartMenuProgramSource).Name;
|
|
|
|
|
|
}
|
2014-03-18 20:05:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|