Ejemplo n.º 1
0
        public static void getOnlineStashes(string name, string poeid, int tabIndex)
        {
            jsonImport.clearStash();
            string response;
            //TODO, hole Anzahl der Tabs und loope durch
            string          adress   = $"https://pathofexile.com/character-window/get-stash-items?league=Legion&tabs=1&tabIndex={tabIndex}&accountName={name}";
            CookieContainer coocCont = new CookieContainer();
            Cookie          cook     = new Cookie("POESESSID", poeid)
            {
                Domain = "pathofexile.com"
            };

            coocCont.Add(cook);
            //TODO Webclient immer beibehalten
            using (BetterWebClient webClient = new BetterWebClient(coocCont)) {
                response = webClient.DownloadString(adress);

                jsonImport.import(response);
            }
        }
Ejemplo n.º 2
0
        public static void getOnlineStashes(string name, string poeid, bool getLocalStash = false)
        {
            jsonImport.clearStash();
            string response = "";
            int    tabIndex = 0;
            //TODO, hole Anzahl der Tabs und loope durch
            string          adress   = $"https://pathofexile.com/character-window/get-stash-items?league=Legion&tabs=1&tabIndex={tabIndex}&accountName={name}";
            CookieContainer coocCont = new CookieContainer();
            Cookie          cook     = new Cookie("POESESSID", poeid)
            {
                Domain = "pathofexile.com"
            };

            coocCont.Add(cook);
            //First try to get the number of Tabs
            using (BetterWebClient webClient = new BetterWebClient(coocCont)) {
                try {
                    if (!getLocalStash)
                    {
                        response = webClient.DownloadString(adress);
                    }
                    else
                    {
                        response = loadStashLocal(tabIndex);
                    }

                    jsonImport.import(response);
                    if (!getLocalStash)
                    {
                        saveStashesLocal(tabIndex, response);
                    }
                } catch (Exception ex) {
                    Log.log(ex);
                    throw;
                }


                tabIndex++;
                //Getting all Tabs
                //DEBUG
                while (tabIndex < stashes[0].numTabs)
                {
                    //while (tabIndex < 15) {
                    response = "";
                    adress   = $"https://pathofexile.com/character-window/get-stash-items?league=Legion&tabs=1&tabIndex={tabIndex}&accountName={name}";
                    if (!getLocalStash)
                    {
                        try {
                            response = webClient.DownloadString(adress);
                        } catch (Exception ex) {
                            Console.Write(ex.Message);
                            System.Threading.Thread.Sleep(100000);
                            response = webClient.DownloadString(adress);
                        }
                    }
                    else
                    {
                        response = loadStashLocal(tabIndex);
                    }
                    jsonImport.import(response);
                    //TODO: Zeige Update im Form
                    win.statusLabel.Content = $"fetching tabs: {tabIndex + 1} / {stashes[0].numTabs}";
                    saveStashesLocal(tabIndex, response);
                    tabIndex++;
                }
            }

            win.statusLabel.Content = "";
        }