private void button1_Click(object sender, EventArgs e) { gfn gfn = new gfn(); if (comboBox1.Text == "kill") { if (comboBox2.Text == "processname") { gfn.ProcessKill(textBox1.Text); MessageBox.Show("The Process was killed."); } if (comboBox2.Text == "pid") { gfn.ProcessKillPID(textBox1.Text); MessageBox.Show("The Process was killed."); } } if (comboBox1.Text == "suspend") { if (comboBox2.Text == "processname") { gfn.ProcessSuspend(textBox1.Text); MessageBox.Show("The Process was suspended."); } if (comboBox2.Text == "pid") { gfn.ProcessSuspendPID(textBox1.Text); MessageBox.Show("The Process was suspended."); } } if (comboBox1.Text == "resume") { if (comboBox2.Text == "processname") { gfn.ProcessResume(textBox1.Text); MessageBox.Show("The Process was resumed."); } if (comboBox2.Text == "pid") { gfn.ProcessResumePID(textBox1.Text); MessageBox.Show("The Process was resumed."); } } }
static void Main(string[] args) { bool gui = false; gfn gfn = new gfn(); if (args.Length == 0) { gui = true; Application.EnableVisualStyles(); Application.Run(new taskutilgui(gui)); } else { if (args[0] == "/?") { gfn.Help(); } if (args[0] == "/k") { if (args.Length == 1) { gfn.NoProcessTypeFinder(); } if (args.Length == 2) { gfn.NoProcessArg(); } if (args[1] == "/p") { gfn.ProcessKillPID(args[2]); } if (args[1] == "/n") { gfn.ProcessKill(args[2]); } } if (args[0] == "/s") { if (args.Length == 1) { gfn.NoProcessTypeFinder(); } if (args.Length == 2) { gfn.NoProcessArg(); } if (args[1] == "/p") { Console.WriteLine("The Process was suspended."); gfn.ProcessSuspendPID(args[2]); } if (args[1] == "/n") { Console.WriteLine("The Process was suspended."); gfn.ProcessSuspend(args[2]); } } if (args[0] == "/r") { if (args.Length == 1) { gfn.NoProcessTypeFinder(); } if (args.Length == 2) { gfn.NoProcessArg(); } if (args[1] == "/p") { Console.WriteLine("The Process was resumed."); gfn.ProcessResumePID(args[2]); } if (args[1] == "/n") { Console.WriteLine("The Process was resumed."); gfn.ProcessResume(args[2]); } } } }