public static string ReadAllText(this FileAbstractLayer fal, RelativePath file)
 {
     using (var sr = OpenReadText(fal, file))
     {
         return(sr.ReadToEnd());
     }
 }
        public static string GetProperty(this FileAbstractLayer fal, RelativePath file, string propertyName)
        {
            var dict = fal.GetProperties(file);

            dict.TryGetValue(propertyName, out string result);
            return(result);
        }
 public static void WriteAllText(this FileAbstractLayer fal, RelativePath file, string content)
 {
     using (var writer = CreateText(fal, file))
     {
         writer.Write(content);
     }
 }
Esempio n. 4
0
 public FileAbstractLayerBuilder FallbackReadFromInput(FileAbstractLayer fal)
 {
     if (fal == null)
     {
         throw new ArgumentNullException(nameof(fal));
     }
     return new FileAbstractLayerBuilder(CreateFallback(_reader, fal.Reader), _writer);
 }
Esempio n. 5
0
 public static FileAbstractLayerBuilder CreateBuilder(FileAbstractLayer fal)
 {
     if (fal == null)
     {
         throw new ArgumentNullException(nameof(fal));
     }
     return(new FileAbstractLayerBuilder(fal.Reader, fal.Writer));
 }
Esempio n. 6
0
 public FileAbstractLayerBuilder FallbackReadFromInput(FileAbstractLayer fal)
 {
     if (fal == null)
     {
         throw new ArgumentNullException(nameof(fal));
     }
     return(new FileAbstractLayerBuilder(CreateFallback(_reader, fal.Reader), _writer));
 }
Esempio n. 7
0
 public FileAbstractLayerBuilder ReadFromOutput(FileAbstractLayer fal)
 {
     if (fal == null)
     {
         throw new ArgumentNullException(nameof(fal));
     }
     if (!fal.CanWrite)
     {
         throw new ArgumentException("FileAbstractLayer cannot write.", nameof(fal));
     }
     return new FileAbstractLayerBuilder(fal.Writer.CreateReader(), _writer);
 }
Esempio n. 8
0
 public FileAbstractLayerBuilder FallbackReadFromOutput(FileAbstractLayer fal)
 {
     if (fal == null)
     {
         throw new ArgumentNullException(nameof(fal));
     }
     if (!fal.CanWrite)
     {
         throw new ArgumentException("FileAbstractLayer cannot write.", nameof(fal));
     }
     return(new FileAbstractLayerBuilder(CreateFallback(_reader, fal.Writer.CreateReader()), _writer));
 }
 public static void WriteAllText(this FileAbstractLayer fal, string file, string content) =>
 WriteAllText(fal, (RelativePath)file, content);
 public static StreamWriter CreateText(this FileAbstractLayer fal, string file) =>
 CreateText(fal, (RelativePath)file);
Esempio n. 11
0
 public static void Copy(this FileAbstractLayer fal, string sourceFileName, string destFileName) =>
 fal.Copy((RelativePath)sourceFileName, (RelativePath)destFileName);
 public static string ReadAllText(this FileAbstractLayer fal, string file) =>
 ReadAllText(fal, (RelativePath)file);
 public static StreamWriter CreateText(this FileAbstractLayer fal, RelativePath file) =>
 new StreamWriter(fal.Create(file));
 public static StreamReader OpenReadText(this FileAbstractLayer fal, string file) =>
 OpenReadText(fal, (RelativePath)file);
Esempio n. 15
0
 public static ImmutableDictionary <string, string> GetProperties(this FileAbstractLayer fal, string file) =>
 fal.GetProperties((RelativePath)file);
 public static bool Exists(this FileAbstractLayer fal, string file) =>
 fal.Exists((RelativePath)file);
 public static StreamReader OpenReadText(this FileAbstractLayer fal, RelativePath file) =>
 new StreamReader(fal.OpenRead(file));
Esempio n. 18
0
 public static FileStream Create(this FileAbstractLayer fal, string file) =>
 fal.Create((RelativePath)file);
        public static bool HasProperty(this FileAbstractLayer fal, RelativePath file, string propertyName)
        {
            var dict = fal.GetProperties(file);

            return(dict.ContainsKey(propertyName));
        }
 public static IEnumerable <KeyValuePair <RelativePath, string> > GetAllPhysicalPaths(this FileAbstractLayer fal) =>
 from r in fal.GetAllInputFiles()
 select new KeyValuePair <RelativePath, string>(r, fal.GetPhysicalPath(r));
 public static string GetOutputPhysicalPath(this FileAbstractLayer fal, RelativePath file) =>
 FileAbstractLayerBuilder.Default
 .ReadFromOutput(fal)
 .Create()
 .GetPhysicalPath(file);
 public static string GetOutputPhysicalPath(this FileAbstractLayer fal, string file) =>
 GetOutputPhysicalPath(fal, (RelativePath)file);
 public static string GetProperty(this FileAbstractLayer fal, string file, string propertyName) =>
 GetProperty(fal, (RelativePath)file, propertyName);
Esempio n. 24
0
 public static FileStream OpenRead(this FileAbstractLayer fal, string file) =>
 fal.OpenRead((RelativePath)file);