mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-22 18:41:26 -07:00
36 lines
859 B
C#
36 lines
859 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Bloxstrap.Models.SettingTasks
|
|
{
|
|
public class ShortcutTask : BaseTask, ISettingTask
|
|
{
|
|
public string ExeFlags { get; set; } = "";
|
|
|
|
public string ShortcutPath { get; set; }
|
|
|
|
public ShortcutTask(string shortcutPath)
|
|
{
|
|
ShortcutPath = shortcutPath;
|
|
|
|
OriginalState = File.Exists(ShortcutPath);
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
if (NewState == OriginalState)
|
|
return;
|
|
|
|
if (NewState)
|
|
Shortcut.Create(Paths.Application, ExeFlags, ShortcutPath);
|
|
else if (File.Exists(ShortcutPath))
|
|
File.Delete(ShortcutPath);
|
|
|
|
OriginalState = NewState;
|
|
}
|
|
}
|
|
}
|