public FileInfoContract NewFileItem(DirectoryInfoContract parent, string name, Stream content, ProgressProxy progress) { if (!string.IsNullOrEmpty(encryptionKey)) { content = content.Encrypt(encryptionKey); } InvalidateDrive(); return(gateway.NewFileItem(rootName, parent.Id, name, content, progress)); }
public FileInfoContract NewFileItem(DirectoryInfoContract parent, string name, Stream content) { return(ExecuteInSemaphore(() => { if (content.Length == 0) { return new ProxyFileInfoContract(name); } var gatewayContent = content.EncryptOrPass(_encryptionKey); var result = _gateway.NewFileItem(_rootName, parent.Id, name, gatewayContent, null); result.Size = (FileSize)content.Length; return result; }, nameof(NewFileItem), true)); }