Advertisement
Guest User

Untitled

a guest
Mar 17th, 2012
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1.  
  2. <#@ import namespace="System" #>
  3. <#@ import namespace="System.Collections.Generic" #>
  4. <#@ import namespace="System.Text" #>
  5. <#@ import namespace="System.Text.RegularExpressions" #>
  6. <#@ import namespace="System.IO" #>
  7. <#+
  8.         List<String> files = new List<String>();
  9.  
  10.         string FileToId(string file){ return System.Text.RegularExpressions.Regex.Replace(file, "^[A-Za-z0-9_]", "x"); }
  11.         void GetFiles(string path,List<string> excludedExtensions)
  12.         {
  13.             string[] dirs = Directory.GetDirectories(path);
  14.             for (var i = 0; i < dirs.Length; i++)
  15.             {
  16.                 GetFiles(dirs[i],excludedExtensions );
  17.             }
  18.  
  19.             string [] loopFiles = Directory.GetFiles(path);
  20.  
  21.             for (var i = 0; i < loopFiles.Length; i++)
  22.             {
  23.                 if (excludedExtensions==null ||
  24.                    !excludedExtensions.Contains(System.IO.Path.GetExtension(loopFiles[i])))
  25.                 {
  26.                     files.Add(loopFiles[i]);
  27.                 }
  28.             }
  29.         }      
  30. #>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement