예제 #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (this.screen == Screen.First)
     {
         string directory = this.folderBrowserDialog1.SelectedPath;
         Directory.CreateDirectory(directory);
         JAO.Taskbar.Progress(Taskbar.ProgressState.Paused);
         this.folderBrowserDialog1.ShowDialog();
         JAO.Taskbar.Progress();
         JAO.DirectoryDelete(directory);
         this.key.SetValue("AppDir", this.textBox1.Text = this.folderBrowserDialog1.SelectedPath);
     }
 }
예제 #2
0
        private void ScreenSecond()
        {
            this.screen = Screen.Second;
            JAO.Taskbar.Urgency();
            this.groupBox1.Visible    = false;
            this.label3.Visible       = true;
            this.progressBar1.Visible = true;
            this.button2.Text         = "Czekaj...";
            this.button1.Enabled      = false;
            this.button2.Enabled      = false;
            this.label1.Text          = "Instalacja";
            this.label3.Text          = "Proszę czekać...";
            this.label2.Text          = "\nTrwa instalacja systemu plików " + JAO.Title + " " + JAO.Version + "...\n\n" + this.label3.Text + "\n\n\nProces ten może potrwać od kilku sekund do kilkunastu minut, w zależności od specyfikacji używanego sprzętu, prędkości łącza internetowego oraz już istniejących składników.";
            JAO.Taskbar.OverlayIcon(68);
            string directory = this.folderBrowserDialog1.SelectedPath;

            Directory.CreateDirectory(directory);
            Directory.SetCurrentDirectory(directory);
            string fileZip = JAO.FileDownload("Ionic.Zip.dll", this.progressBar1, 5);
            string fileJAO = JAO.FileDownload("jao-001-" + JAO.ISA + ".zip", this.progressBar1, 30);
            string fileJVM = null;

            if (!new DirectoryInfo("JVM/" + JAO.ISA + "/jre1.7.0_80").Exists)
            {
                fileJVM = JAO.FileDownload("jre-7u80-" + JAO.ISA + ".zip", this.progressBar1, 30);
            }
            new Thread(() =>
            {
                try
                {
                    this.Invoke(new EventHandler(delegate { this.DownloadInfo(fileZip); }));
                    while (!JAO.FileDownloadLast.Exists(e => e.Equals(fileZip)))
                    {
                        Thread.Sleep(10);
                    }
                    Thread.Sleep(500);
                    this.Invoke(new EventHandler(delegate { this.DownloadInfo(fileJAO); }));
                    while (!JAO.FileDownloadLast.Exists(e => e.Equals(fileJAO)))
                    {
                        Thread.Sleep(10);
                    }
                    Thread.Sleep(500);
                    if (fileJVM != null)
                    {
                        this.Invoke(new EventHandler(delegate { this.DownloadInfo(fileJVM); }));
                        while (!JAO.FileDownloadLast.Exists(e => e.Equals(fileJVM)))
                        {
                            Thread.Sleep(10);
                        }
                    }
                    else
                    {
                        this.Invoke(new EventHandler(delegate { this.SkipInfo(); }));
                        this.Invoke(new EventHandler(delegate { this.ProgressPercent(30); }));
                    }
                    Thread.Sleep(500);
                    String library = "Ionic.Zip";
                    this.Invoke(new EventHandler(delegate { this.ProgressInfo("Trwa przygotowywanie zasobów biblioteki '" + library + "'..."); }));
                    Assembly assembly = JAO.GiveAssembly(library);
                    this.Invoke(new EventHandler(delegate { this.ProgressPercent(5); }));
                    Thread.Sleep(500);
                    if (fileJVM != null)
                    {
                        this.Invoke(new EventHandler(delegate { this.ExtractInfo(fileJVM); }));
                        JAO.ZipExtract("jre-7u80", "JVM/" + JAO.ISA, assembly);
                        RegistryKey keyJVM = this.key.CreateSubKey("JVM");
                        string value       = "java";
                        keyJVM.SetValue(value, "jre");
                        value += "." + keyJVM.GetValue(value);
                        keyJVM.SetValue(value, JAO.ISA);
                        value += "." + keyJVM.GetValue(value);
                        keyJVM.SetValue(value, "7u80");
                        value += "." + keyJVM.GetValue(value);
                        keyJVM.SetValue(value, 0x0);
                        keyJVM.SetValue(value += ".dir", Path.GetFullPath("JVM/" + JAO.ISA + "/jre1.7.0_80"));
                        keyJVM.SetValue(value + ".bin", Path.GetFullPath(keyJVM.GetValue(value) + "/bin"));
                    }
                    else
                    {
                        this.Invoke(new EventHandler(delegate { this.SkipInfo(); }));
                    }
                    this.Invoke(new EventHandler(delegate { this.ProgressPercent(15); }));
                    Thread.Sleep(500);
                    this.Invoke(new EventHandler(delegate { this.ExtractInfo(fileJAO); }));
                    JAO.ZipExtract("jao-001", null, assembly);
                    this.Invoke(new EventHandler(delegate { this.ProgressPercent(15); }));
                    Thread.Sleep(500);
                    this.Invoke(new EventHandler(delegate { this.ProgressInfo("Trwa kasowanie zbędnych plików..."); }));
                    if (fileJVM != null)
                    {
                        File.Delete(fileJVM);
                    }
                    File.Delete(fileJAO);
                    Thread.Sleep(500);
                    this.Invoke(new EventHandler(delegate { this.ProgressPercent(100); }));
                    this.Invoke(new EventHandler(delegate { this.ProgressInfo("Ta część instalacji została pomyślnie ukończona!"); }));
                    Thread.Sleep(500);
                    this.Invoke(new EventHandler(delegate { this.ScreenThird(); }));
                }
                catch (Exception e)
                {
                    this.Invoke(new EventHandler(delegate { JAO.CriticalError(e); }));
                }
            }).Start();
            new Thread(() =>
            {
                try
                {
                    while (this.screen == Screen.Second)
                    {
                        this.Invoke(new EventHandler(delegate { JAO.Taskbar.Progress(this.progressBar1.Value); }));
                        Thread.Sleep(10);
                    }
                }
                catch (Exception e)
                {
                    this.Invoke(new EventHandler(delegate { JAO.CriticalError(e); }));
                }
            }).Start();
        }