Esempio n. 1
0
        public IEnumerable ListFiles(FileInfoSearchPredicate predicate)
        {
            ArrayList files = new ArrayList();

            try
            {
                String prefix = GetCanonicalPath();
                if (!prefix.EndsWith(Separator))
                {
                    prefix += SeparatorChar;
                }
                int cut   = prefix.Length;
                int count = LocalStorage.Length;
                for (int index = 0; index < count; index++)
                {
                    String key = LocalStorage.Key(index);
                    if (key.StartsWith(prefix) && (key.IndexOf(SeparatorChar, cut) == -1))
                    {
                        String name = key.Substring(cut, key.Length);
                        if ((predicate == null) || predicate(name, this))
                        {
                            files.Add(new FileInfo(name, this));
                        }
                    }
                }
            }
            catch (Exception) { }
            return(files);
        }
 public IEnumerable ListFiles(FileInfoSearchPredicate predicate)
 {
     ArrayList files = new ArrayList();
     try
     {
         String prefix = GetCanonicalPath();
         if (!prefix.EndsWith(Separator))
             prefix += SeparatorChar;
         int cut = prefix.Length;
         int count = LocalStorage.Length;
         for (int index = 0; index < count; index++)
         {
             String key = LocalStorage.Key(index);
             if (key.StartsWith(prefix) && (key.IndexOf(SeparatorChar, cut) == -1))
             {
                 String name = key.Substring(cut, key.Length);
                 if ((predicate == null) || predicate(name, this))
                     files.Add(new FileInfo(name, this));
             }
         }
     }
     catch (Exception) { }
     return files;
 }