// Main threading void workerUpdate(object sender, DoWorkEventArgs e) { // TODO: Implement more error handling BackgroundWorker sendingworker = (BackgroundWorker)sender; // Check variables before starting if (String.IsNullOrEmpty(ChosenTempFolder) || String.IsNullOrEmpty(ChosenProjectFolder)) { Application.Current.Dispatcher.Invoke(new Action(() => { new MaterialDialog("", "Please choose both folders.").ShowDialog(); })); e.Cancel = true; return; } // Set up / Clean up variables UpdatePackageList = new List <UpdatePackage>(); HashTable = new Dictionary <string, HashEntry>(); mDriveDirectory = createRootFolder(); string GameFile = Path.Combine(ChosenTempFolder, "gamefile.7z"); string GameFileEncrypted = Path.Combine(ChosenTempFolder, "gamefile.7z.enc"); // TODO: Ask for information // - Versionstring, Description, PatchFor etc. // - Set Versionnumber automatically askFinalGameName(); string GameFileFinal = Path.Combine(ChosenTempFolder, FinalGameName); sendingworker.ReportProgress(5, new StatusHolder() { txt = "# Indexing all project files, this might take a while. Please be patient." + Environment.NewLine, progress = -1 }); _7zip.CreateZip(ChosenProjectFolder, GameFile, sendingworker); if (sendingworker.CancellationPending) { e.Cancel = true; return; } sendingworker.ReportProgress(30, new StatusHolder() { txt = "--> Finished compressing." + Environment.NewLine, progress = -1 }); // Encrypt all the packages sendingworker.ReportProgress(25, new StatusHolder() { txt = "# Encrypting the package." + Environment.NewLine, progress = -1 }); CryptLib.AES_Encrypt(GameFile, GameFileEncrypted, EncryptionPassword, sendingworker); File.Delete(GameFile); File.Delete(GameFileFinal); File.Move(GameFileEncrypted, GameFileFinal); if (sendingworker.CancellationPending) { e.Cancel = true; return; } sendingworker.ReportProgress(30, new StatusHolder() { txt = "--> Finished encrypting." + Environment.NewLine, progress = -1 }); // Show notification for the point of no return showContinueNotification(); if (sendingworker.CancellationPending) { e.Cancel = true; return; } // Uploading the packages to Google Drive sendingworker.ReportProgress(35, new StatusHolder() { txt = "# Uploading packages to Google Drive", progress = -1 }); uploadGame(GameFileFinal, sendingworker); if (sendingworker.CancellationPending) { e.Cancel = true; return; } sendingworker.ReportProgress(40, new StatusHolder() { txt = "--> Finished uploading the packages." + Environment.NewLine, progress = -1 }); sendingworker.ReportProgress(45, new StatusHolder() { txt = "# Package uploaded, here's the link:", progress = -1 }); // Print out the download url string DownloadUrl = "https://drive.google.com/uc?export=download&id=" + UploadedFile.Id; sendingworker.ReportProgress(50, new StatusHolder() { txt = DownloadUrl, progress = -1 }); showCopyableText("Here's the download url:", DownloadUrl); // Print out the size in bytes sendingworker.ReportProgress(55, new StatusHolder() { txt = "Size in bytes: ", progress = -1 }); long Size = new FileInfo(GameFileFinal).Length; sendingworker.ReportProgress(60, new StatusHolder() { txt = Size.ToString(), progress = -1 }); showCopyableText("Size in bytes:", Size.ToString()); }