private void SetHasWorkOrFinished() { if (this.expectOffset == this.SharedTransferData.TotalLength) { Exception ex = null; if (this.md5HashStream.CheckMd5Hash && this.md5HashStream.SucceededSeparateMd5Calculator) { string calculatedMd5 = this.md5HashStream.MD5HashTransformFinalBlock(); string storedMd5 = this.SharedTransferData.Attributes.ContentMD5; if (!calculatedMd5.Equals(storedMd5)) { ex = new InvalidOperationException( string.Format( CultureInfo.CurrentCulture, Resources.DownloadedMd5MismatchException, this.TransferJob.Source.ToString(), calculatedMd5, storedMd5)); } } this.CloseOwnedOutputStream(); if (this.TransferJob.Transfer.PreserveSMBAttributes) { if (this.SharedTransferData.Attributes.CloudFileNtfsAttributes.HasValue && !string.IsNullOrEmpty(this.filePath)) { LongPathFile.SetFileTime(this.filePath, this.SharedTransferData.Attributes.CreationTime.Value, this.SharedTransferData.Attributes.LastWriteTime.Value); LongPathFile.SetAttributes(this.filePath, Utils.AzureFileNtfsAttributesToLocalAttributes(this.SharedTransferData.Attributes.CloudFileNtfsAttributes.Value)); } } if ((PreserveSMBPermissions.None != this.TransferJob.Transfer.PreserveSMBPermissions) && (!string.IsNullOrEmpty(this.SharedTransferData.Attributes.PortableSDDL))) { if (!string.IsNullOrEmpty(this.filePath)) { FileSecurityOperations.SetFileSecurity( this.filePath, this.SharedTransferData.Attributes.PortableSDDL, this.TransferJob.Transfer.PreserveSMBPermissions); } } this.NotifyFinished(ex); this.state = State.Finished; } else { this.hasWork = true; } }
public static void SetFileSecurityInfo(string path, string portableSDDL, PreserveSMBPermissions preserveSMBPermissions) { try { path = DMLibTestConstants.SupportUNCPath ? LongPath.GetFullPath(LongPath.ToUncPath(path)) : LongPath.GetFullPath(path); } catch (Exception) { } FileSecurityOperations.SetFileSecurity(path, portableSDDL, preserveSMBPermissions); }
public static void SetFileSecurityInfo(string path, string portableSDDL, PreserveSMBPermissions preserveSMBPermissions) { FileSecurityOperations.SetFileSecurity(path, portableSDDL, preserveSMBPermissions); }