public bool exists(File file) { for (int i = 0; i < files.Count; i++) { File fle = (File) files[i]; if (fle.Equals(file)) { return true; } } return false; }
private void editFile(File file) { Console.WriteLine("Editing File " + file.getName() + "." + file.getFileExtension()); StringBuilder builder = new StringBuilder(file.getContents()); Console.WriteLine(file.getContents()); int ct = 0; while (true) { Console.Write("["+ct+"]: "); var input = Console.ReadLine(); if (input == "save") { Console.WriteLine("Saving"); file.setContents(builder.ToString()); break; } else { builder.Append("\n" + input); } ct++; } }
public File create(string name, string extension) { File file = new File(name, extension); files.Add(file); return file; }
public Boolean Equals(File other) { return (this.name.Equals(other.getName()) && this.extension.Equals(other.extension)); }