Example #1
0
        /* main methods and functions for a clean code */

        private void LoadContainer()
        {
            Debug("LoadContainer start");

            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    using (Forms.LoadBox loadBox = new Forms.LoadBox(ofd.FileName))
                    {
                        if (loadBox.ShowDialog() == DialogResult.OK)
                        {
                            Debug($"Opening container from GUI {ofd.FileName}");

                            SetStatus($"Opening container {Path.GetFileName(ofd.FileName)} with key {loadBox.pwdKey}");

                            currentlyLoadedContainer = ofd.FileName;

                            Debug("Variable set, initializing core");

                            core = new Box.Core.Core(ofd.FileName, loadBox.pwdKey, this);

                            SetStatus("Loading filesystem ...");

                            RefreshFileSystemView();

                            toolStrip1.Enabled = true;
                        }
                    }
                }
            }

            Debug("LoadContainer completed");
        }
Example #2
0
        private void CloseAndEncrypt()
        {
            SetStatus("Clearing up temp files ...");

            foreach (string file in core.tmpFiles)
            {
                if (File.Exists(file))
                {
                    File.Delete(file);
                }
            }

            SetStatus("Closing and encrypting container ...");

            core.CloseContainer();

            SetStatus("Clearing GUI ...");

            fsView.Items.Clear();
            toolStrip1.Enabled = false;
            core = null;

            SetStatus("No container loaded.");
        }