public static api KeyAuthApp = new api(
name: "chuj",
ownerid: "MQpIlSXHNL",
secret: "bfe9bfb6280c58803703a74879ee558f1ae352265f22a7b28bbf7beb96b40bb5",
version: "1.0"
);
{
{
KeyAuthApp.init();
if (KeyAuthApp.response.message == "invalidver")
{
if (!string.IsNullOrEmpty(KeyAuthApp.app_data.downloadLink))
{
DialogResult dialogResult = MessageBox.Show("Yes to open
file in browser\nNo to download file automatically", "Auto update",
MessageBoxButtons.YesNo);
switch (dialogResult)
{
case DialogResult.Yes:
Process.Start(KeyAuthApp.app_data.downloadLink);
Environment.Exit(0);
break;
case DialogResult.No:
WebClient webClient = new WebClient();
string destFile = Application.ExecutablePath;
string rand = random_string();
destFile = destFile.Replace(".exe", $"-
{rand}.exe");
webClient.DownloadFile(KeyAuthApp.app_data.downloadLink, destFile);
Process.Start(destFile);
Process.Start(new ProcessStartInfo()
{
Arguments = "/C choice /C Y /N /D Y /T 3 &
Del \"" + Application.ExecutablePath + "\"",
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "cmd.exe"
});
Environment.Exit(0);
break;
default:
MessageBox.Show("Invalid option");
Environment.Exit(0);
break;
}
}
MessageBox.Show("Posiadasz starą wersję programu, pobierz nową
za pomocą komendy !download z kanału #cmds na discordzie discord.gg/uran");
Thread.Sleep(2500);
Environment.Exit(0);
}
if (!KeyAuthApp.response.success)
{
MessageBox.Show(KeyAuthApp.response.message);
Environment.Exit(0);
}
// if(KeyAuthApp.checkblack())
// {
// MessageBox.Show("user is blacklisted");
// }
// else
// {
// MessageBox.Show("user is not blacklisted");
// }
KeyAuthApp.check();
}
}
static string random_string()
{
string str = null;
Random random = new Random();
for (int i = 0; i < 5; i++)
{
str += Convert.ToChar(Convert.ToInt32(Math.Floor(26 *
random.NextDouble() + 65))).ToString();
}
return str;
login
{
{
KeyAuthApp.login(logintextboxpast.Text, passwordtextboxpast.Text);
if (KeyAuthApp.response.success)
{
Main mainForm = new Main();
mainForm.Show();
this.Hide();
}
else
{
Guna.UI2.WinForms.Guna2MessageDialog messageDialog = new
Guna.UI2.WinForms.Guna2MessageDialog();
messageDialog.Text = "Username or password is invalid!";
messageDialog.Buttons =
Guna.UI2.WinForms.MessageDialogButtons.OK;
messageDialog.Style =
Guna.UI2.WinForms.MessageDialogStyle.Dark;
messageDialog.Icon = Guna.UI2.WinForms.MessageDialogIcon.Error;
messageDialog.Parent = this;
messageDialog.Show();
}
}
}
register
private void guna2Button2_Click(object sender, EventArgs e)
{
if (guna2Button1.BorderThickness == 0)
{
Guna.UI2.WinForms.Guna2MessageDialog messageDialog = new
Guna.UI2.WinForms.Guna2MessageDialog();
messageDialog.Text = "To register please fill in\nusername,
password and license\n(Click the button again)";
messageDialog.Buttons = Guna.UI2.WinForms.MessageDialogButtons.OK;
messageDialog.Style = Guna.UI2.WinForms.MessageDialogStyle.Dark;
messageDialog.Icon =
Guna.UI2.WinForms.MessageDialogIcon.Information;
messageDialog.Parent = this;
messageDialog.Show();
guna2Button1.BorderThickness = 1;
}
else
{
KeyAuthApp.register(logintextboxpast.Text,
passwordtextboxpast.Text, licensetextboxpast.Text);
if (KeyAuthApp.response.success)
{
Main main = new Main();
main.Show();
this.Hide();
}
else
{
Guna.UI2.WinForms.Guna2MessageDialog messageDialog = new
Guna.UI2.WinForms.Guna2MessageDialog();
messageDialog.Text = "License is invalid!";
messageDialog.Buttons =
Guna.UI2.WinForms.MessageDialogButtons.OK;
messageDialog.Style =
Guna.UI2.WinForms.MessageDialogStyle.Dark;
messageDialog.Icon = Guna.UI2.WinForms.MessageDialogIcon.Error;
messageDialog.Parent = this;
messageDialog.Show();
}
}
licensepanelpast.Show();
}