Press "Enter" to skip to content

极域Killer 1.0代码

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace JiYu_Killer
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {

        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string name;
            name = "StudentMain.exe";
            KillProcess(name);
        }
        public void KillProcess(string processName)
        {
            foreach (var process in Process.GetProcessesByName(processName))
            {
                try
                {
                    // 杀掉这个进程。
                    process.Kill();

                    // 等待进程被杀掉。你也可以在这里加上一个超时时间(毫秒整数)。
                    process.WaitForExit();
                }
                catch (Win32Exception ex)
                {
                    MessageBox.Show("执行错误,无法杀死极域!",ex.ToString());
                    // 无法结束进程,可能有很多原因。
                    // 建议记录这个异常,如果你的程序能够处理这里的某种特定异常了,那么就需要在这里补充处理。
                    // Log.Error(ex);
                }
                catch (InvalidOperationException)
                {
                    MessageBox.Show("执行成功,极域已被杀死!");
                    // 进程已经退出,无法继续退出。既然已经退了,那这里也算是退出成功了。
                    // 于是这里其实什么代码也不需要执行。
                }
            }
        }
        public static string Get(string url, Dictionary<string, string> dic)
        {
            string result = "";
            StringBuilder builder = new StringBuilder();
            builder.Append(url);
            if (dic.Count > 0)
            {
                builder.Append("?");
                int i = 0;
                foreach (var item in dic)
                {
                    if (i > 0)
                        builder.Append("&");
                    builder.AppendFormat("{0}={1}", item.Key, item.Value);
                    i++;
                }
            }
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(builder.ToString());
            //添加参数
            HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
            Stream stream = resp.GetResponseStream();
            try
            {
                //获取内容
                using (StreamReader reader = new StreamReader(stream))
                {
                    result = reader.ReadToEnd();
                }
            }
            finally
            {
                stream.Close();
            }
            return result;
        }

        private void version_Click(object sender, RoutedEventArgs e)
        {
            //int version;
            //string target;
            //version = 1;
            //target = "lmceric.top/jykiller.php";
            MessageBox.Show("功能正在开发中");
        }
    }
}
发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注