Пример #1
0
        /* Checks for updates via github */
        public static void CheckForUpdates()
        {
            try
            {
                string    url            = @"http://raw.githubusercontent.com/Pixel0h/Ethereal/master/Ethereal_VersionInfo.json";
                WebClient client         = new WebClient();
                Version   currentVersion = Instance.Version;
                client.DownloadStringCompleted += (sender, e) =>
                {
                    try
                    {
                        string      text          = e.Result;
                        VersionInfo versionInfo   = JsonConvert.DeserializeObject <VersionInfo>(text);
                        Version     latestVersion = new Version(versionInfo.version);
                        if (latestVersion > currentVersion)
                        {
                            Main.NewText("[c/cccccc:New version of] [c/ffdb00:Ethereal] [c/cccccc:available]");
                            Main.NewTextMultiline("[c/cccccc:Summary:] " + versionInfo.summary, WidthLimit: 725);
                            Main.NewText("[c/cccccc:Get the update from Mod Browser]");
                        }
                        else if (latestVersion == currentVersion && new Version(EConfig.Stats.LastStartVersion) < currentVersion)
                        {
                            Main.NewText("[c/cccccc:Ethereal is now up to date!]");
                            Main.NewTextMultiline("[c/cccccc:Summary changes:] " + versionInfo.summary, WidthLimit: 725);
                        }

                        EConfig.Stats.LastStartVersion = currentVersion.ToString();
                        EConfig.SaveStats();
                    }
                    catch
                    {
                    }
                };
                client.DownloadStringAsync(new Uri(url), url);
            }
            catch
            {
            }
        }
Пример #2
0
        /* Handles mod loading */
        public override void Load()
        {
            EConfig.Initialize();

            Main.player[Main.myPlayer].hbLocked = false;
        }