System.Data.SQLite

Check-in [2be5482b8e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:More designer updates
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | sourceforge
Files: files | file ages | folders
SHA1: 2be5482b8e2bbf77d34bf45b0288216395491d4a
User & Date: rmsimpson 2006-02-21 05:34:39.000
Context
2006-02-22
05:38
no message check-in: 6884dda44b user: rmsimpson tags: sourceforge
2006-02-21
05:34
More designer updates check-in: 2be5482b8e user: rmsimpson tags: sourceforge
2006-02-20
06:01
Added ConnectionUIControl support check-in: d6023aefd0 user: rmsimpson tags: sourceforge
Changes
Unified Diff Ignore Whitespace Patch
Changes to SQLite.Designer/CtcComponents/PkgCmd.ctc.
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#define DIS_DEF DEFAULTDISABLED | DEFAULTINVISIBLE | DYNAMICVISIBILITY
#define OI_NOID guidOfficeIcon:msotcidNoIcon

CMDS_SECTION guidVSPackageBasedProviderPkg

    BUTTONS_BEGIN

        guidVSPackageBasedProviderCmdSet:cmdidCreateTable, Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "&Create Table";
        guidVSPackageBasedProviderCmdSet:cmdidAlterTable,  Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "&Alter Table";
        guidVSPackageBasedProviderCmdSet:cmdidDropTable,   Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "&Drop Table";
        guidVSPackageBasedProviderCmdSet:cmdidCreateIndex, Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "Create &Index";
        guidVSPackageBasedProviderCmdSet:cmdidDropIndex,   Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "Drop Inde&x";
        guidVSPackageBasedProviderCmdSet:cmdidDropView,    Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "Drop &View";
        guidVSPackageBasedProviderCmdSet:cmdidVacuum,      Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "&Vacuum";
        guidVSPackageBasedProviderCmdSet:cmdidRekey,       Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "Change &Password ...";

    BUTTONS_END

CMDS_END








|
|
|
|
|
|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#define DIS_DEF DEFAULTDISABLED | DEFAULTINVISIBLE | DYNAMICVISIBILITY
#define OI_NOID guidOfficeIcon:msotcidNoIcon

CMDS_SECTION guidVSPackageBasedProviderPkg

    BUTTONS_BEGIN

        guidVSPackageBasedProviderCmdSet:cmdidCreateTable, Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "New &Table";
        guidVSPackageBasedProviderCmdSet:cmdidAlterTable,  Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "&Edit";
        guidVSPackageBasedProviderCmdSet:cmdidDropTable,   Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "&Delete ...";
        guidVSPackageBasedProviderCmdSet:cmdidCreateIndex, Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "New &Index";
        guidVSPackageBasedProviderCmdSet:cmdidDropIndex,   Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "&Delete ...";
        guidVSPackageBasedProviderCmdSet:cmdidDropView,    Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "&Delete ...";
        guidVSPackageBasedProviderCmdSet:cmdidVacuum,      Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "&Vacuum";
        guidVSPackageBasedProviderCmdSet:cmdidRekey,       Group_Undefined:0, 0x0000, OI_NOID, BUTTON, DIS_DEF, "Change &Password ...";

    BUTTONS_END

CMDS_END

Changes to SQLite.Designer/SQLiteCommandHandler.cs.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26



27
28
29
30
31
32
33
34

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

62
63

64
65

66
67
68
69
70
71
72
namespace SQLite.Designer
{
  using System;
  using Microsoft.VisualStudio.Data;
  using System.Windows.Forms.Design;
  using Microsoft.VisualStudio.Shell.Interop;
  using Microsoft.VisualStudio;

  enum cmdid
  {
    CreateTable = 256,
    AlterTable = 257,
    DropTable = 258,
    CreateIndex = 259,
    DropIndex = 260,
    DropView = 261,
    Vacuum = 262,
    Rekey = 263,
  }

  internal sealed class SQLiteCommandHandler : DataViewCommandHandler
  {
    private static readonly Guid guidDataCmdSet = new Guid("501822E1-B5AF-11d0-B4DC-00A0C91506EF");
    private static readonly Guid guidSQLiteCmdSet = new Guid("814658EE-A28E-4b97-BC33-4B1BC81EBECB");
    private static readonly Guid guidIFCmdId = new Guid("{74d21311-2aee-11d1-8bfb-00a0c90f26f7}");




    public SQLiteCommandHandler()
    {
    }

    public override OleCommandStatus GetCommandStatus(int[] itemIds, OleCommand command, OleCommandTextType textType, OleCommandStatus status)
    {
      if (command.GroupGuid == guidSQLiteCmdSet)
      {

        switch ((cmdid)command.CommandId)
        {
          case cmdid.CreateTable:
          case cmdid.CreateIndex:
          case cmdid.DropView:
          case cmdid.Vacuum:
//          case cmdid.Rekey:
            status.Supported = true;
            status.Visible = true;
            status.Enabled = true;
            break;
          case cmdid.AlterTable:
          case cmdid.DropTable:
            status.Supported = true;
            status.Visible = true;
            status.Enabled = (SystemTableSelected == false);
            break;
          case cmdid.DropIndex:
            status.Supported = true;
            status.Visible = true;
            status.Enabled = (SystemIndexSelected == false);
            break;
          default:
            base.GetCommandStatus(itemIds, command, textType, status);
            break;
        }
      }

      else
      {

        base.GetCommandStatus(itemIds, command, textType, status);
      }

      return status;
    }

    private bool SystemTableSelected
    {
      get
      {










|
|
<
<
<
|










>
>
>






|
<
>



<
<

|





|


|
<
<
<
<
<





<
>
|
<
>
|
<
>







1
2
3
4
5
6
7
8
9
10
11
12



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

34
35
36
37


38
39
40
41
42
43
44
45
46
47
48





49
50
51
52
53

54
55

56
57

58
59
60
61
62
63
64
65
namespace SQLite.Designer
{
  using System;
  using Microsoft.VisualStudio.Data;
  using System.Windows.Forms.Design;
  using Microsoft.VisualStudio.Shell.Interop;
  using Microsoft.VisualStudio;

  enum cmdid
  {
    CreateTable = 0x3006,
    AlterTable = 0x3003,



    Delete = 17,
    Vacuum = 262,
    Rekey = 263,
  }

  internal sealed class SQLiteCommandHandler : DataViewCommandHandler
  {
    private static readonly Guid guidDataCmdSet = new Guid("501822E1-B5AF-11d0-B4DC-00A0C91506EF");
    private static readonly Guid guidSQLiteCmdSet = new Guid("814658EE-A28E-4b97-BC33-4B1BC81EBECB");
    private static readonly Guid guidIFCmdId = new Guid("{74d21311-2aee-11d1-8bfb-00a0c90f26f7}");

    // 5efc7975-14bc-11cf-9b2b-00aa00573819
    // 0x5efc7975, 0x14bc, 0x11cf, { 0x9b, 0x2b, 0x00, 0xaa, 0x00, 0x57, 0x38, 0x19 }

    public SQLiteCommandHandler()
    {
    }

    public override OleCommandStatus GetCommandStatus(int[] itemIds, OleCommand command, OleCommandTextType textType, OleCommandStatus status)
    {
      //if (command.GroupGuid == guidSQLiteCmdSet)

      //{
        switch ((cmdid)command.CommandId)
        {
          case cmdid.CreateTable:


          case cmdid.Vacuum:
          case cmdid.Rekey:
            status.Supported = true;
            status.Visible = true;
            status.Enabled = true;
            break;
          case cmdid.AlterTable:
          case cmdid.Delete:
            status.Supported = true;
            status.Visible = true;
            status.Enabled = (SystemTableSelected == false && SystemIndexSelected == false);





            break;
          default:
            base.GetCommandStatus(itemIds, command, textType, status);
            break;
        }

      //}
      //else

      //{
      //  base.GetCommandStatus(itemIds, command, textType, status);

      //}
      return status;
    }

    private bool SystemTableSelected
    {
      get
      {
116
117
118
119
120
121
122
123
124


125
126
127
128
129
130



131
132
133
134
135
136
137


138
139
140
141
142
143
144
145
146
147
148
149

150
151

152
153

154
155
156
157
158
159
160
    /// <summary>
    /// This method executes a specified command, potentially based
    /// on parameters passed in from the data view support XML.
    /// </summary>
    public override object ExecuteCommand(int itemId, OleCommand command, OleCommandExecutionOption executionOption, object arguments)
    {
      object returnValue = null;
      if (command.GroupGuid == guidSQLiteCmdSet)
      {


        switch ((cmdid)command.CommandId)
        {
          case cmdid.CreateTable:
            CreateTable();
            break;
          case cmdid.DropTable:



            DropSelectedTables();
            break;
          case cmdid.DropIndex:
            DropSelectedIndexes();
            break;
          case cmdid.DropView:
            DropSelectedViews();


            break;
          case cmdid.Vacuum:
            Vacuum();
            break;
          case cmdid.Rekey:
            ChangePassword();
            break;
          default:
            returnValue = base.ExecuteCommand(itemId, command, executionOption, arguments);
            break;
        }
      }

      else
      {

        returnValue = base.ExecuteCommand(itemId, command, executionOption, arguments);
      }

      return returnValue;
    }

    private void CreateTable()
    {
    }








|
|
>
>





|
>
>
>
|
|
|
|
|
|
|
>
>











<
>
|
<
>
|
<
>







109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148

149
150

151
152

153
154
155
156
157
158
159
160
    /// <summary>
    /// This method executes a specified command, potentially based
    /// on parameters passed in from the data view support XML.
    /// </summary>
    public override object ExecuteCommand(int itemId, OleCommand command, OleCommandExecutionOption executionOption, object arguments)
    {
      object returnValue = null;
      object[] args = arguments as object[];

      //if (command.GroupGuid == guidSQLiteCmdSet)
      //{
        switch ((cmdid)command.CommandId)
        {
          case cmdid.CreateTable:
            CreateTable();
            break;
          case cmdid.Delete:
            switch((string)args[0])
            {
              case "Table":
                DropSelectedTables();
                break;
              case "Index":
                DropSelectedIndexes();
                break;
              case "View":
                DropSelectedViews();
                break;
            }
            break;
          case cmdid.Vacuum:
            Vacuum();
            break;
          case cmdid.Rekey:
            ChangePassword();
            break;
          default:
            returnValue = base.ExecuteCommand(itemId, command, executionOption, arguments);
            break;
        }

      //}
      //else

      //{
      //  returnValue = base.ExecuteCommand(itemId, command, executionOption, arguments);

      //}
      return returnValue;
    }

    private void CreateTable()
    {
    }

172
173
174
175
176
177
178

179
180
181
182
183
184
185
        if (System.Windows.Forms.MessageBox.Show(String.Format("Drop table {0} ({1}), are you sure?", parts[2], parts[0]), "Confirm delete", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
        {
          string sql = String.Format("DROP TABLE [{0}].[{1}]", parts[0], parts[2]);

          DataViewHierarchyAccessor.Connection.Command.ExecuteWithoutResults(sql, (int)System.Data.CommandType.Text, null, 0);
          DataViewHierarchyAccessor.DropObjectNode(items[n]);
        }

      }
    }

    private void DropSelectedViews()
    {
      int[] items = DataViewHierarchyAccessor.GetSelectedItems();
      int n;







>







172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
        if (System.Windows.Forms.MessageBox.Show(String.Format("Drop table {0} ({1}), are you sure?", parts[2], parts[0]), "Confirm delete", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
        {
          string sql = String.Format("DROP TABLE [{0}].[{1}]", parts[0], parts[2]);

          DataViewHierarchyAccessor.Connection.Command.ExecuteWithoutResults(sql, (int)System.Data.CommandType.Text, null, 0);
          DataViewHierarchyAccessor.DropObjectNode(items[n]);
        }
        else throw new OperationCanceledException();
      }
    }

    private void DropSelectedViews()
    {
      int[] items = DataViewHierarchyAccessor.GetSelectedItems();
      int n;
193
194
195
196
197
198
199

200
201
202
203
204
205
206
        if (System.Windows.Forms.MessageBox.Show(String.Format("Drop view {0} ({1}), are you sure?", parts[2], parts[0]), "Confirm delete", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
        {
          string sql = String.Format("DROP VIEW [{0}].[{1}]", parts[0], parts[2]);

          DataViewHierarchyAccessor.Connection.Command.ExecuteWithoutResults(sql, (int)System.Data.CommandType.Text, null, 0);
          DataViewHierarchyAccessor.DropObjectNode(items[n]);
        }

      }
    }

    private void DropSelectedIndexes()
    {
      int[] items = DataViewHierarchyAccessor.GetSelectedItems();
      int n;







>







194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
        if (System.Windows.Forms.MessageBox.Show(String.Format("Drop view {0} ({1}), are you sure?", parts[2], parts[0]), "Confirm delete", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
        {
          string sql = String.Format("DROP VIEW [{0}].[{1}]", parts[0], parts[2]);

          DataViewHierarchyAccessor.Connection.Command.ExecuteWithoutResults(sql, (int)System.Data.CommandType.Text, null, 0);
          DataViewHierarchyAccessor.DropObjectNode(items[n]);
        }
        else throw new OperationCanceledException();
      }
    }

    private void DropSelectedIndexes()
    {
      int[] items = DataViewHierarchyAccessor.GetSelectedItems();
      int n;
214
215
216
217
218
219
220

221
222
223
224
225
226
227
228
229
230


231
232
233
234
235
236
237
238
239
240
241
        if (System.Windows.Forms.MessageBox.Show(String.Format("Drop index {0} ({1}), are you sure?", parts[3], parts[0]), "Confirm delete", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
        {
          string sql = String.Format("DROP INDEX [{0}].[{1}]", parts[0], parts[3]);

          DataViewHierarchyAccessor.Connection.Command.ExecuteWithoutResults(sql, (int)System.Data.CommandType.Text, null, 0);
          DataViewHierarchyAccessor.DropObjectNode(items[n]);
        }

      }
    }

    private void Vacuum()
    {
      DataViewHierarchyAccessor.Connection.Command.ExecuteWithoutResults("VACUUM", (int)System.Data.CommandType.Text, null, 0);
    }

    private void ChangePassword()
    {      


    }

    private void Refresh(int itemId)
    {
      IVsUIHierarchy hier = DataViewHierarchyAccessor.Hierarchy as IVsUIHierarchy;

      Guid g = VSConstants.GUID_VSStandardCommandSet97;
      hier.ExecCommand((uint)itemId, ref g, (uint)0xbd, (uint)OleCommandExecutionOption.DoDefault, IntPtr.Zero, IntPtr.Zero);
    }
  }
}







>









|
>
>











216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
        if (System.Windows.Forms.MessageBox.Show(String.Format("Drop index {0} ({1}), are you sure?", parts[3], parts[0]), "Confirm delete", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
        {
          string sql = String.Format("DROP INDEX [{0}].[{1}]", parts[0], parts[3]);

          DataViewHierarchyAccessor.Connection.Command.ExecuteWithoutResults(sql, (int)System.Data.CommandType.Text, null, 0);
          DataViewHierarchyAccessor.DropObjectNode(items[n]);
        }
        else throw new OperationCanceledException();
      }
    }

    private void Vacuum()
    {
      DataViewHierarchyAccessor.Connection.Command.ExecuteWithoutResults("VACUUM", (int)System.Data.CommandType.Text, null, 0);
    }

    private void ChangePassword()
    {
      System.Data.SQLite.SQLiteConnection cnn = DataViewHierarchyAccessor.Connection.ConnectionSupport.ProviderObject as System.Data.SQLite.SQLiteConnection;
      if (cnn == null) return;
    }

    private void Refresh(int itemId)
    {
      IVsUIHierarchy hier = DataViewHierarchyAccessor.Hierarchy as IVsUIHierarchy;

      Guid g = VSConstants.GUID_VSStandardCommandSet97;
      hier.ExecCommand((uint)itemId, ref g, (uint)0xbd, (uint)OleCommandExecutionOption.DoDefault, IntPtr.Zero, IntPtr.Zero);
    }
  }
}
Changes to SQLite.Designer/SQLiteConnectionProperties.cs.
1
2
3
4
5
6
7
8
9
10
11
12

13
14
15




















16
17
18
19
20
21
22
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer
{
  using System;
  using Microsoft.VisualStudio.Data.AdoDotNet;
  using Microsoft.VisualStudio.Data;


  internal class SQLiteConnectionProperties : AdoDotNetConnectionProperties
  {




















    public SQLiteConnectionProperties() : base("System.Data.SQLite")
    {
    }

    public SQLiteConnectionProperties(string connectionString) : base("System.Data.SQLite", connectionString)
    {
    }












>



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer
{
  using System;
  using Microsoft.VisualStudio.Data.AdoDotNet;
  using Microsoft.VisualStudio.Data;
  using Microsoft.Win32;

  internal class SQLiteConnectionProperties : AdoDotNetConnectionProperties
  {
    static SQLiteConnectionProperties()
    {
      AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
    }

    static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
    {
      if (args.Name.StartsWith("System.Data.SQLite", StringComparison.InvariantCultureIgnoreCase))
      {
        using (RegistryKey key = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\.NETFramework\\v2.0.50727\\AssemblyFoldersEx\\SQLite"))
        {
          if (key != null)
          {
            return System.Reflection.Assembly.LoadFrom(System.IO.Path.Combine(key.GetValue(null).ToString(), "System.Data.SQLite.DLL"));
          }
        }
      }
      return null;
    }

    public SQLiteConnectionProperties() : base("System.Data.SQLite")
    {
    }

    public SQLiteConnectionProperties(string connectionString) : base("System.Data.SQLite", connectionString)
    {
    }
Changes to SQLite.Designer/SQLiteConnectionUIControl.cs.
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
28
29
  using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Text;
  using System.Windows.Forms;

  using Microsoft.Data.ConnectionUI;

  public partial class SQLiteConnectionUIControl : UserControl, IDataConnectionUIControl
  {
    private SQLiteConnectionProperties _connectionProperties;

    public SQLiteConnectionUIControl()
    {
      InitializeComponent();
    }

    private void browseButton_Click(object sender, EventArgs e)
    {







>
|

|

<
<







10
11
12
13
14
15
16
17
18
19
20
21


22
23
24
25
26
27
28
  using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Text;
  using System.Windows.Forms;
  using Microsoft.VisualStudio.Data;
  using Microsoft.Win32;

  public partial class SQLiteConnectionUIControl : DataConnectionUIControl
  {


    public SQLiteConnectionUIControl()
    {
      InitializeComponent();
    }

    private void browseButton_Click(object sender, EventArgs e)
    {
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
        fileTextBox.Text = dlg.FileName;
        fileTextBox_Leave(sender, e);
      }
    }

    #region IDataConnectionUIControl Members

    public void Initialize(IDataConnectionProperties connectionProperties)
    {
      _connectionProperties = (SQLiteConnectionProperties)connectionProperties;
    }

    public void LoadProperties()
    {
      fileTextBox.Text = _connectionProperties["Data Source"] as string;
      passwordTextBox.Text = _connectionProperties["Password"] as string;
    }

    #endregion

    private void passwordTextBox_Leave(object sender, EventArgs e)
    {
      _connectionProperties["Password"] = passwordTextBox.Text;
    }

    private void encoding_Changed(object sender, EventArgs e)
    {
      _connectionProperties["UseUTF16Encoding"] = utf16RadioButton.Checked;
    }

    private void datetime_Changed(object sender, EventArgs e)
    {
      _connectionProperties["DateTimeFormat"] = (iso8601RadioButton.Checked == true) ? "ISO8601" : "Ticks";
    }

    private void sync_Changed(object sender, EventArgs e)
    {
      string sync = "Normal";
      if (fullRadioButton.Checked == true) sync = "Full";
      else if (offRadioButton.Checked == true) sync = "Off";

      _connectionProperties["Synchronous"] = sync;
    }

    private void pageSizeTextBox_Leave(object sender, EventArgs e)
    {
      int n = Convert.ToInt32(pageSizeTextBox.Text);
      _connectionProperties["Page Size"] = n;
    }

    private void cacheSizeTextbox_Leave(object sender, EventArgs e)
    {
      int n = Convert.ToInt32(cacheSizeTextbox.Text);
      _connectionProperties["Cache Size"] = n;
    }

    private void fileTextBox_Leave(object sender, EventArgs e)
    {
      _connectionProperties["Data Source"] = fileTextBox.Text;
    }
  }
}







<
<
<
<
<
|

|
|






|




|




|








|





|





|




|



46
47
48
49
50
51
52





53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
        fileTextBox.Text = dlg.FileName;
        fileTextBox_Leave(sender, e);
      }
    }

    #region IDataConnectionUIControl Members






    public override void LoadProperties()
    {
      fileTextBox.Text = ConnectionProperties["Data Source"] as string;
      passwordTextBox.Text = ConnectionProperties["Password"] as string;
    }

    #endregion

    private void passwordTextBox_Leave(object sender, EventArgs e)
    {
      ConnectionProperties["Password"] = passwordTextBox.Text;
    }

    private void encoding_Changed(object sender, EventArgs e)
    {
      ConnectionProperties["UseUTF16Encoding"] = utf16RadioButton.Checked;
    }

    private void datetime_Changed(object sender, EventArgs e)
    {
      ConnectionProperties["DateTimeFormat"] = (iso8601RadioButton.Checked == true) ? "ISO8601" : "Ticks";
    }

    private void sync_Changed(object sender, EventArgs e)
    {
      string sync = "Normal";
      if (fullRadioButton.Checked == true) sync = "Full";
      else if (offRadioButton.Checked == true) sync = "Off";

      ConnectionProperties["Synchronous"] = sync;
    }

    private void pageSizeTextBox_Leave(object sender, EventArgs e)
    {
      int n = Convert.ToInt32(pageSizeTextBox.Text);
      ConnectionProperties["Page Size"] = n;
    }

    private void cacheSizeTextbox_Leave(object sender, EventArgs e)
    {
      int n = Convert.ToInt32(cacheSizeTextbox.Text);
      ConnectionProperties["Cache Size"] = n;
    }

    private void fileTextBox_Leave(object sender, EventArgs e)
    {
      ConnectionProperties["Data Source"] = fileTextBox.Text;
    }
  }
}
Changes to SQLite.Designer/SQLiteDataConnectionSupport.cs.
9
10
11
12
13
14
15

16
17
18
19
20
21
22
{
  using System;
  using System.Collections.Generic;
  using System.Text;
  using Microsoft.VisualStudio.Data;
  using Microsoft.VisualStudio.OLE.Interop;
  using Microsoft.VisualStudio.Data.AdoDotNet;


  internal class SQLiteDataConnectionSupport : AdoDotNetConnectionSupport
  {
    private SQLiteDataViewSupport _dataViewSupport;
    private SQLiteDataObjectSupport _dataObjectSupport;
    private SQLiteDataObjectIdentifierResolver _dataObjectIdentifierResolver;








>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
  using System;
  using System.Collections.Generic;
  using System.Text;
  using Microsoft.VisualStudio.Data;
  using Microsoft.VisualStudio.OLE.Interop;
  using Microsoft.VisualStudio.Data.AdoDotNet;
  using Microsoft.Win32;

  internal class SQLiteDataConnectionSupport : AdoDotNetConnectionSupport
  {
    private SQLiteDataViewSupport _dataViewSupport;
    private SQLiteDataObjectSupport _dataObjectSupport;
    private SQLiteDataObjectIdentifierResolver _dataObjectIdentifierResolver;

Changes to SQLite.Designer/SQLiteDataViewSupport.xml.
15
16
17
18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
33
34
35
36
37
38
39
		<DataView name="SQLite">
      <DisplayName>SQLite</DisplayName>
			<!-- The connection node is static, i.e. has no underlying object -->
			<StaticConnectionNode>
				<!-- We can always specify data from the root object -->
				<InitialDisplayName>SQLite [{Root.Server}]</InitialDisplayName>
				<CommandBindings>
          <CommandBinding name="NewTable" guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="256" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
          <CommandBinding name="NewIndex" guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="259" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="Vacuum"   guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="262" handler="SQLite.Designer.SQLiteCommandHandler"/>

        </CommandBindings>
				<Children>
          
					<StaticNode nid="Tables">
            <DisplayName>Tables</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewTable" guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="256" handler="SQLite.Designer.SQLiteCommandHandler"/>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
						<Children>
              <Selection type="Table" filter="TYPE='TABLE'">
                <SelectionNode nid="Table">
                  <Children>
                    <SubHierarchyRef name="Table children"/>







|

<

>






|







15
16
17
18
19
20
21
22
23

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
		<DataView name="SQLite">
      <DisplayName>SQLite</DisplayName>
			<!-- The connection node is static, i.e. has no underlying object -->
			<StaticConnectionNode>
				<!-- We can always specify data from the root object -->
				<InitialDisplayName>SQLite [{Root.Server}]</InitialDisplayName>
				<CommandBindings>
          <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12294" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>

          <CommandBinding name="Vacuum"   guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="262" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="Rekey"    guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="263" handler="SQLite.Designer.SQLiteCommandHandler"/>
        </CommandBindings>
				<Children>
          
					<StaticNode nid="Tables">
            <DisplayName>Tables</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12294" handler="SQLite.Designer.SQLiteCommandHandler"/>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
						<Children>
              <Selection type="Table" filter="TYPE='TABLE'">
                <SelectionNode nid="Table">
                  <Children>
                    <SubHierarchyRef name="Table children"/>
131
132
133
134
135
136
137
138


139
140



141
142
143
144
145
146
147
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropTable" guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="258" handler="SQLite.Designer.SQLiteCommandHandler"/>


        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="Microsoft.VisualStudio.DataTools.DBPackage.VDT_OLEDB_CommandHandler_TableTools">
          <Parameter value="Open"/>



        </CommandBinding>
      </CommandBindings>
    </TypeExtension>
    
    <TypeExtension name="View">
      <Identifier>
        <Part name="Name">







|
>
>


>
>
>







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropTable" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="Microsoft.VisualStudio.DataTools.DBPackage.VDT_OLEDB_CommandHandler_TableTools">
          <Parameter value="Open"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>
    
    <TypeExtension name="View">
      <Identifier>
        <Part name="Name">
155
156
157
158
159
160
161
162


163
164
165
166
167
168
169
      <Properties>
        <Property name="IsUpdatable">
          <DisplayName>Updatable</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropView" guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="261" handler="SQLite.Designer.SQLiteCommandHandler"/>


      </CommandBindings>
    </TypeExtension>
    
    <TypeExtension name="ViewColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>







|
>
>







160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
      <Properties>
        <Property name="IsUpdatable">
          <DisplayName>Updatable</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropView" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="View"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>
    
    <TypeExtension name="ViewColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
211
212
213
214
215
216
217
218


219
220
221
222
223
224
225
        </Property>
        <Property name="IsPrimary">
          <DisplayName>Primary Key</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropIndex" guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="260" handler="SQLite.Designer.SQLiteCommandHandler"/>


      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="TableColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>







|
>
>







218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
        </Property>
        <Property name="IsPrimary">
          <DisplayName>Primary Key</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropIndex" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Index"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="TableColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
Changes to SQLite.Designer/SQLitePackage.cs.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer
{
  using System;
  using Microsoft.VisualStudio.Shell;
  using System.Runtime.InteropServices;
  using System.ComponentModel.Design;
  using Microsoft.Win32;
  using Microsoft.VisualStudio.Shell.Interop;

  [Guid("DCBE6C8D-0E57-4099-A183-98FF74C64D9C")]
  internal sealed class SQLitePackage : Package
  {
    public SQLitePackage()
    {













<







1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer
{
  using System;
  using Microsoft.VisualStudio.Shell;
  using System.Runtime.InteropServices;
  using System.ComponentModel.Design;

  using Microsoft.VisualStudio.Shell.Interop;

  [Guid("DCBE6C8D-0E57-4099-A183-98FF74C64D9C")]
  internal sealed class SQLitePackage : Package
  {
    public SQLitePackage()
    {
Changes to tools/install/InstallDesigner.cs.
48
49
50
51
52
53
54
55
56

57
58

59
60
61

62



63
64
65
66
67
68

69
70

71
72
73

74
75
76
77



78
79
80
81
82
83
84
            _assm = System.Reflection.Assembly.LoadFrom(_assmLocation);
          }
          catch
          {
          }
        }

        if (_assm == null)
        {

          try
          {

            _assmLocation = Path.GetFullPath("..\\x64\\System.Data.SQLite.DLL");
            _assm = System.Reflection.Assembly.LoadFrom(_assmLocation);
          }

          catch



          {
          }
        }

        if (_assm == null)
        {

          try
          {

            _assmLocation = Path.GetFullPath("..\\itanium\\System.Data.SQLite.DLL");
            _assm = System.Reflection.Assembly.LoadFrom(_assmLocation);
          }

          catch
          {
          }
        }




        OpenFileDialog dlg = new OpenFileDialog();
        while (_assm == null)
        {
          dlg.Multiselect = false;
          dlg.InitialDirectory = Environment.CurrentDirectory;
          dlg.FileName = "System.Data.SQLite.DLL";







|
<
>
|
<
>
|
|
<
>
|
>
>
>
|
<
<
<
|
<
>
|
<
>
|
|
<
>
|
<
<
<
>
>
>







48
49
50
51
52
53
54
55

56
57

58
59
60

61
62
63
64
65
66



67

68
69

70
71
72

73
74



75
76
77
78
79
80
81
82
83
84
            _assm = System.Reflection.Assembly.LoadFrom(_assmLocation);
          }
          catch
          {
          }
        }

        //if (_assm == null)

        //{
        //  try

        //  {
        //    _assmLocation = Path.GetFullPath("..\\x64\\System.Data.SQLite.DLL");
        //    _assm = System.Reflection.Assembly.LoadFrom(_assmLocation);

        //  }
        //  catch
        //  {
        //  }
        //}




        //if (_assm == null)

        //{
        //  try

        //  {
        //    _assmLocation = Path.GetFullPath("..\\itanium\\System.Data.SQLite.DLL");
        //    _assm = System.Reflection.Assembly.LoadFrom(_assmLocation);

        //  }
        //  catch



        //  {
        //  }
        //}

        OpenFileDialog dlg = new OpenFileDialog();
        while (_assm == null)
        {
          dlg.Multiselect = false;
          dlg.InitialDirectory = Environment.CurrentDirectory;
          dlg.FileName = "System.Data.SQLite.DLL";
153
154
155
156
157
158
159
160
161



162
163
164
165
166
167
168
169
170
171
172
173
174
175
        {
          ListViewItem item = new ListViewItem(itemName);

          item.Tag = subkeyname;

          using (RegistryKey subsubkey = subkey.OpenSubKey(String.Format("DataProviders\\{0}", (isChecked == null) ? lookFor.ToString("B") : ((Guid)isChecked).ToString("B"))))
          {
            if (subsubkey != null)
            {



              bool itemChecked = (subsubkey.GetValue(null) != null);
              DoInstallUninstall(item);
              item.Checked = itemChecked;
            }
            else
              DoInstallUninstall(item);
          }
          installList.Items.Add(item);
          if (item.Checked)
          {
            DoInstallUninstall(item);
          }
          return true;
        }







|

>
>
>
|
|
|
|
<
<
|







153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168


169
170
171
172
173
174
175
176
        {
          ListViewItem item = new ListViewItem(itemName);

          item.Tag = subkeyname;

          using (RegistryKey subsubkey = subkey.OpenSubKey(String.Format("DataProviders\\{0}", (isChecked == null) ? lookFor.ToString("B") : ((Guid)isChecked).ToString("B"))))
          {
            if (subkey == null)
            {
              DoInstallUninstall(item);
              throw new ArgumentNullException("Key doesn't exist");
            }
            bool itemChecked = (subsubkey.GetValue(null) != null);
            DoInstallUninstall(item);
            item.Checked = itemChecked;
          }



          installList.Items.Add(item);
          if (item.Checked)
          {
            DoInstallUninstall(item);
          }
          return true;
        }
231
232
233
234
235
236
237
238













239
240
241



242
243
244




245
246
247
248
249
250
251
252
      {
        if (installList.Items[n].Checked == true)
        {
          install = true;
          break;
        }
      }














      try
      {
        if (install && !installed)



        {
          AssemblyCache.InstallAssembly(_assmLocation, null, AssemblyCommitFlags.Default);
        }




        else if (!install && installed)
        {
          AssemblyCacheUninstallDisposition disp;

          AssemblyCacheEnum entries = new AssemblyCacheEnum("System.Data.SQLite");

          string s;
          while (true)








>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
<
>
>
>

<

>
>
>
>
|







232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254

255
256
257
258

259
260
261
262
263
264
265
266
267
268
269
270
271
      {
        if (installList.Items[n].Checked == true)
        {
          install = true;
          break;
        }
      }

      if (install)
      {
        string path = SQLite.ToString();

        path = Path.GetDirectoryName(_assmLocation);

        using (RegistryKey key = Registry.LocalMachine.CreateSubKey("Software\\Microsoft\\.NETFramework\\v2.0.50727\\AssemblyFoldersEx\\SQLite", RegistryKeyPermissionCheck.ReadWriteSubTree))
        {
          key.SetValue(null, path);
        }
      }
      else
      {
        try
        {

          Registry.LocalMachine.DeleteSubKey("Software\\Microsoft\\.NETFramework\\v2.0.50727\\AssemblyFoldersEx\\SQLite");
        }
        catch
        {

        }
      }

      try
      {
        if (installed)
        {
          AssemblyCacheUninstallDisposition disp;

          AssemblyCacheEnum entries = new AssemblyCacheEnum("System.Data.SQLite");

          string s;
          while (true)
351
352
353
354
355
356
357
358





359





360
361
362
363
364
365
366
          subkey.SetValue("CodeBase", Path.GetFullPath("SQLite.Designer.DLL"));
          
#if USEPACKAGE
           subkey.SetValue("FactoryService", "{DCBE6C8D-0E57-4099-A183-98FF74C64D9D}");
#endif
          using (RegistryKey subsubkey = subkey.CreateSubKey("SupportedObjects", RegistryKeyPermissionCheck.ReadWriteSubTree))
          {
            subsubkey.CreateSubKey("DataConnectionUIControl").Close();





            subsubkey.CreateSubKey("DataConnectionProperties").Close();





            subsubkey.CreateSubKey("DataObjectSupport").Close();
            subsubkey.CreateSubKey("DataViewSupport").Close();
            using (RegistryKey subsubsubkey = subsubkey.CreateSubKey("DataConnectionSupport", RegistryKeyPermissionCheck.ReadWriteSubTree))
            {
#if !USEPACKAGE
              subsubsubkey.SetValue(null, "SQLite.Designer.SQLiteDataConnectionSupport");
#endif







|
>
>
>
>
>
|
>
>
>
>
>







370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
          subkey.SetValue("CodeBase", Path.GetFullPath("SQLite.Designer.DLL"));
          
#if USEPACKAGE
           subkey.SetValue("FactoryService", "{DCBE6C8D-0E57-4099-A183-98FF74C64D9D}");
#endif
          using (RegistryKey subsubkey = subkey.CreateSubKey("SupportedObjects", RegistryKeyPermissionCheck.ReadWriteSubTree))
          {
            using (RegistryKey subsubsubkey = subsubkey.CreateSubKey("DataConnectionUIControl", RegistryKeyPermissionCheck.ReadWriteSubTree))
            {
#if !USEPACKAGE
              subsubsubkey.SetValue(null, "SQLite.Designer.SQLiteConnectionUIControl");
#endif
            }
            using (RegistryKey subsubsubkey = subsubkey.CreateSubKey("DataConnectionProperties", RegistryKeyPermissionCheck.ReadWriteSubTree))
            {
#if !USEPACKAGE
              subsubsubkey.SetValue(null, "SQLite.Designer.SQLiteConnectionProperties");
#endif
            }
            subsubkey.CreateSubKey("DataObjectSupport").Close();
            subsubkey.CreateSubKey("DataViewSupport").Close();
            using (RegistryKey subsubsubkey = subsubkey.CreateSubKey("DataConnectionSupport", RegistryKeyPermissionCheck.ReadWriteSubTree))
            {
#if !USEPACKAGE
              subsubsubkey.SetValue(null, "SQLite.Designer.SQLiteDataConnectionSupport");
#endif
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
            if (key != null)
            {
              using (RegistryKey subkey = key.CreateSubKey("SQLite", RegistryKeyPermissionCheck.ReadWriteSubTree))
              {
                subkey.SetValue(null, path);
              }
            }

          }
        }
      }

#if USEPACKAGE
      using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\8.0\\Packages", keyname), true))
      {







<







449
450
451
452
453
454
455

456
457
458
459
460
461
462
            if (key != null)
            {
              using (RegistryKey subkey = key.CreateSubKey("SQLite", RegistryKeyPermissionCheck.ReadWriteSubTree))
              {
                subkey.SetValue(null, path);
              }
            }

          }
        }
      }

#if USEPACKAGE
      using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\8.0\\Packages", keyname), true))
      {
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
        xmlNode.ParentNode.RemoveChild(xmlNode);

      xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/remove[@invariant=\"System.Data.SQLite\"]");
      if (xmlNode != null)
        xmlNode.ParentNode.RemoveChild(xmlNode);

      xmlDoc.Save(xmlFileName);

      // Remove any entries in the machine.config if they're still there
      xmlFileName = Environment.ExpandEnvironmentVariables("%WinDir%\\Microsoft.NET\\Framework\\v2.0.50727\\CONFIG\\machine.config");
      xmlDoc = new XmlDocument();
      xmlDoc.PreserveWhitespace = true;
      xmlDoc.Load(xmlFileName);

      xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/add[@invariant=\"System.Data.SQLite\"]");







|







615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
        xmlNode.ParentNode.RemoveChild(xmlNode);

      xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/remove[@invariant=\"System.Data.SQLite\"]");
      if (xmlNode != null)
        xmlNode.ParentNode.RemoveChild(xmlNode);

      xmlDoc.Save(xmlFileName);
      
      // Remove any entries in the machine.config if they're still there
      xmlFileName = Environment.ExpandEnvironmentVariables("%WinDir%\\Microsoft.NET\\Framework\\v2.0.50727\\CONFIG\\machine.config");
      xmlDoc = new XmlDocument();
      xmlDoc.PreserveWhitespace = true;
      xmlDoc.Load(xmlFileName);

      xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/add[@invariant=\"System.Data.SQLite\"]");