예제 #1
0
 public static void WriteAllText(this IFileAbstractLayer fal, string file, string content)
 {
     using (var writer = CreateText(fal, file))
     {
         writer.Write(content);
     }
 }
예제 #2
0
 public static string ReadAllText(this IFileAbstractLayer fal, string file)
 {
     using (var reader = OpenReadText(fal, file))
     {
         return(reader.ReadToEnd());
     }
 }
예제 #3
0
        public static string GetProperty(this IFileAbstractLayer fal, string file, string propertyName)
        {
            var dict = fal.GetProperties(file);

            dict.TryGetValue(propertyName, out string result);
            return(result);
        }
예제 #4
0
        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());
        }
예제 #5
0
 public RootedFileAbstractLayer(IFileAbstractLayer impl)
 {
     _impl = impl;
 }
예제 #6
0
        public static bool HasProperty(this IFileAbstractLayer fal, string file, string propertyName)
        {
            var dict = fal.GetProperties(file);

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