public void ExtractPhysicsRBZ(bool overwriteSubFolder) { if (!Directory.Exists("Physics") && !File.Exists("physics.rbz")) { DialogResult dr = MessageBox.Show(Loc.String(13), "", MessageBoxButtons.OKCancel); if (dr == DialogResult.OK) { DownloadPluginNGP(); } else { Environment.Exit(-1); } } if (Directory.Exists("Physics")) { if (overwriteSubFolder) { //Directory.Delete("Physics", true); //while (Directory.Exists("Physics")) System.Threading.Thread.Sleep(10); HelperFunctions.DirectoryDeleteAllFilesRecursively("Physics"); } else { return; } } if (File.Exists("physics.rbz")) { ZipManager.ExtractToDirectory("physics.rbz", "."); } }
public void ExtractFile(string path, string outputdir) { if (UseExternalUnzipper) { ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = PathToExternalUnzipper; psi.Arguments = ExternalUnzipperArguments.Replace("%1%", path).Replace("%2%", outputdir); Process myProcess = Process.Start(psi); myProcess.WaitForExit(); } else { ZipManager.ExtractToDirectory(path, outputdir); } }
private void Client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e) { DownloadJob job = jobQueue[jobQueue.Count - 1]; WebClient wc = (WebClient)e.UserState; string header_contentDisposition = wc.ResponseHeaders["content-disposition"]; filename = job.path + new ContentDisposition(header_contentDisposition).FileName; FileStream fs = new FileStream(filename, FileMode.Create); fs.Write(e.Result, 0, e.Result.Length); fs.Close(); ZipManager.ExtractToDirectory(filename, job.path); File.Delete(filename); jobQueue.RemoveAt(jobQueue.Count - 1); downloadNextJob(); }
public void ExtractPhysicsRBZ(bool overwriteSubFolder) { if (!Directory.Exists("Physics") && !File.Exists("physics.rbz")) { DialogResult dr = MessageBox.Show("Neither the file 'physics.rbz' nor the subfolder 'Physics' could be found." + "\nPlease start this tool from inside an RBR folder." + "\nIf this is already the case, please restore 'physics.rbz'." + "\n\nAlternatively, the NGP plugin could be downloaded now to rectify the situation. Download now?", "", MessageBoxButtons.OKCancel); if (dr == DialogResult.OK) { DownloadPluginNGP(); } else { Environment.Exit(-1); } } if (Directory.Exists("Physics")) { if (overwriteSubFolder) { //Directory.Delete("Physics", true); //while (Directory.Exists("Physics")) System.Threading.Thread.Sleep(10); HelperFunctions.DirectoryDeleteAllFilesRecursively("Physics"); } else { return; } } if (File.Exists("physics.rbz")) { ZipManager.ExtractToDirectory("physics.rbz", "."); } }