private void buttonImport_Click(object sender, EventArgs e) { if (buttonImport.Enabled) { FileExporter io; if (radioIAStash.Checked) { io = new IAFileExporter(_filename); } else if (radioGDStash.Checked) { GDTransferFile settings = cbItemSelection.SelectedItem as GDTransferFile; if (settings == null) { io = new GDFileExporter(_filename, false, string.Empty); } else { io = new GDFileExporter(_filename, settings.IsExpansion1, settings.Mod); } } else { _playerItemDao.Save(_sm.EmptyStash(_filename)); MessageBox.Show("Items imported", "Items imported!", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var items = io.Read(); _playerItemDao.Import(items); MessageBox.Show("Items imported\nIf you already had items, you may have gotten duplicates.", "Items imported!", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void buttonImport_Click(object sender, EventArgs e) { if (buttonImport.Enabled) { FileExporter io; if (radioIAStash.Checked) { io = new IAFileExporter(_filename); } else if (radioGDStash.Checked) { GDTransferFile settings = cbItemSelection.SelectedItem as GDTransferFile; io = new GDFileExporter(_filename, settings?.Mod ?? string.Empty); } else { _playerItemDao.Save(_sm.EmptyStash(_filename)); MessageBox.Show( RuntimeSettings.Language.GetTag("iatag_ui_importexport_import_success"), RuntimeSettings.Language.GetTag("iatag_ui_importexport_import_success"), MessageBoxButtons.OK, MessageBoxIcon.Information ); return; } var items = io.Read(Read(_filename)); _playerItemDao.Import(items); MessageBox.Show( RuntimeSettings.Language.GetTag("iatag_ui_importexport_import_success_body"), RuntimeSettings.Language.GetTag("iatag_ui_importexport_import_success"), MessageBoxButtons.OK, MessageBoxIcon.Information ); } }