Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected override void SaveToFile(string path)
- {
- var profile = new EquipData();
- profile.DamageType = (StatType)cboDamageType.SelectedItem;
- profile.MainStat = (StatType)cboMainStat.SelectedItem;
- profile.SubStat = (StatType)cboSubStat.SelectedItem;
- profile.Physical = (float)numPhysical.Value;
- profile.Magical = (float)numMagical.Value;
- profile.Special = (float)numSpecial.Value;
- //First we'll back up the old file.
- if (File.Exists(path))
- {
- string backuppath = path + ".bak";
- if (File.Exists(backuppath))
- {
- File.Delete(backuppath);
- }
- File.Copy(path, backuppath);
- File.Delete(path);
- }
- //Then save it!
- var doc = new XDocument(profile.SaveToXml());
- using (var stream = File.OpenWrite(path))
- {
- doc.Save(stream);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement