Expose Pokedex.Species as an IDictionary.

This commit is contained in:
Greg Edwards 2015-05-08 19:05:43 -04:00
parent 855bd9eb88
commit 320fc26a2a
3 changed files with 9 additions and 6 deletions

View File

@ -172,10 +172,13 @@ namespace PkmnFoundations.Pokedex
private Dictionary<LocationNumbering, Dictionary<int, Location>> m_location_values_generations;
// todo: add ReadOnlyIndexer1d class, replace these methods with them
public Species Species(int national_dex)
// todo: use readonly wrappers
public IDictionary<int, Species> Species
{
return m_species[national_dex];
get
{
return m_species;
}
}
public Family Families(int id)

View File

@ -90,7 +90,7 @@ namespace PkmnFoundations.Pokedex
// since we want the Pokemon4/5 ctor to succeed regardless of how
// broken the underlying data is.
return new LazyKeyValuePair<int, Species>(
k => k == 0 ? null : (pokedex == null ? null : pokedex.Species(k)),
k => k == 0 ? null : (pokedex == null ? null : pokedex.Species[k]),
v => v == null ? 0 : v.NationalDex);
}
}

View File

@ -142,7 +142,7 @@ namespace PkmnFoundations.GTS
{
Pokedex.Pokedex pokedex = AppStateHelper.Pokedex(Application);
GtsRecordBase record = (GtsRecordBase)DataItem;
return Common.HtmlEncode(pokedex.Species(record.Species).Name.ToString());
return Common.HtmlEncode(pokedex.Species[record.Species].Name.ToString());
}
catch
{
@ -216,7 +216,7 @@ namespace PkmnFoundations.GTS
{
Pokedex.Pokedex pokedex = AppStateHelper.Pokedex(Application);
GtsRecordBase record = (GtsRecordBase)DataItem;
Species species = pokedex.Species(record.RequestedSpecies);
Species species = pokedex.Species[record.RequestedSpecies];
return "<img src=\"" + ResolveUrl(WebFormat.SpeciesImageSmall(species)) +
"\" alt=\"" + Common.HtmlEncode(species.Name.ToString()) +