using NativeHelpers;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SetLnkApp
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
string[] args = Environment.GetCommandLineArgs();
if (args.Length < 2 || !File.Exists(args[1]) || Path.GetExtension(args[1]).ToLower() != ".lnk")
{
Usage();
return;
}
ShellLink shortcut = null;
try
{
shortcut = new ShellLink(args[1]);
}
catch (Exception)
{
Usage();
return;
}
if (shortcut == null)
{
Usage();
return;
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm(shortcut));
}
private static void Usage()
{
MessageBox.Show("Please drag a .lnk file onto SetLnkApp.exe");
}
}
}