using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace GameOfLife.UI.Services; /// /// Defines the contract for file input/output operations. /// This service abstracts the logic of scanning directories and parsing text files. /// public interface IFileService { /// /// Asynchronously enumerates files in the specified directory. /// Using IAsyncEnumerable allows the UI to populate the list item-by-item (streaming) /// without freezing the interface, even if there are thousands of files. /// /// The full path to the directory to scan. /// A token to cancel the operation if the user selects a different folder. /// An async stream of file paths. IAsyncEnumerable EnumerateFilesAsync(string folderPath, CancellationToken token); /// /// Asynchronously loads a game board from a text file. /// Reads the file content and parses it into a 2D boolean grid. /// /// The full path to the text file. /// The required height of the grid. /// The required width of the grid. /// A task representing the asynchronous operation, containing the initialized grid. Task LoadBoardAsync(string filePath, int rows, int cols); }