示例#1
0
        public static Dictionary <string, string> FetchOnlineStartupManifest(bool betamode)
        {
            string[] ulrs = new[] { StartupManifestURL, StartupManifestBackupURL };
            foreach (var staticurl in ulrs)
            {
                Uri    myUri = new Uri(staticurl);
                string host  = myUri.Host;

                var fetchUrl = staticurl;
                if (betamode && host == @"me3tweaks.com")
                {
                    fetchUrl += "&beta=true";                                       //only me3tweaks source supports beta. fallback will always just use whatever was live when it synced
                }
                try
                {
                    using var wc = new ShortTimeoutWebClient();
                    string json = wc.DownloadString(fetchUrl);
                    App.ServerManifest = JsonConvert.DeserializeObject <Dictionary <string, string> >(json);
                    Log.Information($@"Fetched startup manifest from endpoint {host}");
                    return(App.ServerManifest);
                }
                catch (Exception e)
                {
                    Log.Error($@"Unable to fetch startup manifest from endpoint {host}: {e.Message}");
                }
            }

            Log.Error(@"Failed to fetch startup manifest.");
            return(new Dictionary <string, string>());
        }
        public static Dictionary <string, string> FetchOnlineStartupManifest(bool betamode)
        {
            using var wc = new ShortTimeoutWebClient();
            var fetchUrl = StartupManifestURL;

            if (betamode)
            {
                fetchUrl += "&beta=true";
            }
            string json = wc.DownloadString(fetchUrl);

            App.ServerManifest = JsonConvert.DeserializeObject <Dictionary <string, string> >(json);
            return(App.ServerManifest);
        }