Exemple #1
0
        public void Config(BeSafeConfig config, PipeServer pipeServer, bool stoppingService)
        {
            _config     = config;
            _pipeServer = pipeServer;

            if ((config != null) && (config.ComponentsState.SecureVolume) && (stoppingService == false))
            {
                _secureDrive.FileAccessRequestEvent += OnFileAccessRequestEvent;
                string mappedDriveLetter = _secureDrive.MapDrive(config.SecureVolumePath);

                _driveView = new DriveView(mappedDriveLetter);
                _driveView.SetDriveIcon($"{System.Reflection.Assembly.GetEntryAssembly().Location}");
            }
            else
            {
                DriveInfo beSafeDriveInfo = ServiceUtils.GetBeSafeDriveLetter();
                if (beSafeDriveInfo == null)
                {
                    return;
                }

                _secureDrive.UnmapDrive(beSafeDriveInfo.Name);
                new DriveView(beSafeDriveInfo.Name).RemoveDriveView();
            }
        }
        private void CreateNewDriveView(string path)
        {
            this.Text = $"{ApplicationTitle} - {Path.GetFileName(path)}";

            // Destroy the current drive view
            splitContainer1.Panel1.Controls.Remove(driveView);

            // Create a new view for this drive
            driveView      = new DriveView();
            driveView.Dock = DockStyle.Fill;
            driveView.TabSelectionChanged += DriveView_TabSelectionChanged;
            driveView.TaskStarted         += DriveView_TaskStarted;
            driveView.TaskCompleted       += DriveView_TaskCompleted;

            // Add the view to the panel
            splitContainer1.Panel1.Controls.Add(driveView);
        }