/// <summary> /// Creates a file transfer object. /// </summary> /// <param name="lineNumber">Optional line number for item that required the file transfer.</param> /// <param name="source">Source path.</param> /// <param name="destination">Destination path.</param> /// <param name="type">Optional type of file trnasfer.</param> /// <param name="move">Flag if file should be moved or copied</param> /// <returns>File transfer object.</returns> public static FileTransfer Create(FileLineNumber lineNumber, string source, string destination, string type, bool move) { FileTransfer transfer = new FileTransfer(); transfer.LineNumber = lineNumber; transfer.Type = type; transfer.Move = move; try { transfer.Source = Path.GetFullPath(source); } catch (ArgumentException) { throw new CompilerException(new CompilerMessageEventArgs(CompilerMessage.InvalidFileName(source), lineNumber)); } catch (PathTooLongException) { throw new CompilerException(new CompilerMessageEventArgs(CompilerMessage.PathTooLong(source), lineNumber)); } try { transfer.Destination = Path.GetFullPath(destination); } catch (ArgumentException) { throw new CompilerException(new CompilerMessageEventArgs(CompilerMessage.InvalidFileName(destination), lineNumber)); } catch (PathTooLongException) { throw new CompilerException(new CompilerMessageEventArgs(CompilerMessage.PathTooLong(destination), lineNumber)); } transfer.Redundant = String.Equals(transfer.Source, transfer.Destination, StringComparison.OrdinalIgnoreCase); return(transfer); }