Пример #1
0
 private void cGetname_Click(object sender, EventArgs e)
 {
     try
     {
         string Link = tLink.Text;
         if (Link.Length > Link.IndexOf(ytID_Prefix) + ytID_Prefix.Length + 11)
         {
             Link = Link.Substring(0, Link.IndexOf(ytID_Prefix) + ytID_Prefix.Length + 11);
         }
         string YT_Html  = new System.Net.WebClient().DownloadString(Link);
         string ytPrefix = "<meta name=\"title\" content=\"";
         YT_Html = YT_Html.Substring(YT_Html.IndexOf(ytPrefix) + ytPrefix.Length);
         YT_Html = YT_Html.Substring(0, YT_Html.IndexOf("\">"));
         YT_Html = YT_Html.Replace("/", "_").Replace("\\", "_").Replace(":", "_").Replace("?", "_").Replace
                       ("<", "_").Replace("\"", "_").Replace(">", "_").Replace("|", "_");
         if (YT_Html.Length > 250)
         {
             YT_Html = YT_Html.Substring(0, 250);
         }
         tFile.Text = YT_Html;
     }
     catch (Exception ex)
     {
         System.Media.SystemSounds.Hand.Play();
         MessageBox.Show("Houston, we have a problem.\r\n\r\n" +
                         "Occurred in: cmdIdentifyVoid\r\n" + ex.Message);
     }
 }
Пример #2
0
        public star_st currentlocation(string username)
        {
            string result = new System.Net.WebClient().DownloadString("https://www.edsm.net/api-logs-v1/get-position?commanderName=" + username);

            if (result.Length < 13 || result.Substring(0, 13) != "{\"msgnum\":100")
            {
                return(new star_st());
            }
            numofchecks++;
            return(searchbyname(result.Substring(result.IndexOf(",\"system\":\"") + ",\"system\":\"".Length, result.IndexOf("\",\"firstDiscover") - (result.IndexOf(",\"system\":\"") + ",\"system\":\"".Length))));
        }
Пример #3
0
        string[] GetPictureURLs(string ThreadURL)
        {
            try
            {
                string[] ret, PicURLs;
                int      Board;
                for (Board = 0; Board < ChanCfg.Length; Board++)
                {
                    if (ChanP(2, Board) == ThreadURL.Substring(0, ChanP(2, Board).Length))
                    {
                        break;
                    }
                }
                if (Board >= ChanCfg.Length)
                {
                    Board = -1;
                }
                string ThreadHTML = new System.Net.WebClient().DownloadString(ThreadURL);
                if (ChanP(10, Board) != "!null~")
                {
                    ThreadHTML = ThreadHTML.Substring(ThreadHTML.IndexOf(ChanP(10, Board)) + (ChanP(10, Board).Length));
                }
                if (ChanP(11, Board) != "!null~")
                {
                    ThreadHTML = ThreadHTML.Substring(0, ThreadHTML.IndexOf(ChanP(11, Board)));
                }

                string msgbox = "";
                PicURLs = aSplit(ThreadHTML, ChanP(12, Board));
                ret     = new string[PicURLs.GetUpperBound(0)];
                for (int a = 0; a < PicURLs.GetUpperBound(0); a++)
                {
                    ret[a] = PicURLs[a + 1];
                    if (ChanP(13, Board) != "!null~")
                    {
                        ret[a] = ret[a].Substring(ret[a].IndexOf(ChanP(13, Board)) + ChanP(13, Board).Length);
                    }
                    if (ChanP(14, Board) != "!null~")
                    {
                        ret[a] = ret[a].Substring(0, ret[a].IndexOf(ChanP(14, Board)));
                    }
                    if (ChanP(4, Board) != "!null~")
                    {
                        ret[a] = ChanP(4, Board) + ret[a];
                    }
                    msgbox += ret[a] + "\r\n";
                }
                //(ThreadURL + " - " + (msgbox.Split('\n').Length-1) + "\r\n\r\n" + msgbox);
                return(ret);
            }
            catch { MessageBox.Show("Could not open thread."); return(new string[0]); }
        }
Пример #4
0
 /// <summary>
 /// 获取双色球开奖结果
 /// </summary>
 /// <returns></returns>
 private void GetSSQResult()
 {
     string ssqResult = "";
     try
     {
         System.Threading.Thread.Sleep(3000);
         string html = new System.Net.WebClient().DownloadString("http://www.zhcw.com/kaijiang/index_kj.html");
         html = html.Substring(html.IndexOf("<dd>"), html.IndexOf("</dd>") - html.IndexOf("<dd>") + 4).Replace("\r\n","");
         string regStr = "<li class=\"qiured\">(.*?)</li>          <li class=\"qiured\">(.*?)</li>          <li class=\"qiured\">(.*?)</li>          <li class=\"qiured\">(.*?)</li>          <li class=\"qiured\">(.*?)</li>          <li class=\"qiured\">(.*?)</li>          <li class=\"qiublud\">(.*?)</li>";
         var regex = new System.Text.RegularExpressions.Regex(regStr);
         System.Text.RegularExpressions.Match m;
         if ((m = regex.Match(html)).Success && m.Groups.Count == 8)
         {
             for (int i = 1; i < 8; i++)
             {
                 ssqResult += "," + m.Groups[i].Value;
             }
             ssqResult = ssqResult.Substring(1);
         }
     }
     catch (Exception ex)
     {
         ssqResult = ex.Message;
     }
     Response.Write(ssqResult);
     Response.Flush();
     Response.End();
 }
Пример #5
0
        private void tHotkeys_Tick(object sender, EventArgs e)
        {
            if (GetAsyncKeyState(Keys.Scroll) == -32767)
            {
                string src = new System.Net.WebClient().DownloadString(
                    "http://zip.4chan.org/a/imgboard.html");
                src = src
                      .Replace("¤", "")
                      .Replace("\" class=\"quotejs\">No.</a><a href=\"", "¤");
                string[] pa = src
                              .Substring(src.IndexOf("¤") + 1)
                              .Split('¤');
                for (int a = 0; a < pa.Length; a++)
                {
                    pa[a] = pa[a]
                            .Replace("¤", "")
                            .Replace(".html#q", "¤")
                            .Split('¤')[1];
                    pa[a] = pa[a]
                            .Split('"')[0];
                }
                int iRet = 0;
                for (int a = 0; a < pa.Length; a++)
                {
                    int iTmp = Convert.ToInt32(pa[a]);
                    if (iTmp > iRet)
                    {
                        iRet = iTmp;
                    }
                }
                iRet += 2;

                SendKeys.Send("" + iRet);
            }
        }
Пример #6
0
        string[] ReturnThreads(string Board)
        {
            /*try
             * {
             *  string[] ret, BoardURLs; string BoardURL = GetUrlFromBoard(Board);
             *  string BoardHTML = new System.Net.WebClient().DownloadString(BoardURL);
             *  BoardURLs = aSplit(BoardHTML, "</a>  &nbsp; [<a href=\"");
             *  ret = new string[BoardURLs.GetUpperBound(0)];
             *  for (int a = 1; a <= BoardURLs.GetUpperBound(0); a++)
             *      ret[a - 1] = GetUrlFromBoard(Board) + BoardURLs[a].Split('\"')[0];
             *  return ret;
             * }
             * catch { MessageBox.Show("Could not open board."); return new string[0]; }*/

            try
            {
                string[] ret, BoardURLs; string BoardURL = GetUrlFromBoard(Board, true);
                string   BoardHTML = new System.Net.WebClient().DownloadString(BoardURL);
                if (ChanP(5, -1) != "!null~")
                {
                    BoardHTML = BoardHTML.Substring(BoardHTML.IndexOf(ChanP(5, -1)) + (ChanP(5, -1).Length));
                }
                if (ChanP(6, -1) != "!null~")
                {
                    BoardHTML = BoardHTML.Substring(0, BoardHTML.IndexOf(ChanP(6, -1)));
                }

                BoardURLs = aSplit(BoardHTML, ChanP(7, -1));
                ret       = new string[BoardURLs.GetUpperBound(0)];
                for (int a = 0; a < BoardURLs.GetUpperBound(0); a++)
                {
                    ret[a] = BoardURLs[a + 1];
                    if (ChanP(8, -1) != "!null~")
                    {
                        ret[a] = ret[a].Substring(ret[a].IndexOf(ChanP(8, -1)) + ChanP(8, -1).Length);
                    }
                    if (ChanP(9, -1) != "!null~")
                    {
                        ret[a] = ret[a].Substring(0, ret[a].IndexOf(ChanP(9, -1)));
                    }
                    ret[a] = GetUrlFromBoard(Board, false) + ret[a];
                }
                return(ret);
            }
            catch { MessageBox.Show("Could not open board."); return(new string[0]); }
        }
Пример #7
0
        public star_st searchbyname(string starname)
        {
            string  result = new System.Net.WebClient().DownloadString("https://www.edsm.net/api-system-v1/estimated-value?systemName=" + starname);
            star_st ret    = new star_st();

            ret.name = starname;
            if (result.IndexOf(",\"estimatedValue\":") == -1)
            {
                ret.value = -1;
                ret.url   = "";
                return(ret);
            }
            ret.value = Int64.Parse(result.Substring(result.IndexOf(",\"estimatedValue\":") + ",\"estimatedValue\":".Length, result.Length - (result.IndexOf(",\"estimatedValue\":") + ",\"estimatedValue\":".Length) - 1));
            ret.url   = result.Substring(result.IndexOf(",\"url\":") + ",\"url\":".Length, (result.IndexOf(",\"estimatedValue\":") - (result.IndexOf(",\"url\":") + ",\"url\":".Length))).Replace("\\", "");
            ret.url   = ret.url.Substring(1, ret.url.Length - 2);
            return(ret);
        }
Пример #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            string result = new System.Net.WebClient().DownloadString("https://www.edsm.net/api-logs-v1/get-position?commanderName=" + textBox1.Text);

            curr            = searchbyname(result.Substring(result.IndexOf(",\"system\":\"") + ",\"system\":\"".Length, result.IndexOf("\",\"firstDiscover") - (result.IndexOf(",\"system\":\"") + ",\"system\":\"".Length)));
            textBox2.Text   = curr.name + Environment.NewLine + curr.value;
            button2.Text    = "Open " + curr.name;
            button2.Enabled = true;
        }
Пример #9
0
        public star_st searchbyname(string starname)
        {
            string result = new System.Net.WebClient().DownloadString("https://www.edsm.net/api-v1/systems?systemName=" + HttpUtility.UrlEncode(starname) + "&showCoordinates=1");

            if (result == "[]")
            {
                return(new star_st());
            }
            if (!result.Contains("coords"))
            {
                return(new star_st());
            }
            star_st ret = new star_st();

            ret.name    = starname;
            ret.coord.x = Double.Parse((result.Substring(result.IndexOf("\"x\":") + "\"x\":".Length, result.IndexOf(",\"y\":") - (result.IndexOf("\"x\":") + "\"x\":".Length))), CultureInfo.InvariantCulture);
            ret.coord.y = Double.Parse((result.Substring(result.IndexOf(",\"y\":") + ",\"y\":".Length, result.IndexOf(",\"z\":") - (result.IndexOf(",\"y\":") + ",\"y\":".Length))), CultureInfo.InvariantCulture);
            ret.coord.z = Double.Parse((result.Substring(result.IndexOf(",\"z\":") + ",\"z\":".Length, result.IndexOf("}") - (result.IndexOf(",\"z\":") + ",\"z\":".Length))), CultureInfo.InvariantCulture);
            numofchecks++;
            return(ret);
        }
Пример #10
0
        private string time_token(string port)
        {
            byte   retry = 0;
            string str   = "";

            while (str == "")
            {
                try
                {
                    str = new System.Net.WebClient().DownloadString("http://chat.uchat.co.kr:" + port + "/socket.io/1/?t=" + ((new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond).Ticks - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks) / 10000L).ToString());
                }
                catch { System.Threading.Thread.Sleep(1000); if (++retry == 10)
                        {
                            throw new Exception("토큰을 받아올 수 없습니다. (시도횟수 10) - time_token()");
                        }
                }
            }

            return(str.Substring(0, str.IndexOf(":")));
        }
Пример #11
0
        public void versioncheck()
        {
            string temp = "";

            if (!beta)
            {
                temp = new System.Net.WebClient().DownloadString("https://raw.githubusercontent.com/RapidfireCRH/nextinroute/master/version");
                if (temp.Substring(0, temp.Length - 1) != (version_major + "." + version_minor + " " + version_date))
                {
                    Console.Write("Newer version available. Current Version:" + version_major + "." + version_minor + " " + version_date + ". Latest version: " + temp);
                    Thread.Sleep(6000);
                }
            }
            else
            {
                temp = new System.Net.WebClient().DownloadString("https://raw.githubusercontent.com/RapidfireCRH/nextinroute/Dev/version");
                if (temp.Substring(0, temp.Length - 1) != (version_major + "." + version_minor + "b " + version_date))
                {
                    Console.Write("Newer version available. Current Version:" + version_major + "." + version_minor + "b " + version_date + ". Latest version: " + temp);
                    Thread.Sleep(6000);
                }
            }
        }
Пример #12
0
        private void harvesthidemyip(string url)
        {
            List <string> webproxyList = new List <string>();

            string html = "";

            try
            {
                html = new System.Net.WebClient
                {
                    Proxy = null
                }.DownloadString(url);
            }
            catch (Exception ex)
            {
                --threads;
                UpdateLog("Error: " + ex.Message);
                return;
            }

            string keystart      = "var json =";
            string keyend        = "<!-- proxylist -->";
            var    start         = html.IndexOf(keystart) + keystart.Length;
            string jsonProxyList = html.Substring(start, html.IndexOf(keyend) - start);

            List <string> chunks  = jsonProxyList.Split(',').ToList();
            List <string> proxies = new List <string>();

            for (int i = 0; i < chunks.Count; i++)
            {
                string line    = chunks[i];
                int    startl  = line.IndexOf("[{\"i\":\"") + 7;
                string address = line.Substring(startl, line.Length - startl - 1);
                address = address.TrimStart('"');
                if (address.Length > 0)
                {
                    string line2  = chunks[i + 1];
                    int    startr = line2.IndexOf("\"p\":\"") + 5;
                    string port   = line2.Substring(startr, line2.Length - startr - 1);
                    if (port.Length > 0)
                    {
                        address += ":" + port;
                        webproxyList.Add(address);
                        i += 7; // skip the rest
                    }
                }
            }

            // sanitize strings by IP:PORT
            SanitizeProxyList(ref webproxyList);
            // filter by port
            ProcessPortFilter(ref webproxyList);
            // update global list
            lstProxies.AddRange(webproxyList);

            UpdateLog("Adding proxy list from: " + url);
            foreach (var item in webproxyList)
            {
                if (stop_threads)
                {
                    threads--;
                    return;
                }

                string[]     tokens = item.Split(':');
                ListViewItem proxy  = new ListViewItem();
                if (tokens.Length > 1 && !tokens.Contains(""))
                {
                    proxy.Text = tokens[0];
                    proxy.SubItems.Add(tokens[1]);

                    UpdateProxiesList(proxy);
                    proxiesfound++;
                }
                Thread.Sleep(5);
            }

            UpdateLog("Done with: " + url);
            --threads;
        }
Пример #13
0
        private string time_token(string port)
        {
            byte retry = 0;
            string str = "";

            while (str == "")
            {
                try
                {
                    str = new System.Net.WebClient().DownloadString("http://chat.uchat.co.kr:" + port + "/socket.io/1/?t=" + ((new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond).Ticks - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks) / 10000L).ToString());
                }
                catch { System.Threading.Thread.Sleep(1000); if(++retry == 10) throw new Exception("토큰을 받아올 수 없습니다. (시도횟수 10) - time_token()"); }
            }

            return str.Substring(0, str.IndexOf(":"));
        }