Beispiel #1
0
        public void UpdateScript(Configuration.Config config)
        {
            if (config.No <= 0)
            {
                return;
            }

            if (Action != null)
            {
                foreach (ListViewItem eachItem in lsvScripts.Items)
                {
                    if (eachItem.SubItems[0].Text == config.No.ToString())
                    {
                        eachItem.SubItems[1].Text = config.Delay.ToString();
                        eachItem.SubItems[2].Text = config.Description;

                        break;
                    }
                }

                foreach (var item in Action.Configs)
                {
                    if (item.No == config.No)
                    {
                        item.XPos      = config.XPos;
                        item.YPos      = config.YPos;
                        item.ColorName = config.ColorName;

                        item.XPosIgnored      = config.XPosIgnored;
                        item.YPosIgnored      = config.YPosIgnored;
                        item.ColorIgnoredName = config.ColorIgnoredName;

                        item.X2Pos      = config.X2Pos;
                        item.Y2Pos      = config.Y2Pos;
                        item.Color2Name = config.Color2Name;

                        item.IsDrag         = config.IsDrag;
                        item.XPosMoved      = config.XPosMoved;
                        item.YPosMoved      = config.YPosMoved;
                        item.ColorMovedName = config.ColorMovedName;

                        item.IsSequential = config.IsSequential;
                        item.Description  = config.Description;
                        item.Delay        = config.Delay;

                        item.IsStartIcon = config.IsStartIcon;
                        item.RunOnce     = config.RunOnce;

                        item.EndWholeScripts = config.EndWholeScripts;
                        item.RunAfterScript  = config.RunAfterScript;

                        item.IsClosedPosition = config.IsClosedPosition;

                        break;
                    }
                }
            }
        }
Beispiel #2
0
        public void AddScript(Configuration.Config config)
        {
            var          no   = lsvScripts.Items.Count + 1;
            ListViewItem item = new ListViewItem((no).ToString());

            item.SubItems.Add(new ListViewItem.ListViewSubItem(item, $"X1:{config.XPos}, Y1:{config.YPos}, Color1:{config.ColorName} | X2:{config.X2Pos}, Y2:{config.Y2Pos}, Color2:{config.Color2Name} | XMoved:{config.XPosMoved}, YMoved:{config.YPosMoved}, ColorMoved:{config.ColorMovedName}"));
            item.SubItems.Add(new ListViewItem.ListViewSubItem(item, config.Description));
            lsvScripts.Items.Add(item);

            config.No = no;
            Configs.Add(config);
        }
Beispiel #3
0
        public void AddScript(Configuration.Config config)
        {
            var nox = GetSelectedNox();

            if (nox == null)
            {
                MessageBox.Show("Please take control & select a Nox");
                return;
            }

            var          no   = lsvScripts.Items.Count + 1;
            ListViewItem item = new ListViewItem((no).ToString());

            //item.SubItems.Add(new ListViewItem.ListViewSubItem(item, $"X1:{config.XPos}, Y1:{config.YPos}, Color1:{config.ColorName} | X2:{config.X2Pos}, Y2:{config.Y2Pos}, Color2:{config.Color2Name} | XMoved:{config.XPosMoved}, YMoved:{config.YPosMoved}, ColorMoved:{config.ColorMovedName}"));
            item.SubItems.Add(new ListViewItem.ListViewSubItem(item, config.Delay.ToString()));
            item.SubItems.Add(new ListViewItem.ListViewSubItem(item, config.Description));
            lsvScripts.Items.Add(item);

            config.No = no;

            nox.Configs.Add(config);
        }
Beispiel #4
0
        private Config GetConfig()
        {
            var config = new Configuration.Config
            {
                No = Config.No,

                XPos      = string.IsNullOrWhiteSpace(txtXPos.Text) ? 0 : int.Parse(txtXPos.Text),
                YPos      = string.IsNullOrWhiteSpace(txtYPos.Text) ? 0 : int.Parse(txtYPos.Text),
                ColorName = txtColor1.Text,

                X2Pos      = string.IsNullOrWhiteSpace(txtX2.Text) ? 0 : int.Parse(txtX2.Text),
                Y2Pos      = string.IsNullOrWhiteSpace(txtY2.Text) ? 0 : int.Parse(txtY2.Text),
                Color2Name = txtColor2.Text,

                XPosIgnored      = string.IsNullOrWhiteSpace(txtXIgnored1.Text) ? 0 : int.Parse(txtXIgnored1.Text),
                YPosIgnored      = string.IsNullOrWhiteSpace(txtYIgnored1.Text) ? 0 : int.Parse(txtYIgnored1.Text),
                ColorIgnoredName = txtColorIgnored1.Text,

                XPosMoved      = string.IsNullOrWhiteSpace(txtXMoved.Text) ? 0 : int.Parse(txtXMoved.Text),
                YPosMoved      = string.IsNullOrWhiteSpace(txtYMoved.Text) ? 0 : int.Parse(txtYMoved.Text),
                ColorMovedName = txtColorMoved.Text,

                Description = txtDescription.Text,
                Delay       = string.IsNullOrWhiteSpace(txtDelay.Text) ? 200 : int.Parse(txtDelay.Text),
                IsDrag      = chkDrag.Checked,
                DragSlow    = chkSlow.Checked,

                IsStartIcon = chkIsStartIcon.Checked,
                RunOnce     = chkRunOnce.Checked,

                EndWholeScripts  = chkEndWholeScripts.Checked,
                IsClosedPosition = chkIsClosedPosition.Checked,

                RunAfterScript = ((Config)cboRunAfterScript.SelectedItem)?.No ?? 0
            };

            return(config);
        }
Beispiel #5
0
        public void UpdateScript(Configuration.Config config)
        {
            if (config.No <= 0)
            {
                return;
            }

            var action = GetSelectedAction();

            if (action != null)
            {
                foreach (ListViewItem eachItem in lsvScripts.Items)
                {
                    if (eachItem.SubItems[0].Text == config.No.ToString())
                    {
                        //eachItem.SubItems[1].Text = $"X1:{config.XPos}, Y1:{config.YPos}, Color1:{config.ColorName} | X2:{config.X2Pos}, Y2:{config.Y2Pos}, Color2:{config.Color2Name} | XMoved:{config.XPosMoved}, YMoved:{config.YPosMoved}, ColorMoved:{config.ColorMovedName}";
                        eachItem.SubItems[1].Text = config.Delay.ToString();
                        eachItem.SubItems[2].Text = config.Description;

                        break;
                    }
                }

                foreach (var item in action.Configs)
                {
                    if (item.No == config.No)
                    {
                        item.XPos      = config.XPos;
                        item.YPos      = config.YPos;
                        item.ColorName = config.ColorName;

                        item.XPosIgnored      = config.XPosIgnored;
                        item.YPosIgnored      = config.YPosIgnored;
                        item.ColorIgnoredName = config.ColorIgnoredName;

                        item.X2Pos      = config.X2Pos;
                        item.Y2Pos      = config.Y2Pos;
                        item.Color2Name = config.Color2Name;

                        item.IsDrag         = config.IsDrag;
                        item.DragSlow       = config.DragSlow;
                        item.XPosMoved      = config.XPosMoved;
                        item.YPosMoved      = config.YPosMoved;
                        item.ColorMovedName = config.ColorMovedName;

                        item.IsSequential = config.IsSequential;
                        item.Description  = config.Description;
                        item.Delay        = config.Delay;

                        item.IsStartIcon = config.IsStartIcon;
                        item.RunOnce     = config.RunOnce;

                        item.EndWholeScripts = config.EndWholeScripts;
                        item.RunAfterScript  = config.RunAfterScript;

                        item.IsClosedPosition = config.IsClosedPosition;

                        break;
                    }
                }
            }
        }
Beispiel #6
0
        private async Task RunAsync(Configuration.Config config)
        {
            //txtProgress.AppendText($"- Script No : {config.No}. Description: {config.Description}. {Environment.NewLine}");

            await Task.Delay(config.Delay);

            lock (padlock)
            {
                if (isRun == false)
                {
                    return;
                }
            }

            // Make Calculator the foreground application and send it
            // a set of calculations.

            ClickOnPointTool.SetForegroundWindow(config.WindowHandle);
            //ClickOnPointTool.ShowActiveWindow(config.WindowHandle);

            //if (LoadingConfigs != null && LoadingConfigs.Count > 0)
            //{
            //    var loadingItem = LoadingConfigs[0];
            //    var loadingColor = await MouseOperation.GetColorAt(new Point(loadingItem.XPos, loadingItem.YPos));
            //    while (loadingColor.Name == loadingItem.ColorName)
            //    {
            //        txtProgress.AppendText($"- Script No : {config.No}. Loading.... {Environment.NewLine}");

            //        loadingColor = await MouseOperation.GetColorAt(new Point(loadingItem.XPos, loadingItem.YPos));

            //    }
            //}

            if (config.IsSequential)
            {
                if (config.IsDrag)
                {
                    await ClickOnPointTool.ClickAndDragAsync(config.WindowHandle, new Point(config.XPos, config.YPos), config.ColorName, new Point(config.XPosMoved, config.YPosMoved), new Point(config.XPosIgnored, config.XPosIgnored), config.ColorMovedName);
                }
                else
                {
                    await MouseOperation.SendMessageAsync(config.WindowHandle,
                                                          (int)MouseOperation.MouseEventFlags.LeftDown, 1, config, LoadingConfigs);

                    await MouseOperation.SendMessageAsync(config.WindowHandle,
                                                          (int)MouseOperation.MouseEventFlags.LeftUp, 0, config, LoadingConfigs);
                }
            }
            else // Speed mode
            {
                if (config.IsDrag)
                {
                    await ClickOnPointTool.ClickAndDragAsync(config.WindowHandle, new Point(config.XPos, config.YPos), config.ColorName, new Point(config.XPosMoved, config.YPosMoved), new Point(config.XPosIgnored, config.XPosIgnored), config.ColorMovedName);
                }
                else
                {
                    var isOk = await MouseOperation.ClickSpeedModeAsync(config.WindowHandle, config);

                    if (isOk)
                    {
                        // Do something else
                        if (config.RunOnce)
                        {
                            config.IsDisabledTemp = true;
                        }
                    }
                }
            }
        }