public Catalog GetCatalog(string name, Action <Catalog> loadedCB = null) { Catalog cat; if (catalogCache.ContainsKey(name)) { cat = catalogCache[name]; } else { Stream xmlStream = TitleContainer.OpenStream("Content/" + name + ".cat"); cat = new CatalogImpl(xmlStream); } if (loadedCB != null) { loadedCB(cat); } return(cat); }
public Catalog GetCatalog(string name, Action <Catalog> loadedCB = null) { CatalogImpl catalog; if (catalogCache.ContainsKey(name)) { catalog = catalogCache[name]; loadedCB(catalog); } else { catalog = new CatalogImpl(); mgr.LoadTextFile("Content/" + name + ".cat", delegate(string txt) { catalog.SetXML(new MemoryStream(Encoding.UTF8.GetBytes(txt ?? ""))); catalogCache[name] = catalog; if (loadedCB != null) { loadedCB(catalog); } }); } return(catalog); }