Пример #1
0
        public AdEditorForm(IGADatabaseConnector conn, ContentEntry entry)
        {
            InitializeComponent();
            this._conn = conn;

            ActivationDatePicker.CustomFormat = Common.DateTimeFormat;
            ExpiryDatePicker.CustomFormat = Common.DateTimeFormat;

            // deserialize data row
            if (entry != null)
            {
                // real row
                _entry = entry;
            }
            else
            {
                _entry = new ContentEntry();

                // work around limitation of the library
                if (_conn.MinTimeStoredInSeconds)
                {
                    _entry.Properties["MinTime"] = "2";
                }
            }

            DrawToForm();
        }
Пример #2
0
 /// <summary>
 /// Creates a new AdParkImportForm
 /// </summary>
 /// <param name="conn">An IGADatabaseConnector object.</param>
 /// <param name="ads">An AdPack instance to import</param>
 public AdPackImportForm(IGADatabaseConnector conn, AdPack ads)
 {
     this.ads = ads;
     foreach (KeyValuePair<uint, ContentEntry> item in conn.GetAllEntries(false))
     {
         ContentTypes.Add(item.Key, item.Value.contentType);
     }
     this.conn = conn;
     InitializeComponent();
 }
Пример #3
0
        /// <summary>
        /// Creates a new AdPackExportForm.
        /// </summary>
        /// <param name="conn">The connection to get images from.</param>
        public AdPackExportForm(IGADatabaseConnector conn)
        {
            this.AppID = conn.AppID;

            foreach (KeyValuePair<uint, ContentEntry> item in conn.GetAllEntries(false))
            {
                ContentTypes.Add(item.Key, item.Value.contentType);
            }

            //this.ContentTypes = null;
            this.conn = conn;
            InitializeComponent();
        }
Пример #4
0
        protected void OpenDatabase(String filename)
        {
            // open db
            IGADatabaseConnector connector;
            try {
                connector = new IGADatabaseConnector(this.FileChooserControl.Filename);

                // connected okay, now spawn mainform
                this.Success = true;
                this.Hide();
                new MainForm(connector);
                this.Destroy();
                MainClass.owin = null;
            } catch (DatabaseConnectionFailureException) {
                MessageDialog d = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok,
                    "There was a problem trying to open the cache file.  It is probably not in the right format, or it has been corrupted.");
                d.Run();
                d.Destroy();
            }
        }
Пример #5
0
        public MainForm(IGADatabaseConnector connector)
            : base("")
        {
            Stetic.Gui.Build(this, typeof(igaeditorgtk.MainForm));

            // open database
            this._igaconnector = connector;

            this.RecordTreeView.AppendColumn("ID", new CellRendererText(), "text", 0);
            this.RecordTreeView.AppendColumn("Active?", new CellRendererText(), "text", 1);
            this.RecordTreeView.AppendColumn("Activates", new CellRendererText(), "text", 2);
            this.RecordTreeView.AppendColumn("Expires", new CellRendererText(), "text", 3);
            this.RecordTreeView.AppendColumn("Shown", new CellRendererText(), "text", 4);
            this.RecordTreeView.AppendColumn("Size", new CellRendererText(), "text", 5);
            this.RecordTreeView.AppendColumn("Type", new CellRendererText(), "text", 6);
            this.RecordTreeView.AppendColumn("Views", new CellRendererText(), "text", 7);
            this.RecordTreeView.HeadersVisible = true;
            this.RepopulateList();
            this.Show();
            if (this._igaconnector.AppSupported) {
                this.DatabaseTitleLabel.Text = "Ad Cache Entries for " + this._igaconnector.appInfo.AppName + ":";
            } else {
                this.DatabaseTitleLabel.Text = "Ad Cache Entries for Unknown Application (#" + this._igaconnector.AppID.ToString() + "):";
                // disable write functions
                this.AddRecordButton.Sensitive = false;
                this.EditRecordButton.Sensitive = false;
                this.DeleteRecordButton.Sensitive = false;
                this.ImportImageButton.Sensitive = false;
                this.ImportAdpack.Sensitive = false;
                this.ExportAdpack.Sensitive = false;
                // display warning
                MessageDialog d = new MessageDialog(this, DialogFlags.Modal, MessageType.Warning, ButtonsType.Ok,
                    "The application that created this cache file is not officially supported.  Write functions have been disabled to prevent potential damage to the file.");
                d.Run();
                d.Destroy();
            }
        }
Пример #6
0
 public AdEditorForm(IGADatabaseConnector conn)
     : this(conn, new ContentEntry())
 {
 }
Пример #7
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;
        }
Пример #8
0
 private void CloseDatabase()
 {
     _igaconnector = null;
     WelcomeGroup.Show();
     EditingGroup.Hide();
     refreshToolStripMenuItem.Enabled = false;
     importAdpackFilebfadsToolStripMenuItem.Enabled = false;
     exportAdpackFilebfadsToolStripMenuItem.Enabled = false;
     closeDatabaseToolStripMenuItem.Enabled = false;
     vacuumDatabaseToolStripMenuItem.Enabled = false;
     debugToolStripMenuItem.Enabled = false;
     ViewSwitchButton.Visible = false;
 }
Пример #9
0
 protected virtual void OnCloseDatabaseActivated(object sender, System.EventArgs e)
 {
     this._igaconnector = null;
     MainClass.owin = new OpenWindow();
     MainClass.owin.Show();
     MainClass.owin.Activate();
     this.Hide();
     this.Destroy();
 }
Пример #10
0
 protected void AppExit()
 {
     this._igaconnector = null;
     Application.Quit();
 }