Exemplo n.º 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();
            }
        }