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);
     }
 }
示例#4
0
 public FileAbstractLayerBuilder FallbackReadFromInput(FileAbstractLayer fal)
 {
     if (fal == null)
     {
         throw new ArgumentNullException(nameof(fal));
     }
     return new FileAbstractLayerBuilder(CreateFallback(_reader, fal.Reader), _writer);
 }
示例#5
0
 public static FileAbstractLayerBuilder CreateBuilder(FileAbstractLayer fal)
 {
     if (fal == null)
     {
         throw new ArgumentNullException(nameof(fal));
     }
     return(new FileAbstractLayerBuilder(fal.Reader, fal.Writer));
 }
示例#6
0
 public FileAbstractLayerBuilder FallbackReadFromInput(FileAbstractLayer fal)
 {
     if (fal == null)
     {
         throw new ArgumentNullException(nameof(fal));
     }
     return(new FileAbstractLayerBuilder(CreateFallback(_reader, fal.Reader), _writer));
 }
示例#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);
 }
示例#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);
 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);
 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));
 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);
 public static FileStream OpenRead(this FileAbstractLayer fal, string file) =>
 fal.OpenRead((RelativePath)file);