Example #1
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     TaskManager.AddAsyncTask(delegate
     {
         string direction   = "";
         WebRequest request = WebRequest.Create("http://checkip.dyndns.org/");
         using (WebResponse response = request.GetResponse())
         {
             using (StreamReader stream = new StreamReader(response.GetResponseStream()))
             {
                 direction = stream.ReadToEnd();
             }
         }
         int first    = direction.IndexOf("Address: ") + 9;
         int last     = direction.LastIndexOf("</body>");
         direction    = direction.Substring(first, last - first);
         LocalAddress = IPAddress.Parse(direction);
     });
     ExceptionHandler.CloseProgram += new ModUpdaterDelegate(ExceptionHandler_CloseProgram);
     Debug.Assert("Debug mode is enabled.  In-depth messages will be displayed.");
     if (ProgramOptions.Debug)
     {
         MinecraftModUpdater.Logger.Log(Logger.Level.Warning, "Client is running in debug-mode.");
     }
     if (ProgramOptions.CommandLine)
     {
         MinecraftModUpdater.Logger.Log(Logger.Level.Warning, "Client is running in commandline.");
     }
     TaskManager.AddAsyncTask(delegate
     {
         string ver;
         bool api;
         if (Extras.CheckForUpdate("client", Program.Version, out ver, out api))
         {
             UpdateForm.Open(ver, api);
         }
     });
     if (Properties.Settings.Default.FirstRun)
     {
         TaskManager.AddAsyncTask(delegate
         {
             SplashScreen.ShowSplashScreen();
         });
         OnFirstRun();
     }
     if (recover)
     {
         Recover();
         return;
     }
     if (!PrepareConnection())
     {
         Close();
     }
     Connect();
 }
Example #2
0
        public static void Open(string ver, bool api)
        {
            UpdateForm t = new UpdateForm();

            if (!api)
            {
                t.label2.Text = string.Format("Version {0} for MCModUpdater is now available.", ver);
            }
            else
            {
                t.label2.Text = string.Format("Version {0} for MCModUpdater API is now available.", ver);
            }
            t.ShowDialog();
        }