Example #1
0
        public static void LinkMod()
        {
            workingLink = MakeUseableLink.workingLink;

            if (workingLink.Contains(curseProject)) //wow.curseforge.com/projects/
            {
                // handles curseforge.comjustt
                Console.WriteLine("this is a wow.curseforge.com link");
                workingLink = workingLink + ("/files/latest");
                var htmlDoc = web.Load(workingLink);
                Downloader.Filedownload();
            }
            else if (workingLink.Contains(curseForge) || workingLink.Contains(curseForge)) //curseforge.com/wow/addons/
            {
                // handles curseforge.com
                Console.WriteLine("this is a curseforge.com link");
                if (workingLink.Contains("/download"))
                {
                    var htmlDoc = web.Load(workingLink);
                    foreach (HtmlNode node in htmlDoc.DocumentNode.SelectNodes("//p/a"))
                    {
                        var hrefValue = node.Attributes["href"]?.Value;
                        downloadLink = $"https://www.curseforge.com{hrefValue}";
                        workingLink  = downloadLink;
                    }
                }
                else
                {
                    workingLink += "/download";
                    var htmlDoc = web.Load(workingLink);
                    foreach (HtmlNode node in htmlDoc.DocumentNode.SelectNodes("//p/a"))
                    {
                        var hrefValue = node.Attributes["href"]?.Value;
                        downloadLink = "https://www.curseforge.com" + hrefValue;
                        workingLink  = downloadLink;
                    }
                }
                Downloader.Filedownload();
            }
            else if (workingLink.Contains(wowAce)) //www.wowace.com/projects/
            {
                // handles WoWAce
                Console.WriteLine("this is a wowace.com link");
                var htmlDoc = web.Load(workingLink);
                downloadLink = workingLink + "/files/latest";
            }
            else if (workingLink.Contains(wowInterface))  // handles WoWInterface
            {
                var downloadpage = workingLink.Replace("info", "download");
                Console.WriteLine("this is a wowinterface.com link");
                var htmlDoc = web.Load(downloadpage);
                foreach (HtmlNode node in htmlDoc.DocumentNode.SelectNodes("//div[@class='manuallink']/a"))
                {
                    var hrefValue = node.Attributes["href"]?.Value;
                    downloadLink = hrefValue;
                }
            }
            MakeUseableLink.DownloadStuffs();
        }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     MakeUseableLink.FileCheck();
     MakeUseableLink.done = false;
 }