Exemple #1
0
        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;
        }
Exemple #2
0
        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++;
            }
        }
Exemple #3
0
 public File create(string name, string extension)
 {
     File file = new File(name, extension);
     files.Add(file);
     return file;
 }
Exemple #4
0
 public Boolean Equals(File other)
 {
     return (this.name.Equals(other.getName()) && this.extension.Equals(other.extension));
 }