private void SplashScreen_Load(object sender, EventArgs e) { uiVersionLabel.Text = $"v{Constants.OsirtVersion} {Constants.CefVersion}"; var backgroundWorker = new BackgroundWorker(); backgroundWorker.WorkerReportsProgress = true; backgroundWorker.DoWork += delegate { OsirtHelper.CheckCacheDirectoriesExist(); Thread.Sleep(2000); string[] log = OsirtLogWriter.ReadLog(); string path = log[0]; if (!Convert.ToBoolean(log[1])) { bool fileExists = File.Exists(path + ".osr"); if (!fileExists) { backgroundWorker.ReportProgress(10, $"Previous Case not closed successfully. Re-Archiving: {log[0] + Constants.ContainerExtension}"); Thread.Sleep(250); using (ZipFile zip = new ZipFile()) { //if (password.Length > 0) //{ // zip.Password = password; // zip.Encryption = EncryptionAlgorithm.WinZipAes256; //} zip.AddDirectory(path, Path.GetFileName(path)); zip.Save(Path.Combine(Directory.GetParent(path).FullName, Path.GetFileName(path) + Constants.ContainerExtension)); } //Dear idiot, don't recursively delete your desktop again like a moron. OsirtHelper.DeleteDirectory(path); } } }; backgroundWorker.ProgressChanged += BackgroundWorker_ProgressChanged; backgroundWorker.RunWorkerCompleted += delegate { CaseChecked?.Invoke(this, e); Close(); }; backgroundWorker.RunWorkerAsync(); }
private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { OsirtLogWriter.Write(Constants.ContainerLocation, true); //don't want to exit if we're just shutting a case down. Application.Exit(); }
private void ShowBrowserPanelAndLogOpening() { ShowBrowserPanel(); caseOpened = true; OsirtLogWriter.Write(Constants.ContainerLocation, false); }