public ActiveFile(ActiveFile activeFile, ActiveFileStatus status) { if (activeFile == null) { throw new ArgumentNullException("activeFile"); } Initialize(activeFile); Status = status; }
public ActiveFile(ActiveFile activeFile, DateTime lastEncryptionWriteTimeUtc, ActiveFileStatus status) { if (activeFile == null) { throw new ArgumentNullException("activeFile"); } Initialize(activeFile); Properties = new ActiveFileProperties(activeFile.Properties.LastActivityTimeUtc, lastEncryptionWriteTimeUtc, activeFile.Properties.CryptoId); Status = status; }
private void Initialize(IDataStore encryptedFileInfo, IDataStore decryptedFileInfo, LogOnIdentity identity, SymmetricKeyThumbprint thumbprint, ActiveFileStatus status, ActiveFileProperties properties) { EncryptedFileInfo = New <IDataStore>(encryptedFileInfo.FullName); DecryptedFileInfo = New <IDataStore>(decryptedFileInfo.FullName); Identity = identity; Thumbprint = thumbprint; Status = status; Properties = new ActiveFileProperties(New <INow>().Utc, properties.LastEncryptionWriteTimeUtc, properties.CryptoId); IsShared = EncryptedFileInfo.IsKeyShared(Identity); }
public ActiveFile(ActiveFile activeFile, ActiveFileStatus status, ILauncher process) { if (activeFile == null) { throw new ArgumentNullException("activeFile"); } Initialize(activeFile); Status = status; Process = process; }
public ActiveFile(ActiveFile activeFile, DateTime lastEncryptionWriteTimeUtc, ActiveFileStatus status) { if (activeFile == null) { throw new ArgumentNullException("activeFile"); } Initialize(activeFile); LastEncryptionWriteTimeUtc = lastEncryptionWriteTimeUtc; Status = status; }
private async Task <FileOperationContext> LaunchApplicationForDocument(ActiveFile destinationActiveFile, FileLock decryptedLock) { ActiveFileStatus status = ActiveFileStatus.AssumedOpenAndDecrypted; ILauncher process; try { if (Resolve.Log.IsInfoEnabled) { Resolve.Log.LogInfo("Starting process for '{0}'".InvariantFormat(decryptedLock.DataStore.FullName)); } process = New <ILauncher>(); process.Launch(decryptedLock.DataStore.FullName); if (process.WasStarted) { process.Exited += new EventHandler(process_Exited); } else { status |= ActiveFileStatus.NoProcessKnown; if (Resolve.Log.IsInfoEnabled) { Resolve.Log.LogInfo("Starting process for '{0}' did not start a process, assumed handled by the shell.".InvariantFormat(decryptedLock.DataStore.FullName)); } } } catch (Exception ex) { New <IReport>().Exception(ex); if (Resolve.Log.IsErrorEnabled) { Resolve.Log.LogError("Could not launch application for '{0}', Exception was '{1}'.".InvariantFormat(decryptedLock.DataStore.FullName, ex.Message)); } return(new FileOperationContext(decryptedLock.DataStore.FullName, ErrorStatus.CannotStartApplication)); } if (Resolve.Log.IsWarningEnabled) { if (process.HasExited) { Resolve.Log.LogWarning("The process seems to exit immediately for '{0}'".InvariantFormat(decryptedLock.DataStore.FullName)); } } if (Resolve.Log.IsInfoEnabled) { Resolve.Log.LogInfo("Launched and opened '{0}'.".InvariantFormat(decryptedLock.DataStore.FullName)); } destinationActiveFile = new ActiveFile(destinationActiveFile, status); _fileSystemState.Add(destinationActiveFile, process); await _fileSystemState.Save(); return(new FileOperationContext(String.Empty, ErrorStatus.Success)); }
private void Initialize(IRuntimeFileInfo encryptedFileInfo, IRuntimeFileInfo decryptedFileInfo, DateTime lastWriteTimeUtc, AesKey key, AesKeyThumbprint thumbprint, ActiveFileStatus status, ILauncher process) { EncryptedFileInfo = OS.Current.FileInfo(encryptedFileInfo.FullName); DecryptedFileInfo = OS.Current.FileInfo(decryptedFileInfo.FullName); Key = key; Thumbprint = thumbprint; Status = status; LastActivityTimeUtc = OS.Current.UtcNow; Process = process; LastEncryptionWriteTimeUtc = lastWriteTimeUtc; }
private void SetRangeInternal(IEnumerable <ActiveFile> activeFiles, ActiveFileStatus mask) { _activeFilesByDecryptedPath = new Dictionary <string, ActiveFile>(); _activeFilesByEncryptedPath = new Dictionary <string, ActiveFile>(); foreach (ActiveFile activeFile in activeFiles) { ActiveFile thisActiveFile = activeFile; if ((activeFile.Status & mask) != 0) { thisActiveFile = new ActiveFile(activeFile, activeFile.Status & ~mask, null); } AddInternal(thisActiveFile); } }
private void SetRangeInternal(IEnumerable <ActiveFile> activeFiles, ActiveFileStatus mask) { lock (_activeFilesByEncryptedPath) { _activeFilesByEncryptedPath.Clear(); } foreach (ActiveFile activeFile in activeFiles) { ActiveFile thisActiveFile = activeFile; if ((activeFile.Status & mask) != 0) { thisActiveFile = new ActiveFile(activeFile, activeFile.Status & ~mask); } AddInternal(thisActiveFile); } }
public static bool HasMask(this ActiveFileStatus status, ActiveFileStatus mask) { return((status & mask) == mask); }
public ActiveFile(IDataStore encryptedFileInfo, IDataStore decryptedFileInfo, LogOnIdentity key, ActiveFileStatus status, Guid cryptoId) { if (encryptedFileInfo == null) { throw new ArgumentNullException("encryptedFileInfo"); } if (decryptedFileInfo == null) { throw new ArgumentNullException("decryptedFileInfo"); } if (key == null) { throw new ArgumentNullException("key"); } Initialize(encryptedFileInfo, decryptedFileInfo, key, null, status, new ActiveFileProperties(New <INow>().Utc, encryptedFileInfo.LastWriteTimeUtc, cryptoId)); }
public ActiveFile(IRuntimeFileInfo encryptedFileInfo, IRuntimeFileInfo decryptedFileInfo, AesKey key, ActiveFileStatus status, ILauncher process) { if (encryptedFileInfo == null) { throw new ArgumentNullException("encryptedFileInfo"); } if (decryptedFileInfo == null) { throw new ArgumentNullException("decryptedFileInfo"); } if (key == null) { throw new ArgumentNullException("key"); } Initialize(encryptedFileInfo, decryptedFileInfo, decryptedFileInfo.LastWriteTimeUtc, key, null, status, process); }
public static bool HasMask(this ActiveFileStatus status, ActiveFileStatus mask) { return (status & mask) == mask; }
private void SetRangeInternal(IEnumerable<ActiveFile> activeFiles, ActiveFileStatus mask) { _activeFilesByDecryptedPath = new Dictionary<string, ActiveFile>(); _activeFilesByEncryptedPath = new Dictionary<string, ActiveFile>(); foreach (ActiveFile activeFile in activeFiles) { ActiveFile thisActiveFile = activeFile; if ((activeFile.Status & mask) != 0) { thisActiveFile = new ActiveFile(activeFile, activeFile.Status & ~mask, null); } AddInternal(thisActiveFile); } }