/// <summary> /// Recursively searches for all files within <see cref="RootDirectory"/> and its subdirectories, /// and adds them to <see cref="Files"/>. /// </summary> /// <param name="writeToConsole">When set to true, each file will be echoed to the Console.</param> public void PopulateFiles(bool writeToConsole) { foreach (var file in RootDirectory.GetFiles("*", SearchOption.AllDirectories)) { var watchedFile = new WatchedFile(file, RootDirectory); watchedFile.Refresh(); Files.Add(watchedFile); if (writeToConsole) { Console.WriteLine("Registered " + file.Name + "."); } } }