Click here to Skip to main content
Click here to Skip to main content
Articles » Database » Database » SQL Server » Downloads
 
Add your own
alternative version

SQLite Compare Utility

, 6 Jul 2011
Utility for comparing two SQLite database files for both structure and data
SQLiteCompare.zip
SQLiteCompare
gplex.exe
gplexx.frame
gppg.exe
license.lic
log4net.dll
Puzzle.SyntaxBox.NET3.5.dll
ShiftReduceParser.dll
SQLiteTurboDiff.suo
System.Data.SQLite.dll
AutomaticUpdates
Properties
Be.Windows.Forms.HexBox
HexBox.bmp
HexBox.snk
Thumbs.db
Design
Common
Properties
CreateTestDatabases
Properties
TestSchemaFiles
DiffControl
Properties
FastGrid
Properties
Settings.settings
Liron.Windows.Forms
multipanel.ico
Thumbs.db
Design
Properties
Setup
appicon.ico
finish_banner.bmp
installer_banner.bmp
setup.nsi
Thumbs.db
uninstallicon.ico
SQLiteParser
sqlite.lex
sqlite.y
Properties
SQLiteTurbo
sqlite.syn
SQLiteTurbo.csproj.user
Properties
Settings.settings
Resources
feedback2.png
feedback_non_selected_idea.png
feedback_non_selected_question.png
feedback_pressed.png
feedback_problem_non_selected.png
feedback_problem_selected.png
feedback_selected_idea.png
feedback_selected_question.png
normal_feedback_button.png
pressed_feedback_button.png
SVG
about.svg
accept.svg
app.svg
appicon.svg
bug.svg
check_updates.svg
close_comparison.svg
company_tagline.svg
compare.svg
copy_from_left_db.svg
copy_from_right_db.svg
edit_selected_difference.svg
feather.svg
feedback.svg
feedback_frame.svg
feedback_non_selected_idea.svg
feedback_non_selected_problem.svg
feedback_question.svg
feedback_selected_problem.svg
feedback_selected_question.svg
finish_page_banner.svg
free.svg
generate_script_left_to_right.svg
generate_script_right_to_left.svg
greenpinesoftware_logo.svg
home_screenshot.svg
installer_banner.svg
key.svg
lamp.svg
lamp_non_selected.svg
lamp_selected.svg
lock.svg
main_screen.svg
next_diff.svg
prev_diff.svg
question.svg
recycle_bin.svg
redo.svg
reject.svg
reorder_columns.svg
save_schema.svg
search.svg
smallbug.svg
sqlite_compare_logo.svg
sqlite_feather.svg
text2451.png
undo.svg
uninstall.svg
v_bullet.svg
UndoRedo
Properties
SQLiteCompareSetup.zip
SQLiteCompare_src.zip
gplex.exe
gplexx.frame
gppg.exe
license.lic
log4net.dll
Puzzle.SyntaxBox.NET3.5.dll
ShiftReduceParser.dll
SQLiteTurboDiff.suo
System.Data.SQLite.dll
HexBox.bmp
HexBox.snk
Thumbs.db
Settings.settings
multipanel.ico
Thumbs.db
appicon.ico
finish_banner.bmp
installer_banner.bmp
setup.nsi
Thumbs.db
uninstallicon.ico
sqlite.lex
sqlite.y
sqlite.syn
SQLiteTurbo.csproj.user
Settings.settings
feedback2.png
feedback_non_selected_idea.png
feedback_non_selected_question.png
feedback_pressed.png
feedback_problem_non_selected.png
feedback_problem_selected.png
feedback_selected_idea.png
feedback_selected_question.png
normal_feedback_button.png
pressed_feedback_button.png
about.svg
accept.svg
app.svg
appicon.svg
bug.svg
check_updates.svg
close_comparison.svg
company_tagline.svg
compare.svg
copy_from_left_db.svg
copy_from_right_db.svg
edit_selected_difference.svg
feather.svg
feedback.svg
feedback_frame.svg
feedback_non_selected_idea.svg
feedback_non_selected_problem.svg
feedback_question.svg
feedback_selected_problem.svg
feedback_selected_question.svg
finish_page_banner.svg
free.svg
generate_script_left_to_right.svg
generate_script_right_to_left.svg
greenpinesoftware_logo.svg
home_screenshot.svg
installer_banner.svg
key.svg
lamp.svg
lamp_non_selected.svg
lamp_selected.svg
lock.svg
main_screen.svg
next_diff.svg
prev_diff.svg
question.svg
recycle_bin.svg
redo.svg
reject.svg
reorder_columns.svg
save_schema.svg
search.svg
smallbug.svg
sqlite_compare_logo.svg
sqlite_feather.svg
text2451.png
undo.svg
uninstall.svg
v_bullet.svg
using System;
using System.Collections;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;

namespace Liron.Windows.Forms.Design
{
    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")] 
    public class MultiPanelDesigner : ParentControlDesigner
    {
        public override void Initialize(IComponent component)
        {
            _mpanel = component as MultiPanel;
            if (_mpanel == null)
            {
                this.DisplayError(new ArgumentException("Tried to use the MultiPanelControlDesign with a class that does not inherit from MultiPanel.", "component"));
                return;
            }
            base.Initialize(component);
            IComponentChangeService iccs = (IComponentChangeService)this.GetService(typeof(IComponentChangeService));
            if (iccs != null)
            {
                iccs.ComponentRemoved += new ComponentEventHandler(ComponentRemoved);
            }
            ISelectionService s = (ISelectionService)GetService(typeof(ISelectionService));
            if (s != null)
            {
                s.SelectionChanged += new EventHandler(s_SelectionChanged);
            }
        }

        /// <summary>
        /// Overridden. Inherited from <see cref="IDesigner.DoDefaultAction()"/>.
        /// </summary>
        public override void DoDefaultAction() 
        { 
        }

        /// <summary>
        /// Overridden. Inherited from <see cref="ControlDesigner"/>.
        /// </summary>
        public override DesignerVerbCollection Verbs
        {
            get
            {
                if (_verbs == null)
                {
                    _verbs = new DesignerVerbCollection();
                    _verbs.Add(new DesignerVerb("Add Page", new EventHandler(AddPage)));
                    _verbs.Add(new DesignerVerb("Remove Page", new EventHandler(RemovePage)));
                }
                return _verbs;
            }
        }

        public override ICollection AssociatedComponents
        {
            get
            {
                return _mpanel.Controls;
            }
        }

        /// <summary>
        /// Event handler for the "Add Page" verb.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="ea">
        /// Some <see cref="EventArgs"/>.
        /// </param>
        private void AddPage(object sender, EventArgs ea)
        {
            IDesignerHost dh = (IDesignerHost)GetService(typeof(IDesignerHost));
            if (dh != null)
            {
                DesignerTransaction dt = dh.CreateTransaction("Added new page");

                MultiPanelPage before = _mpanel.SelectedPage;

                string name = GetNewPageName();
                MultiPanelPage ytp = dh.CreateComponent(typeof(MultiPanelPage), name) as MultiPanelPage;
                ytp.Text = name;
                _mpanel.Controls.Add(ytp);
                _mpanel.SelectedPage = ytp;

                RaiseComponentChanging(TypeDescriptor.GetProperties(Control)["SelectedPage"]);
                RaiseComponentChanged(TypeDescriptor.GetProperties(Control)["SelectedPage"], before, ytp);

                dt.Commit();
            }
        }

        /// <summary>
        /// Event handler for the "Remove Tab" verb.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="ea">
        /// Some <see cref="EventArgs"/>.
        /// </param>
        private void RemovePage(object sender, EventArgs ea)
        {
            IDesignerHost dh = (IDesignerHost)GetService(typeof(IDesignerHost));
            if (dh != null)
            {
                DesignerTransaction dt = dh.CreateTransaction("Removed page");

                MultiPanelPage page = _mpanel.SelectedPage;
                if (page != null)
                {
                    MultiPanelPage ytp = _mpanel.SelectedPage;
                    _mpanel.Controls.Remove(ytp);
                    dh.DestroyComponent(ytp);

                    if (_mpanel.Controls.Count > 0)
                        _mpanel.SelectedPage = (MultiPanelPage)_mpanel.Controls[0];
                    else
                        _mpanel.SelectedPage = null;

                    RaiseComponentChanging(TypeDescriptor.GetProperties(Control)["SelectedPage"]);
                    RaiseComponentChanged(TypeDescriptor.GetProperties(Control)["SelectedPage"], ytp, _mpanel.SelectedPage);
                }

                dt.Commit();
            }
        }

        /// <summary>
        /// Gets a new tab name for the a tab.
        /// </summary>
        /// <returns></returns>
        private string GetNewPageName()
        {
            int i = 1;
            Hashtable h = new Hashtable(_mpanel.Controls.Count);
            foreach (Control c in _mpanel.Controls)
            {
                h[c.Name] = null;
            }
            while (h.ContainsKey("Page_" + i))
            {
                i++;
            }
            return "Page_" + i;
        }

        #region Private Methods

        private void s_SelectionChanged(object sender, EventArgs e)
        {
            ISelectionService s = (ISelectionService)GetService(typeof(ISelectionService));
            if (s != null)
            {
                if (s.PrimarySelection != null)
                {
                    MultiPanelPage page = GetMultiPanelPage((Control)s.PrimarySelection);
                    if (page != null)
                        _mpanel.SelectedPage = page;
                }
            }
        }

        private MultiPanelPage GetMultiPanelPage(Control ctrl)
        {
            if (ctrl is MultiPanelPage)
            {
                MultiPanelPage p = (MultiPanelPage)ctrl;
                if (object.ReferenceEquals(_mpanel, p.Parent))
                    return p;
                else
                    return null;
            }
            else if (ctrl.Parent != null)
                return GetMultiPanelPage(ctrl.Parent);
            else
                return null;
        }

        /// <summary>
        /// </summary>
        /// <param name="sender">
        /// The object that send this event.
        /// </param>
        /// <param name="cea">
        /// Some <see cref="ComponentEventArgs"/>.
        /// </param>
        private void ComponentRemoved(object sender, ComponentEventArgs cea)
        {
        }
        #endregion

        #region Constants
        /// <summary>
        /// Id for the WM_LBUTTONDOWN message.
        /// </summary>
        private const int WM_LBUTTONDOWN = 0x0201;

        /// <summary>
        /// Id for the WM_LBUTTONDBLCLICK message.
        /// </summary>
        private const int WM_LBUTTONDBLCLK = 0x0203;
        #endregion

        #region Private Variables
        private MultiPanel _mpanel;
        private DesignerVerbCollection _verbs;
        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)

Share

About the Author

liron.levi
Software Developer Arineta Cardio Imaging
Israel Israel
My name is Liron Levi and I'm developing software for fun & profit for 15 years already. I'm now working for Arineta Cardio Imaging as a software developer (the company develops a CT machine).
 
I can be contacted directly at liron.levi@outlook.com or via linkedin at http://www.linkedin.com/pub/liron-levy/1/578/ab5

| Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 6 Jul 2011
Article Copyright 2011 by liron.levi
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid