private CopyItemAction SetOutFileAttributes(IVirtualItem sourceItem, IChangeVirtualItem destItem, bool setAttributes, bool setTime) { ChangeItemAction action; Debug.Assert(setAttributes || setTime); Label_000F:; try { IUpdateVirtualProperty property = destItem as IUpdateVirtualProperty; if (property != null) { property.BeginUpdate(); } if (setAttributes) { if (destItem.CanSetProperty(6)) { FileAttributes normal = FileAttributes.Normal; if (sourceItem.IsPropertyAvailable(6)) { normal = sourceItem.Attributes & ~(FileAttributes.Encrypted | FileAttributes.Compressed); if (this.CheckOption(CopyWorkerOptions.ClearROFromCD)) { IGetVirtualVolume parent = sourceItem.Parent as IGetVirtualVolume; if ((parent != null) && (parent.VolumeType == DriveType.CDRom)) { normal &= ~FileAttributes.ReadOnly; } } } destItem[6] = normal | (destItem.Attributes & (FileAttributes.Encrypted | FileAttributes.Compressed)); } if (this.CheckOption(CopyWorkerOptions.CopyACL)) { SetProperty(sourceItem, destItem, 14); } } if (setTime) { SetProperty(sourceItem, destItem, 7); SetProperty(sourceItem, destItem, 9); SetProperty(sourceItem, destItem, 8); } if (property != null) { property.EndUpdate(); } return CopyItemAction.Next; } catch (UnauthorizedAccessException exception) { action = this.ChangeItemError(destItem, sourceItem, destItem, AvailableItemActions.CanRetryOrIgnore, exception); } catch (IOException exception2) { action = this.ChangeItemError(destItem, sourceItem, destItem, AvailableItemActions.CanRetryOrIgnore, exception2); } switch (action) { case ChangeItemAction.Retry: goto Label_000F; case ChangeItemAction.Ignore: return CopyItemAction.Next; case ChangeItemAction.Skip: return CopyItemAction.Skip; case ChangeItemAction.Cancel: base.CancelAsync(); return CopyItemAction.Skip; } throw new InvalidEnumArgumentException(); }
private static void SetProperty(IVirtualItem sourceItem, IChangeVirtualItem destItem, int property) { if (destItem.CanSetProperty(property) && sourceItem.IsPropertyAvailable(property)) { object obj2 = sourceItem[property]; if (obj2 != null) { destItem[property] = obj2; } } }
private IVirtualItem MoveItem(IChangeVirtualItem item, IVirtualFolder dest) { ChangeItemAction action; AvailableItemActions canRetryOrElevate = AvailableItemActions.CanRetryOrElevate; Label_0003:; try { return item.MoveTo(dest); } catch (UnauthorizedAccessException exception) { action = this.MoveItemError(item, canRetryOrElevate, exception); canRetryOrElevate &= ~AvailableItemActions.CanElevate; } catch (Exception exception2) { action = this.MoveItemError(item, canRetryOrElevate, exception2); } switch (action) { case ChangeItemAction.Retry: goto Label_0003; case ChangeItemAction.Skip: return null; case ChangeItemAction.Cancel: base.CancelAsync(); return null; } throw new InvalidEnumArgumentException(); }