Пример #1
0
        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);
            }
        }
Пример #2
0
        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));
                Logger.Debug($"Storing {items.Count} items to db");
                progressBar1.Maximum = items.Count;
                buttonImport.Enabled = false;
                Thread t = new Thread(() => {
                    ExceptionReporter.EnableLogUnhandledOnThread();
                    isLocked = true;

                    var batches = BatchUtil.ToBatches <PlayerItem>(items);
                    foreach (var batch in batches)
                    {
                        _playerItemDao.Import(batch);
                        Invoke((MethodInvoker) delegate { progressBar1.Value += batch.Count; });
                    }

                    isLocked = false;
                    MessageBox.Show(
                        RuntimeSettings.Language.GetTag("iatag_ui_importexport_import_success_body"),
                        RuntimeSettings.Language.GetTag("iatag_ui_importexport_import_success"),
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information
                        );
                });

                t.Start();
            }
        }
Пример #3
0
        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
                    );
            }
        }
Пример #4
0
 public void Import(List <PlayerItem> items)
 {
     ThreadExecuter.Execute(
         () => repo.Import(items)
         );
 }