예제 #1
0
        public bool CleanUpDirectories()
        {
            string directory = Path.Combine(Constants.CasePath, Constants.CaseContainerName);

            OsirtHelper.DeleteDirectory(directory);
            return(Directory.Exists(directory));
        }
예제 #2
0
 private void RezipCase(string path)
 {
     using (ZipFile zip = new ZipFile())
     {
         zip.AddDirectory(path, Path.GetFileName(path));
         zip.Save(Path.Combine(Directory.GetParent(path).FullName, Path.GetFileName(path) + Constants.ContainerExtension));
     }
     OsirtHelper.DeleteDirectory(path);
 }
예제 #3
0
        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();
        }