BeatSaber-version-changer/ui/NoAdmin.cs
2022-05-15 03:02:51 +02:00

50 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BeatSaber_Versions.ui
{
public partial class NoAdmin : Form
{
public NoAdmin()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
StartAsAdmin($@"{AppDomain.CurrentDomain.BaseDirectory}BeatSaber-Versions.exe");
}
public static void StartAsAdmin(string fileName)
{
var proc = new Process
{
StartInfo =
{
FileName = fileName,
UseShellExecute = true,
Verb = "runas"
}
};
proc.Start();
Application.Exit();
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}