mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
27 lines
768 B
C#
27 lines
768 B
C#
namespace Bloxstrap.Models.SettingTasks
|
|
{
|
|
public class ShortcutTask : BoolBaseTask
|
|
{
|
|
private string _shortcutPath;
|
|
|
|
private string _exeFlags;
|
|
|
|
public ShortcutTask(string name, string lnkFolder, string lnkName, string exeFlags = "") : base("Shortcut", name)
|
|
{
|
|
_shortcutPath = Path.Combine(lnkFolder, lnkName);
|
|
_exeFlags = exeFlags;
|
|
|
|
OriginalState = File.Exists(_shortcutPath);
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
if (NewState)
|
|
Shortcut.Create(Paths.Application, _exeFlags, _shortcutPath);
|
|
else if (File.Exists(_shortcutPath))
|
|
File.Delete(_shortcutPath);
|
|
|
|
OriginalState = NewState;
|
|
}
|
|
}
|
|
} |