public static async Task ImportZips(this OGLContext context, bool applyKeywords = false, bool cleanup = true) { if (cleanup) { context.CleanUp(); } String basepath = PCLSourceManager.Data.Path; foreach (IFile z in PCLSourceManager.Zips) { String s = System.IO.Path.ChangeExtension(z.Name, null); if (context.ExcludedSources.Contains(s, StringComparer.OrdinalIgnoreCase)) { continue; } using (ZipFile zf = new ZipFile(await z.OpenAsync(FileAccess.Read))) { string f = s.ToLowerInvariant() + "/"; string ff = s.ToLowerInvariant() + "\\"; String basesource = PCLSourceManager.Sources.Select(ss => ss.Name).FirstOrDefault(ss => StringComparer.OrdinalIgnoreCase.Equals(ss, s)); bool overridden = basesource != null; foreach (ZipEntry entry in zf) { if (!entry.IsFile) { continue; } string name = entry.Name.ToLowerInvariant(); if ((name.StartsWith(f) || name.StartsWith(ff)) && name.EndsWith(".xml")) { String path = System.IO.Path.Combine(basepath, entry.Name).Replace("\\", "/"); if (overridden && (await FileSystem.Current.GetFileFromPathAsync(path)) != null) { continue; } using (Stream st = zf.GetInputStream(entry)) OGLImport.Import(st, path, s, basepath, context, applyKeywords); } else if (name.EndsWith(".xml")) { String path = System.IO.Path.Combine(basepath, basesource, entry.Name).Replace("\\", "/"); if (overridden && (await FileSystem.Current.GetFileFromPathAsync(path)) != null) { continue; } using (Stream st = zf.GetInputStream(entry)) OGLImport.Import(st, path, s, basepath, context, applyKeywords); } } } } }