Exemple #1
0
        internal static void Construction(object o)
        {
            ArrayList balls = new ArrayList();

            ha         = ConstructionInfo.PrepareHttpAccesser(universe);
            ha.Referer = referer;
            string baseurl = ha.AccessUrl;

            foreach (ProductivityInfo.Ball ball in pi.Balllist)
            {
                ha.AccessUrl = baseurl + ball.AccessParm;
                ha.Cookies   = ccold;
                IEnumerator ie = ccnew.GetEnumerator();
                while (ie.MoveNext())
                {
                    ha.Cookies.Add((Cookie)ie.Current);
                }
                ccnew      = ha.access();
                ha.Referer = baseurl;
                //取得每一个星球
                ConstructionInfo ciloop = ConstructionInfo.AnalyzHtml();
                ciloop.CurrentBallName = ball.Name;
                balls.Add(ciloop);
            }
            referer = ha.AccessUrl;
            ConstructionEventHandler(balls);
        }
Exemple #2
0
        internal static HttpAccesser PrepareHttpAccesser(string universe, string loginname, string pw)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("http://");
            sb.Append(universe);
            sb.Append(".cicihappy.com/ogame/login.php");
            HttpAccesser ha = new HttpAccesser();

            ha.AccessUrl    = sb.ToString();
            ha.AccessMethod = HttpAccesser.ACCESS_METHOD.POST;
            ha.Host         = universe + ".cicihappy.com";
            ha.UserAgent    = "Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3";
            ha.Accept       = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
            ha.AddHeader("Accept-Language", "en-US,en;q=0.5");
            ha.Referer     = "http://www.cicihappy.com/";
            ha.Connection  = "keep-alive";
            ha.ContentType = "application/x-www-form-urlencoded";
            ha.IsUseCookie = true;
            //ha.AddCookie("bd8e9_lastvisit", "1594%091376360967%09%2Findex.php", "/", "www.cicihappy.com", "Wed, 13-Aug-2014 02:29:27 GMT");
            ha.AddCookie("pgv_pvi", "6115632128", "/", ".cicihappy.com", "2038年1月18日 8:00:00");
            ha.AddCookie("pgv_si", "s1617598464", "/", ".cicihappy.com", null);
            //ha.AddCookie("pgv_si", "s3797821440", "/", ".cicihappy.com", null);
            ha.UrlParam = "v=2&username="******"&password="******"&universe=" + universe + ".cicihappy.com";
            return(ha);
        }
Exemple #3
0
        internal static HttpAccesser PrepareHttpAccesser(HttpAccesser ha, string universe, int range)
        {
            if (ha == null)
            {
                ha = new HttpAccesser();
            }
            //指定有问题?只有第一次可以这样指定。
            if (ha.AccessUrl == null)
            {
                ha.Referer = "http://" + universe + ".cicihappy.com/ogame/leftmenu.php";
            }
            else
            {
                ha.Referer = ha.AccessUrl;
            }
            StringBuilder sb = new StringBuilder();

            sb.Append("http://");
            sb.Append(universe);
            sb.Append(".cicihappy.com/ogame/stat.php?range=1");
            ha.AccessUrl    = sb.ToString();
            ha.AccessMethod = HttpAccesser.ACCESS_METHOD.POST;
            ha.Host         = universe + ".cicihappy.com";
            ha.UserAgent    = "Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3";
            ha.Accept       = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
            ha.AddHeader("Accept-Language", "en-US,en;q=0.5");
            ha.Connection  = "keep-alive";
            ha.IsUseCookie = true;
            ha.ContentType = "application/x-www-form-urlencoded";
            ha.UrlParam    = "whochange=0&typechange=0&rangechange=1&who=1&type=1&range=" + range;
            return(ha);
        }
Exemple #4
0
        internal static void login(object o)
        {
            ccold = null;
            ccnew = null;
            ha    = LoginInfo.PrepareHttpAccesser(universe, loginname, password);
            ccold = ha.Cookies;
            ccnew = ha.access();
            LoginInfo li = LoginInfo.AnalyzHtml();

            ObjectEventHandler(li);
            Thread.Sleep(200);
        }
Exemple #5
0
        internal static void Rank(object o)
        {
            string connStr = "Provider=Microsoft.ACE.OLEDB.12.0;data source=rank.accdb";

            try
            {
                using (OleDbConnection dbc = new OleDbConnection(connStr))
                {
                    dbc.Open();
                    DataSet          ds  = new DataSet();
                    OleDbDataAdapter adp = new OleDbDataAdapter();

                    for (int c = 0; c < 15; c++)
                    {
                        ha         = RankInfo.PrepareHttpAccesser(StarScript.ha, universe, c * 100 + 1);
                        ha.Cookies = ccold;
                        IEnumerator i = ccnew.GetEnumerator();
                        while (i.MoveNext())
                        {
                            ha.Cookies.Add((Cookie)i.Current);
                        }
                        ccold = ha.Cookies;
                        ccnew = ha.access();
                        RankInfo[] ris = RankInfo.AnalyzHtml();

                        for (int j = 0; j < ris.Length; j++)
                        {
                            if (ris[j] != null)
                            {
                                adp.InsertCommand = new OleDbCommand(@"insert into rank (rank,player,score,cdate) values ('" + ris[j].Rank + "','" + ris[j].User + "','" + ris[j].Score + "',now())", dbc);
                                adp.InsertCommand.ExecuteNonQuery();
                            }
                        }
                    }
                }
            }
            catch (System.InvalidOperationException ioe)
            {
                if (ioe.ToString().Contains("OLEDB"))
                {
                    MessageBox.Show(ConstString.suggest_db_conn_program_not_install);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            RankScanOverHandler(0);
        }
        internal static HttpAccesser PrepareHttpAccesser(string universe)
        {
            HttpAccesser  ha = new HttpAccesser();
            StringBuilder sb = new StringBuilder();

            sb.Append("http://");
            sb.Append(universe);
            sb.Append(".cicihappy.com/ogame/buildings.php");
            ha.AccessUrl    = sb.ToString();
            ha.AccessMethod = HttpAccesser.ACCESS_METHOD.GET;
            ha.Host         = universe + ".cicihappy.com";
            ha.UserAgent    = "Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3";
            ha.Accept       = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
            ha.AddHeader("Accept-Language", "en-US,en;q=0.5");
            ha.Referer     = "";
            ha.Connection  = "keep-alive";
            ha.IsUseCookie = true;
            return(ha);
        }
Exemple #7
0
        internal static void Productivity(object o)
        {
            ArrayList balls = new ArrayList();

            ha         = ProductivityInfo.PrepareHttpAccesser(universe);
            ha.Referer = referer;
            string baseurl = ha.AccessUrl;

            ha.Cookies = ccold;
            IEnumerator i = ccnew.GetEnumerator();

            while (i.MoveNext())
            {
                ha.Cookies.Add((Cookie)i.Current);
            }
            ccold = ha.Cookies;
            ccnew = ha.access();
            //取得第一个星球的总星球列表
            pi = ProductivityInfo.AnalyzHtml();

            foreach (ProductivityInfo.Ball ball in pi.Balllist)
            {
                ha.Referer   = ha.AccessUrl;
                ha.AccessUrl = baseurl + ball.AccessParm;
                ha.Cookies   = ccold;
                IEnumerator ie = ccnew.GetEnumerator();
                while (ie.MoveNext())
                {
                    ha.Cookies.Add((Cookie)ie.Current);
                }
                ccnew = ha.access();
                //取得每一个星球
                ProductivityInfo piloop = ProductivityInfo.AnalyzHtml();
                balls.Add(piloop);
                MessageEventHandler(100 / pi.Balllist.Count);
            }
            Thread.Sleep(600);
            referer = ha.AccessUrl;
            ObjectEventHandler(pi);
            Thread.Sleep(200);
            ObjectEventHandler(balls);
            Thread.Sleep(200);
        }
Exemple #8
0
        internal static void logout(object o)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("http://u7.cicihappy.com/ogame/buildings.php");
            HttpAccesser ha = new HttpAccesser();

            ha.AccessUrl    = sb.ToString();
            ha.AccessMethod = HttpAccesser.ACCESS_METHOD.GET;
            ha.Host         = "u7.cicihappy.com";
            ha.UserAgent    = "Mozilla/5.0 (Windows NT 6.1; rv:22.0) Gecko/20100101 Firefox/22.0";
            ha.Accept       = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
            ha.AddHeader("Accept-Language", "en-US,en;q=0.5");
            ha.Referer     = "http://u7.cicihappy.com/ogame/leftmenu.php";
            ha.Connection  = "keep-alive";
            ha.ContentType = "application/x-www-form-urlencoded";
            ha.IsUseCookie = true;
            ccold          = ha.Cookies;
            ccnew          = ha.access();
            Thread.Sleep(200);
        }
Exemple #9
0
        internal static void overview(object o)
        {
            ArrayList balls = new ArrayList();

            ha = OverviewInfo.PrepareHttpAccesser(universe);
            string baseurl = ha.AccessUrl;

            ha.Cookies = ccold;
            IEnumerator i = ccnew.GetEnumerator();

            while (i.MoveNext())
            {
                ha.Cookies.Add((Cookie)i.Current);
            }
            ccold = ha.Cookies;
            ccnew = ha.access();
            //取得第一个星球的总星球列表
            OverviewInfo ovf = OverviewInfo.AnalyzHtml();

            foreach (OverviewInfo.Ball ball in ovf.Balllist)
            {
                ha.Referer   = ha.AccessUrl;
                ha.AccessUrl = baseurl + ball.AccessParm;
                ha.Cookies   = ccold;
                IEnumerator ie = ccnew.GetEnumerator();
                while (ie.MoveNext())
                {
                    ha.Cookies.Add((Cookie)ie.Current);
                }
                ccnew = ha.access();
                //取得每一个星球
                OverviewInfo ovfloop = OverviewInfo.AnalyzHtml();
                balls.Add(ovfloop);
            }
            referer = ha.AccessUrl;
            ObjectEventHandler(ovf);
            Thread.Sleep(200);
            ObjectEventHandler(balls);
            Thread.Sleep(200);
        }
Exemple #10
0
        internal static HttpAccesser PrepareHttpAccesser(string universe)
        {
            HttpAccesser  ha = new HttpAccesser();
            StringBuilder sb = new StringBuilder();

            sb.Append("http://");
            sb.Append(universe);
            sb.Append(".cicihappy.com/ogame/galaxy.php?mode=0");
            ha.AccessUrl    = sb.ToString();
            ha.AccessMethod = HttpAccesser.ACCESS_METHOD.GET;
            ha.Host         = universe + ".cicihappy.com";
            ha.UserAgent    = "Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3";
            ha.Accept       = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
            ha.AddHeader("Accept-Language", "en-US,en;q=0.5");
            //指定有问题?只有第一次可以这样指定。
            ha.Referer     = "http://" + universe + ".cicihappy.com/ogame/leftmenu.php";
            ha.Connection  = "keep-alive";
            ha.IsUseCookie = true;
            ha.ContentType = "application/x-www-form-urlencoded";
            //ha.UrlParam = "galaxyRight=dr&galaxy=" + 1 + "&system=" + 1 + "&galaxycode=";
            return(ha);
        }
Exemple #11
0
        private void homepage(object o)
        {
            ccold = null;
            ccnew = null;
            StringBuilder sb = new StringBuilder();

            sb.Append("http://www.cicihappy.com/");
            HttpAccesser ha = new HttpAccesser();

            ha.AccessUrl    = sb.ToString();
            ha.AccessMethod = HttpAccesser.ACCESS_METHOD.POST;
            ha.Host         = "www.cicihappy.com";
            ha.UserAgent    = "Mozilla/5.0 (Windows NT 6.1; rv:22.0) Gecko/20100101 Firefox/22.0";
            ha.Accept       = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
            ha.AddHeader("Accept-Language", "en-US,en;q=0.5");
            ha.Referer     = "http://www.cicihappy.com/";
            ha.Connection  = "keep-alive";
            ha.ContentType = "";
            ha.IsUseCookie = true;
            ha.AddHeader("Cache-Control", "max-age=0");
            ccold = ha.Cookies;
            ccnew = ha.access();
            Thread.Sleep(200);
        }
Exemple #12
0
        internal static void Locations(object o)
        {
            ha = LocationsInfo.PrepareHttpAccesser(universe);
            //ha.Referer = referer;
            ha.Cookies = ccold;
            IEnumerator i = ccnew.GetEnumerator();

            while (i.MoveNext())
            {
                ha.Cookies.Add((Cookie)i.Current);
            }
            ccold = ha.Cookies;
            ccnew = ha.access();
            LocationsInfo[] mylis = LocationsInfo.AnalyzHtml();

            ha.AccessMethod = HttpAccesser.ACCESS_METHOD.POST;
            ha.AccessUrl    = "http://" + universe + ".cicihappy.com/ogame/galaxy.php?mode=1";
            ha.Referer      = "http://" + universe + ".cicihappy.com/ogame/galaxy.php?mode=0";
            //Txtout.writeA("银河系,太阳系,行星,联盟,玩家,星球名,月球,度假\r\n", "balls.csv");
            string connStr = "Provider=Microsoft.ACE.OLEDB.12.0;data source=rank.accdb";

            try
            {
                using (OleDbConnection dbc = new OleDbConnection(connStr))
                {
                    dbc.Open();
                    OleDbDataAdapter adp = new OleDbDataAdapter();
                    adp.SelectCommand = new OleDbCommand(@"select max([_id]) as maxid from scanprocess where not complete", dbc);
                    DataTable dt        = new DataTable();
                    string    processid = string.Empty;
                    bool      usecontinue;
                    adp.Fill(dt);
                    if (dt.Rows.Count > 0 && !dt.Rows[0][0].ToString().Equals(string.Empty))
                    {
                        usecontinue = true;
                        processid   = dt.Rows[0][0].ToString();
                    }
                    else
                    {
                        usecontinue = false;
                    }
                    if (usecontinue)
                    {
                        //找到最后一次扫描的最后一个球的坐标 -- galaxy and solar index
                        adp.SelectCommand = new OleDbCommand(@"select top 1 galaxy, solar from 
    (select *,galaxy * 1000 + solar as xuhao from galaxymap where process = " + processid + @")t1 order by xuhao desc", dbc);
                        dt.Columns.Clear();
                        dt.Clear();
                        adp.Fill(dt);
                        int galaxyStart;
                        int solarStart;
                        if (dt.Rows.Count == 0)
                        {
                            galaxyStart = 1;
                            solarStart  = 1;
                        }
                        else
                        {
                            galaxyStart = ProductivityInfo.ToInt(dt.Rows[0][0].ToString());
                            solarStart  = ProductivityInfo.ToInt(dt.Rows[0][1].ToString());
                        }
                        //根据坐标继续扫描
                        GalaxyLoop(processid, galaxyStart, solarStart, adp, dbc);
                    }
                    else
                    {
                        //创建一个新的扫描过程
                        adp.InsertCommand = new OleDbCommand(@"insert into scanprocess (complete, cdate) values (false, now())", dbc);
                        adp.InsertCommand.ExecuteNonQuery();
                        adp.SelectCommand = new OleDbCommand(@"select max([_id]) as maxid from scanprocess where not complete", dbc);
                        dt.Columns.Clear();
                        dt.Clear();
                        adp.Fill(dt);
                        if (dt.Rows.Count > 0)
                        {
                            processid = dt.Rows[0][0].ToString();
                            //从头扫描
                            GalaxyLoop(processid, 1, 1, adp, dbc);
                        }
                    }
                }
            }
            catch (System.InvalidOperationException ioe)
            {
                if (ioe.ToString().Contains("OLEDB"))
                {
                    MessageBox.Show(ConstString.suggest_db_conn_program_not_install);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }