예제 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            for (int a = 1; ; a++)
            {
                if (ListItem.ListItem.items.Find(r => r.Id == a) == null)
                {
                    if (main.Config.Config.config.ScriptNameSelected != null && main.Config.Config.config.ScriptNameSelected != "")
                    {
                        DropzWindow newprofile = new DropzWindow();
                        newprofile.Id               = a;
                        newprofile.Description      = a.ToString();
                        newprofile.Start            = false;
                        newprofile.Status           = "---";
                        newprofile.AutoRunning      = false;
                        newprofile.ButtonReady      = true;
                        newprofile.ScriptParameters = new object();

                        Setting newsetting = new Setting();
                        newsetting.Proxytype       = ProxyType.none;
                        newsetting.Host            = "";
                        newsetting.Port            = 0;
                        newsetting.HidePopup       = true;
                        newsetting.Width           = 1000;
                        newsetting.Height          = 500;
                        newsetting.UserAgent       = "";
                        newsetting.Visible         = false;
                        newsetting.DelayClosePopup = 5;
                        newprofile.Setting         = newsetting;

                        AutoScript autoscript = new AutoScript();
                        autoscript.Script     = main.Config.Config.config.ListScript[main.Config.Config.config.ScriptNameSelected];
                        autoscript.ScriptName = main.Config.Config.config.ScriptNameSelected;
                        autoscript.ScriptType = ScriptType.claimtoolcommand;
                        newprofile.Script     = autoscript;

                        ListItem.ListItem.items.Add(newprofile);
                        lvUsers.Items.Refresh();
                    }
                    break;
                }
            }
        }
예제 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (MainWindow.captchasolverstatus.Running)
            {
                MainWindow.captchasolverstatus.Running = false;
                this.DataContext = null;
                this.DataContext = MainWindow.captchasolverstatus;
            }
            else
            {
                MainWindow.captchasolverstatus.Running = true;
                this.DataContext = null;
                this.DataContext = MainWindow.captchasolverstatus;

                Thread mainThread = new Thread(() =>
                {
                    while (MainWindow.captchasolverstatus.Running)
                    {
                        Thread.Sleep(1000);
                        //MessageBox.Show(Process.GetProcessById(MainWindow.items[0].IdProcess).MainWindowHandle.ToString());
                        if (MainWindow.captchasolverstatus.Next)
                        {
                            MainWindow.captchasolverstatus.Next = false;
                            //MessageBox.Show("ok2");
                            if (LastDropzWindow.Hwnd != IntPtr.Zero)
                            {
                                SetParent(LastDropzWindow.Hwnd, IntPtr.Zero);
                                if (LastDropzWindow.Visible)
                                {
                                    SetWindowPos(LastDropzWindow.Hwnd, 0, LastDropzWindow.Left, LastDropzWindow.Top, 0, 0, SWP_SHOWWINDOW);
                                }
                                else
                                {
                                    SetWindowPos(LastDropzWindow.Hwnd, 0, LastDropzWindow.Left, LastDropzWindow.Top, 0, 0, SWP_HIDEWINDOW);
                                }
                                MoveWindow(LastDropzWindow.Hwnd, LastDropzWindow.Left, LastDropzWindow.Top, LastDropzWindow.Width, LastDropzWindow.Height, true);

                                LastDropzWindow.Hwnd = IntPtr.Zero;
                            }
                            List <DropzWindow> listcaptcha = ListItem.ListItem.items.FindAll(item => item.Captcha == true && item.AutoRunning == true && item.Start == true);
                            if (listcaptcha.Count > 0)
                            {
                                DropzWindow min = listcaptcha[0];
                                foreach (DropzWindow item in listcaptcha)
                                {
                                    if (item.CaptchaTime < min.CaptchaTime)
                                    {
                                        min = item;
                                    }
                                }

                                DropzWindow minItem = ListItem.ListItem.items.Find(item => item.Id == min.Id);

                                LastDropzWindow.Id   = minItem.Id;
                                LastDropzWindow.Hwnd = minItem.Hwnd;

                                RECT rct;
                                if (GetWindowRect(new HandleRef(this, LastDropzWindow.Hwnd), out rct))
                                {
                                    LastDropzWindow.Width   = rct.Right - rct.Left;
                                    LastDropzWindow.Height  = rct.Bottom - rct.Top;
                                    LastDropzWindow.Top     = rct.Top;
                                    LastDropzWindow.Left    = rct.Left;
                                    LastDropzWindow.Visible = IsWindowVisible(LastDropzWindow.Hwnd);
                                }

                                ListItem.ListItem.items.Find(item => item == min).CommandSend = "clickcaptcha|400|550";
                                //MessageBox.Show(ListItem.ListItem.items[LastDropzWindow.Index].Script.ScriptName);
                                //IntPtr pr = Process.GetProcessById(ListItem.ListItem.items[LastDropzWindow.Index].IdProcess).MainWindowHandle;
                                SetParent(minItem.Hwnd, main.Handle);
                                SetWindowPos(minItem.Hwnd, 0, -10, -30, 0, 0, SWP_SHOWWINDOW);
                            }
                        }
                    }
                });
                mainThread.Start();
            }
        }