Exemplo n.º 1
0
        // -- some stuff goes here that keeps track of the task pool list and interacts with it.
        public void addTask()
        {
            ion.User u         = new ion.User();
            string   tmpTaskID = strings.TruncateString(u.genID, 10);

            string[] tmpout = outboundNumbers.Items.OfType <string>().ToArray();
            Spammer  sp     = new Spammer()
            {
                numberToCall = offenderNumberTxt.Text,
                recordAudio  = checkBox2.Checked,
                autoStart    = checkBox1.Checked,
                taskID       = tmpTaskID,
                //accountID = (string)ion2.settings.Get("accid"),
                accountID = textBox3.Text,
                //authToken = (string)ion2.settings.Get("authsecret"),
                authToken       = textBox4.Text,
                outgoingNumbers = tmpout,
                sayMessage      = voiceMsgTxt.Text
            };

            u = null;
            ListViewItem tmp = new ListViewItem()
            {
                Name = "JobTask_" + sp.taskID,
                Tag  = (string)sp.taskID,
                Text = sp.taskID
            };

            tmp.SubItems.Add("Idle");
            listView1.Items.Add(tmp);
            Q.Add(sp.taskID, sp.manualStart(sp.autoStart));
        }
        private void runSpammer()
        {
            Spammer spammer = new Spammer();

            spammer.StatusTextChanged += (sender, text) =>
            {
                status.Text = text;
            };
            spammer.Main(phonenumber.Text);
        }
        private void startTask(string threadID)
        {
            if (!Q.ContainsKey(threadID))
            {
                return;
            }
            Spammer s = Q[threadID];

            s.Go();
        }
        // -- some stuff goes here that keeps track of the task pool list and interacts with it.
        public void addTask(Spammer sp)
        {
            ListViewItem tmp = new ListViewItem()
            {
                Name = "JobTask_" + sp.taskID,
                Tag  = (string)sp.taskID,
                Text = sp.taskID
            };

            tmp.SubItems.Add("Idle");
            listView1.Items.Add(tmp);
            sp.Go();
            Q.Add(sp.taskID, sp);
            sp = null;
        }
Exemplo n.º 5
0
        private void load(object s, EventArgs e)
        {
            ion2.loadSettings(); // automatically initialize settings class
            // then loads settings to dictionary object

            // -------- initialize context menu
            listView1.ContextMenu = new ContextMenu()
            {
                Name = "taskListMenu"
            };

            MenuItem ls1 = new MenuItem("Remove Task");
            MenuItem ls2 = new MenuItem("Start Task");
            MenuItem ls3 = new MenuItem("Pause Task");

            ls1.Click += (ee, bb) => {
                if (listView1.SelectedItems.Count < 1)
                {
                    return;
                }
                removeTask((string)listView1.SelectedItems[0].Tag);
            };
            ls2.Click += (ci, eo) => {
                if (listView1.SelectedItems.Count < 1)
                {
                    return;
                }
                startTask((string)listView1.SelectedItems[0].Tag);
            };
            ls3.Click += (wi, ck) => {
                if (listView1.SelectedItems.Count < 1)
                {
                    return;
                }
                stopTask((string)listView1.SelectedItems[0].Tag);
            };
            listView1.ContextMenu.MenuItems.Add(ls1);
            listView1.ContextMenu.MenuItems.Add(ls2);
            listView1.ContextMenu.MenuItems.Add(ls3);
            listView1.ContextMenu.Popup += (df, vn) => {
                foreach (MenuItem lt in listView1.ContextMenu.MenuItems)
                {
                    lt.Enabled = false;
                }
                if (listView1.SelectedItems.Count < 1)
                {
                    return;
                }
                listView1.ContextMenu.MenuItems[0].Enabled = true;
                if (taskIsActive((string)listView1.SelectedItems[0].Tag))
                {
                    ls3.Enabled = true;
                }
                else
                {
                    ls2.Enabled = true;
                }
            };

            // -------------
            FormClosing += (ee, vv) => {
                foreach (Spammer spc in Q.Values)
                {
                    spc.Stop();
                }
                ion2.saveSettings();
            };

            // -------------

            Q = new Dictionary <string, Spammer>();


            // -------------- timer 1
            System.Windows.Forms.Timer tt = new System.Windows.Forms.Timer();
            tt.Interval = 350;
            tt.Tick    += (df, gd) => {
                counterLbl.Text = (string)"Queue: " + Q.Count;
            };
            tt.Start();
            // -------------- status timer
            System.Windows.Forms.Timer ty = new System.Windows.Forms.Timer();
            ty.Interval = 1000;
            ty.Tick    += (em, cl) => {
                // this is a very crude, ineffective way of doing this, but
                // I'm lazy and it works.
                foreach (ListViewItem ii in listView1.Items)
                {
                    Spammer spc = Q[(string)ii.Tag];
                    ii.SubItems[1].Text = spc.Status();
                }
            };
            ty.Start();
        }
        private void load(object s, EventArgs e)
        {
            u = new ion.User();
            ion2.loadSettings(); // automatically initialize settings class
            // then loads settings to dictionary object


            // --------
            listView1.ContextMenu = new ContextMenu()
            {
                Name = "taskListMenu"
            };

            MenuItem ls1 = new MenuItem("Remove Task");
            MenuItem ls2 = new MenuItem("Start Task");

            ls1.Click += (ee, bb) => {
                if (listView1.SelectedItems.Count < 1)
                {
                    return;
                }
                removeTask((string)listView1.SelectedItems[0].Tag);
            };
            ls2.Click += (ci, eo) => {
                if (listView1.SelectedItems.Count < 1)
                {
                    return;
                }
                startTask((string)listView1.SelectedItems[0].Tag);
            };
            listView1.ContextMenu.MenuItems.Add(ls1);
            listView1.ContextMenu.MenuItems.Add(ls2);
            listView1.ContextMenu.Popup += (df, vn) => {
                if (listView1.SelectedItems.Count < 1)
                {
                    return;
                }
            };

            // -------------
            FormClosing += (ee, vv) => {
                foreach (Spammer spc in Q.Values)
                {
                    spc.Stop();
                }
                ion2.saveSettings();
            };

            // -------------

            Q = new Dictionary <string, Spammer>();


            // -------------- timer 1
            System.Windows.Forms.Timer tt = new System.Windows.Forms.Timer();
            tt.Interval = 350;
            tt.Tick    += (df, gd) => {
                counterLbl.Text = (string)"Queue: " + Q.Count;
            };
            tt.Start();
            // -------------- status timer
            System.Windows.Forms.Timer ty = new System.Windows.Forms.Timer();
            ty.Interval = 1000;
            ty.Tick    += (em, cl) => {
                foreach (ListViewItem ii in listView1.Items)
                {
                    Spammer spc = Q[(string)ii.Tag];
                    ii.SubItems[1].Text = spc.Status();
                }
            };
            ty.Start();
        }