public static async Task <IEnumerable <string> > EnumerateCategories(this OGLContext context, string type) { HashSet <string> result = new HashSet <string>(); foreach (var f in await PCLSourceManager.GetAllDirectoriesAsync(context, type)) { result.UnionWith(await GetSubDirectoriesAsync(f.Key, type).ConfigureAwait(false)); } return(from s in result orderby s select s); }
public static async Task <IEnumerable <string> > EnumerateCategories(this OGLContext context, string type) { HashSet <string> result = new HashSet <string>(); foreach (var f in await PCLSourceManager.GetAllDirectoriesAsync(context, type)) { result.UnionWith(await GetSubDirectoriesAsync(f.Key, type).ConfigureAwait(false)); } string t = type.TrimEnd('/', '\\').ToLowerInvariant() + "/"; string tt = type.TrimEnd('/', '\\').ToLowerInvariant() + "\\"; foreach (IFile z in PCLSourceManager.Zips) { String s = System.IO.Path.ChangeExtension(z.Name, null); using (ZipFile zf = new ZipFile(await z.OpenAsync(FileAccess.Read))) { string f = s.ToLowerInvariant() + "/" + t; string ff = s.ToLowerInvariant() + "\\" + tt; zf.IsStreamOwner = true; foreach (ZipEntry entry in zf) { String name = entry.IsFile ? System.IO.Path.GetFileName(entry.Name) : entry.Name; String n = name.ToLowerInvariant(); if (n.StartsWith(t)) { result.Add(name.Substring(t.Length)); } else if (n.StartsWith(tt)) { result.Add(name.Substring(tt.Length)); } else if (n.StartsWith(f)) { result.Add(name.Substring(f.Length)); } else if (n.StartsWith(ff)) { result.Add(name.Substring(ff.Length)); } } } } return(from s in result orderby s select s); }