bloxstrap/Bloxstrap/Models/SettingTasks/ShortcutTask.cs
pizzaboxer ab2f5f589a
Cleanup new shortcuts functionality
Remove old obsolete option and ensure uninstaller deletes all the new shortcuts
2024-08-13 14:51:15 +01:00

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;
}
}
}