Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Update...
Browse files Browse the repository at this point in the history
  • Loading branch information
ny4rlk0 committed May 7, 2024
1 parent 3c6bef2 commit 044e1ea
Show file tree
Hide file tree
Showing 10 changed files with 5,273 additions and 3 deletions.
117 changes: 115 additions & 2 deletions WindowsActivation/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 74 additions & 1 deletion WindowsActivation/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,92 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Security.Principal;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using MaterialSkin;
using MaterialSkin.Controls;

namespace WindowsActivation
{
public partial class Form1 : Form
public partial class Form1 : MaterialForm
{
public Form1()
{
InitializeComponent();
var materialSkinManager = MaterialSkinManager.Instance;
materialSkinManager.AddFormToManage(this);
materialSkinManager.Theme = MaterialSkinManager.Themes.DARK;
materialSkinManager.ColorScheme = new ColorScheme(Primary.Grey900, Primary.Grey600, Primary.Grey100, Accent.Teal100, TextShade.WHITE);
}

private void Form1_Load(object sender, EventArgs e)
{
runAsAdministrator();
}
#region Admin olarak çalıştırma metodu
static private void runAsAdministrator()
{
var wi = WindowsIdentity.GetCurrent();
var wp = new WindowsPrincipal(wi);
bool runAsAdmin = wp.IsInRole(WindowsBuiltInRole.Administrator);
if (!runAsAdmin)
{
var processInfo = new ProcessStartInfo(Assembly.GetExecutingAssembly().CodeBase);
processInfo.UseShellExecute = true;
processInfo.Verb = "runas";
try { Process.Start(processInfo); }
catch (Exception) { MessageBox.Show("Run this program as Administrator!"); }
System.Windows.Forms.Application.Exit();
Environment.Exit(0);
}
}
#endregion

private void materialButton1_Click(object sender, EventArgs e)
{
Thread bt = new Thread(() => ps("irm https://massgrave.dev/get | iex"));
bt.Start();
materialButton1.Enabled = false;
}
#region Powershell komut çalıştırma metodu
private string ps(string komut)
{
string output = "", error = "";
try
{
ProcessStartInfo psi = new ProcessStartInfo
{
FileName = "powershell.exe",
Arguments = "-noprofile -executionpolicy bypass -command \"" + komut + "\"",
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = true
};
using (Process process = new Process { StartInfo = psi })
{
process.Start();
output = process.StandardOutput.ReadToEnd();
error = process.StandardError.ReadToEnd();
process.WaitForExit();
return output.Trim() + error.Trim();
}
}
catch (Exception ex)
{ return ex.ToString(); }
finally
{
this.Invoke((MethodInvoker)delegate { materialButton1.Enabled = true; });

}
}
#endregion
}
}
Loading

0 comments on commit 044e1ea

Please sign in to comment.