Пример #1
0
        private bool OpenDatabaseConnection()
        {
            DialogResult res = DialogResult.Cancel;
            bool cont = true;

            do
            {
                res = OpenDatabaseDialogue.ShowDialog();
                if (res == DialogResult.Cancel)
                {
                    res = MessageBox.Show("You canceled opening the icontent.cache file.  You need to locate it to use this program.\r\n\r\nWould you like to try again?", "IGA Ad Cache Editor", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (res == DialogResult.No)
                    {
                        cont = false;
                    }
                }
                else
                {
                    // try opening file.
                    try {
                        _igaconnector = new IGADatabaseConnector(OpenDatabaseDialogue.FileName);
                        if (_igaconnector.AppID == 0)
                        {
                            // no appid
                            OverrideAppidForm oaf = new OverrideAppidForm();
                            oaf.ShowDialog();

                            if (oaf.Success)
                            {
                                _igaconnector.AppID = oaf.AppID;
                                if (oaf.SaveToDatabase)
                                {
                                    _igaconnector.ChangeAppID(oaf.AppID);
                                }
                            }
                            else
                            {
                                //throw new Exception("The operation to select an appid was cancelled.");
                                return false; // be less drastic.
                            }
                        }

                        if (!_igaconnector.AppSupported)
                        {
                            // unsupported appid
                            UnsupportedApplicationForm uaf = new UnsupportedApplicationForm(_igaconnector.AppID);
                            uaf.ShowDialog();
                        }
                    } catch (DatabaseConnectionFailureException) {
                        res = MessageBox.Show("There was a problem loading the cache file.  The error code was: DatabaseConnectionFailureException.\r\n\r\nWould you like to try again?", "IGA Ad Cache Editor", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);
                        if (res == DialogResult.No)
                        {
                            cont = false;
                        }
                        else
                        {
                            res = DialogResult.Cancel;
                        }
                    }

                }
            } while (res == DialogResult.Cancel && cont);

            if (cont)
            {
                WelcomeGroup.Hide();
                EditingGroup.Show();
                refreshToolStripMenuItem.Enabled = true;
                exportAdpackFilebfadsToolStripMenuItem.Enabled = true;
                closeDatabaseToolStripMenuItem.Enabled = true;
                debugToolStripMenuItem.Enabled = true;
                ViewSwitchButton.Visible = true;
                SetReadonlyRestrictions(_igaconnector.AppSupported);
                RefreshList();
            }

            return cont;
        }
Пример #2
0
        private void changeAppIDOfCacheToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OverrideAppidForm oaf = new OverrideAppidForm();
            oaf.ShowDialog();

            if (oaf.Success)
            {

                _igaconnector.AppID = oaf.AppID;
                if (oaf.SaveToDatabase)
                {
                    _igaconnector.ChangeAppID(oaf.AppID);
                }
                SetReadonlyRestrictions(_igaconnector.AppSupported);
                //RefreshList();
                MessageBox.Show("The operation was completed.");
            }
        }