コード例 #1
0
        public override string GetDirectVideoLink(string VeryStreamEmbeddedLink)
        {
            web.DocumentCompleted += Web_DocumentCompleted;
            web.Invoke(new Action(() => { web.Navigate(VeryStreamEmbeddedLink); }));

            while (Link == "")
            {
                ;
            }

            string returnme = Link;

            Link = "";

            return(returnme);
        }
コード例 #2
0
        private float GetScaleToShowWholeWidthOfPage()
        {
            if (_browser != null)
            {
                if (_browser.InvokeRequired)
                {
                    return((float)_browser.Invoke((MethodInvoker)(() => GetScaleToShowWholeWidthOfPage())));
                }

                var div = _browser.Document.ActiveElement;
                if (div != null)
                {
                    div = (GeckoHtmlElement)(div.EvaluateXPath("//div[contains(@class, 'bloom-page')]").GetNodes().FirstOrDefault());
                    if (div != null)
                    {
                        if (div.ScrollWidth > _browser.Width)
                        {
                            var widthWeNeed = div.ScrollWidth + 100 + 100 /*for qtips*/;
                            return(((float)_browser.Width) / widthWeNeed);
                        }
                        else
                        {
                            return(1.0f);
                        }
                    }
                }
            }
            return(0f);
        }
コード例 #3
0
        void watchDevice(MyDriverClient client)
        {
            client.NetClient = client.AddPointToWatch(client.Device.Address, client.WatchingPoints.ToArray(), (point, value) =>
            {
                try
                {
                    var pointObj = _AllPoints.FirstOrDefault(m => m.Value <string>("addr") == point);
                    if (pointObj != null)
                    {
                        //转换数值
                        value = SunRizDriver.Helper.Transform(pointObj, value);
                    }
                    Debug.WriteLine($"addr:{point} value:{value}");
                    _gecko.Invoke(new ThreadStart(() =>
                    {
                        using (var jsContext = new AutoJSContext(_gecko.Window))
                        {
                            jsContext.EvaluateScript($"onReceiveValueFromServer({ (new { addr = point, value = value }).ToJsonString()})");
                        }
                    }));
                }
                catch (Exception ex)
                {
                }
            }, (err) =>
            {
                if (client.Released)
                {
                    return;
                }

                Task.Run(() =>
                {
                    Thread.Sleep(2000);
                    watchDevice(client);
                });
            });
        }
コード例 #4
0
        public void GetVideoLink()
        {
            web.CreateWindow += CloseWindow;
            new Thread(() =>
            {
                string Url = "";
                web.Invoke((MethodInvoker) delegate()
                {
                    using (AutoJSContext context = new AutoJSContext(web.Window))
                    {
                        context.EvaluateScript("document.URL;", out Url);
                    }
                });

                while (Url == "")
                {
                    ;
                }

                //if (!Url.Contains("bs.to"))
                //{
                //    web.Navigate(Link);
                //    web.DocumentCompleted += CaptchaSiteBack;
                //}
                //else
                //{
                //    ready = true;
                //}

                ready = true;

                while (!ready)
                {
                    ;
                }

                Point audioBTN = FindPicture("BypassGoogle\\audioBTN.png");
                LeftMouseClick(audioBTN);
                Thread.Sleep(300);
                Point downloadBTN = FindPicture("BypassGoogle\\downloadBTN.png");
                LeftMouseClick(downloadBTN);

                while (AudioLink == "")
                {
                    ;
                }

                WebClient wbc = new WebClient();
                wbc.DownloadFile(AudioLink, "BypassGoogle\\audio.mp3");

                string TextMeaning = UnderstandAudio().Replace("\n", "").Replace("\r", "");

                Thread.Sleep(rnd.Next(100, 200));

                Point Textfield = downloadBTN;
                Textfield.Y    -= rnd.Next(33, 43);
                Textfield.X    += rnd.Next(0, 50);
                LeftMouseClick(Textfield);

                Thread.Sleep(rnd.Next(10, 50));

                InputSimulator sim = new InputSimulator();
                foreach (char item in TextMeaning)
                {
                    VirtualKeyCode c = VirtualKeyCode.VK_0;

                    switch (item.ToString().ToLower().ToCharArray()[0])
                    {
                    case 'a':
                        c = VirtualKeyCode.VK_A;
                        break;

                    case 'b':
                        c = VirtualKeyCode.VK_B;
                        break;

                    case 'c':
                        c = VirtualKeyCode.VK_C;
                        break;

                    case 'd':
                        c = VirtualKeyCode.VK_D;
                        break;

                    case 'e':
                        c = VirtualKeyCode.VK_E;
                        break;

                    case 'f':
                        c = VirtualKeyCode.VK_F;
                        break;

                    case 'g':
                        c = VirtualKeyCode.VK_G;
                        break;

                    case 'h':
                        c = VirtualKeyCode.VK_H;
                        break;

                    case 'i':
                        c = VirtualKeyCode.VK_I;
                        break;

                    case 'j':
                        c = VirtualKeyCode.VK_J;
                        break;

                    case 'k':
                        c = VirtualKeyCode.VK_K;
                        break;

                    case 'l':
                        c = VirtualKeyCode.VK_L;
                        break;

                    case 'm':
                        c = VirtualKeyCode.VK_M;
                        break;

                    case 'n':
                        c = VirtualKeyCode.VK_N;
                        break;

                    case 'o':
                        c = VirtualKeyCode.VK_O;
                        break;

                    case 'p':
                        c = VirtualKeyCode.VK_P;
                        break;

                    case 'q':
                        c = VirtualKeyCode.VK_Q;
                        break;

                    case 'r':
                        c = VirtualKeyCode.VK_R;
                        break;

                    case 's':
                        c = VirtualKeyCode.VK_S;
                        break;

                    case 't':
                        c = VirtualKeyCode.VK_T;
                        break;

                    case 'u':
                        c = VirtualKeyCode.VK_U;
                        break;

                    case 'v':
                        c = VirtualKeyCode.VK_V;
                        break;

                    case 'w':
                        c = VirtualKeyCode.VK_W;
                        break;

                    case 'x':
                        c = VirtualKeyCode.VK_X;
                        break;

                    case 'y':
                        c = VirtualKeyCode.VK_Y;
                        break;

                    case 'z':
                        c = VirtualKeyCode.VK_Z;
                        break;

                    case ' ':
                        c = VirtualKeyCode.SPACE;
                        break;
                    }

                    sim.Keyboard.KeyPress(c);
                    Thread.Sleep(rnd.Next(50, 100));
                }

                Point submit = FindPicture("BypassGoogle\\submit.png");
                LeftMouseClick(submit);
            }).Start();
        }