Represents a client database (DBC) file in its raw data format.
Esempio n. 1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                Stream fileStream = null;
                RawClientDatabase database;

                try
                {
                    fileStream = File.Open(openFileDialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
                    database = new RawClientDatabase(fileStream);
                    databaseViewer.Database = database;
                    fileNameToolStripStatusLabel.Text = openFileDialog.FileName;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, Properties.Resources.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    fileNameToolStripStatusLabel.Text = "";
                }
                finally
                {
                    if (fileStream != null)
                        fileStream.Close();
                }
            }
        }
        protected override void OnFileChanged()
        {
            if (File == null)
            {
                Database = null;
                return;
            }
            else
            {
                Stream stream;

                if (File.Size <= 0x400000
                    || MessageBox.Show(
                        Host, Properties.Resources.DatabaseSizeWarningMessage,
                        string.Format(Properties.Resources.Culture, Properties.Resources.DatabaseSizeWarningTitle, Host.SelectedFileName),
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Exclamation) == DialogResult.Yes)
                {
                    stream = File.Open();
                    try { Database = new RawClientDatabase(stream); }
                    finally { stream.Close(); }
                }
                else
                {
                    Database = null;
                }
            }
        }