Ejemplo n.º 1
0
        private void GetFromPokePaste(string url)
        {
            var htmldoc   = NetUtil.GetPageText(url);
            var pastedata = htmldoc.Split(new[] { "<aside>" }, StringSplitOptions.None)[1].Split(new[] { "</aside>" }, StringSplitOptions.None)[0];

            var title = pastedata.Split(new[] { "<h1>" }, StringSplitOptions.None);

            if (title.Length > 1)
            {
                Title = GetVal(title[1]);
            }

            var auth = pastedata.Split(new[] { "<h2>&nbsp;by" }, StringSplitOptions.None);

            if (auth.Length > 1)
            {
                Author = GetVal(auth[1]);
            }

            var desc = pastedata.Split(new[] { "<p>" }, StringSplitOptions.None);

            if (desc.Length > 1)
            {
                Description = GetVal(desc[1]);
            }
        }
Ejemplo n.º 2
0
        private void GetFromPasteBin(string url)
        {
            var page = NetUtil.GetPageText(url);

            var title = page.Split(new[] { "<div class=\"paste_box_line1\" title=\"" }, StringSplitOptions.None)[1];

            Title = GetVal(title, '"');

            var auth = page.Split(new[] { "<div class=\"paste_box_line2\">" }, StringSplitOptions.None)[1].Split('>');

            Author = GetVal(auth[1]);

            var datestr = auth[3];
            var date    = GetVal(datestr);

            Description = $"Pastebin created on: {date}";
        }
Ejemplo n.º 3
0
        public TeamPasteInfo(string url)
        {
            URL = url;
            var isUri = Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute);

            if (!isUri)
            {
                return;
            }
            Source = GetSource(url);
            if (Source == PasteSource.None)
            {
                return;
            }

            url  = GetRawURL(url);
            Sets = NetUtil.GetPageText(url).Trim();
            LoadMetadata();
            Valid = true;
        }
Ejemplo n.º 4
0
        public SmogonSetList(PKM pk)
        {
            var baseURL = GetBaseURL(pk.GetType().Name);

            if (string.IsNullOrWhiteSpace(baseURL))
            {
                return;
            }

            var set = new ShowdownSet(pk);

            Species = GameInfo.GetStrings("en").Species[pk.Species];
            Form    = set.Form;

            URL  = GetURL(Species, Form, baseURL);
            Page = NetUtil.GetPageText(URL);

            Valid = true;
            ShowdownSpeciesName = GetShowdownName(Species, Form);

            LoadSetsFromPage();
        }
Ejemplo n.º 5
0
        public SmogonSetList(PKM pk)
        {
            var baseURL = GetBaseURL(pk.GetType().Name);

            if (string.IsNullOrWhiteSpace(baseURL))
            {
                URL = Species = Form = ShowdownSpeciesName = Page = string.Empty;
                return;
            }

            var set = new ShowdownSet(pk);

            Species = GameInfo.GetStrings("en").Species[pk.Species];
            Form    = ConvertFormToURLForm(set.Form, Species);
            var psform = ConvertFormToShowdown(set.Form, set.Species);

            URL  = GetURL(Species, Form, baseURL);
            Page = NetUtil.GetPageText(URL);

            Valid = true;
            ShowdownSpeciesName = GetShowdownName(Species, psform);

            LoadSetsFromPage();
        }