public static void AppendAllText(string path, string contents) { if (_provider == null) { File.AppendAllText(path, contents); } else { _provider.AppendAllText(path, contents); } }
public bool Create(string filename, string path = null, string content = null) { if (string.IsNullOrWhiteSpace(path)) { path = UserDirectory.Get(); } bool isNull = string.IsNullOrEmpty(filename); if (!isNull) { bool IsTxt = FileProvider.CheckFileExtension(filename); if (IsTxt) { var exist = IsExist(filename, path); if (!exist) { if (string.IsNullOrWhiteSpace(content)) { return(FileProvider.Create(filename, path, content)); } else { return(FileProvider.AppendAllText(filename, path, content)); } } else { return(FileProvider.WriteAllText(filename, path, content)); } } else { throw new FileExtensionException($"The file \"{filename}\" is not a text file"); } } else { throw new NoFileNameException("CREATE: FileName is missing"); } }