Update wc6 database

g7db was last updated Nov 17, 2016
Closes #701
fix extension suggestion & copy backup logic from main
This commit is contained in:
Kurt 2017-01-07 09:54:31 -08:00
parent 4636042fe1
commit bd1ac8e266
4 changed files with 12 additions and 4 deletions

View file

@ -80,7 +80,7 @@ namespace PKHeX
}
}
public string Extension => "." + GetType().Name.ToLower();
public string Extension => GetType().Name.ToLower();
public string FileName => getCardHeader() + "." + Extension;
public virtual byte[] Data { get; set; }
public abstract PKM convertToPKM(SaveFile SAV);

Binary file not shown.

Binary file not shown.

View file

@ -147,14 +147,22 @@ namespace PKHeX
SaveFileDialog outputwc6 = new SaveFileDialog
{
Filter = getFilter(),
FileName = Util.CleanFileName($"{mg.CardID} - {mg.CardTitle}{mg.Extension}")
FileName = Util.CleanFileName(mg.FileName)
};
if (outputwc6.ShowDialog() != DialogResult.OK) return;
string path = outputwc6.FileName;
if (File.Exists(path)) // File already exists, save a .bak
File.WriteAllBytes(path + ".bak", File.ReadAllBytes(path));
if (File.Exists(path))
{
// File already exists, save a .bak
string bakpath = path + ".bak";
if (!File.Exists(bakpath))
{
byte[] backupfile = File.ReadAllBytes(path);
File.WriteAllBytes(bakpath, backupfile);
}
}
File.WriteAllBytes(path, mg.Data);
}