/// <summary> /// Remove a child item from this folder /// </summary> /// <param name="item">Entry or Folder item</param> public void RemoveItem(ICVSItem item) { _childItems.Remove(item); }
/// <summary> /// Writes one Entry to the CVS Entries file. /// If the entry is in the file, it updates the line. /// Otherwise, it adds it to the end of the file. /// </summary> /// <param name="entry">The entry.</param> public void WriteEntry(ICVSItem entry) { // Read file IList<string> readLines = ReaderWriter.Current.ReadFileLines((FileInfo) entry.Info); ////using (TextReader reader = new StreamReader(EntriesFile.Open(FileMode.Open, FileAccess.Read))) ////{ //// string line = string.Empty; //// while (line != null) //// { //// line = reader.ReadLine(); //// readLines.Add(line); //// } //// reader.Close(); ////} IList<string> writeLines = new List<string>(); // Find entry line and update bool lineFound = false; foreach (var line in readLines) { string writeLine; string regex = PServerHelper.GetEntryFilenameRegex(entry.Info.Name); Match m = Regex.Match(line, regex); if (m.Success) { writeLine = entry.EntryLine; lineFound = true; } else writeLine = line; writeLines.Add(writeLine); } if (!lineFound) writeLines.Add(entry.EntryLine); // Save updated lines to file ReaderWriter.Current.WriteFileLines((FileInfo) entry.Info, writeLines); ////using (TextWriter writer = new StreamWriter(EntriesFile.Open(FileMode.Create, FileAccess.Write))) ////{ //// foreach (var line in writeLines) //// { //// writer.WriteLine(line); //// } //// writer.Flush(); //// writer.Close(); ////} }
/// <summary> /// Add a child item to this folder /// </summary> /// <param name="item">Entry or Folder item</param> public void AddItem(ICVSItem item) { _childItems.Add(item); }
private static void PrintWorkingDirStructure(ICVSItem working) { Console.Write("(d)"); Console.WriteLine(working.Info.FullName); foreach (ICVSItem item in working) { if (item is Folder) PrintWorkingDirStructure(item); else Console.WriteLine("(f)" + item.Info.FullName); } }