mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-04-24 07:16:48 -05:00
Add list of regions to the database.
This commit is contained in:
parent
c714be02ec
commit
01b3c9a3ef
|
|
@ -607,6 +607,14 @@ namespace VeekunImport
|
|||
}
|
||||
}
|
||||
|
||||
// pkmncf_pokedex_regions
|
||||
ProcessTSV("regions.txt", fields =>
|
||||
{
|
||||
if (fields.Length < 2) return;
|
||||
int id = Convert.ToInt32(fields[0]);
|
||||
db.PokedexInsertRegion(new Region(null, id, new LocalizedString(){{"EN", fields[1]}}));
|
||||
});
|
||||
|
||||
connVeekun.Close();
|
||||
}
|
||||
|
||||
|
|
@ -633,6 +641,27 @@ namespace VeekunImport
|
|||
if (reader["damage_class_id"] is DBNull) return DamageClass.None;
|
||||
return (DamageClass)(Convert.ToInt32(reader["damage_class_id"]) - 1);
|
||||
}
|
||||
|
||||
private static bool ProcessTSV(String filename, Action<String[]> action)
|
||||
{
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
Console.WriteLine("File {0} not found, skipped.", filename);
|
||||
return false;
|
||||
}
|
||||
using (FileStream fs = File.Open(filename, FileMode.Open))
|
||||
{
|
||||
StreamReader sr = new StreamReader(fs, Encoding.UTF8);
|
||||
String line;
|
||||
while ((line = sr.ReadLine()) != null)
|
||||
{
|
||||
String[] fields = line.Split('\t');
|
||||
action(fields);
|
||||
}
|
||||
fs.Close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
internal class ItemLoading
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@
|
|||
<Content Include="families.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="regions.txt" />
|
||||
<Content Include="ribbons.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
|
|||
9
VeekunImport/regions.txt
Normal file
9
VeekunImport/regions.txt
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
1 Event
|
||||
2 Kanto
|
||||
3 Johto
|
||||
4 Hoenn
|
||||
5 Orre
|
||||
6 Sevii Islands
|
||||
7 Sinnoh
|
||||
8 Unova
|
||||
9 Kalos
|
||||
Loading…
Reference in New Issue
Block a user