public List <string> ReadAllLines(string fileName) { if (!_directoryFile.IsValidFileName(fileName)) { throw new ArgumentException("Nome do arquivo inválido."); } if (!_directoryFile.FileExists(fileName)) { throw new FileNotFoundException("Arquivo não existe."); } return(_directoryFile.ReadAllLines(fileName).ToList()); }
public void WriteText(string path, string fileName, string contents, bool overrideFile = false) { if (!_directoryFile.IsValidFileName(fileName)) { return; } if (!_directoryFile.DirectoryExists(path)) { _directoryFile.CreateDirectory(path); } if (overrideFile) { _directoryFile.WriteAllText($@"{path}\{fileName}", contents); } else { _directoryFile.AppendAllText($@"{path}\{fileName}", contents); } }