示例#1
0
        public Dictionary <string, IContentReference> BuildDictionary(string ext, string exclude)
        {
            var entries = FarProvider.GetEntriesForExtension(ext);
            var result  = new Dictionary <string, IContentReference>();

            string[] folders = null;
            if (BareFoldersByExtension.TryGetValue(ext, out folders))
            {
                foreach (var folder in folders)
                {
                    var test     = Manager.TS1AllFiles;
                    var regexStr = folder + ".*\\" + ext;
                    FileProvider <object> provider;
                    if (!FileProvidersByRegex.TryGetValue(regexStr, out provider))
                    {
                        var regex = new Regex(regexStr);
                        provider        = new FileProvider <object>(Manager, null, regex);
                        provider.UseTS1 = true;
                        provider.Init();
                        FileProvidersByRegex[regexStr] = provider;
                    }
                    var entries2 = provider.List();
                    foreach (var entry in entries2)
                    {
                        result[entry.ToString()] = entry;
                    }
                }
            }

            if (entries == null)
            {
                return(result);
            }
            foreach (var entry in entries)
            {
                var name = Path.GetFileName(entry.FarEntry.Filename.ToLowerInvariant().Replace('\\', '/'));
                if (name.Contains(exclude))
                {
                    continue;
                }
                result[name] = entry;
            }

            /*
             * var entries3 = FileProvider.GetEntriesForExtension(ext);
             * foreach (var entry in entries3)
             * {
             *  var name = Path.GetFileName(entry.Name.ToLowerInvariant().Replace('\\', '/'));
             *  if (name.Contains(exclude)) continue;
             *  result[name] = entry;
             * }*/

            return(result);
        }
示例#2
0
 public void Init()
 {
     FarProvider.Init();
     FileProvider.UseTS1 = true;
     FileProvider.Init();
 }
 public void Init()
 {
     FAR.Init();
     Files.Init();
 }