Wow魔兽世界自动登陆器

原创 2006年06月24日 14:10:00

       前一段时间疯狂的迷上了魔兽世界,为之疯狂,但是9c的5区,让多少玩家郁闷啊,守护之剑每天排队800+,还不停地卡机,掉线,本人上班族,每天晚上6点下班回家排队,上线也都8点多了,MC啊,黑E啊,AQL啊等活动早开始了,十分的郁闷!

     为了按时玩游戏,本着将魔兽进行到底的原则,决定开发一个魔兽的自动登陆器,以解决燃眉之急,哈哈!

     首先定义一个类ViaStruct,用来存储游戏的路径,等待时间,以及用户名,密码!

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Windows.Forms;
using System.Threading;
using System.Diagnostics;
namespace KeyBoardInput
{
    [Serializable]
    public class ViaStruct
    {
        private string timer = "";
        private string filepath = "";
        private string username = "";
        private string pwd = "";
        private string timer2 = "";
        public bool SuccessFlag = false;
        public ViaStruct()
        {
            SuccessFlag=ReadFormKBI();
        }

        #region 属性
        public string Timer
        {
            get { return timer; }
            set { timer = value; }
        }
        public string FilePath
        {
            get { return filepath; }
            set { filepath = value; }
        }
        public string UserName
        {
            get { return username; }
            set { username = value; }
        }
        public string Pwd
        {
            get { return pwd; }
            set { pwd = value; }
        }
        public string Timer2
        {
            get { return timer2; }
            set { timer2 = value; }
        }
        #endregion

        private bool ReadFormKBI()
        {
            StreamReader sr = new StreamReader("info.txt");
            if ((this.filepath = sr.ReadLine()) == null || this.filepath == "")
            {
                return false;
            }
            this.timer = sr.ReadLine();
            this.timer2 = sr.ReadLine();
            this.username = sr.ReadLine();
            this.pwd = sr.ReadLine();
            sr.Close();
            sr.Dispose();
            GC.Collect();
            return true;
        }

        public void WriteToKBI()
        {
            Thread th = new Thread(new ThreadStart(NewMethod));
            th.Start();
        }

        private void NewMethod()
        {
            try
            {
               
                StreamWriter sw = new StreamWriter("info.txt");
                sw.WriteLine(this.filepath);
                sw.Flush();
                sw.WriteLine(this.timer);
                sw.Flush();
                sw.WriteLine(this.timer2);
                sw.Flush();
                sw.WriteLine(this.username);
                sw.Flush();
                sw.WriteLine(this.pwd);
                sw.Flush();
             
                sw.Close();

                MessageBox.Show("写入成功!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

 

然后编写Form1窗口

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Threading;


namespace KeyBoardInput
{
   

    public partial class Form1 : Form
    {
        ViaStruct via;
        Thread th;
        Thread ti;
        public Form1()
        {
            InitializeComponent();
            via = new ViaStruct();
        }

      

        private void Form1_Load(object sender, EventArgs e)
        {
            this.textBox1.Text = via.UserName;
            this.textBox2.Text = via.Pwd;
            this.textBox3.Text = via.FilePath;
            this.textBox4.Text = via.Timer2;
            this.comboBox1.Text = via.Timer;
            th = new Thread(new ThreadStart(NewMethod));
            th.Start();
           
          
        }

        private void NewMethod()
        {
            if (via.SuccessFlag)
            {
                try
                {
                    Thread.Sleep(Convert.ToInt32((Convert.ToDecimal(via.Timer) * 60 * 1000)));//开起程序后等待
                                                                                                                                                          //via.Timer时间内启动程序
                    Process.Start(via.FilePath);
                    Thread.Sleep(Convert.ToInt32((Convert.ToDecimal(via.Timer2) * 60 * 1000)));//启动程序后等待                                                                                                                                      //via.Timer2时间输入用户名密码
                }
                catch (Exception ex)
                {
          
                  if(ex.GetType().ToString()!="System.Threading.ThreadAbortException")
                    MessageBox.Show(ex.Message+"1");
                }               
            }
            if (via.SuccessFlag)
            {
                MySendKeys();
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            this.openFileDialog1.RestoreDirectory = true;
            if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                this.textBox3.Text = this.openFileDialog1.FileName;
                      
            }
           // MessageBox.Show(Environment.CurrentDirectory);
           
        }

        private void notifyIcon1_DoubleClick(object sender, EventArgs e)
        {
            this.Show();
        }

        private void Form1_MinimumSizeChanged(object sender, EventArgs e)
        {
            this.Visible = false;
        }

        private void MySendKeys()//输入用户名密码
        {
           
            foreach (char ArrayValue in via.UserName.ToCharArray())
            {
                SendKeys.SendWait(ArrayValue.ToString());
                Thread.Sleep(10);
            }
            SendKeys.SendWait("{Tab}");
            foreach (char ArrayValue in via.Pwd.ToCharArray())
            {
                SendKeys.SendWait(ArrayValue.ToString());
                Thread.Sleep(10);
            }
            SendKeys.SendWait("{Enter}");
          
        }

        private void button2_Click(object sender, EventArgs e)//给Via对象赋值
        {
            via.Timer = this.comboBox1.Text;
            via.Timer2 = this.textBox4.Text;
            via.FilePath = this.textBox3.Text;        
            via.UserName = this.textBox1.Text;
            via.Pwd = this.textBox2.Text;
            via.WriteToKBI();          
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)//关闭窗口后推出线程
        {
            if (th.ThreadState != System.Threading.ThreadState.Aborted)
                th.Abort();
            if (ti!=null&&ti.ThreadState !=System.Threading.ThreadState.Aborted)
                ti.Abort();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            th.Abort();
            ti = new Thread(new ThreadStart(PrograssImmediately));
            ti.Start();
        }

        private void PrograssImmediately()
        {
            if (via.SuccessFlag)
            {
                try
                {
                    Process.Start(via.FilePath);
                    Thread.Sleep(Convert.ToInt32((Convert.ToDecimal(via.Timer2) * 60 * 1000)));
                }
                catch (Exception ex)
                {
                    //MessageBox.Show(ex.GetType().ToString());
                    if (ex.GetType().ToString() != "System.Threading.ThreadAbortException")
                        MessageBox.Show(ex.Message + "1");
                }
            }
            if (via.SuccessFlag)
            {
                MySendKeys();
            }
        }  

    }
}

把改程序的快捷方式拷入启动里,让其成为开机自启动程序

程序在VS2005 WinXp系统下测试成功!

 

局限性:

1.需要主板BIOS支持自动开机;

2.开机以后电脑就连在互连网上;

3.需要.net framework2.0的支持

相关文章推荐

vb编写游戏登陆器(魔兽世界)

  • 2010年11月01日 12:45
  • 1.63MB
  • 下载

魔兽世界(WOW)3.13版本源码2

  • 2010年04月08日 12:31
  • 17.76MB
  • 下载

CSU wifi免帐号自动登陆器

原理很简单,采用数据包提交的方式提交到服务端。 一下是源代码:(Ubuntu13.04 64位 Linux) #include #include #include #include #...
  • dl6210
  • dl6210
  • 2013年06月15日 14:20
  • 909

魔兽世界模拟器注册器

魔兽世界模拟器注册器是一款WINDOWS平台下注册账号的小程序 适用于以下情况: 1、不想架设WEB服务器(魔兽世界模拟器默认的注册方式为网页注册) 2、80端口被占用 软件特点 1、免费 2、简单易...
  • clb929
  • clb929
  • 2016年04月23日 14:19
  • 540

魔兽世界模型察看器4.8e(含源码)

  • 2006年11月17日 10:34
  • 9.34MB
  • 下载

华科无线网登陆器

// 对话框的构造函数代码在最后。。。 // 为了实现那个小的没有滚动条的界面,, // 尝试过些HTML代码,写div层、IFRAME之类的东西, // 但是最后因为 程序运行中权限的问题,没法自动...

QQ自动登陆器

  • 2014年08月30日 20:58
  • 40.64MB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Wow魔兽世界自动登陆器
举报原因:
原因补充:

(最多只允许输入30个字)