コード例 #1
0
 private static void PatchDlFinished(object sender, AsyncCompletedEventArgs e)
 {
     try
     {
         l2.Dlnotif("Extracting Patch");
         var zfs = ZipFile.OpenRead(MCHandler.mclocation + "/pack.szf");
         foreach (ZipArchiveEntry file in zfs.Entries)
         {
             string completeFileName = Path.Combine(MCHandler.mclocation, file.FullName);
             if (!file.ToString().EndsWith(@"/"))
             {
                 l2.Dlnotif("File Updated:" + completeFileName);
                 file.ExtractToFile(completeFileName, true);
             }
         }
         l2.StartGame();
     }
     catch (Exception er)
     {
         using (SphubCore.ErrorWindow ew = new SphubCore.ErrorWindow(er))
         {
             ew.Show();
         }
     }
 }
コード例 #2
0
 public Launch2()
 {
     try
     {
         InitializeComponent();
         label1.Text = "Build: " + System.IO.File.ReadAllText(@"version.txt") + ", Connected to " + Classes.Definitions.ServerName + " Build Server";
         this.Icon   = new Icon("Resources/favicon.ico");
         F_Init();
         l2 = this;
         SwitchWindows(Properties.Settings.Default.fav_men);
     }
     catch (Exception errormessage)
     {
         SphubCore.ErrorWindow ew = new SphubCore.ErrorWindow(errormessage);
         ew.Show();
     }
 }
コード例 #3
0
        public void F_Init()
        {
            try
            {
                Minecraft.DefaultPath = Properties.Settings.Default.mclocation;
                var java = new CmlLib.Utils.MJava(Minecraft.DefaultPath + "\\runtime");
                if (!java.CheckJavaw())
                {
                    var form = new JVDWN();
                    form.Show();
                    bool iscom = false;

                    java.DownloadProgressChanged += (s, v) =>
                    {
                        form.ChangeProgress(v.ProgressPercentage);
                    };
                    java.UnzipCompleted += (t, w) =>
                    {
                        form.Close();
                        this.Show();
                        iscom = true;
                    };

                    java.DownloadJavaAsync();

                    while (!iscom)
                    {
                        Application.DoEvents();
                    }
                }
                MHC.javalocation = Minecraft.DefaultPath + "\\runtime\\bin\\javaw.exe";
            }
            catch (Exception errormessage)
            {
                SphubCore.ErrorWindow ew = new SphubCore.ErrorWindow(errormessage);
                ew.Show();
            }
        }
コード例 #4
0
 public void SwitchWindows(int id)
 {
     try
     {
         HideAllWindows();
         if (id == 0)
         {
             HomeWindow.Visible         = true;
             this.BackColor             = System.Drawing.Color.Black;
             this.BackgroundImage       = global::GADD_Application.Properties.Resources.split_logo;
             this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
         }
         //MC Login Window
         if (id == 11)
         {
             if (GADD_Application.Properties.Settings.Default.username != "" && GADD_Application.Properties.Settings.Default.password != "")
             {
                 if (MCHandler.AuthenticateLogin(GADD_Application.Properties.Settings.Default.username, GADD_Application.Properties.Settings.Default.password))
                 {
                     SwitchWindows(12);
                 }
                 else
                 {
                     LoginWindow.Visible        = true;
                     this.BackColor             = System.Drawing.Color.Black;
                     this.BackgroundImage       = global::GADD_Application.Properties.Resources.Minecraft_Path_Tracing_Feature;
                     this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                 }
             }
             else
             {
                 LoginWindow.Visible        = true;
                 this.BackColor             = System.Drawing.Color.Black;
                 this.BackgroundImage       = global::GADD_Application.Properties.Resources.Minecraft_Path_Tracing_Feature;
                 this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
             }
         }
         //MC Main Window
         if (id == 12)
         {
             MCMainWindow.Visible = true;
             MainWindowMC.MWMC.InitializeWindow();
             this.BackColor             = System.Drawing.Color.Black;
             this.BackgroundImage       = global::GADD_Application.Properties.Resources.Minecraft_Path_Tracing_Feature;
             this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
         }
         if (id == 21)
         {
             mainWindowArma.Visible = true;
             MainWindowArma.MWArma.InitializeWindow();
             this.BackColor             = System.Drawing.Color.Black;
             this.BackgroundImage       = global::GADD_Application.Properties.Resources.Liv1_Phil;
             this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
         }
     }
     catch (Exception errormessage)
     {
         SphubCore.ErrorWindow ew = new SphubCore.ErrorWindow(errormessage);
         ew.Show();
     }
 }