using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
namespace L2
{
class Program
{
static void Main(string[] args)
{
var executableFile = "l2.bin";
if (!File.Exists(executableFile))
{
MessageBox(IntPtr.Zero, $"File {executableFile} not found!", "Warning!", MB_ICONWARNING);
return;
}
try
{
_ = new Process
{
StartInfo = new ProcessStartInfo()
{
FileName = executableFile,
UseShellExecute = false,
Verb = "runas"
}
}.Start();
}
catch (Exception e)
{
MessageBox(IntPtr.Zero, e.ToString(), e.Message, 0);
}
}
// https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox
public static readonly long MB_ICONWARNING = 0x00000030L;
// https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int MessageBox(IntPtr hWnd, string lpText, string lpCaption, long uType);
}
}