Exemplo n.º 1
0
        public CompareWorker(CompareParams cp)
        {
            _params = cp;

            // Initialize the lexical scanner and the parser objects that will be used
            // to analyze all SQLite schema objects.
            _parser.scanner = _scanner;

            // Initialize the notification object
            _pevent = new ProgressEventArgs(false, 0, null, null);
            _pevent.NestedProgress = new ProgressEventArgs(false, 0, null, null);
        }
Exemplo n.º 2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            float v;

            try
            {
                // Make sure both files are SQLite version 3 databases
                v = Utils.GetSQLiteVersion(txtLeftFile.Text.Trim());
                if (v == -1)
                {
                    MessageBox.Show(this,
                                    "The left file is not recognized as a valid SQLite database",
                                    "Error",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return;
                }
                else if (v < 3)
                {
                    MessageBox.Show(this,
                                    "The left file has an older SQLite file format that is not supported by this utility.\r\n" +
                                    "If you really want to compare this file then you'll have to convert it to the newer file\r\n" +
                                    "format by following the instructions at http://www.sqlite.org/formatchng.html",
                                    "Compatibility Error",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this,
                                ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            } // catch

            try
            {
                v = Utils.GetSQLiteVersion(txtRightFile.Text.Trim());
                if (v == -1)
                {
                    MessageBox.Show(this,
                                    "The right file is not recognized as a valid SQLite database",
                                    "Error",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return;
                }
                else if (v < 3)
                {
                    MessageBox.Show(this,
                                    "The right file has an older SQLite file format that is not supported by this utility.\r\n" +
                                    "If you really want to compare this file then you'll have to convert it to the newer file\r\n" +
                                    "format by following the instructions at http://www.sqlite.org/formatchng.html",
                                    "Compatibility Error",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this,
                                ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            } // catch

            ComparisonType ctype = ComparisonType.None;

            if (rbtnCompareSchemaOnly.Checked)
            {
                ctype = ComparisonType.CompareSchemaOnly;
            }
            else if (rbtnCompareSchemaAndData.Checked)
            {
                ctype = ComparisonType.CompareSchemaAndData;
            }
            else
            {
                throw new ApplicationException("illegal state");
            }

            // Prepare the comparison parameters object
            _params = new CompareParams(txtLeftFile.Text.Trim(), txtRightFile.Text.Trim(), ctype, cbxCompareBlobFields.Checked && rbtnCompareSchemaAndData.Checked);

            // Save parameters in the registry
            Configuration.LastUsedLeftDbPath     = _params.LeftDbPath;
            Configuration.LastUsedRightDbPath    = _params.RightDbPath;
            Configuration.LastComparisonWithData = _params.ComparisonType == ComparisonType.CompareSchemaAndData;
            Configuration.LastCompareBlobFields  = _params.IsCompareBlobFields;

            DialogResult = DialogResult.OK;
        }
Exemplo n.º 3
0
 public void setFiles(string left, string right)
 {
     _compareParams = new CompareParams(left, right, ComparisonType.CompareSchemaAndData, true);
 }