コード例 #1
0
        public static async Task ServersFromUrl(ToolStripLabel toolStripLabel, StatusStrip ss, Servers serversInstance,
                                                threads threadsInstance, ListView serverView, view baseView)
        {
            var sb = new getStringBox();

            sb.label1.Text = "Enter URL to extract ip:ports from";
            sb.ShowDialog();
            String ret = sb.returnvalue;

            if (ret == "")
            {
                return;
            }

            ToolStripText(toolStripLabel, ref ss, "Extracting Web Page Text");
            var page = await NetExtras.DownloadWebPage(ret);

            if (page == null)
            {
                MessageBox.Show("Not a valid webpage");
                return;
            }

            threadsInstance.addServerCollectionThread(toolStripLabel, ref ss, page, serversInstance, threadsInstance);

            ToolStripText(toolStripLabel, ref ss, "Ready");
            baseView.allServersToServerView();
        }
コード例 #2
0
ファイル: view.cs プロジェクト: andreigec/COD4-Server-Tool
        private void addSingleIPAddressToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var SB = new getStringBox();

            SB.label1.Text = "Enter IP Address:Port";
            SB.ShowDialog();
            String ret = SB.returnvalue;

            if (ret == "")
            {
                return;
            }

            try
            {
                String ip   = ret.Substring(0, ret.IndexOf(':'));
                String port = ret.Substring(ret.IndexOf(':') + 1);

                Server s = threadsInstance.addServerThread(ip, Int32.Parse(port), serversInstance);
                if (s == null)
                {
                    return;
                }

                String kkey = s.getServerIdentifier(Protocol.Protocol.ipAddressSTR, Protocol.Protocol.portSTR);

                try
                {
                    Controller.AddServerToServerView(s, serverview);
                    Controller.UpdateServerInServerView(s, serverview);
                    serverview.SelectedItems.Clear();
                    serverview.Items[kkey].Selected = true;
                    serverview.EnsureVisible(serverview.Items[kkey].Index);
                }
                catch
                {
                    serverview.SelectedItems.Clear();
                    serverview.Items[kkey].Selected = true;
                    serverview.EnsureVisible(serverview.Items[kkey].Index);
                }

                Controller.Refreshselected(serverview, protocolInstance, serversInstance);
            }
            catch
            {
                MessageBox.Show("Error, must be in the format ip:port");
            }
        }
コード例 #3
0
        public static async Task ServersFromUrl(ToolStripLabel toolStripLabel, StatusStrip ss, Servers serversInstance,
                                          threads threadsInstance, ListView serverView, view baseView)
        {
            var sb = new getStringBox();
            sb.label1.Text = "Enter URL to extract ip:ports from";
            sb.ShowDialog();
            String ret = sb.returnvalue;
            if (ret == "")
                return;

            ToolStripText(toolStripLabel, ref ss, "Extracting Web Page Text");
            var page = await NetExtras.DownloadWebPage(ret);

            if (page == null)
            {
                MessageBox.Show("Not a valid webpage");
                return;
            }
            
            threadsInstance.addServerCollectionThread(toolStripLabel, ref ss, page, serversInstance, threadsInstance);

            ToolStripText(toolStripLabel, ref ss, "Ready");
            baseView.allServersToServerView();
        }
コード例 #4
0
ファイル: view.cs プロジェクト: GiGatR00n/COD4-Server-Tool
        private void addSingleIPAddressToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var SB = new getStringBox();
            SB.label1.Text = "Enter IP Address:Port";
            SB.ShowDialog();
            String ret = SB.returnvalue;
            if (ret == "")
                return;

            try
            {
                String ip = ret.Substring(0, ret.IndexOf(':'));
                String port = ret.Substring(ret.IndexOf(':') + 1);

                Server s = threadsInstance.addServerThread(ip, Int32.Parse(port), serversInstance);
                if (s == null)
                    return;

                String kkey = s.getServerIdentifier(Protocol.Protocol.ipAddressSTR, Protocol.Protocol.portSTR);

                try
                {
                    Controller.AddServerToServerView(s, serverview);
                    Controller.UpdateServerInServerView(s, serverview);
                    serverview.SelectedItems.Clear();
                    serverview.Items[kkey].Selected = true;
                    serverview.EnsureVisible(serverview.Items[kkey].Index);
                }
                catch
                {
                    serverview.SelectedItems.Clear();
                    serverview.Items[kkey].Selected = true;
                    serverview.EnsureVisible(serverview.Items[kkey].Index);
                }

                Controller.Refreshselected(serverview, protocolInstance, serversInstance);
            }
            catch
            {
                MessageBox.Show("Error, must be in the format ip:port");
            }
        }