Esempio n. 1
0
 string ReadText(IVirtualFileStorage s, string file)
 {
     using (var stream = s.OpenRead(file))
         using (var reader = new StreamReader(stream))
         {
             return(reader.ReadToEnd());
         }
 }
Esempio n. 2
0
 /// <summary>
 /// Returns the list of file paths included by this FileGroupTarget.
 /// It can throw an <see cref="UnmatchedFileException"/> if <see cref="MatchBehavior"/> is <see cref="FileFilterMatchBehavior.NoneIsUnmatchedFileException"/>.
 /// </summary>
 /// <param name="root">The path of the directory into which we must look for included file paths.</param>
 /// <returns>The list of included file paths relative to <paramref name="root"/>.</returns>
 public IEnumerable <Result> IncludedFiles(string root, IVirtualFileStorage fs)
 {
     if (string.IsNullOrWhiteSpace(root))
     {
         throw new ArgumentException("root must be not null nor whitespace", "root");
     }
     if (fs == null)
     {
         throw new ArgumentNullException("fs");
     }
     foreach (string fullName in fs.EnumerateFiles(root))
     {
         FilterMatchResult m          = FilterMatchResult.None;
         string            filePath   = fullName.Substring(root.Length);
         string            filterRoot = null;
         foreach (FileNameFilter filter in Filters)
         {
             m = filter.FilePathMatch(filePath);
             if (m != FilterMatchResult.Excluded)
             {
                 filterRoot = filter.Root ?? String.Empty;
             }
             if (m != FilterMatchResult.None)
             {
                 break;
             }
         }
         if (m == FilterMatchResult.None && _matchBehavior == FileFilterMatchBehavior.NoneIsUnmatchedFileException)
         {
             throw new UnmatchedFileException(fullName);
         }
         if (m == FilterMatchResult.Included || (m == FilterMatchResult.None && _matchBehavior == FileFilterMatchBehavior.NoneIsIncluded))
         {
             yield return(new Result(filePath, filterRoot, filePath.Substring(filterRoot.Length)));
         }
     }
 }
Esempio n. 3
0
 public DpVirtualDirectory(string virtualDir, IVirtualFileStorage storage)
     : base(virtualDir)
 {
     _Storage = storage;
 }
Esempio n. 4
0
 public DpVirtualFile(string virtualPath, IVirtualFileStorage storage)
     : base(virtualPath)
 {
     _Storage = storage;
 }
Esempio n. 5
0
 public DpCacheDependancy(IVirtualFileStorage storage)
 {
     _Storage = storage;
     _Storage.OnInvalidateCache += new Action(storage_OnInvalidateCache);
 }
Esempio n. 6
0
 public DpVirtualPathProvider(IVirtualFileStorage storage)
 {
     _Storage = storage;
 }