/// <summary> /// Create the command object that will be used to act on the repository. /// </summary> /// <returns>The command object that will be used to act on the /// repository.</returns> /// <exception cref="Exception">TODO: Make a more specific exception</exception> /// <exception cref="NotImplementedException">If the command argument /// is not implemented currently. TODO: Implement the argument.</exception> public override ICommand CreateCommand() { ICSharpCode.SharpCvsLib.Commands.AddCommand addCommand; this.ParseOptions(this.unparsedOptions); try { // Open the Repository file in the CVS directory Manager manager = new Manager(Environment.CurrentDirectory); Repository repository = manager.FetchRepository(Environment.CurrentDirectory); // If this fails error out and state the user // is not in a CVS repository directory tree. CurrentWorkingDirectory = new WorkingDirectory(this.cvsRoot, Environment.CurrentDirectory, repository.FileContents); CurrentWorkingDirectory.OverrideDirectory = Environment.CurrentDirectory; // If fileNames has a wild card (*) like '*.txt' // Create new AddCommand object addCommand = new ICSharpCode.SharpCvsLib.Commands.AddCommand( this.CurrentWorkingDirectory); String[] files = Directory.GetFiles(Environment.CurrentDirectory, fileNames); ArrayList copiedFiles = new ArrayList(); foreach (String file in files) { LOGGER.Debug("file=[" + file + "]"); // Remove the .txt when everything works, giving me bugs... String fullPath = Path.Combine(Environment.CurrentDirectory, file); copiedFiles.Add(fullPath); } addCommand.Folders = GetFoldersToAdd(copiedFiles); } catch (Exception e) { LOGGER.Error(e); throw e; } return(addCommand); }
/// <summary> /// Create the command object that will be used to act on the repository. /// </summary> /// <returns>The command object that will be used to act on the /// repository.</returns> /// <exception cref="Exception">TODO: Make a more specific exception</exception> /// <exception cref="NotImplementedException">If the command argument /// is not implemented currently. TODO: Implement the argument.</exception> public override ICommand CreateCommand () { ICSharpCode.SharpCvsLib.Commands.AddCommand addCommand; this.ParseOptions(this.unparsedOptions); try { // Open the Repository file in the CVS directory Manager manager = new Manager(Environment.CurrentDirectory); Repository repository = manager.FetchRepository(Environment.CurrentDirectory); // If this fails error out and state the user // is not in a CVS repository directory tree. CurrentWorkingDirectory = new WorkingDirectory( this.cvsRoot, Environment.CurrentDirectory, repository.FileContents); CurrentWorkingDirectory.OverrideDirectory = Environment.CurrentDirectory; // If fileNames has a wild card (*) like '*.txt' // Create new AddCommand object addCommand = new ICSharpCode.SharpCvsLib.Commands.AddCommand( this.CurrentWorkingDirectory); String[] files = Directory.GetFiles(Environment.CurrentDirectory, fileNames); ArrayList copiedFiles = new ArrayList (); foreach (String file in files) { LOGGER.Debug("file=[" + file + "]"); // Remove the .txt when everything works, giving me bugs... String fullPath = Path.Combine(Environment.CurrentDirectory, file); copiedFiles.Add(fullPath); } addCommand.Folders = GetFoldersToAdd(copiedFiles); } catch (Exception e) { LOGGER.Error (e); throw e; } return addCommand; }