Пример #1
0
        private void LoadShit()
        {
            SetText("Checking version...");
            if (!Blocks.CheckForUpdates())
            {
                DialogResult dr = MessageBox.Show("New version of MineEdit is available.\n\nWould you like to visit the download site to get the newest version?", "Update available", MessageBoxButtons.YesNo);
                if (dr == System.Windows.Forms.DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start("http://github.com/N3X15/MineEdit/downloads/");
                }
            }

            if (Blocks.Broken)
            {
                MessageBox.Show("Update required due to a danger of damaging your saves.  Exiting...");
                Environment.Exit(0);
            }

            SetText("Loading blocks...");
            Blocks.Init();

            SetText("Loading settings...");
            Settings.Init();


            string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            for (short i = 0; i < 5; i++)
            {
                SetText(string.Format("Checking for World{0}...", i + 1));
                string f = Path.Combine(appdata, string.Format(@".minecraft\saves\World{0}\level.dat", i + 1));
                Console.WriteLine(f);
                if (File.Exists(f))
                {
                    Settings.Worlds.Add(i, (Utils.DirSize(new DirectoryInfo(Path.GetDirectoryName(f))) / 1024f) / 1024f);
                }
            }

            Console.WriteLine("Loading /game/ handler.");
            Thread.Sleep(1000);
            Close();
        }