Esempio n. 1
0
 public static void WriteAllText(this IFileAbstractLayer fal, string file, string content)
 {
     using (var writer = CreateText(fal, file))
     {
         writer.Write(content);
     }
 }
Esempio n. 2
0
 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());
        }
Esempio n. 5
0
 public RootedFileAbstractLayer(IFileAbstractLayer impl)
 {
     _impl = impl;
 }
Esempio n. 6
0
        public static bool HasProperty(this IFileAbstractLayer fal, string file, string propertyName)
        {
            var dict = fal.GetProperties(file);

            return(dict.ContainsKey(propertyName));
        }
Esempio n. 7
0
 public static StreamWriter CreateText(this IFileAbstractLayer fal, string file) =>
 new StreamWriter(fal.Create(file));
Esempio n. 8
0
 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));
Esempio n. 10
0
 public static void Clean()
 {
     _baseDirectory        = null;
     _outputDirectory      = null;
     FileAbstractLayerImpl = null;
 }