Ejemplo n.º 1
0
        public MangaFoxDownload(SingleManaFox smf)
        {
            this.smf = smf;
            //string test = fixUrl(smf.url);


            //nextUrl = link;
            bool loop = true;

            mangaReadUrls = new List <string>();
            try
            {
                while (loop)
                {
                    string editUrl   = fixUrl(smf.url);
                    string editedUrl = editUrl + x + ".html";
                    string body      = getPageContetn(editedUrl);
                    string link      = getImageLink(body);
                    bool   testThis  = linkFoundForReading(link);

                    x++;

                    if (!testThis)
                    {
                        break;
                    }
                }
            }

            catch
            {
                System.Windows.MessageBox.Show("End");
            }
        }
Ejemplo n.º 2
0
        public MangaFoxDownload(SingleManaFox smf, string path)
        {
            this.smf = smf;
            //string test = fixUrl(smf.url);
            this.saveFolderPath = path;

            //nextUrl = link;
            bool loop = true;

            try
            {
                while (loop)
                {
                    string editUrl   = fixUrl(smf.url);
                    string editedUrl = editUrl + x + ".html";
                    string body      = getPageContetn(editedUrl);
                    string link      = getImageLink(body);
                    bool   testThis  = testSaveImage(link);
                    // break;
                    x++;

                    if (!testThis)
                    {
                        break;
                    }
                }
            }

            catch
            {
                System.Windows.MessageBox.Show("End:");
            }
        }
Ejemplo n.º 3
0
        private void listBoxMangaTest_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            SingleManaFox sm = new SingleManaFox();

            sm = (SingleManaFox)listBoxMangaTest.SelectedItem;
            var mangaWindow = new SelectedManga(sm);

            mangaWindow.Show();
        }
Ejemplo n.º 4
0
        private void listBoxMangaChapters_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            SingleManaFox readsmf = new SingleManaFox();

            readsmf = (SingleManaFox)listBoxMangaChapters.SelectedItem;
            //MessageBox.Show(readsmf.name);
            List <string>    mangaReadUrl = new List <string>();
            MangaFoxDownload mfdRead      = new MangaFoxDownload(readsmf);

            mangaReadUrl = mfdRead.readManga();
            readChapter rc = new readChapter(mangaReadUrl);

            rc.Show();
        }
Ejemplo n.º 5
0
        public SelectedManga(SingleManaFox smf)
        {
            InitializeComponent();
            this.smf = smf;

            listSmf = new List <SingleManaFox>();
            MangaFoxSelected mfs = new MangaFoxSelected(smf.url);

            listSmf = mfs.getMangaChapters();
            foreach (SingleManaFox ss in listSmf)
            {
                listBoxMangaChapters.Items.Add(ss);
            }
            //MessageBox.Show(smf.name);
        }
Ejemplo n.º 6
0
        private void downloadChapterOnebyOne()
        {
            int numOfChapters = listBoxMangaChapters.Items.Count - 1;

            int xyy = 0;

            for (int i = 0; i <= numOfChapters; i++)
            {
                UpdateProgress(xyy);
                xyy++;
                SingleManaFox newSmf = new SingleManaFox();
                newSmf = (SingleManaFox)listBoxMangaChapters.Items.GetItemAt(i);
                MangaFoxDownload mfd = new MangaFoxDownload(newSmf, folderPath);
                countUp();
            }

            MessageBox.Show("Download completed");
        }
Ejemplo n.º 7
0
        private List <SingleManaFox> getLinks(string s)
        {
            char[]        dataArray      = s.ToCharArray();
            StringBuilder name           = new StringBuilder();
            StringBuilder url            = new StringBuilder();
            bool          scrapName      = false;
            bool          scrapUrl       = false;
            bool          scrapNameStart = false;
            bool          scrapUrlStart  = false;
            SingleManaFox smf;

            for (int i = 0; i < dataArray.Length; i++)
            {
                if (dataArray[i] == '<' && dataArray[i + 1] == 'l' && dataArray[i + 2] == 'i')
                {
                    i       += 5;
                    scrapUrl = true;
                }


                if (dataArray[i] == '"' && dataArray[i + 1] == '>')
                {
                    i        += 2;
                    scrapName = true;
                }

                if (scrapName && dataArray[i] == '<' && dataArray[i + 1] == '/' && dataArray[i + 2] == 'a')
                {
                    scrapName = false;
                    i        += 4;
                    //System.Windows.MessageBox.Show(url.ToString());
                    smf      = new SingleManaFox();
                    smf.url  = name.ToString();
                    smf.name = url.ToString();
                    mangaList.Add(smf);
                    url.Clear();
                    name.Clear();
                }

                if (scrapName)
                {
                    url.Append(dataArray[i]);
                }
                if (scrapUrl)
                {
                    if (dataArray[i] == 'h' && dataArray[i + 1] == 'r' && dataArray[i + 2] == 'e' && dataArray[i + 3] == 'f' && dataArray[i + 4] == '=' && dataArray[i + 5] == '"')
                    {
                        i            += 6;
                        scrapUrlStart = true;
                    }
                }


                if (dataArray[i] == '"' && dataArray[i + 1] == ' ' && scrapUrlStart == true)
                {
                    scrapUrlStart = false;
                    scrapUrl      = false;

                    //mangaUrl.Add(name.ToString());
                    //System.Windows.MessageBox.Show(name.ToString());
                    //name.Clear();
                }


                if (scrapUrl && scrapUrlStart)
                {
                    name.Append(dataArray[i]);
                }
            }
            return(mangaList);
        }
Ejemplo n.º 8
0
        public List <SingleManaFox> getMangaChapters()
        {
            string body  = getPageContetn(url);
            string body1 = splitSummary(body);

            char[]        getManaList = body1.ToCharArray();
            StringBuilder sb          = new StringBuilder();
            StringBuilder sbName      = new StringBuilder();
            bool          mName       = false;
            bool          mUrl        = false;
            bool          mStartUrl   = false;
            bool          mNameStart  = false;

            for (int i = 0; i < getManaList.Length; i++)
            {
                if (getManaList[i] == 'm' && getManaList[i + 1] == 'i' && getManaList[i + 2] == 'n' && getManaList[i + 3] == 'i' && getManaList[i + 4] == 'e' && getManaList[i + 5] == 'd' && getManaList[i + 6] == 'i' && getManaList[i + 7] == 't')
                {
                    i   += 10;
                    mUrl = true;
                }

                if (mUrl)
                {
                    if (getManaList[i] == 'h' && getManaList[i + 1] == 'r' && getManaList[i + 2] == 'e' && getManaList[i + 3] == 'f' && getManaList[i + 4] == '=')
                    {
                        i        += 6;
                        mStartUrl = true;
                    }
                }

                if (mStartUrl && getManaList[i] == '"' && getManaList[i + 1] == ' ')
                {
                    mUrl      = false;
                    mStartUrl = false;
                    mName     = true;
                }

                if (mStartUrl)
                {
                    sb.Append(getManaList[i]);
                }

                if (mName && getManaList[i] == '"' && getManaList[i + 1] == '>')
                {
                    mNameStart = true;
                    i         += 2;
                }

                if (mNameStart && getManaList[i] == '<' && getManaList[i + 1] == '/' && getManaList[i + 2] == 'a')
                {
                    mNameStart = false;
                    mName      = false;
                    SingleManaFox ssmf = new SingleManaFox();
                    ssmf.name = sbName.ToString();
                    ssmf.url  = sb.ToString();
                    sbName.Clear();
                    sb.Clear();
                    smf.Add(ssmf);
                }

                if (mNameStart)
                {
                    sbName.Append(getManaList[i]);
                }
            }

            return(smf);
        }