public IEnumerable<string> GetFiles(string path, string filter, MySearchOption searchOption)
        {
            if (!Directory.Exists(path))
                return null;

            return Directory.GetFiles(path, filter, (System.IO.SearchOption)searchOption);
        }
Beispiel #2
0
        public IEnumerable <string> GetFiles(string path, string filter, MySearchOption searchOption)
        {
            MyZipArchive zipFile = TryDoZipAction(path, TryGetZipArchive, null);

            string subpath = "";

            if (searchOption == MySearchOption.TopDirectoryOnly)
            {
                subpath = TryDoZipAction(path, TryGetSubpath, null);
            }

            if (zipFile != null)
            {
                string pattern = Regex.Escape(filter).Replace(@"\*", ".*").Replace(@"\?", ".");
                pattern += "$";
                foreach (var fileName in zipFile.FileNames)
                {
                    if (searchOption == MySearchOption.TopDirectoryOnly)
                    {
                        if (fileName.Count((x) => x == '\\') != subpath.Count((x) => x == '\\') + 1)
                        {
                            continue;
                        }
                    }
                    if (Regex.IsMatch(fileName, pattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
                    {
                        yield return(Path.Combine(zipFile.ZipPath, fileName));
                    }
                }

                zipFile.Dispose();
            }
        }
        public IEnumerable <string> GetFiles(string path, string filter, MySearchOption searchOption)
        {
            if (!Directory.Exists(path))
            {
                return(null);
            }

            return(Directory.GetFiles(path, filter, (System.IO.SearchOption)searchOption));
        }
        public IEnumerable<string> GetFiles(string path, string filter, MySearchOption searchOption)
        {
            if (!Directory.Exists(path))
                return null;

//NotYet #if XB1
//NotYet            System.Diagnostics.Debug.Assert(false, "TODO for XB1.");
//NotYet            return null;
//NotYet #else // !XB1
            return Directory.GetFiles(path, filter, (System.IO.SearchOption)searchOption);
//NotYet #endif // !XB1
        }
        public IEnumerable <string> GetFiles(string path, string filter, MySearchOption searchOption)
        {
            if (!Directory.Exists(path))
            {
                return(null);
            }

//NotYet #if XB1
//NotYet            System.Diagnostics.Debug.Assert(false, "TODO for XB1.");
//NotYet            return null;
//NotYet #else // !XB1
            return(Directory.GetFiles(path, filter, (System.IO.SearchOption)searchOption));
//NotYet #endif // !XB1
        }
        public IEnumerable<string> GetFiles(string path, string filter, MySearchOption searchOption)
        {
            foreach (var p in m_providers)
            {
                try
                {
                    var files = p.GetFiles(path, filter, searchOption);
                    if (files != null)
                        return files;
                }
                catch { }

            }
            return null;
        }
Beispiel #7
0
 public IEnumerable <string> GetFiles(string path, string filter, MySearchOption searchOption)
 {
     foreach (var p in m_providers)
     {
         try
         {
             var files = p.GetFiles(path, filter, searchOption);
             if (files != null)
             {
                 return(files);
             }
         }
         catch { }
     }
     return(null);
 }
Beispiel #8
0
        public IEnumerable <string> GetFiles(string path, string filter, MySearchOption searchOption)
        {
            MyZipArchive zipFile = TryDoZipAction(path, TryGetZipArchive, null);

            string subpath = "";

            if (searchOption == MySearchOption.TopDirectoryOnly)
            {
                subpath = TryDoZipAction(path, TryGetSubpath, null);
            }

            if (zipFile != null)
            {
#if XB1
                System.Diagnostics.Debug.Assert(false, "TODO for XB1.");
                if (filter == "hgdshfjghjdsghj")
                {
                    yield return("");
                }
#else // !XB1
                string pattern = Regex.Escape(filter).Replace(@"\*", ".*").Replace(@"\?", ".");
                pattern += "$";
                foreach (var fileName in zipFile.FileNames)
                {
                    if (searchOption == MySearchOption.TopDirectoryOnly)
                    {
                        if (fileName.Count((x) => x == '\\') != subpath.Count((x) => x == '\\') + 1)
                        {
                            continue;
                        }
                    }
                    if (Regex.IsMatch(fileName, pattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
                    {
                        yield return(Path.Combine(zipFile.ZipPath, fileName));
                    }
                }
#endif // !XB1

                zipFile.Dispose();
            }
        }