public void Upload(String Path, string fileType) { String[] directories = Directory.GetFiles(Path); for (int i = 0; i < directories.Length; i++) { WebClient client = new WebClient(); if (!directories[i].ToLower().EndsWith(fileType)) { continue; } txtbox.AppendText("\n\n" + MainWindow.globalLanguage.processer.ReturnProcessed(MainWindow.globalLanguage.bBBU.code.uploadingToBMBF, directories[i])); try { client.UploadFile("http://" + MainWindow.config.IP + ":50000/host/beatsaber/upload?overwrite", directories[i]); } catch { txtbox.AppendText(MainWindow.globalLanguage.global.BMBF100); } if (i % 20 == 0 && i != 0) { txtbox.AppendText("\n\n" + MainWindow.globalLanguage.global.syncingToBS); BMBFUtils.Sync(txtbox); System.Threading.Thread.Sleep(2000); } } BMBFUtils.Sync(txtbox); }
private void finished_upload(object sender, UploadFileCompletedEventArgs e) { Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { txtbox.AppendText("\n\n" + MainWindow.globalLanguage.global.syncingToBS); })); BMBFUtils.Sync(txtbox); txtbox.AppendText("\n\n" + MainWindow.globalLanguage.global.syncedToBS); Running = false; }