private async Task SetFolderOperationMode(FolderOperationMode folderOperationMode)
        {
            _userSettings.FolderOperationMode = folderOperationMode;
            if (folderOperationMode != FolderOperationMode.IncludeSubfolders)
            {
                return;
            }

            await Resolve.SessionNotify.NotifyAsync(new SessionNotification(SessionNotificationType.WatchedFolderOptionsChanged, Resolve.KnownIdentities.DefaultEncryptionIdentity, New <FileSystemState>().WatchedFolders.Select(wf => wf.Path)));
        }
 public static FolderOperationMode Policy(this FolderOperationMode operationMode)
 {
     if (New <LicensePolicy>().Capabilities.Has(LicenseCapability.IncludeSubfolders))
     {
         return(operationMode);
     }
     else
     {
         return(FolderOperationMode.SingleFolder);
     }
 }
Exemple #3
0
 public static IEnumerable <IDataStore> ListEncrypted(this IDataContainer folderPath, IEnumerable <IDataContainer> ignoreFolders, FolderOperationMode folderOperationMode)
 {
     return(folderPath.ListOfFiles(ignoreFolders, folderOperationMode).Where(fileInfo => fileInfo.IsEncrypted()));
 }
Exemple #4
0
        public static IEnumerable <IDataStore> ListOfFiles(this IDataContainer folderPath, IEnumerable <IDataContainer> ignoreFolders, FolderOperationMode folderOperationMode)
        {
            if (folderPath == null)
            {
                throw new ArgumentNullException("folderPath");
            }

            IEnumerable <IDataStore> files = folderPath.Files;

            if (folderOperationMode == FolderOperationMode.SingleFolder)
            {
                return(files);
            }

            IEnumerable <IDataContainer> folders        = folderPath.Folders.Where(folderInfo => !ignoreFolders.Any(x => x.FullName == folderInfo.FullName));
            IEnumerable <IDataStore>     subFolderFiles = folders.SelectMany(folder => folder.ListOfFiles(ignoreFolders, folderOperationMode));

            return(files.Concat(subFolderFiles));
        }
Exemple #5
0
        public static async Task <IEnumerable <IDataStore> > ListEncryptableWithWarningAsync(this IDataContainer folderPath, IEnumerable <IDataContainer> ignoreFolders, FolderOperationMode folderOperationMode)
        {
            IEnumerable <IDataStore> listofFiles         = folderPath.ListOfFiles(ignoreFolders, folderOperationMode);
            List <IDataStore>        filteredListOfFiles = new List <IDataStore>();

            foreach (IDataStore dataStore in listofFiles)
            {
                if (await dataStore.IsEncryptableWithWarningAsync())
                {
                    filteredListOfFiles.Add(dataStore);
                }
            }
            return(filteredListOfFiles);
        }