Exemple #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);
     }
 }
 /// <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();
 }
Exemple #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]); }
        }
Exemple #4
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);
            }
        }
Exemple #5
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]); }
        }
Exemple #6
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);
        }
Exemple #7
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;
        }
        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))));
        }
        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);
        }
Exemple #10
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.Text += Application.ProductVersion;
            string strError = "Warning!\r\n\r\nCould not verify the download template.\r\nProgram may not work!";

            #region Update checker and template downloader
            try
            {
                string wcRaw = new System.Net.WebClient().DownloadString(ptAppInfo);
                if (wcRaw.IndexOf("<ytDL_Template>") == -1)
                {
                    MessageBox.Show(strError);
                }
                else
                {
                    string Tpl = wcRaw;
                    Tpl           = Tpl.Substring(Tpl.IndexOf("<ytDL_Template>") + "<ytDL_Template>".Length);
                    Tpl           = Tpl.Substring(0, Tpl.IndexOf("</ytDL_Template>"));
                    ytDL_Template = Tpl;

                    //string Ver = wcRaw; string myVer = ProductVersion;
                    //Ver = Ver.Substring(Ver.IndexOf("<version>") + "<version>".Length);
                    //Ver = Ver.Substring(0, Ver.IndexOf("</version>"));
                    if (wcRaw.IndexOf("<version>" + Application.ProductVersion + "</version>") == -1)
                    {
                        MessageBox.Show("There is a new version available on my website.\r\n" +
                                        "Please re-download PYTD if you want to update.");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(strError + "\r\n\r\n" + "Specific error:\r\n" + ex.Message);
            }
            #endregion
        }
Exemple #11
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(":")));
        }
Exemple #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;
        }
Exemple #13
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            #region Update checker and template downloader
            string strError = "VirtuaPad could not check for new versions!";
            try
            {
                string wcRaw = new System.Net.WebClient().DownloadString(ptAppInfo);
                if (wcRaw.IndexOf("<version>") == -1)
                {
                    MessageBox.Show(strError);
                }
                else
                {
                    if (wcRaw.IndexOf("<version>" + Application.ProductVersion + "</version>") == -1)
                    {
                        MessageBox.Show("There is a new version available on my website.\r\n" +
                                        "Please re-download VirtuaPad if you want to update.");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(strError + "\r\n\r\n" + "Specific error:\r\n" + ex.Message);
            }
            #endregion
            Root = InputBox.Show("Enter the name of the samples folder you wish to use.",
                                 "Samples chooser", "Demo_03").Text + "/";
            string raw = FileRead(Root + "_config.txt").Replace("\r", "");
            if (raw == "")
            {
                MessageBox.Show("Could not find a valid _config.txt file!"); Application.Exit(); return;
            }
            this.Text = "VirtuaPad ~ v" + Application.ProductVersion + " ~ " +
                        raw.Substring(0, raw.IndexOf("\n"));
            raw = raw.Substring(raw.IndexOf("\n") + 1);
            while (raw.IndexOf("\n\n") != -1)
            {
                raw = raw.Replace("\n\n", "\n");
            }
            while (raw.StartsWith("\n"))
            {
                raw = raw.Substring(1);
            }
            while (raw.EndsWith("\n"))
            {
                raw = raw.Substring(0, raw.Length - 1);
            }
            Paths = raw.Split('\n');

            lInf = new LabelArray(this); pGlow = new PBoxArray(this); pPad = new PanelArray(this);
            for (int y = 1; y <= 4; y++)
            {
                for (int x = 1; x <= 4; x++)
                {
                    int aThis = ControlIntFromXY(x, y);
                    pGlow.NewPBox(); pPad.NewPanel(); lInf.NewLabel();
                    pGlow[aThis].Size            = new Size(124, 124);
                    pGlow[aThis].Location        = new Point(((x * 130) - 130) + 12, ((y * 130) - 130) + 63);
                    pGlow[aThis].BackColor       = Color.FromArgb(0, 60, 125);
                    pGlow[aThis].BackgroundImage = picGlow2.Image;
                    pGlow[aThis].Controls.Add(pPad[aThis]);
                    pPad[aThis].Size      = new Size(100, 100);
                    pPad[aThis].Location  = new Point(12, 12);
                    pPad[aThis].BackColor = Color.Transparent;
                    pPad[aThis].Controls.Add(lInf[aThis]);
                    lInf[aThis].AutoSize  = false; lInf[aThis].Size = new Size(90, 90);
                    lInf[aThis].Location  = new Point(5, 5);
                    lInf[aThis].BackColor = Color.Transparent;
                    lInf[aThis].ForeColor = Color.FromArgb(0, 0, 0);
                    lInf[aThis].Text      = HotkeyFromControlInt(aThis) + "\r\n\r\n" + Paths[aThis];
                    lInf[aThis].TextAlign = ContentAlignment.MiddleCenter;
                    pGlow[aThis].BringToFront(); pPad[aThis].BringToFront(); lInf[aThis].BringToFront();
                }
            }
            aiFade = new int[Paths.GetUpperBound(0) + 1];
            Sfx    = new MP3[Paths.GetUpperBound(0) + 1];
            for (int a = 0; a <= Sfx.GetUpperBound(0); a++)
            {
                Sfx[a] = new MP3();
                Sfx[a].Open(a, Root + Paths[a] + ".wav");
                aiFade[a] = 10 + (a * 4);
            }
            tHotkeys.Start(); tPadFader.Start();
        }
        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(":"));
        }