bloxstrap/Bloxstrap/Models/SettingTasks/ShortcutTask.cs
pizzaboxer 7e95fb4d8f
Deferred settings application system + new shortcut settings
this system took way too much effort to think of for some reason idk why
2024-08-13 00:10:18 +01:00

36 lines
828 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
File.Delete(ShortcutPath);
OriginalState = NewState;
}
}
}