-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ProgramSources settings (code only, without GUI) #42
- Loading branch information
Showing
11 changed files
with
151 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace Wox.Infrastructure.UserSettings | ||
{ | ||
[Serializable] | ||
public class ProgramSource | ||
{ | ||
public string Location { get; set; } | ||
public string Assembly { get; set; } | ||
public string Type { get; set; } | ||
public int BounsPoints { get; set; } | ||
public bool Enabled { get; set; } | ||
public Dictionary<string, string> Meta { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Wox.Plugin.System | ||
{ | ||
[global::System.ComponentModel.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_STARTMENU = 0x16; // \Windows\Start Menu\Programs | ||
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() | ||
: base(getPath()) | ||
{ | ||
} | ||
|
||
public CommonStartMenuProgramSource(Wox.Infrastructure.UserSettings.ProgramSource source) | ||
: this() | ||
{ | ||
this.BonusPoints = source.BounsPoints; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace Wox.Plugin.System | ||
{ | ||
[global::System.ComponentModel.Browsable(false)] | ||
public class UserStartMenuProgramSource : FileSystemProgramSource | ||
{ | ||
public UserStartMenuProgramSource() | ||
: base(Environment.GetFolderPath(Environment.SpecialFolder.Programs)) | ||
{ | ||
} | ||
|
||
public UserStartMenuProgramSource(Wox.Infrastructure.UserSettings.ProgramSource source) | ||
: this() | ||
{ | ||
this.BonusPoints = source.BounsPoints; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters