/// <summary> /// Creates a new LfsOperationData to describe a file system operation. /// </summary> /// <param name="operation">The kind of operation to create.</param> /// <param name="entry">The global file system entry involved in the operation.</param> /// <param name="targetType">The type of entity to which the operation applies.</param> /// <returns>A new instance of LfsOperationData.</returns> public static LfsOperationData Create(LfsOperations operation, IGlobalFileSystemEntry entry, System.Type targetType) { LfsOperationData operationData = null; switch (operation) { case LfsOperations.Add: case LfsOperations.Remove: case LfsOperations.Update: if ((entry is IDirectory) && (targetType == typeof(IDirectory))) { operationData = new LfsOperationData(operation, (IDirectory)entry); } else if ((entry is ILfsFileInfo) && (targetType == typeof(ILfsFileInfo))) { operationData = new LfsOperationData(operation, (ILfsFileInfo)entry); } else if (entry is Fork) { operationData = new LfsOperationData(operation, (Fork)entry); } else { throw new System.InvalidOperationException(); } break; case LfsOperations.UpdateFlags: operationData = new LfsOperationData(operation); break; case LfsOperations.Reformat: throw new System.InvalidOperationException(Resources.Strings.Reformat_ArgError); } return(operationData); }
private LfsOperationData(LfsOperations operation, LfsEntityType type, IGlobalFileSystemEntry fileSystemEntry) : this(operation, type) { Uid = fileSystemEntry.Uid; FileSystemNumber = InvalidFileSystemNumber; }