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); }
private static WFApi GetTranslateApi() { var api = new WFApi(); Messenger.SendDebugInfo("正在加载翻译 API."); var source = "https://raw.githubusercontent.com/Richasy/WFA_Lexicon/master/"; var sw = Stopwatch.StartNew(); Task.WaitAll( Downloader.GetCacheOrDownload <Alert[]>($"{source}WF_Alert.json", alerts => api.Alert = alerts), Downloader.GetCacheOrDownload <Dict[]>($"{source}WF_Dict.json", dicts => api.Dict = dicts), Downloader.GetCacheOrDownload <Invasion[]>($"{source}WF_Invasion.json", invs => api.Invasion = invs), Downloader.GetCacheOrDownload <Sale[]>($"{source}WF_Sale.json", sales => api.Sale = sales), Downloader.GetCacheOrDownload <Riven[]>($"{source}WF_Riven.json", rivens => api.Riven = rivens), Downloader.GetCacheOrDownload <Relic[]>($"{source}WF_Relic.json", relics => api.Relic = relics), Downloader.GetCacheOrDownload <Modifier[]>($"{source}WF_Modifier.json", modifiers => api.Modifier = modifiers), Downloader.GetCacheOrDownload <NightWave[]>($"{source}WF_NightWave.json", nightwave => api.NightWave = nightwave) ); Messenger.SendDebugInfo($"翻译 API 加载完成. 用时 {sw.Elapsed.TotalSeconds:N1}s."); // 嘿,如果你在看这个方法怎么用,让2019年3月14日23:59:23的trks来告诉你吧,这个api是本地缓存的api(在本地有的情况下),但是不久后将会被第三方线程操成最新的,我在这里浪费了好久,希望你不会. return(api); }