BeatSaber-version-changer/ui/NoAdmin.cs

50 lines
1.1 KiB
C#
Raw Permalink Normal View History

2022-05-14 19:00:01 +02:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
2022-05-15 03:02:51 +02:00
using System.Diagnostics;
2022-05-14 19:00:01 +02:00
using System.Drawing;
using System.Linq;
2022-05-15 03:02:51 +02:00
using System.Reflection;
2022-05-14 19:00:01 +02:00
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BeatSaber_Versions.ui
{
public partial class NoAdmin : Form
{
public NoAdmin()
{
InitializeComponent();
}
2022-05-15 03:02:51 +02:00
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();
}
2022-05-14 19:00:01 +02:00
}
2022-05-15 03:02:51 +02:00
2022-05-14 19:00:01 +02:00
}