示例#1
0
        public MainWindow()
        {
            InitializeComponent();
            this.Loaded += OnLoaded;
            try
            {
                reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\JavaSoft\Java Update\Policy");
            }
            catch
            {
                MessageBox.Show("자바를 설치후 실행해 주세요.\n자바 미설치시 프로그램이 작동하지 않습니다.\n\nPlease install Java and run it.\nIf Java is not installed, the program does not work.", title, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                this.Close();
            }
            dummyfiledel = new BackgroundWorker()//더미파일 삭제
            {
                WorkerReportsProgress      = true,
                WorkerSupportsCancellation = true
            };
            dummyfiledel.DoWork             += dummyfiledel_Dowork;
            dummyfiledel.ProgressChanged    += dummyfiledel_ProgressChanged;
            dummyfiledel.RunWorkerCompleted += dummyfiledel_RunWorkerCompleted;

            startdownload = new BackgroundWorker()//스피갓 다운 시작
            {
                WorkerSupportsCancellation = true
            };
            startdownload.DoWork             += startdownload_Dowork;
            startdownload.RunWorkerCompleted += startdownload_RunWorkerCompleted;
            try
            {
                Document doc         = NSoupClient.Parse(GetWebText("https://hub.spigotmc.org/jenkins/job/BuildTools/"));
                var      versionlist = doc.Select("a.tip.model-link.inside.build-link.display-name");
                newver = NSoupClient.Parse(versionlist.ToArray()[0].ToString()).Text();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to retrieve BuildTools version list.\nIf the phenomenon persists, please press the \"Bug Report\"\nbutton in the program to report the bug.\n\nLearn more:\n" + ex, title, MessageBoxButton.OK, MessageBoxImage.Information);
            }
            reg = Registry.LocalMachine.CreateSubKey("SOFTWARE").CreateSubKey("Spigot Downloader");
            string savever = reg.GetValue("BuildTools version", "").ToString();

            if (!new FileInfo("BuildTools.jar").Exists || savever != newver)
            {
                progressonly window1 = new progressonly(language_code);
                window1.Show();
                reg.SetValue("BuildTools version", newver);
            }
            else
            {
            }
        }
示例#2
0
        private void buildtoolsdownload_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Document doc         = NSoupClient.Parse(GetWebText("https://hub.spigotmc.org/jenkins/job/BuildTools/"));
                var      versionlist = doc.Select("a.tip.model-link.inside.build-link.display-name");
                newver = NSoupClient.Parse(versionlist.ToArray()[0].ToString()).Text();
            }
            catch
            {
            }
            RegistryKey reg;

            reg = Registry.LocalMachine.CreateSubKey("SOFTWARE").CreateSubKey("Spigot Downloader");

            progressonly window1 = new progressonly(language_code);

            window1.Show();
        }