Exemplo n.º 1
0
 public IEnumerable <StreamAttributes> Enumerate(string underLogicalPath, EnumerateTypes types, bool recursive)
 {
     return(_enumerateCache.GetOrBuild($"{recursive}|{types}|{underLogicalPath}", null, () =>
     {
         return _inner.Enumerate(underLogicalPath, types, recursive).ToList();
     }));
 }
 public static IEnumerable <string> Queries(this IStreamProvider streamProvider)
 {
     // Return all Queries
     foreach (StreamAttributes item in streamProvider.Enumerate("Query", EnumerateTypes.File, true))
     {
         if (item.Path.EndsWith(".xql", StringComparison.OrdinalIgnoreCase))
         {
             yield return(item.Path.RelativePath("Query\\", ".xql"));
         }
     }
 }
 public IEnumerable <StreamAttributes> Enumerate(string underLogicalPath, EnumerateTypes types, bool recursive)
 {
     // Enumerate items but make them look like the unpacked zip files
     foreach (StreamAttributes item in _inner.Enumerate(underLogicalPath, types, recursive))
     {
         if (item.Path.EndsWith(".zip"))
         {
             item.Path = item.Path.Substring(0, item.Path.Length - 4);
         }
         yield return(item);
     }
 }
        private static void AddFullFolderContainers(this IStreamProvider streamProvider, string rootToRemove, string underPath, HashSet <string> results)
        {
            foreach (StreamAttributes item in streamProvider.Enumerate(underPath, EnumerateTypes.Folder, false))
            {
                if (item.Path.EndsWith("\\Full"))
                {
                    // If this has a 'Full' folder in it, add it and stop recursing
                    results.Add(underPath.RelativePath(rootToRemove));
                    return;
                }

                // Otherwise look under this folder
                AddFullFolderContainers(streamProvider, rootToRemove, item.Path, results);
            }
        }
        public static IEnumerable <string> Tables(this IStreamProvider streamProvider)
        {
            HashSet <string> tables = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            // Return all Configs as tables
            foreach (StreamAttributes item in streamProvider.Enumerate("Config", EnumerateTypes.File, true))
            {
                if (item.Path.EndsWith(".xql", StringComparison.OrdinalIgnoreCase))
                {
                    tables.Add(item.Path.RelativePath("Config\\", ".xql"));
                }
            }

            // Return raw Sources as tables
            AddFullFolderContainers(streamProvider, "Source", tables);

            // Return built Tables as tables
            AddFullFolderContainers(streamProvider, "Table", tables);

            return(tables);
        }