Ejemplo n.º 1
0
        public List <WFAlert> GetAlerts()
        {
            try
            {
                var alerts = WebHelper.DownloadJson <List <WFAlert> >($"https://api.warframestat.us/{platform}/alerts");
                foreach (var alert in alerts)
                {
                    translator.TranslateAlert(alert);
                    alert.Activation = GetRealTime(alert.Activation);
                    alert.Expiry     = GetRealTime(alert.Expiry);
                }

                return(alerts);
            }
            catch (HttpRequestException)
            {
                // 啥也不做
            }
            catch (WebException)
            {
                // 啥也不做
            }
            catch (Exception e)
            {
                Messenger.SendDebugInfo($"警报获取报错: \r\n" +
                                        $"{e}");
            }
            return(new List <WFAlert>());
        }
Ejemplo n.º 2
0
        private static WFApi GetThirdPartyTranslateApi()
        {
            var alerts = WebHelper.DownloadJson <Alert[]>(
                "https://raw.githubusercontent.com/TheRealKamisama/WFA_Lexicon/master/WF_Alert.json");
            var dicts = WebHelper.DownloadJson <Dict[]>(
                "https://raw.githubusercontent.com/TheRealKamisama/WFA_Lexicon/master/WF_Dict.json");
            var invasions = WebHelper.DownloadJson <Invasion[]>(
                "https://raw.githubusercontent.com/TheRealKamisama/WFA_Lexicon/master/WF_Invasion.json");
            var sales = WebHelper.DownloadJson <Sale[]>(
                "https://raw.githubusercontent.com/TheRealKamisama/WFA_Lexicon/master/WF_Sale.json");
            var riven = WebHelper.DownloadJson <Riven[]>(
                "https://raw.githubusercontent.com/TheRealKamisama/WFA_Lexicon/master/WF_Riven.json");
            var relic = WebHelper.DownloadJson <Relic[]>(
                "https://raw.githubusercontent.com/TheRealKamisama/WFA_Lexicon/master/WF_Relic.json");
            var modifier = WebHelper.DownloadJson <Modifier[]>(
                "https://raw.githubusercontent.com/TheRealKamisama/WFA_Lexicon/master/WF_Modifier.json");
            var translateApi = new WFApi
            {
                Alert    = alerts,
                Dict     = dicts,
                Invasion = invasions,
                Relic    = relic,
                Riven    = riven,
                Sale     = sales,
                Modifier = modifier
            };

            return(translateApi);
        }
Ejemplo n.º 3
0
        public VallisCycle GetVallisCycle()
        {
            var cycle = WebHelper.DownloadJson <VallisCycle>("https://api.warframestat.us/pc/vallisCycle");

            cycle.expiry = GetRealTime(cycle.expiry);
            return(cycle);
        }
Ejemplo n.º 4
0
        public List <Kuva> GetKuvaMissions()
        {
            var kuvas = WebHelper.DownloadJson <List <Kuva> >("https://api.warframestat.us/pc/kuva");

            translator.TranslateKuvaMission(kuvas);
            return(kuvas);
        }
Ejemplo n.º 5
0
        public CetusCycle GetCetusCycle()
        {
            var cycle = WebHelper.DownloadJson <CetusCycle>($"https://api.warframestat.us/{platform}/cetusCycle");

            cycle.Expiry = GetRealTime(cycle.Expiry);
            return(cycle);
        }
Ejemplo n.º 6
0
        public EarthCycle GetEarthCycle()
        {
            var cycle = WebHelper.DownloadJson <EarthCycle>($"https://api.warframestat.us/{platform}/earthCycle");

            cycle.expiry = GetRealTime(cycle.expiry);
            return(cycle);
        }
Ejemplo n.º 7
0
        public Arbitration GetArbitrationMission()
        {
            var ar = WebHelper.DownloadJson <Arbitration>("https://api.warframestat.us/pc/arbitration");

            translator.TranslateArbitrationMission(ar);
            return(ar);
        }
Ejemplo n.º 8
0
        public WFNightWave GetNightWave()
        {
            var wave = WebHelper.DownloadJson <WFNightWave>($"https://api.warframestat.us/{platform}/nightwave");

            translator.TranslateNightWave(wave);
            return(wave);
        }
Ejemplo n.º 9
0
        public List <PersistentEnemie> GetPersistentEnemies()
        {
            var enemies = WebHelper.DownloadJson <List <PersistentEnemie> >("https://api.warframestat.us/pc/persistentEnemies");

            translator.TranslatePersistentEnemies(enemies);
            return(enemies);
        }
Ejemplo n.º 10
0
        public List <SyndicateMission> GetSyndicateMissions()
        {
            var missions = WebHelper.DownloadJson <List <SyndicateMission> >($"https://api.warframestat.us/{platform}/syndicateMissions");

            translator.TranslateSyndicateMission(missions);
            return(missions);
        }
Ejemplo n.º 11
0
        public List <Fissure> GetFissures()
        {
            var fissures = WebHelper.DownloadJson <List <Fissure> >($"https://api.warframestat.us/{platform}/fissures");

            translator.TranslateFissures(fissures);
            return(fissures);
        }
Ejemplo n.º 12
0
        private static Dict[] GetDictFromWFA()
        {
            var dicts = WebHelper.DownloadJson <Dict[]>(
                "https://raw.githubusercontent.com/Richasy/WFA_Lexicon/master/WF_Dict.json");

            return(dicts);
        }
Ejemplo n.º 13
0
        public Sortie GetSortie()
        {
            var sortie = WebHelper.DownloadJson <Sortie>($"https://api.warframestat.us/{platform}/sortie");

            translator.TranslateSortie(sortie);
            return(sortie);
        }
Ejemplo n.º 14
0
        public List <RivenData> GetRivenDatas()
        {
            var info = WebHelper.DownloadJson <List <RivenData> >(
                "http://n9e5v4d8.ssl.hwcdn.net/repos/weeklyRivensPC.json");

            info.ForEach(d => d.compatibility = d.compatibility.IsNullOrEmpty() ? "" : translator.TranslateWeapon(d.compatibility.Replace("<ARCHWING> ", "").Format()));
            return(info);
        }
Ejemplo n.º 15
0
        public WMInfoEx GetWMINfoEx(string searchword)
        {
            var header = new WebHeaderCollection();

            header.Add("Authorization", $"Bearer {Config.Instance.AcessToken}");
            var info = WebHelper.DownloadJson <WMInfoEx>($"https://api.richasy.cn/wfa/basic/pc/wm/{searchword}", header);

            return(info);
        }
Ejemplo n.º 16
0
        public VoidTrader GetVoidTrader()
        {
            var trader = WebHelper.DownloadJson <VoidTrader>($"https://api.warframestat.us/{platform}/voidTrader");

            trader.activation = GetRealTime(trader.activation);
            trader.expiry     = GetRealTime(trader.expiry);
            translator.TranslateVoidTrader(trader);
            return(trader);
        }
Ejemplo n.º 17
0
        public List <RivenInfo> GetRiveninfos(string weapon)
        {
            var header = new WebHeaderCollection();
            var count  = 5;

            header.Add("Authorization", $"Bearer {Config.Instance.AcessToken}");
            header.Add("Platform", "pc");
            header.Add("Weapon", weapon.ToBase64());
            return(WebHelper.DownloadJson <List <RivenInfo> >($"https://api.richasy.cn/wfa/rm/riven", header).Where(info => info.isSell == 1).Take(count).ToList());
        }
Ejemplo n.º 18
0
        public List <WFInvasion> GetInvasions()
        {
            var invasions = WebHelper.DownloadJson <List <WFInvasion> >($"https://api.warframestat.us/{platform}/invasions");

            foreach (var invasion in invasions)
            {
                translator.TranslateInvasion(invasion);
                invasion.activation = GetRealTime(invasion.activation);
            }

            return(invasions);
        }
Ejemplo n.º 19
0
        public List <Event> GetEvents()
        {
            var events = WebHelper.DownloadJson <List <Event> >($"https://api.warframestat.us/{platform}/events");

            translator.TranslateEvents(events);
            foreach (var @event in events)
            {
                @event.expiry = GetRealTime(@event.expiry);
            }

            return(events);
        }
Ejemplo n.º 20
0
        public WMInfo GetWMInfo(string searchword)
        {
            var header   = new WebHeaderCollection();
            var platform = Config.Instance.Platform.GetSymbols().First();

            if (Config.Instance.Platform == Platform.NS)
            {
                platform = "switch";
            }
            header.Add("platform", platform);
            var info = WebHelper.DownloadJson <WMInfo>($"https://api.warframe.market/v1/items/{searchword}/orders?include=item");

            return(info);
        }
Ejemplo n.º 21
0
        public List <RivenInfo> GetRiveninfos(string weapon)
        {
            var header   = new WebHeaderCollection();
            var count    = 5;
            var platform = Config.Instance.Platform.GetSymbols().First();

            if (Config.Instance.Platform == Platform.NS)
            {
                platform = "ns";
            }
            header.Add("Authorization", $"Bearer {Config.Instance.AcessToken}");
            header.Add("Platform", platform);
            header.Add("Weapon", weapon.ToBase64());
            return(WebHelper.DownloadJson <List <RivenInfo> >($"https://api.richasy.cn/wfa/rm/riven", header).Where(info => info.isSell == 1).Take(count).ToList()); // 操 云之幻好蠢 为什么不能在请求里限制是买还是卖
        }
Ejemplo n.º 22
0
        public WMInfoEx GetWMINfoEx(string searchword)
        {
            var header = new WebHeaderCollection();

            header.Add("Authorization", $"Bearer {Config.Instance.AcessToken}");
            var platform = Config.Instance.Platform.GetSymbols().First();

            if (Config.Instance.Platform == Platform.NS)
            {
                platform = "ns";
            }
            var info = WebHelper.DownloadJson <WMInfoEx>($"https://api.richasy.cn/wfa/basic/{platform}/wm/{searchword}", header);

            return(info);
        }
Ejemplo n.º 23
0
        private static void Download <T>(string url, Action <T> setter, string path)
        {
            var content = WebHelper.DownloadJson <T>(url);

            try
            {
                File.WriteAllText(path, content.ToJsonString());
            }
            catch (Exception e)
            {
                Trace.WriteLine($"我操我上辈子是日了狗么, 缓存 {path} 无法保存. {e}", "Cache"); //哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈啊哈哈哈啊哈哈哈哈哈哈哈哈哈哈 --2019年3月2日22:18:27
            }
            setter(content);
            finishedCount++;

            if (finishedCount == expectedCount && expectedCount >= 6)
            {
                Messenger.SendDebugInfo("可缓存的玩意看起来全部下载完成.");
            }
        }
Ejemplo n.º 24
0
        public WMInfo GetWMInfo(string searchword)
        {
            var info = WebHelper.DownloadJson <WMInfo>($"https://api.warframe.market/v1/items/{searchword}/orders?include=item");

            return(info);
        }
Ejemplo n.º 25
0
 public Wiki GetWiki(string word)
 {
     return(WebHelper.DownloadJson <Wiki>(
                $"https://warframe.huijiwiki.com/api.php?action=query&format=json&formatversion=2&list=search&srsearch={word}"));
 }
Ejemplo n.º 26
0
        public SentientOutposts GetSentientOutposts()
        {
            var outposts = WebHelper.DownloadJson <SentientOutposts>("https://api.warframestat.us/pc/sentientOutposts");

            return(outposts);
        }