Example #1
0
        public void Set_Target_Name(string name)
        {
            if (this.label_target_name.InvokeRequired)
            {
                Set_Target_Name_Callback d = new Set_Target_Name_Callback(Set_Target_Name);
                label_target_name.Invoke(d, new object[] { name });
                return;
            }

            label_target_name.Text = name;
        }
Example #2
0
        public static Task getAllTV(Bunifu.Framework.UI.BunifuCheckbox UpdateCheck, System.Windows.Forms.PictureBox preview, Bunifu.Framework.UI.BunifuFlatButton Start, Bunifu.Framework.UI.BunifuFlatButton Stop, Bunifu.Framework.UI.BunifuCircleProgressbar Progress, Stream_Scraper.Form1.StopWatch Watch, Bunifu.Framework.UI.BunifuCustomDataGrid dataGrid, System.Windows.Forms.Label Total, System.Windows.Forms.Label Scraped, string url, string table_db, string seasons_db, string stream_db)
        {
            int PagesCount = getPagesCount(url);

            Total.Invoke(new Action(() => Total.Text = PagesCount.ToString()));
            for (int i = 1; i <= PagesCount; i++)
            {
                List <string> TVURLs = null;


                if (i == 1)
                {
                    TVURLs = getTVsURLs($"https://libertyvf.co/series/");
                }
                else
                {
                    TVURLs = getTVsURLs($"https://libertyvf.co/series/page-{i}.html");
                }
                getTVPerPage(preview, TVURLs, table_db, seasons_db, stream_db, dataGrid, UpdateCheck);
                Scraped.Invoke(new Action(() => Scraped.Text = i.ToString()));
            }
            Start.Invoke(new Action(() => Start.Enabled        = true));
            Stop.Invoke(new Action(() => Stop.Enabled          = false));
            Progress.Invoke(new Action(() => Progress.animated = false));
            Progress.Invoke(new Action(() => Progress.Visible  = false));
            return(null);
        }
Example #3
0
        public static Task getAnimes(System.Windows.Forms.PictureBox preview, Bunifu.Framework.UI.BunifuFlatButton Start, Bunifu.Framework.UI.BunifuFlatButton Stop, Bunifu.Framework.UI.BunifuCircleProgressbar Progress, Stream_Scraper.Form1.StopWatch Watch, Bunifu.Framework.UI.BunifuCustomDataGrid dataGrid, System.Windows.Forms.Label Total, System.Windows.Forms.Label Scraped, string url)
        {
            int PageCount = 45;


            Total.Invoke(new Action(() => Total.Text = PageCount.ToString()));
            try
            {
                for (int i = 1; i < PageCount; i++)
                {
                    List <string> AnimeList = getAnimeList(url + $"?page={i}");
                    List <Anime>  animes    = getAnimesPerPage(dataGrid, preview, AnimeList);
                    Scraped.Invoke(new Action(() => Scraped.Text = (i).ToString()));
                }
            }
            catch
            {
            }
            finally
            {
                Start.Invoke(new Action(() => Start.Enabled        = true));
                Stop.Invoke(new Action(() => Stop.Enabled          = false));
                Progress.Invoke(new Action(() => Progress.animated = false));
                Progress.Invoke(new Action(() => Progress.Visible  = false));
            }


            return(null);
        }
Example #4
0
        public void Set_Target_HP(string text)
        {
            if (this.label_target_hp.InvokeRequired)
            {
                Set_Target_HP_Callback d = new Set_Target_HP_Callback(Set_Target_HP);
                label_target_hp.Invoke(d, new object[] { text });
                return;
            }

            label_target_hp.Text = text;
        }
Example #5
0
 /// <summary>
 /// 스레드에서 라벨 텍스트 변경
 /// </summary>
 public static void SetLabel(System.Windows.Forms.Label label, string str)
 {
     if (label.InvokeRequired)
     {
         SetLabelCallBack dele = new SetLabelCallBack(SetLabel);
         label.Invoke(dele, label, str);
     }
     else
     {
         label.Text = str;
     }
 }
 public void ShowInfo(string Info)
 {
     if (_label.InvokeRequired)
     {
         showInfo = new dShowInfo(ShowInfo);
         _label.Invoke(showInfo, new object[] { Info });
     }
     else
     {
         _label.Text = Info;
     }
 }
Example #7
0
        public void InitPlugin(System.Windows.Forms.TabPage pluginScreenSpace, System.Windows.Forms.Label pluginStatusText)
        {
            ShortCutCreator.TryCreateShortcut(APP_ID, APP_ID);
            active                 = true;
            this.lblStatus         = pluginStatusText;
            this.lblStatus.Text    = "FFXIV F.A.T.E Plugin Started.";
            pluginScreenSpace.Text = "FATE Parser";

            Task.Factory.StartNew(() =>
            {
                this.lblStatus.Text = "Downloading Data.json";

                loadJSONData();
                this.lblStatus.Text = "Downloaded Data.json";

                pluginStatusText.Invoke(new Action(delegate()
                {
                    this.lblStatus.Text = "FFXIV F.A.T.E Plugin Started.";

                    pluginScreenSpace.Controls.Add(this);
                    xmlSettings = new SettingsSerializer(this);

                    foreach (ActPluginData plugin in ActGlobals.oFormActMain.ActPlugins)
                    {
                        if (plugin.pluginObj != this)
                        {
                            continue;
                        }
                        fileInfo = plugin.pluginFile;
                        break;
                    }


                    if (timer == null)
                    {
                        timer          = new System.Windows.Forms.Timer();
                        timer.Interval = 30 * 1000;
                        timer.Tick    += Timer_Tick;
                    }
                    timer.Enabled = true;

                    updateFFXIVProcesses();


                    LoadSettings();
                    this.comboBoxLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
                    selLng = (string)this.comboBoxLanguage.SelectedValue;
                    loadFates();
                }));
            });
        }
Example #8
0
        private void move()
        {
            Point p;
            Block head = (Block)this._blocks[0];

            if (this._direction == Direction.Up)
            {
                p = new Point(head.Point.X, head.Point.Y - 1);
            }
            else if (this._direction == Direction.Down)
            {
                p = new Point(head.Point.X, head.Point.Y + 1);
            }
            else if (this._direction == Direction.Left)
            {
                p = new Point(head.Point.X - 1, head.Point.Y);
            }
            else
            {
                p = new Point(head.Point.X + 1, head.Point.Y);
            }


            Block b = new Block(Color.Green, this._size, p);


            if (this._food.Point != p)
            {
                this._blocks.RemoveAt(this._blocks.Count - 1);
            }


            else
            {
                this._food = this.getFood();
            }
            this._blocks.Insert(0, b);
            scoreLable.Invoke(new Action(() => scoreLable.Text = _blocks.Count.ToString()));
            this.PaintPalette(this._gpPalette);
        }
        public static Task getAllMovies(Bunifu.Framework.UI.BunifuCheckbox UpdateCheck, System.Windows.Forms.PictureBox preview, Bunifu.Framework.UI.BunifuFlatButton Start, Bunifu.Framework.UI.BunifuFlatButton Stop, Bunifu.Framework.UI.BunifuCircleProgressbar Progress, Stream_Scraper.Form1.StopWatch Watch, Bunifu.Framework.UI.BunifuCustomDataGrid dataGrid, System.Windows.Forms.Label Total, System.Windows.Forms.Label Scraped, string url, string table_db, string stream_db)
        {
            int PagesCount = getPagesCount(url);

            Total.Invoke(new Action(() => Total.Text = PagesCount.ToString()));

            for (int i = 1; i <= PagesCount; i++)
            {
                try {
                    List <string> moviesURLs = null;

                    moviesURLs = getMoviesURLs($"https://french-film.co/film-streaming/page/{i}/");
                    getMoviesPerPage(UpdateCheck, preview, moviesURLs, table_db, stream_db, dataGrid);
                    Scraped.Invoke(new Action(() => Scraped.Text = i.ToString()));
                }
                catch { }
            }
            Start.Invoke(new Action(() => Start.Enabled        = true));
            Stop.Invoke(new Action(() => Stop.Enabled          = false));
            Progress.Invoke(new Action(() => Progress.animated = false));
            Progress.Invoke(new Action(() => Progress.Visible  = false));
            return(null);
        }
Example #10
0
        public bool Step2(System.Windows.Forms.RichTextBox lbError, System.Windows.Forms.ProgressBar progCurrentName, System.Windows.Forms.Label lblCurName,
                          System.Windows.Forms.Label lblNameIndex, bool isScaleAll, bool isAutoLogo = true, bool isSaveDb = true,
                          bool isFast = true)
        {
            try
            {
                string folderPath     = Directory.GetCurrentDirectory();
                string exportLogoPath = folderPath + Settings.Default.LogoExportPath;
                string logoName       = SunfrogConfig.Logo;
                ////string logoName = "Logo 83";
                string logoRootPath = folderPath + Settings.Default.LogoPath + logoName + "\\";

                for (int i = 0; i < nameList.Count; i++)
                {
                    if (string.IsNullOrEmpty(nameList[i]))
                    {
                        nameList.RemoveAt(i);
                        i--;
                    }
                }

                if (isAutoLogo)
                {
                    if (SunfrogConfig.StartRange + SunfrogConfig.EndRange > nameList.Count)
                    {
                        nameList = nameList.Skip(SunfrogConfig.StartRange).Take(nameList.Count).DefaultIfEmpty().ToList();
                    }
                    else
                    {
                        nameList = nameList.Skip(SunfrogConfig.StartRange).Take(SunfrogConfig.EndRange).DefaultIfEmpty().ToList();
                    }
                }

                if (!isSaveDb)
                {
                    if (File.Exists(folderPath + Settings.Default.ListNameSuccess))
                    {
                        var existedList = File.ReadLines(folderPath + Settings.Default.ListNameSuccess).ToList();
                        for (int i = 0; i < existedList.Count; i++)
                        {
                            nameList.Remove(existedList[i]);
                        }
                    }
                }

                if (nameList.Count > 0)
                {
                    progCurrentName.Invoke(new Action(() => progCurrentName.Value = progCurrentName.Minimum));

                    for (int i = 0; i < nameList.Count; i++)
                    //int i = 0;
                    // Parallel.ForEach(nameList, (name) =>
                    {
                        string logoPath = string.Empty;
                        string name     = nameList[i];
                        if (!isAutoLogo)
                        {
                            logoPath = nameList[i];
                            name     = Path.GetFileNameWithoutExtension(logoPath);
                        }


                        try
                        {
                            string[] temp     = name.Split(new string[] { Settings.Default.SplitString }, StringSplitOptions.None);
                            string   realName = name;
                            if (temp != null)
                            {
                                realName = temp[0];
                            }

                            //string realName = name.Replace(Settings.Default.SplitString, Settings.Default.ExportSplitString);
                            lblCurName.Invoke(new Action(() => lblCurName.Text = realName));
                            ArtModel model = null;
                            if (isSaveDb)
                            {
                                model = MongoController.Instance.FindModel(name, logoName);
                            }
                            if (model == null)
                            {
                                if (isAutoLogo)
                                {
                                    logoPath = LoadNewSunfrogData(name, exportLogoPath, folderPath + Settings.Default.LogoPath,
                                                                  logoName, Settings.Default.SplitString, Settings.Default.ExportSplitString, isScaleAll);
                                }

                                string title    = string.Empty;
                                string jsonData = CreateNewSunfrogData(name, logoPath, ref title, isFast);

                                SunfrogController.Instance.web.SendRequest("https://manager.sunfrogshirts.com/Designer/", "GET", null);

                                string result = SunfrogController.Instance.UplodNewMockup(jsonData);
                                if (result.Contains("Temporarily Unavailable") ||
                                    result.Contains("Sorry, this service is currently unavailable"))
                                {
                                    lbError.Invoke(new Action(() => lbError.Text += "\nSunfrog bảo trì rồi"));
                                    // System.Windows.Forms.MessageBox.Show("Sunfrog bao tri!");
                                    BackendController.IsMaintain = true;
                                    i--;
                                    SchedulerController.Instance.Start();
                                    while (!BackendController.IsMaintain)
                                    {
                                        Thread.Sleep(1000 * 60 * 5);
                                    }
                                }
                                logger.Debug("result: " + result);
                                UploadNewResult modelResult = Newtonsoft.Json.JsonConvert.DeserializeObject <UploadNewResult>(result);
                                if (modelResult != null)
                                {
                                    string description = modelResult.description.ToLower();
                                    if (description.Contains("error creating mockup image."))
                                    {
                                        logger.Error("upload error: " + description);
                                        break;
                                    }
                                    else if (description.Contains("Please refresh this page to login"))
                                    {
                                        SunfrogController.Instance.Login(SunfrogConfig.SFAcc, SunfrogConfig.SFPass);
                                        Thread.Sleep(1000 * 60 * 3);
                                        i--;
                                        continue;
                                    }
                                }
                                string rawLink        = modelResult.products[0].pageName;
                                string groupID        = ExtractGroupID(rawLink);
                                string jsonUpdateData = CreateUpdatingMockupJson(groupID, SunfrogController.Instance.AM, isFast);
                                Task   task           = SunfrogController.Instance.UpdateMockup(jsonUpdateData);
                                Task.WhenAll(task);
                                Console.WriteLine("test");

                                if (isSaveDb)
                                {
                                    SaveNewToDB(name, modelResult, groupID, title, lbError);
                                }

                                lbError.Invoke(new Action(() => {
                                    if (lbError.TextLength >= 500)
                                    {
                                        lbError.Text = "";
                                    }
                                }));

                                //SaveNewToDB(name, modelResult, Settings.Default.SplitString, Settings.Default.ExportSplitString);
                                File.AppendAllLines(folderPath + Settings.Default.ListNameSuccess, new String[] { name });
                                // File.AppendAllLines(folderPath + Settings.Default.UploadedLinks, new String[] { SunfrogLink });
                            }
                            //else
                            {
                                lbError.Invoke(new Action(() => {
                                    lbError.Text += "\r\n" + name + " da upload!";
                                }));
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.WarnFormat("Error Message: {0}\nStacktrace: {1}", ex.Message, ex.StackTrace);
                            File.AppendAllLines(folderPath + Settings.Default.ErrorNameList, new String[] { name });
                        }
                        progCurrentName.Invoke(new Action(() => progCurrentName.Value = (i + 1) * 100 / nameList.Count));
                        lblNameIndex.Invoke(new Action(() => lblNameIndex.Text        = string.Format("{0}/{1}", i + 1, nameList.Count)));
                    }
                    ;
                }
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("Error Message: {0}\nStacktrace: {1}", ex.Message, ex.StackTrace);
            }
            return(false);
        }
Example #11
0
        public void GetCityOfSockHttpRequest(System.Windows.Forms.Label label3 = null, string proxyfile = "")
        {
            if (proxyfile == "")
            {
                proxyfile = "rawSocks.txt";
            }
            File.Delete("proxyWithCityHttpRequest.txt");
            int block = 50;

            for (int j = 0; j <= File.ReadAllLines(proxyfile).Count() / block; j++)
            {
                if (label3 != null)
                {
                    label3.Invoke((System.Windows.Forms.MethodInvoker)(() => label3.Text = "checking..." + j + "/" + File.ReadAllLines(proxyfile).Count() / block));
                }
                ChangeProxy.ResetProxySockEntireComputer();

                CheckProxyThread[] thr = new CheckProxyThread[1000];
                Thread[]           tid = new Thread[1000];

                //MyThread thr1 = new MyThread();
                //MyThread thr2 = new MyThread();

                //Thread tid1 = new Thread(new ThreadStart(thr1.Thread1));
                //Thread tid2 = new Thread(new ThreadStart(thr2.Thread1));

                //tid1.Start();
                //tid2.Start();
                System.IO.DirectoryInfo downloadedMessageInfo = new DirectoryInfo("temp\\");

                foreach (FileInfo file in downloadedMessageInfo.GetFiles())
                {
                    file.Delete();
                }

                int num;
                if (j == File.ReadAllLines(proxyfile).Count() / block)
                {
                    num = File.ReadAllLines(proxyfile).Count();
                }
                else
                {
                    num = (j + 1) * block;
                }
                for (int i = j * block; i < num; i++)
                {
                    string proxy = ReadProxyAtLine(i + 1, proxyfile);
                    thr[i]      = new CheckProxyThread();
                    tid[i]      = new Thread(new ThreadStart(thr[i].SockCheckHttpRequest));
                    tid[i].Name = proxy;
                    tid[i].Start();
                }

                for (int i = j * block; i < num; i++)
                {
                    tid[i].Join();
                }

                if (label3 != null)
                {
                    label3.Invoke((System.Windows.Forms.MethodInvoker)(() => label3.Text = "finish check !!!"));
                }
            }
        }