Exemplo n.º 1
0
                protected override void CreateChildElements()
                {
                    _AHK    ahk               = new _AHK();
                    _Images img               = new _Images();
                    string  HeartImage        = ahk.AppDir() + "\\ico\\heart.png";
                    string  HeartClickedImage = ahk.AppDir() + "\\ico\\heartClicked.png";

                    base.CreateChildElements();
                    likeButton.NotifyParentOnMouseInput = true;
                    likeButton.Image  = HeartImage.ToImage(30, 30);
                    likeButton.Click += likeButton_Click;
                    likeButton.EnableElementShadow = false;
                    likeButton.Margin = new Padding(10, 0, 10, 0);
                    this.Children.Add(likeButton);
                }
Exemplo n.º 2
0
        // generate wordlist

        public string WordCount_FromFile(string filePath)  // returns list of words parsed to unique words with word count (in ini format) from File
        {
            //### load AHK script into memory, execute function, return parse value ###

            // load wordcount.ahk function into AHK workspace
            string wordCountAHK = ahk.AppDir() + "\\Scripts\\WordCount.ahk";  //@"C:\Users\Jason\Google Drive\IMDB\Scripts\WordCount.ahk";

            //create an autohotkey engine (AHK DLL) or use existing instance if it hasn't be initiated
            AutoHotkey.Interop.AutoHotkeyEngine ahkddll = new AutoHotkey.Interop.AutoHotkeyEngine();

            // load the ahk function file to access in user scripts
            ahk.Load_ahkFile(wordCountAHK, false, false);

            // execute function to return ini values with counts after parsing the filePath for words
            string wordCounts = ahkddll.ExecFunction("Generate_WordCount", filePath);  // execute loaded function

            return wordCounts;
        }
Exemplo n.º 3
0
                public override void Synchronize()
                {
                    _AHK    ahk               = new _AHK();
                    _Images img               = new _Images();
                    string  HeartImage        = ahk.AppDir() + "\\ico\\heart.png";
                    string  HeartClickedImage = ahk.AppDir() + "\\ico\\heartClicked.png";


                    base.Synchronize();
                    if (this.Data.Tag != null && (bool)this.Data.Tag == true)
                    {
                        this.likeButton.Image = HeartClickedImage.ToImage(30, 30);
                    }
                    else
                    {
                        this.likeButton.Image = HeartImage.ToImage(30, 30);
                    }
                }
Exemplo n.º 4
0
            public DataTable Return_PrnChill_DataTable(string DbFile = "", string TableName = "PrnChill", string WhereClause = "", bool Debug = false)
            {
                _Database.SQLite sqlite = new _Database.SQLite();
                _AHK             ahk    = new _AHK();

                if (DbFile == "")
                {
                    DbFile = ahk.AppDir() + @"\Db\PrnChill.sqlite";
                }
                string SelectLine = "Select * From [PrnChill]";

                if (WhereClause != "")
                {
                    if (WhereClause.ToUpper().Contains("WHERE"))
                    {
                        SelectLine = SelectLine + " " + WhereClause;
                    }
                    if (!WhereClause.ToUpper().Contains("WHERE"))
                    {
                        SelectLine = SelectLine + " WHERE " + WhereClause;
                    }
                }

                DataTable ReturnTable = sqlite.GetDataTable(DbFile, SelectLine);


                DataTable table = new DataTable();

                table.Columns.Add("PostName", typeof(string));
                table.Columns.Add("PostURL", typeof(string));
                table.Columns.Add("Links", typeof(string));
                table.Columns.Add("DateAdded", typeof(string));
                table.Columns.Add("LinkCheckDate", typeof(string));
                table.Columns.Add("InCollection", typeof(string));
                table.Columns.Add("ImageDir", typeof(string));

                if (ReturnTable != null)
                {
                    foreach (DataRow ret in ReturnTable.Rows)
                    {
                        PrnChill returnObject = new PrnChill();

                        returnObject.PostName      = ret["PostName"].ToString();
                        returnObject.PostURL       = ret["PostURL"].ToString();
                        returnObject.Links         = ret["Links"].ToString();
                        returnObject.DateAdded     = ret["DateAdded"].ToString();
                        returnObject.LinkCheckDate = ret["LinkCheckDate"].ToString();
                        returnObject.InCollection  = ret["InCollection"].ToString();
                        returnObject.ImageDir      = ret["ImageDir"].ToString();

                        table.Rows.Add(returnObject.PostName, returnObject.PostURL, returnObject.Links, returnObject.DateAdded, returnObject.LinkCheckDate, returnObject.InCollection, returnObject.ImageDir);
                    }
                }

                return(table);
            }
Exemplo n.º 5
0
            /// <summary>
            /// Returns Path to Extracted ScreenClipINI
            /// </summary>
            /// <param name="Open">Option to Open ScreneClip INI</param>
            /// <returns>Returns File Path to ScrenClip INI</returns>
            public string INI(bool Open = false)
            {
                string path = ahk.AppDir() + "\\Apps\\ScreenClip\\ScreenClip.ini";

                if (Open)
                {
                    ahk.Run(path);
                }
                return(path);
            }
Exemplo n.º 6
0
            /// <summary>
            /// Configure RadChat Actions
            /// </summary>
            /// <param name="radchat"></param>
            public void SetupRadChat(RadChat radchat)
            {
                RadCHAT = radchat;
                RadCHAT.AutoAddUserMessages  = false;
                RadCHAT.SendMessage         += SendMessage;
                RadCHAT.TimeSeparatorAdding += TimeSeparatorAdding;
                RadCHAT.ItemFormatting      += RadChat_ItemFormatting;


                adminImg2 = ahk.AppDir() + "\\ico\\admin2.ico";
                adminImg3 = ahk.AppDir() + "\\ico\\admin3.ico";
                adminImg4 = ahk.AppDir() + "\\ico\\admin4.ico";


                Author author2 = new Author(adminImg4.ToImage(), "Jason");

                RadCHAT.Author = author2;

                //RadCHAT.ItemFormatting += RadChat_ItemFormattingChildren;

                AddToolbar();
                //SetCustomFactory();
            }
Exemplo n.º 7
0
            public List <PrnChill> Return_PrnChill_List(string WhereClause = "", string DbFile = "", string TableName = "[PrnChill]")
            {
                _Database.SQLite sqlite = new _Database.SQLite();
                _AHK             ahk    = new _AHK();

                if (DbFile == "")
                {
                    DbFile = ahk.AppDir() + @"\Db\PrnChill.sqlite";
                }
                string SelectLine = "Select * From " + TableName;

                if (WhereClause != "")
                {
                    if (WhereClause.ToUpper().Contains("WHERE"))
                    {
                        SelectLine = SelectLine + " " + WhereClause;
                    }
                    if (!WhereClause.ToUpper().Contains("WHERE"))
                    {
                        SelectLine = SelectLine + " WHERE " + WhereClause;
                    }
                }
                DataTable ReturnTable = sqlite.GetDataTable(DbFile, SelectLine);

                List <PrnChill> ReturnList = new List <PrnChill>();

                if (ReturnTable != null)
                {
                    foreach (DataRow ret in ReturnTable.Rows)
                    {
                        PrnChill returnObject = new PrnChill();

                        returnObject.PostName      = ret["PostName"].ToString();
                        returnObject.PostURL       = ret["PostURL"].ToString();
                        returnObject.Links         = ret["Links"].ToString();
                        returnObject.DateAdded     = ret["DateAdded"].ToString();
                        returnObject.LinkCheckDate = ret["LinkCheckDate"].ToString();
                        returnObject.InCollection  = ret["InCollection"].ToString();
                        returnObject.ImageDir      = ret["ImageDir"].ToString();

                        ReturnList.Add(returnObject);
                    }
                }

                return(ReturnList);
            }
Exemplo n.º 8
0
            public bool PrnChill_Insert(PrnChill inObject, string DbFile = "")
            {
                _Database.SQLite sqlite = new _Database.SQLite();
                _AHK             ahk    = new _AHK();

                if (DbFile == "")
                {
                    DbFile = ahk.AppDir() + @"\Db\PrnChill.sqlite";
                }
                string InsertLine = "Insert Into [PrnChill] (PostName, PostURL, Links, DateAdded, LinkCheckDate, InCollection, ImageDir) values ('" + inObject.PostName + "', '" + inObject.PostURL + "', '" + inObject.Links + "', '" + inObject.DateAdded + "', '" + inObject.LinkCheckDate + "', '" + inObject.InCollection + "', '" + inObject.ImageDir + "')";
                bool   Inserted   = sqlite.Execute(DbFile, InsertLine);

                if (!Inserted)
                {
                    ahk.MsgBox("Inserted Into [PrnChill] = " + Inserted.ToString());
                }
                return(Inserted);
            }
Exemplo n.º 9
0
            public void Add_RadMenu_XMLDir(RadMenu RadMen, EventHandler ev, string xmlDir = "\\RadTreeXML")
            {
                if (RadMen == null)
                {
                    return;
                }

                CurrentMenu = RadMen;

                string dir = xmlDir;

                if (dir.Trim() == "\\RadTreeXML")
                {
                    dir = ahk.AppDir() + "\\RadTreeXML";
                }

                // Populate RadMenu with list of XML Files Available to Load in RadTree
                RadMenu_FolderFiles(dir, ev, "*.xml", RadMen);
            }
Exemplo n.º 10
0
        /// <summary>Loads last selected tab # when starting app (from Settings.sqlite table)</summary>
        /// <param name="tc">TabControl Name</param>
        public void Load_Last_Tab(TabControl tc)
        {
            _Database.SQLite sqlite = new _Database.SQLite();
            _AHK             ahk    = new _AHK();

            string LastTabIndex = sqlite.Setting(tc.Name + "_LastTab");

            // read same setting value again, this time for the option field, convert to bool response
            bool LoadLastTab = ahk.ToBool(sqlite.Setting_Value(tc.Name + "_LastTab", ahk.AppDir() + "\\Settings.sqlite", "Settings", "", true)); // check user setting to see if this option is enabled

            if (LoadLastTab)                                                                                                                     // if option enabled, read the last index position and select that tab
            {
                int lTab = ahk.ToInt(LastTabIndex);
                try
                {
                    tc.SelectedIndex = lTab;
                }
                catch { }
            }
        }
Exemplo n.º 11
0
            public bool PrnChill_UpdateInsert(PrnChill obj, string DbFile = "")
            {
                _AHK ahk = new _AHK();

                if (DbFile == "")
                {
                    DbFile = ahk.AppDir() + @"\Db\PrnChill.sqlite";
                }
                if (!File.Exists(DbFile))
                {
                    Create_Table_PrnChill(DbFile);
                }

                bool Updated = PrnChill_Update(obj, DbFile);  // try to update record first

                if (!Updated)
                {
                    Updated = PrnChill_Insert(obj, DbFile);
                }                                                          // if unable to update, insert new record
                return(Updated);
            }
Exemplo n.º 12
0
            public PrnChill Return_Object_From_PrnChill(string WhereClause = "[PostName] = ''", string DbFile = "")
            {
                _Database.SQLite sqlite = new _Database.SQLite();
                _AHK             ahk    = new _AHK();

                if (DbFile == "")
                {
                    DbFile = ahk.AppDir() + @"\Db\PrnChill.sqlite";
                }
                string    SelectLine  = "Select [PostName], [PostURL], [Links], [DateAdded], [LinkCheckDate], [InCollection], [ImageDir] From [PrnChill] ";
                DataTable ReturnTable = sqlite.GetDataTable(DbFile, SelectLine);

                if (WhereClause.ToUpper().Contains("WHERE "))
                {
                    SelectLine = SelectLine + " " + WhereClause;
                }
                if (!WhereClause.ToUpper().Contains("WHERE "))
                {
                    SelectLine = SelectLine + "WHERE " + WhereClause;
                }
                PrnChill returnObject = new PrnChill();
                int      i            = 0;
                string   Value        = "";

                if (ReturnTable != null)
                {
                    foreach (DataRow ret in ReturnTable.Rows)
                    {
                        returnObject.PostName      = ret["PostName"].ToString();
                        returnObject.PostURL       = ret["PostURL"].ToString();
                        returnObject.Links         = ret["Links"].ToString();
                        returnObject.DateAdded     = ret["DateAdded"].ToString();
                        returnObject.LinkCheckDate = ret["LinkCheckDate"].ToString();
                        returnObject.InCollection  = ret["InCollection"].ToString();
                        returnObject.ImageDir      = ret["ImageDir"].ToString();
                    }
                }

                return(returnObject);
            }
Exemplo n.º 13
0
            /// <summary>
            /// Create Nuget File to Upload (Using Nuget.exe)
            /// </summary>
            /// <param name="slnPath">Path to VisualStudio Solution File</param>
            /// <param name="nugetPath">Path to Nuget.exe</param>
            /// <returns>Returns True if Both SLN and EXE Are Found - Does not reflect status of the new exe job results</returns>
            public bool CreateNuget(string slnPath, string nugetPath = "")
            {
                _AHK ahk = new _AHK();

                if (nugetPath == "")
                {
                    nugetPath = ahk.AppDir() + "\\EXEs\\NuGet.exe";
                }
                if (File.Exists(nugetPath))
                {
                    return(false);
                }
                if (File.Exists(slnPath))
                {
                    return(false);
                }

                string line = "\"" + nugetPath + "\" pack \"" + slnPath + "\"";

                ahk.Run(line);
                return(true);
            }
Exemplo n.º 14
0
            public bool RGP(int PageNum = 1)
            {
                string url = "http://rgporn.com/index.php?newsid=" + PageNum;
                //tel.Update(txtURL, url);

                string html = web.DownloadHTML(url);

                if (html == "")
                {
                    return(false);
                }

                resultLines = xml.Parse_HTML_XML(html, "//body/div/div/div/div/table/tbody/tr/td/div/div/div/p");  // extract sections of text from html xml

                // extract tags
                string        display = "TAGS: ";
                List <string> tags    = new List <string>();
                string        Tags    = "";

                foreach (string line in resultLines)
                {
                    if (line.Contains("=tags"))
                    {
                        string tag = line.Replace("<a", "");
                        tag = tag.Replace("</a>", "");
                        tag = ahk.StringSplit(tag, ">", 1);
                        tag = tag.Trim();
                        tags.Add(tag);

                        display = display + "\n" + tag;

                        if (Tags != "")
                        {
                            Tags = Tags + "|" + tag;
                        }
                        if (Tags == "")
                        {
                            Tags = tag;
                        }
                    }
                }

                // extract title
                List <string> titleLines = xml.Parse_HTML_XML(html, "//body/div/div/div/div/table/tbody/tr/td/div/div/div");  // extract sections of text from html xml
                string        title      = lst.Return_List_Value(titleLines, 2);

                title = title.Replace("<h1 class=\"shead\">", "");
                title = title.Replace("</h1>", "");

                string imagehtml = "";

                foreach (string ima in titleLines)
                {
                    if (ima.Contains(".jpg"))
                    {
                        imagehtml = imagehtml + "\n" + ima;
                    }
                }

                //ahk.MsgBox(title);

                List <string> links = rg.Regex_RGLinks(html);

                bool   AllOnline       = true;
                int    onlineLinkCount = 0;
                string linkText        = "";

                foreach (string link in links)
                {
                    RGInfo info = rg.RapidGatorCheckStatus(link);

                    if (!info.FileOnline)
                    {
                        AllOnline = false;
                    }
                    else
                    {
                        onlineLinkCount++;
                    }

                    string wlink = link + "|" + info.FileSize;

                    if (linkText != "")
                    {
                        linkText = linkText + "\n" + wlink;
                    }
                    if (linkText == "")
                    {
                        linkText = wlink;
                    }
                }

                string linksMsg = onlineLinkCount + "/" + links.Count + " Links Online";

                // Extract / Display Images From Page
                int downloaded = 0;

                if (AllOnline)
                {
                    string SaveDir = ahk.AppDir() + "\\Posts\\RGP\\" + ahk.AddLeadingZeros(PageNum, 5).ToString();
                    ahk.FileCreateDir(SaveDir);
                    ahk.Sleep(500);

                    ahk.FileAppend(Tags, SaveDir + "\\Tags.txt");
                    ahk.FileAppend(title, SaveDir + "\\Title.txt");
                    ahk.FileAppend(linkText, SaveDir + "\\Links.txt");

                    downloaded = DownloadImages(imagehtml, SaveDir, ahk.AddLeadingZeros(PageNum, 5).ToString());

                    //tel.Update(txtResults, "Title: " + title + "\n\nTags: " + Tags + "\n\n" + linksMsg);
                }


                //ahk.MsgBox("Found " + links.Count + " Links\nDownloaded " + downloaded.ToString() + " + Images");


                return(AllOnline);
            }
Exemplo n.º 15
0
            // takes tiled screen shot to generate a single preview image - returns path to new preview image (blank if failed)
            public string VidCap_Tiles(string videoFilePath, string saveDir = "", int TilesWide = 3, int TilesTall = 3, string Scale = "320:240", string SaveFormat = "jpg", string CaptureOpt = "1000")
            {
                if (!ahk.isVideo(videoFilePath))
                {
                    sb(videoFilePath + " Not Recognized Video Format... Skipping");
                    return("");
                }

                VideoFile vidInfo = GetVideoInfo(videoFilePath);

                // Extract FPS From video Info returned

                //h264(Main)(avc1 / 0x31637661), yuv420p, 600x450, 750 kb / s, SAR 1:1 DAR 4:3, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc(default)



                int seconds      = vidInfo.Duration.TotalSeconds.ToInt(); //getDuration(videoFilePath);
                int egs          = TilesWide * TilesTall;                 // ex 3 x 3 = 9 segs - dfivide total time by 9 for even timing
                int shotDistance = seconds / egs;

                //TimeSpan t = TimeSpan.FromMilliseconds(shotDistance);
                TimeSpan t = TimeSpan.FromSeconds(shotDistance);

                int MinBetween            = t.Minutes; // # of minutes between tile shots (in video)
                int SecondsBetween        = t.Seconds; // # of seconds between tile shots (in video)
                int distanceBetweenFrames = (seconds * vidInfo.FPS).ToInt();

                //string SaveFormat = "jpg";
                //Scale = "0:0";
                int FrameCount = 1;

                //Scale = "320:240";

                //int TileX = 2;
                //int TileY = 3;
                //string Scale = "320:240";
                //string[] shots = new string[numShots];

                // default save dir under neath original file
                if (saveDir == "")
                {
                    saveDir = ahk.FileDir(videoFilePath) + "\\Previews";
                }

                string outImage = saveDir + "\\" + ahk.FileNameNoExt(videoFilePath) + "." + SaveFormat;

                if (File.Exists(outImage))
                {
                    return("");
                }


                outImage = saveDir + "\\" + ahk.FileNameNoExt(videoFilePath) + "_%03d" + SaveFormat;

                ahk.FileCreateDir(saveDir);

                string args = "";
                string opt  = CaptureOpt;



                //-i video.mkv -vf scale=500:-1 -t 10 -r 10 image.gif

                // one every 1000 frames, works but didn't alway fill all the boxes
                if (opt == "1000")
                {
                    args = " -ss 00:" + MinBetween + ":" + SecondsBetween + " -i \"" + videoFilePath + "\" -frames: " + FrameCount + " -vf \"select=not(mod(n\\,1000)),scale=" + Scale + ",tile=" + TilesWide + "x" + TilesTall + "\" \"" + outImage + "\"";
                }

                // one every 3000 frames - works but SLOWER
                if (opt == "3000")
                {
                    args = " -ss 00:" + MinBetween + ":" + SecondsBetween + " -i \"" + videoFilePath + "\" -vf \"select=not(mod(n\\,3000)),scale=" + Scale + ",tile=" + TilesWide + "x" + TilesTall + "\" \"" + outImage + "\"";
                }

                //string args = " -ss 00:" + MinBetween + ":" + SecondsBetween + " -i \"" + videoFilePath + "\" -vf \"-r 0.0033,scale=" + Scale + ",tile=" + TilesWide + "x" + TilesTall + "\" \"" + outImage + "\"";
                //string args = " -ss 00:" + MinBetween + ":" + SecondsBetween + " -i \"" + videoFilePath + "\" -vf \"select=not(mod(n\\,3500)),scale=" + Scale + ",tile=" + TilesWide + "x" + TilesTall + "\" \"" + outImage + "\"";

                // one frame per video (thumbnails no rows)
                if (opt == "1")
                {
                    args = " -ss 00:" + MinBetween + ":" + SecondsBetween + " -i \"" + videoFilePath + "\" -vf thumbnail,scale=" + Scale + " -frames:v 1 \"" + outImage + "\"";
                }

                // export ALL action frames (about 1K images in 40min example video)
                if (opt == "ActionFrames")
                {
                    args = "-i \"" + videoFilePath + "\" -vf \"select = 'eq(pict_type,PICT_TYPE_I)'\" -vsync vfr \"" + saveDir + "\\" + ahk.FileNameNoExt(videoFilePath) + "_%04d." + SaveFormat + "\"";
                }

                // One screen shot at specific time stamp
                if (opt == "TimeShot")
                {
                    args = " -i \"" + videoFilePath + "\" -ss 00:02:05.000 -vframes 1 \"" + saveDir + "\\" + ahk.FileNameNoExt(videoFilePath) + "." + SaveFormat + "\"";
                }

                // mosasic option - works
                if (opt == "Mosasic")
                {
                    args = " -i \"" + videoFilePath + "\" -vf select='gt(scene\\,0.5)',scale=" + Scale + ",tile -frames:v 5  \"" + outImage + "\"";
                }


                //args = "-ss 3 -i \"" + videoFilePath + "\" -vf \"select = gt(scene\\, 0.5)\" -frames:v 5 -vsync vfr \"" + outImage + "\"";
                //args = "-i \"" + videoFilePath + "\" -vf  \"select = gt(scene\\, 0.4),scale = 640:360\" -frames:v 5 \"" + outImage + "\"";
                //args = "-i \"" + videoFilePath + "\" -vf fps=1/60 \"" + outImage + "\""; // one image per minute
                //int dur = getDuration(videoFilePath);
                // 2,266 = 37 min video


                string FPS = "";  // number of frames to capture

                try
                {
                    int totalFPS = vidInfo.Duration.TotalSeconds.ToInt() / 10;  // divide total seconds by 10
                    FPS = "1/" + totalFPS.ToString();
                }
                catch { FPS = "1/60"; }  // 1 frame per min



                args = "-i \"" + videoFilePath + "\" -vf fps=" + FPS + " \"" + outImage + "\""; //


                ahk.FileAppend(videoFilePath, ahk.AppDir() + "\\FFMpeg_Log.txt");
                StartFFMpeg(args);


                if (File.Exists(outImage))
                {
                    return(outImage);
                }
                else
                {
                    return("");
                }
            }
Exemplo n.º 16
0
        //    public string Generate_TabPage_Code_List(string ProjectFile = "")  // CodeGen: Create TabPage List Function (Populated) To Insert Into Project
        //{
        //    if (ProjectFile == "") { ProjectFile = @"C:\Users\jason\Google Drive\IMDB\SQLiter\NPAD\NPAD.cs"; }
        //    List<string> TabPages = code.ProjectFile_ControlList(ProjectFile, "TABPAGE");

        //    string Code = "public List<TabPage> TabPageList()  // returns list of TabPages to reference throughout project" + Environment.NewLine + "{" + Environment.NewLine;
        //    Code = Code + "\t\t" + "List<TabPage> TabList = new List<TabPage>();" + Environment.NewLine;

        //    foreach (string Tab in TabPages)
        //    {
        //        Code = Code + "\t\t" + "TabList.Add(" + Tab + ");" + Environment.NewLine;
        //    }

        //    Code = Code + "\t\treturn TabList;" + Environment.NewLine + "\t}";

        //    return Code;
        //}

        //    public TabPage Next_Available_TabPage(TabControl tc, string ProjectFile = "", List<TabPage> TabList = null)  // use list of tabs (auto generated code from dev dll) to find next available tab page control
        //    {
        //        if (TabList == null && ProjectFile != "")
        //        {
        //            TabList = TabPageList();
        //        }

        //        foreach (TabPage tp in TabList)
        //        {
        //            int IndexOfTabPage = tc.TabPages.IndexOf(tp);
        //            if (IndexOfTabPage == -1) { return tp; }  // -1 means not created yet - free to use
        //        }

        //        return null;
        //    }

        //    public TabPage TabPage_From_IndexId(TabControl tc, int IndexId, List<TabPage> TabList = null)  // use list of tabs (auto generated code from dev dll) to find next available tab page control
        //    {
        //        if (TabList == null)
        //        {
        //            TabList = TabPageList();  // return list of tab pages from local function
        //        }

        //        if (TabList != null)
        //        {
        //            foreach (TabPage Tab in TabList)
        //            {
        //                int IndexOfTabPage = tc.TabPages.IndexOf(Tab);
        //                if (IndexOfTabPage == IndexId)
        //                { return Tab; }
        //            }
        //        }

        //        return null;
        //    }

        //    public List<TabPage> TabPageList()  // PLACE HOLDER FOR CODEGEN CODE
        //    {
        //        ahk.MsgBox("Need to Populate First With CodeGen.");
        //        return null;
        //    }

        #endregion

        #region === Save / Load Tab Index ===

        /// <summary>Store the selected index for the tab control to SettingsDb</summary>
        /// <param name="tc">TabControl Name</param>
        public void Save_Last_Tab(TabControl tc, bool LoadOnStartupEnabled = true)
        {
            _Database.SQLite sqlite = new _Database.SQLite();
            _AHK             ahk    = new _AHK();

            sqlite.Setting_Save(tc.Name + "_LastTab", tc.SelectedIndex.ToString(), LoadOnStartupEnabled.ToString(), ahk.AppDir() + "\\Settings.sqlite");
        }
Exemplo n.º 17
0
            //_Parse.XML xml = new _Parse.XML();
            //_AHK ahk = new _AHK();
            //_Database.SQL sql = new _Database.SQL();
            //_Lists lst = new _Lists();
            //_Parse prs = new _Parse();
            ////_Images img = new _Images();
            //_TelerikLib.RadProgress pro = new _TelerikLib.RadProgress();
            //_TelerikLib tel = new _TelerikLib();
            ////_Apps.Chrome cr = new _Apps.Chrome();
            //sharpAHK_Dev._Threads thr = new sharpAHK_Dev._Threads();
            //_TelerikLib.RadTree tree = new _TelerikLib.RadTree();
            //IAFD iafd = new IAFD();
            //_Web.ADBSites.PBBForum pbb = new _Web.ADBSites.PBBForum();
            //_Web.ADBSites.PRNWForum prnw = new _Web.ADBSites.PRNWForum();

            #endregion


            public void Download_Site(int startPage = 1, int LastPage = 230, bool SkipExisting = true, RadProgressBar Bar = null, RadProgressBar Bar2 = null, bool NewThread = true)
            {
                _AHK   ahk = new _AHK();
                _Lists lst = new _Lists();

                _Sites.RapidGator       rg  = new _Sites.RapidGator();
                _TelerikLib.RadProgress pro = new _TelerikLib.RadProgress();

                if (NewThread)
                {
                    Thread newThread = new Thread(() => Download_Site(startPage, LastPage, SkipExisting, Bar, Bar2, false)); // Function To Execute
                    newThread.IsBackground = true;
                    newThread.Start();
                }
                else
                {
                    int pageNum = startPage;
                    do
                    {
                        int           postNum = 0;
                        string        html    = ahk.Download_HTML("http://pornchil.com/page/" + pageNum + "/");
                        List <string> lines   = lst.Text_To_List(html, true, true, false);

                        if (Bar != null)
                        {
                            pro.SetupProgressBar(Bar, 10);
                        }                                                    // # of posts/page

                        foreach (string line in lines)
                        {
                            if (line.Contains("<h1 class=\"entry-title\"><a href="))
                            {
                                PrnChill chill = new PrnChill();
                                //ahk.MsgBox(line);

                                string Line = line.Replace("<h1 class=\"entry-title\"><a href=\"", "");
                                chill.PostURL  = ahk.StringSplit(Line, "\"", 0);
                                chill.PostName = ahk.StringSplit(Line, ">", 1);
                                chill.PostName = ahk.StringSplit(chill.PostName, "<", 0);

                                if (SkipExisting)
                                {
                                    if (AlreadyParsed(chill.PostURL))
                                    {
                                        continue;
                                    }                                                // check to see if this post already has an entry, if so skip
                                }


                                if (Bar != null)
                                {
                                    postNum++; pro.UpdateProgress(Bar, postNum + "/10");
                                }                                                                          // # of posts remaining

                                string        postHTML = ahk.Download_HTML(chill.PostURL);
                                List <string> links    = rg.Regex_RGLinks(postHTML);

                                if (links.Count > 0)
                                {
                                    if (Bar != null)
                                    {
                                        pro.ProgressText(Bar, postNum + "/10 | Verifying Links");
                                    }                                                                                           // # of posts remaining

                                    List <_Sites.RapidGator.RGInfo> checkedLinks = rg.RapidGator_BatchCheck(links, true, Bar2); // batch check list of rg links

                                    string rglinks = ""; int goodLinkCount = 0;
                                    foreach (_Sites.RapidGator.RGInfo link in checkedLinks)
                                    {
                                        if (rglinks == "")
                                        {
                                            rglinks = link.FileURL + "|" + link.FileSize; goodLinkCount++;
                                        }
                                        else
                                        {
                                            rglinks = rglinks + "\n" + link.FileURL + "|" + link.FileSize; goodLinkCount++;
                                        }
                                    }

                                    chill.Links     = rglinks; // online rg links with  filepath|filesize return
                                    chill.LinkCount = goodLinkCount;

                                    chill.LinkCheckDate = DateTime.Now.ToString();
                                }

                                chill.InCollection = "false";

                                List <string> images = rg.JpgImageLinks(postHTML);

                                if (Bar != null)
                                {
                                    pro.ProgressText(Bar, postNum + "/10 | Downloading Images (" + images.Count + ")");
                                }                                                                                                         // # of posts remaining

                                if (images.Count > 0)
                                {
                                    // create save dir
                                    string saveDir = ahk.AppDir() + "\\PrnChillPosts";
                                    ahk.FileCreateDir(saveDir);
                                    saveDir = saveDir + "\\" + chill.PostName;
                                    ahk.FileCreateDir(saveDir);

                                    chill.ImageDir = saveDir;

                                    int imgNum = 1;
                                    foreach (string image in images)
                                    {
                                        ahk.Download_File(image, saveDir + "\\" + imgNum + ".jpg", true); imgNum++;
                                    }
                                }

                                PrnChill_UpdateInsert(chill);
                            }
                        }

                        pageNum++;
                    } while (pageNum <= LastPage);
                }
            }