public static void WriteAllText(this IFileAbstractLayer fal, string file, string content) { using (var writer = CreateText(fal, file)) { writer.Write(content); } }
public static string ReadAllText(this IFileAbstractLayer fal, string file) { using (var reader = OpenReadText(fal, file)) { return(reader.ReadToEnd()); } }
public static string GetProperty(this IFileAbstractLayer fal, string file, string propertyName) { var dict = fal.GetProperties(file); dict.TryGetValue(propertyName, out string result); return(result); }
public static string[] ReadAllLines(this IFileAbstractLayer fal, string file) { using var reader = OpenReadText(fal, file); string line; var list = new List <string>(); while ((line = reader.ReadLine()) != null) { list.Add(line); } return(list.ToArray()); }
public RootedFileAbstractLayer(IFileAbstractLayer impl) { _impl = impl; }
public static bool HasProperty(this IFileAbstractLayer fal, string file, string propertyName) { var dict = fal.GetProperties(file); return(dict.ContainsKey(propertyName)); }
public static StreamWriter CreateText(this IFileAbstractLayer fal, string file) => new StreamWriter(fal.Create(file));
public static StreamReader OpenReadText(this IFileAbstractLayer fal, string file) => new StreamReader(fal.OpenRead(file));
public static IEnumerable <KeyValuePair <string, string> > GetAllPhysicalPaths(this IFileAbstractLayer fal) => from r in fal.GetAllInputFiles() select new KeyValuePair <string, string>(r, fal.GetPhysicalPath(r));
public static void Clean() { _baseDirectory = null; _outputDirectory = null; FileAbstractLayerImpl = null; }