public static TextureCollection CreateCollection(IEnumerable<string> packages) { var pkgs = new List<TexturePackage>(); foreach (var package in packages) { var existing = Packages.FirstOrDefault(x => String.Equals(x.PackageFile, package, StringComparison.InvariantCultureIgnoreCase)); if (existing != null) { // Package already loaded in another map pkgs.Add(existing); } else { // Load the package var provider = RegisteredProviders.FirstOrDefault(p => p.IsValidForPackageFile(package)); if (provider == null) throw new ProviderNotFoundException("No texture provider was found for package: " + package); var pkg = provider.CreatePackage(package); Packages.Add(pkg); pkgs.Add(pkg); } } var tc = new TextureCollection(pkgs); Collections.Add(tc); return tc; }
public static void DeleteCollection(TextureCollection collection) { Collections.RemoveAll(x => x == collection); var remove = Packages.Where(package => !Collections.Any(x => x.Packages.Contains(package))).ToList(); foreach (var package in remove) { Packages.Remove(package); package.Provider.DeletePackages(new[] {package}); package.Dispose(); } }
public static void DeleteCollection(TextureCollection collection) { Collections.RemoveAll(x => x == collection); var remove = Packages.Where(package => !Collections.Any(x => x.Packages.Contains(package))).ToList(); foreach (var package in remove) { Packages.Remove(package); package.Provider.DeletePackages(new[] { package }); package.Dispose(); } }
public static void DeleteCollection(TextureCollection collection) { Collections.RemoveAll(x => x == collection); foreach (var package in Packages.ToArray()) { if (!Collections.Any(x => x.Packages.Contains(package))) { Packages.Remove(package); package.Dispose(); } } }
public static TextureCollection CreateCollection(IEnumerable<string> sourceRoots, IEnumerable<string> additionalPackages, IEnumerable<string> blacklist, IEnumerable<string> whitelist) { var list = sourceRoots.ToList(); var additional = additionalPackages == null ? new List<string>() : additionalPackages.ToList(); var wl = whitelist == null ? new List<string>() : whitelist.ToList(); var bl = blacklist == null ? new List<string>() : blacklist.ToList(); var pkgs = new List<TexturePackage>(); foreach (var provider in RegisteredProviders) { pkgs.AddRange(provider.CreatePackages(list, additional, bl, wl)); } var tc = new TextureCollection(pkgs); Packages.AddRange(pkgs); Collections.Add(tc); return tc; }
public static TextureCollection CreateCollection(IEnumerable <string> sourceRoots, IEnumerable <string> additionalPackages, IEnumerable <string> blacklist, IEnumerable <string> whitelist) { var list = sourceRoots.ToList(); var additional = additionalPackages == null ? new List <string>() : additionalPackages.ToList(); var wl = whitelist == null ? new List <string>() : whitelist.ToList(); var bl = blacklist == null ? new List <string>() : blacklist.ToList(); var pkgs = new List <TexturePackage>(); foreach (var provider in RegisteredProviders) { pkgs.AddRange(provider.CreatePackages(list, additional, bl, wl)); } var tc = new TextureCollection(pkgs); Packages.AddRange(pkgs); Collections.Add(tc); return(tc); }
private Document() { Selection = new SelectionManager(this); History = new HistoryManager(this); HelperManager = new HelperManager(this); TextureCollection = new TextureCollection(new List<TexturePackage>()); }