From: <kro...@us...> - 2010-11-13 16:23:03
|
Revision: 3929 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3929&view=rev Author: kroko_koenig Date: 2010-11-13 16:22:50 +0000 (Sat, 13 Nov 2010) Log Message: ----------- adding import (not finshed), bug fixes Modified Paths: -------------- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Bookmark.cs trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj.user trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.Designer.cs trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.cs trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.resx trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/todo.txt trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb.suo trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Skybound.Gecko.suo Added Paths: ----------- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/ImportIE.Designer.cs trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/ImportIE.cs trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/ImportIE.resx trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/SqlLite.cs trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/res/icon-48x48-mouse.png Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Bookmark.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Bookmark.cs 2010-11-12 08:40:45 UTC (rev 3928) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Bookmark.cs 2010-11-13 16:22:50 UTC (rev 3929) @@ -143,7 +143,7 @@ catch { } } - public static void AddSavedFolder(string Path) + public static void AddFolder(string Path, string FolderName) { if (!File.Exists(Path)) { @@ -163,7 +163,7 @@ { foreach (XmlNode one in r.ChildNodes) { - if (one.FirstChild.InnerText == "Saved by MP") found = true; + if (one.FirstChild.InnerText == FolderName) found = true; } } @@ -171,7 +171,7 @@ { XmlElement childElement = xmlDocument.CreateElement("Entry"); - XmlElement sub1 = xmlDocument.CreateElement("Name"); sub1.InnerText = "Saved by MP"; + XmlElement sub1 = xmlDocument.CreateElement("Name"); sub1.InnerText = FolderName; childElement.AppendChild(sub1); XmlElement sub2 = xmlDocument.CreateElement("URL"); sub2.InnerText = string.Empty; childElement.AppendChild(sub2); @@ -179,7 +179,7 @@ childElement.AppendChild(sub3); XmlElement sub4 = xmlDocument.CreateElement("LastVisited"); sub4.InnerText = "0001-01-01T00:00:00"; childElement.AppendChild(sub4); - XmlElement sub5 = xmlDocument.CreateElement("Created"); sub5.InnerText = "0001-01-01T00:00:00"; + XmlElement sub5 = xmlDocument.CreateElement("Created"); sub5.InnerText = DateTime.UtcNow.ToString("u", null); childElement.AppendChild(sub5); XmlElement sub6 = xmlDocument.CreateElement("isFolder"); sub6.InnerText = "true"; childElement.AppendChild(sub6); @@ -226,7 +226,7 @@ childElement.AppendChild(sub3); XmlElement sub4 = xmlDocument.CreateElement("LastVisited"); sub4.InnerText = "0001-01-01T00:00:00"; childElement.AppendChild(sub4); - XmlElement sub5 = xmlDocument.CreateElement("Created"); sub5.InnerText = "0001-01-01T00:00:00"; + XmlElement sub5 = xmlDocument.CreateElement("Created"); sub5.InnerText = DateTime.UtcNow.ToString("u", null); childElement.AppendChild(sub5); XmlElement sub6 = xmlDocument.CreateElement("isFolder"); sub6.InnerText = "false"; childElement.AppendChild(sub6); @@ -405,7 +405,7 @@ } public static void InitCachePath() { - if(!Directory.Exists(Config.GetFolder(MediaPortal.Configuration.Config.Dir.Cache) + "\\BrowseTheWeb")) + if (!Directory.Exists(Config.GetFolder(MediaPortal.Configuration.Config.Dir.Cache) + "\\BrowseTheWeb")) Directory.CreateDirectory(Config.GetFolder(MediaPortal.Configuration.Config.Dir.Cache) + "\\BrowseTheWeb"); } } Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj 2010-11-12 08:40:45 UTC (rev 3928) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj 2010-11-13 16:22:50 UTC (rev 3929) @@ -16,12 +16,13 @@ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> - <Optimize>false</Optimize> + <Optimize>true</Optimize> <OutputPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <UseVSHostingProcess>false</UseVSHostingProcess> + <PlatformTarget>x86</PlatformTarget> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> @@ -35,18 +36,22 @@ <Reference Include="Core, Version=1.1.1.11854, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Core.dll</HintPath> + <Private>False</Private> </Reference> <Reference Include="Dialogs, Version=1.1.1.11860, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\Dialogs.dll</HintPath> + <Private>False</Private> </Reference> <Reference Include="HtmlAgilityPack, Version=1.4.0.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\HtmlAgilityPack.dll</HintPath> + <Private>False</Private> </Reference> <Reference Include="Skybound.Gecko, Version=1.9.1.1, Culture=neutral, PublicKeyToken=3209ac31600d1857, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\Skybound.Gecko.dll</HintPath> + <Private>False</Private> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> @@ -57,6 +62,7 @@ <Reference Include="Utils, Version=2.2.7.11849, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Utils.dll</HintPath> + <Private>False</Private> </Reference> </ItemGroup> <ItemGroup> @@ -83,6 +89,12 @@ <Compile Include="GUIPlugin.cs" /> <Compile Include="HtmlInputType.cs" /> <Compile Include="HtmlLinkNumber.cs" /> + <Compile Include="ImportIE.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="ImportIE.Designer.cs"> + <DependentUpon>ImportIE.cs</DependentUpon> + </Compile> <Compile Include="Mouse.cs"> <SubType>UserControl</SubType> </Compile> @@ -108,6 +120,7 @@ <Compile Include="Setup.Designer.cs"> <DependentUpon>Setup.cs</DependentUpon> </Compile> + <Compile Include="SqlLite.cs" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="GetFolder.resx"> @@ -144,7 +157,11 @@ <Content Include="todo.txt" /> <EmbeddedResource Include="GetThumb.resx"> <DependentUpon>GetThumb.cs</DependentUpon> + <SubType>Designer</SubType> </EmbeddedResource> + <EmbeddedResource Include="ImportIE.resx"> + <DependentUpon>ImportIE.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="Mouse.resx"> <DependentUpon>Mouse.cs</DependentUpon> <SubType>Designer</SubType> Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj.user =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj.user 2010-11-12 08:40:45 UTC (rev 3928) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj.user 2010-11-13 16:22:50 UTC (rev 3929) @@ -1,7 +1,7 @@ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <StartAction>Program</StartAction> - <StartProgram>C:\Program Files\Team MediaPortal\MediaPortal\MediaPortal.exe</StartProgram> + <StartProgram>C:\Program Files\Team MediaPortal\MediaPortal\Mediaportal.exe</StartProgram> </PropertyGroup> <PropertyGroup> <ProjectView>ProjectFiles</ProjectView> Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs 2010-11-12 08:40:45 UTC (rev 3928) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs 2010-11-13 16:22:50 UTC (rev 3929) @@ -172,6 +172,7 @@ { Xpcom.Initialize(Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + "\\xulrunner"); + #region add forms webBrowser = new GeckoWebBrowser(); GUIGraphicsContext.form.Controls.Add(webBrowser); webBrowser.Visible = false; @@ -183,71 +184,84 @@ mouse = new Mouse(); GUIGraphicsContext.form.Controls.Add(mouse); mouse.Visible = false; + #endregion LoadSettings(); - Bookmark.AddSavedFolder(Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + "\\bookmarks.xml"); + Bookmark.AddFolder(Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + "\\bookmarks.xml", "Saved by MP"); return Load(GUIGraphicsContext.Skin + @"\BrowseTheWeb.xml"); } protected override void OnPageLoad() { - GUIPropertyManager.SetProperty("#btWeb.status", "Init browser"); - GUIPropertyManager.SetProperty("#btWeb.linkid", ""); - linkId = string.Empty; + try + { + MyLog.debug("Init browser"); - timer.Interval = 100; - timer.Tick += new EventHandler(timer_Tick); - timer.Start(); + GUIPropertyManager.SetProperty("#btWeb.status", "Init browser"); + GUIPropertyManager.SetProperty("#btWeb.linkid", ""); + linkId = string.Empty; - #region init browser - webBrowser.Visible = true; - webBrowser.Enabled = false; + #region init browser + webBrowser.Visible = true; + webBrowser.Enabled = false; - webBrowser.Dock = System.Windows.Forms.DockStyle.None; - webBrowser.Location = new System.Drawing.Point(0, 0); + webBrowser.Dock = System.Windows.Forms.DockStyle.None; + webBrowser.Location = new System.Drawing.Point(0, 0); - if (statusBar) - webBrowser.Size = new System.Drawing.Size(GUIGraphicsContext.form.Width, GUIGraphicsContext.form.Height - 100); - else - webBrowser.Size = new System.Drawing.Size(GUIGraphicsContext.form.Width, GUIGraphicsContext.form.Height); + if (statusBar) + webBrowser.Size = new System.Drawing.Size(GUIGraphicsContext.form.Width, GUIGraphicsContext.form.Height - 100); + else + webBrowser.Size = new System.Drawing.Size(GUIGraphicsContext.form.Width, GUIGraphicsContext.form.Height); - webBrowser.Window.TextZoom = font; - webBrowser.Zoom = zoom; + webBrowser.Window.TextZoom = font; + webBrowser.Zoom = zoom; - webBrowser.DocumentCompleted += new EventHandler(webBrowser_DocumentCompleted); - webBrowser.StatusTextChanged += new EventHandler(webBrowser_StatusTextChanged); + MyLog.debug("Create eventhandler"); - if (windowed) - { - MyLog.debug("switch to windowed fullscreen mode"); - GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SWITCH_FULL_WINDOWED, 0, 0, 0, 0, 0, null); - GUIWindowManager.SendMessage(msg); - } + webBrowser.DocumentCompleted += new EventHandler(webBrowser_DocumentCompleted); + webBrowser.StatusTextChanged += new EventHandler(webBrowser_StatusTextChanged); - string loadFav = StartupLink; + if (windowed) + { + MyLog.debug("switch to windowed fullscreen mode"); + GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SWITCH_FULL_WINDOWED, 0, 0, 0, 0, 0, null); + GUIWindowManager.SendMessage(msg); + } - if (webBrowser.Document.Domain == string.Empty) - { - if ((usehome) && (string.IsNullOrEmpty(loadFav))) + string loadFav = StartupLink; + + if (webBrowser.Document.Domain == string.Empty) { - webBrowser.Navigate(homepage); - MyLog.debug("load home page " + homepage); + if ((usehome) && (string.IsNullOrEmpty(loadFav))) + { + webBrowser.Navigate(homepage); + MyLog.debug("load home page " + homepage); + } } + + if (!string.IsNullOrEmpty(loadFav)) + { + webBrowser.Navigate(loadFav); + MyLog.debug("load favorite " + loadFav); + StartupLink = string.Empty; + } + + #endregion + + osd_linkID.Location = new System.Drawing.Point((GUIGraphicsContext.form.Width / 2) - (osd_linkID.Width / 2), + (GUIGraphicsContext.form.Height / 2) - (osd_linkID.Height / 2)); + + timer.Interval = 100; + timer.Tick += new EventHandler(timer_Tick); + timer.Start(); } - - if (!string.IsNullOrEmpty(loadFav)) + catch (Exception ex) { - webBrowser.Navigate(loadFav); - MyLog.debug("load favorite " + loadFav); - StartupLink = string.Empty; + MyLog.debug("Exception OnLoad : " + ex.Message); + MyLog.debug("Exception OnLoad : " + ex.StackTrace); } - #endregion - - osd_linkID.Location = new System.Drawing.Point((GUIGraphicsContext.form.Width / 2) - (osd_linkID.Width / 2), - (GUIGraphicsContext.form.Height / 2) - (osd_linkID.Height / 2)); - base.OnPageLoad(); } @@ -258,7 +272,7 @@ { usehome = xmlreader.GetValueAsBool("btWeb", "usehome", true); homepage = xmlreader.GetValueAsString("btWeb", "homepage", "http://team-mediaportal.com"); - remoteTime = xmlreader.GetValueAsInt("btWeb", "remote", 15); + remoteTime = xmlreader.GetValueAsInt("btWeb", "remotetime", 15); pluginName = xmlreader.GetValueAsString("btWeb", "name", "Browse Web"); blankBrowser = xmlreader.GetValueAsBool("btWeb", "blank", false); statusBar = xmlreader.GetValueAsBool("btWeb", "status", true); @@ -515,13 +529,13 @@ #region zoom & move case Action.ActionType.ACTION_ZOOM_IN: - case Action.ActionType.ACTION_PAGE_DOWN: + case Action.ActionType.ACTION_PAGE_UP: if (zoom < 2) zoom += 0.1f; webBrowser.Zoom = zoom; GUIPropertyManager.SetProperty("#btWeb.status", "Zoom set to " + (int)(zoom * 100)); break; case Action.ActionType.ACTION_ZOOM_OUT: - case Action.ActionType.ACTION_PAGE_UP: + case Action.ActionType.ACTION_PAGE_DOWN: if (zoom > 0.1f) zoom -= 0.1f; webBrowser.Zoom = zoom; GUIPropertyManager.SetProperty("#btWeb.status", "Zoom set to " + (int)(zoom * 100)); @@ -745,6 +759,10 @@ private void OnLinkId(string LinkId) { + linkId = string.Empty; + osd_linkID.Visible = false; + Application.DoEvents(); + HtmlLinkNumber hln = null; if (GetLinkById(Convert.ToInt32(LinkId), out hln)) { Added: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/ImportIE.Designer.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/ImportIE.Designer.cs (rev 0) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/ImportIE.Designer.cs 2010-11-13 16:22:50 UTC (rev 3929) @@ -0,0 +1,78 @@ +namespace BrowseTheWeb +{ + partial class ImportIE + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.listBox1 = new System.Windows.Forms.ListBox(); + this.btnClose = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // listBox1 + // + this.listBox1.FormattingEnabled = true; + this.listBox1.Location = new System.Drawing.Point(12, 22); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(502, 251); + this.listBox1.TabIndex = 0; + // + // btnClose + // + this.btnClose.Location = new System.Drawing.Point(12, 279); + this.btnClose.Name = "btnClose"; + this.btnClose.Size = new System.Drawing.Size(502, 31); + this.btnClose.TabIndex = 1; + this.btnClose.Text = "Close"; + this.btnClose.UseVisualStyleBackColor = true; + this.btnClose.Click += new System.EventHandler(this.btnClose_Click); + // + // ImportIE + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(526, 323); + this.Controls.Add(this.btnClose); + this.Controls.Add(this.listBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ImportIE"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Import Internet Explorer"; + this.Load += new System.EventHandler(this.ImportIE_Load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.Button btnClose; + } +} \ No newline at end of file Added: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/ImportIE.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/ImportIE.cs (rev 0) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/ImportIE.cs 2010-11-13 16:22:50 UTC (rev 3929) @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using System.IO; +using MediaPortal.Configuration; + +namespace BrowseTheWeb +{ + public partial class ImportIE : Form + { + public List<Bookmark> EntryList = new List<Bookmark>(); + + public ImportIE() + { + InitializeComponent(); + } + + private void btnClose_Click(object sender, EventArgs e) + { + this.Close(); + } + private void ImportIE_Load(object sender, EventArgs e) + { + string favPath = Environment.GetFolderPath(Environment.SpecialFolder.Favorites); + string[] favFiles; + + listBox1.Items.Add("Import folder is " + favPath); + listBox1.Items.Add("Reading folder"); + + if (Directory.Exists(favPath)) + { + string[] favDirs = Directory.GetDirectories(favPath); + listBox1.Items.Add("Found " + favDirs.Length.ToString() + " folder"); + + foreach (string folder in favDirs) + { + listBox1.Items.Add("Work on folder '" + Path.GetFileName(folder) + "'"); + + favFiles = Directory.GetFiles(folder, "*.url", SearchOption.TopDirectoryOnly); + listBox1.Items.Add(favFiles.Length.ToString() + " files to import"); + + foreach (string s in favFiles) + { + FileInfo f = new FileInfo(s); + string name = Path.GetFileNameWithoutExtension(f.Name); + + listBox1.Items.Add("Found '" + name + "'"); + string url = GetUrlFile(s); + + if (url != null) + { + Bookmark bkm = new Bookmark(); + bkm.Url = url; + bkm.Name = name; + + EntryList.Add(bkm); + } + } + } + + listBox1.Items.Add("Reading root folder"); + + favFiles = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.Favorites), "*.url", SearchOption.TopDirectoryOnly); + listBox1.Items.Add(favFiles.Length.ToString() + " files to import"); + + foreach (string s in favFiles) + { + FileInfo f = new FileInfo(s); + string name = Path.GetFileNameWithoutExtension(f.Name); + + listBox1.Items.Add("Found '" + name + "'"); + string url = GetUrlFile(s); + + if (url != null) + { + Bookmark bkm = new Bookmark(); + bkm.Url = url; + bkm.Name = name; + + EntryList.Add(bkm); + } + } + listBox1.Items.Add("Reading finished. Found " + EntryList.Count + " bookmarks"); + } + else + { + listBox1.Items.Add("Directory does not exist."); + } + } + + private string GetUrlFile(string File) + { + using (StreamReader sr = new StreamReader(File)) + { + while (!sr.EndOfStream) + { + string line = sr.ReadLine(); + if (line.StartsWith("URL=")) + return line.Substring(4); + } + } + return null; + } + } +} Added: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/ImportIE.resx =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/ImportIE.resx (rev 0) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/ImportIE.resx 2010-11-13 16:22:50 UTC (rev 3929) @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.Designer.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.Designer.cs 2010-11-12 08:40:45 UTC (rev 3928) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.Designer.cs 2010-11-13 16:22:50 UTC (rev 3929) @@ -49,6 +49,7 @@ this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.chkWindowed = new System.Windows.Forms.CheckBox(); this.chkOSD = new System.Windows.Forms.CheckBox(); this.chkStatus = new System.Windows.Forms.CheckBox(); this.chkBlank = new System.Windows.Forms.CheckBox(); @@ -73,6 +74,8 @@ this.txtZoom = new System.Windows.Forms.Label(); this.trkZoom = new System.Windows.Forms.TrackBar(); this.tabPage3 = new System.Windows.Forms.TabPage(); + this.btnImportFF = new System.Windows.Forms.Button(); + this.btnImportIE = new System.Windows.Forms.Button(); this.label7 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); @@ -89,7 +92,6 @@ this.comboBox1 = new System.Windows.Forms.ComboBox(); this.chkRemote = new System.Windows.Forms.CheckBox(); this.listBox1 = new System.Windows.Forms.ListBox(); - this.chkWindowed = new System.Windows.Forms.CheckBox(); this.contextMenuStrip1.SuspendLayout(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); @@ -298,6 +300,16 @@ this.groupBox5.TabStop = false; this.groupBox5.Text = "Other settings"; // + // chkWindowed + // + this.chkWindowed.AutoSize = true; + this.chkWindowed.Location = new System.Drawing.Point(19, 155); + this.chkWindowed.Name = "chkWindowed"; + this.chkWindowed.Size = new System.Drawing.Size(223, 20); + this.chkWindowed.TabIndex = 5; + this.chkWindowed.Text = "use windowed mode in fullscreen"; + this.chkWindowed.UseVisualStyleBackColor = true; + // // chkOSD // this.chkOSD.AutoSize = true; @@ -548,6 +560,8 @@ // tabPage3 // this.tabPage3.BackColor = System.Drawing.SystemColors.Control; + this.tabPage3.Controls.Add(this.btnImportFF); + this.tabPage3.Controls.Add(this.btnImportIE); this.tabPage3.Controls.Add(this.label7); this.tabPage3.Controls.Add(this.label4); this.tabPage3.Controls.Add(this.label3); @@ -561,6 +575,26 @@ this.tabPage3.TabIndex = 2; this.tabPage3.Text = "Bookmarks"; // + // btnImportFF + // + this.btnImportFF.Location = new System.Drawing.Point(87, 442); + this.btnImportFF.Name = "btnImportFF"; + this.btnImportFF.Size = new System.Drawing.Size(75, 23); + this.btnImportFF.TabIndex = 19; + this.btnImportFF.Text = "Import FF"; + this.btnImportFF.UseVisualStyleBackColor = true; + this.btnImportFF.Click += new System.EventHandler(this.btnImportFF_Click); + // + // btnImportIE + // + this.btnImportIE.Location = new System.Drawing.Point(6, 442); + this.btnImportIE.Name = "btnImportIE"; + this.btnImportIE.Size = new System.Drawing.Size(75, 23); + this.btnImportIE.TabIndex = 18; + this.btnImportIE.Text = "Import IE"; + this.btnImportIE.UseVisualStyleBackColor = true; + this.btnImportIE.Click += new System.EventHandler(this.btnImportIE_Click); + // // label7 // this.label7.AutoSize = true; @@ -724,16 +758,6 @@ this.listBox1.Size = new System.Drawing.Size(550, 372); this.listBox1.TabIndex = 0; // - // chkWindowed - // - this.chkWindowed.AutoSize = true; - this.chkWindowed.Location = new System.Drawing.Point(19, 155); - this.chkWindowed.Name = "chkWindowed"; - this.chkWindowed.Size = new System.Drawing.Size(223, 20); - this.chkWindowed.TabIndex = 5; - this.chkWindowed.Text = "use windowed mode in fullscreen"; - this.chkWindowed.UseVisualStyleBackColor = true; - // // Setup // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -845,5 +869,7 @@ private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.CheckBox chkWindowed; + private System.Windows.Forms.Button btnImportIE; + private System.Windows.Forms.Button btnImportFF; } } \ No newline at end of file Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.cs 2010-11-12 08:40:45 UTC (rev 3928) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.cs 2010-11-13 16:22:50 UTC (rev 3929) @@ -1,4 +1,4 @@ -#region Copyright (C) 2005-2010 Team MediaPortal +#region Copyright (C) 2005-2010 Team MediaPortal /* * Copyright (C) 2005-2010 Team MediaPortal @@ -464,6 +464,7 @@ addBkm.Name = get.SelectedName; addBkm.Url = get.SelectedUrl; addBkm.isSubFolder = true; + addBkm.Created = DateTime.Now; add.Tag = addBkm; node.ExpandAll(); @@ -475,6 +476,7 @@ Bookmark addBkm = new Bookmark(); addBkm.Name = get.SelectedName; addBkm.Url = get.SelectedUrl; + addBkm.Created = DateTime.Now; add.Tag = addBkm; node.Parent.ExpandAll(); @@ -487,6 +489,7 @@ Bookmark addBkm = new Bookmark(); addBkm.Name = get.SelectedName; addBkm.Url = get.SelectedUrl; + addBkm.Created = DateTime.Now; add.Tag = addBkm; treeView1.Nodes[0].ExpandAll(); @@ -597,7 +600,7 @@ { chkHome.Checked = xmlreader.GetValueAsBool("btWeb", "usehome", true); txtHome.Text = xmlreader.GetValueAsString("btWeb", "homepage", "http://team-mediaportal.com"); - trkRemote.Value = xmlreader.GetValueAsInt("btWeb", "remote", 25); + trkRemote.Value = xmlreader.GetValueAsInt("btWeb", "remotetime", 25); txtName.Text = xmlreader.GetValueAsString("btWeb", "name", "Browse Web"); chkBlank.Checked = xmlreader.GetValueAsBool("btWeb", "blank", false); chkStatus.Checked = xmlreader.GetValueAsBool("btWeb", "status", false); @@ -629,7 +632,7 @@ { xmlwriter.SetValueAsBool("btWeb", "usehome", chkHome.Checked); xmlwriter.SetValue("btWeb", "homepage", txtHome.Text); - xmlwriter.SetValue("btWeb", "remote", trkRemote.Value); + xmlwriter.SetValue("btWeb", "remotetime", trkRemote.Value); xmlwriter.SetValue("btWeb", "name", txtName.Text); xmlwriter.SetValueAsBool("btWeb", "blank", chkBlank.Checked); xmlwriter.SetValueAsBool("btWeb", "status", chkStatus.Checked); @@ -720,5 +723,97 @@ { TrySetProxy(); } + + private void btnImportIE_Click(object sender, EventArgs e) + { + if (!Bookmark.Exists(treeView1, "Import IE")) + { + TreeNode newNode = treeView1.Nodes[0].Nodes.Add("Import IE"); + newNode.ImageIndex = 1; + newNode.SelectedImageIndex = 1; + + Bookmark bkm = new Bookmark(); + bkm.Name = "Import IE"; + bkm.isFolder = true; + newNode.Tag = bkm; + + treeView1.Nodes[0].ExpandAll(); + } + + ImportIE import = new ImportIE(); + import.ShowDialog(); + + int max = import.EntryList.Count; + int imported = 0; + + TreeNode node = null; + foreach (TreeNode n in treeView1.Nodes[0].Nodes) + { + if (n.Text == "Import IE") + { + node = n; + break; + } + } + + if (node != null) + { + foreach (Bookmark bkm in import.EntryList) + { + if (!Bookmark.Exists(treeView1, bkm.Name)) + { + if (!Bookmark.isValidUrl(bkm.Url)) + { + DialogResult res = MessageBox.Show("The url seems not to be valid !\nContinue anyway ?", "Error home page address", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + //if (res != DialogResult.Yes) break; + } + + if (chkUseThumbs.Checked) + { + GetThumb thumb = new GetThumb(); + thumb.SelectedUrl = bkm.Url; + thumb.ShowDialog(); + } + + TreeNode add = node.Nodes.Add(bkm.Url, bkm.Name); + + Bookmark addBkm = new Bookmark(); + addBkm.Name = bkm.Name; + addBkm.Url = bkm.Url; + addBkm.isSubFolder = true; + add.Tag = addBkm; + + node.ExpandAll(); + + } + } + } + } + private void btnImportFF_Click(object sender, EventArgs e) + { + SQLite db = new SQLite(); + + string path = @"C:\Users\mka\AppData\Roaming\Mozilla\Firefox\Profiles\wyhhe7f5.default\places.sqlite"; + + db.OpenDatabase(path); + //db.OpenDatabase(path);"Data Source=" + path + ";Version=3;New=True;Compress=True;" + + //DataTable table = db.ExecuteQuery("select * from moz_places"); + DataTable table = db.ExecuteQuery("SELECT moz_bookmarks.title,moz_places.url,moz_bookmarks.type FROM moz_bookmarks LEFT JOIN moz_places " + + "WHERE moz_bookmarks.fk = moz_places.id AND moz_bookmarks.title != 'null' AND moz_places.url LIKE '%http%';"); + + + foreach (DataRow row in table.Rows) + { + string t = Convert.ToString(row["title"]); + string u = Convert.ToString(row["url"]); + + System.Diagnostics.Debug.WriteLine("--------"); + System.Diagnostics.Debug.WriteLine(t); + System.Diagnostics.Debug.WriteLine(u); + } + + db.CloseDatabase(); + } } } Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.resx =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.resx 2010-11-12 08:40:45 UTC (rev 3928) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.resx 2010-11-13 16:22:50 UTC (rev 3929) @@ -124,52 +124,51 @@ <value> AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 - ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABM - CgAAAk1TRnQBSQFMAgEBAwEAAfABAAHwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo - AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA - AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 - AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA - AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZ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AERGF0YQcCAgAAAAkDAAAADwMAAABK + CgAAAk1TRnQBSQFMAgEBAwIAAQEBAAEBARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA + AUADAAEQAwABAQEAAQgGAAEEGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA + AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA + AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm + AwABmQMAAcwCAAEzAwACMwIAATMBZgIAATMBmQIAATMBzAIAATMB/wIAAWYDAAFmATMCAAJmAgABZgGZ + AgABZgHMAgABZgH/AgABmQMAAZkBMwIAAZkBZgIAApkCAAGZAcwCAAGZAf8CAAHMAwABzAEzAgABzAFm + AgABzAGZAgACzAIAAcwB/wIAAf8BZgIAAf8BmQIAAf8BzAEAATMB/wIAAf8BAAEzAQABMwEAAWYBAAEz + AQABmQEAATMBAAHMAQABMwEAAf8BAAH/ATMCAAMzAQACMwFmAQACMwGZAQACMwHMAQACMwH/AQABMwFm + AgABMwFmATMBAAEzAmYBAAEzAWYBmQEAATMBZgHMAQABMwFmAf8BAAEzAZkCAAEzAZkBMwEAATMBmQFm + AQABMwKZAQABMwGZAcwBAAEzAZkB/wEAATMBzAIAATMBzAEzAQABMwHMAWYBAAEzAcwBmQEAATMCzAEA + ATMBzAH/AQABMwH/ATMBAAEzAf8BZgEAATMB/wGZAQABMwH/AcwBAAEzAv8BAAFmAwABZgEAATMBAAFm + AQABZgEAAWYBAAGZAQABZgEAAcwBAAFmAQAB/wEAAWYBMwIAAWYCMwEAAWYBMwFmAQABZgEzAZkBAAFm + ATMBzAEAAWYBMwH/AQACZgIAAmYBMwEAA2YBAAJmAZkBAAJmAcwBAAFmAZkCAAFmAZkBMwEAAWYBmQFm + AQABZgKZAQABZgGZ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jEDKgHzGwABdAExARtWAAFCAU0BPgcA + AT4DAAEoAwABQAMAARADAAEBAQABAQUAAYAXAAP/AQAB5wHzAv8B8wHnAgABwAEBAeAB/wHgAYMCAAHA + AQEBwAEfAeABAwIAAcABAQHAAQMB4AEDAgABwAEDAcABAwHwAQcCAAHAAQMBwAEBAfABBwIAAcABAwHA + AQEBwAEDAgABwAEDAcABAQHAAQECAAHAAQMBgAEAAYADAAHAAQMBgAEAAYADAAHAAQMBgAEAAcABAQIA + AcABAwGAAQAB+AEfAgABwAEDAYABBwH8AR8CAAHgAQcB4QH/AfwBPwIAAfgBDwL/Af4BPwIABv8CAAs= </value> </data> <metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> Added: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/SqlLite.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/SqlLite.cs (rev 0) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/SqlLite.cs 2010-11-13 16:22:50 UTC (rev 3929) @@ -0,0 +1,191 @@ +using System; +using System.Data; +using System.Runtime.InteropServices; + +namespace BrowseTheWeb +{ + public class SQLiteException : Exception + { + public SQLiteException(string message) : + base(message) + { + + } + } + + public class SQLite + { + const int SQLITE_OK = 0; + const int SQLITE_ROW = 100; + const int SQLITE_DONE = 101; + const int SQLITE_INTEGER = 1; + const int SQLITE_FLOAT = 2; + const int SQLITE_TEXT = 3; + const int SQLITE_BLOB = 4; + const int SQLITE_NULL = 5; + + //const string path = @"C:\Program Files\Team MediaPortal\MediaPortal\Plugins\Windows\"; + const string path = ""; + + [DllImport(path + "sqlite3.dll", EntryPoint = "sqlite3_open")] + static extern int sqlite3_open(string filename, out IntPtr db); + + [DllImport(path + "sqlite3.dll", EntryPoint = "sqlite3_close")] + static extern int sqlite3_close(IntPtr db); + + [DllImport(path + "sqlite3.dll", EntryPoint = "sqlite3_prepare_v2")] + static extern int sqlite3_prepare_v2(IntPtr db, string zSql, + int nByte, out IntPtr ppStmpt, IntPtr pzTail); + + [DllImport(path + "sqlite3.dll", EntryPoint = "sqlite3_step")] + static extern int sqlite3_step(IntPtr stmHandle); + + [DllImport(path + "sqlite3.dll", EntryPoint = "sqlite3_finalize")] + static extern int sqlite3_finalize(IntPtr stmHandle); + + [DllImport(path + "sqlite3.dll", EntryPoint = "sqlite3_errmsg")] + static extern string sqlite3_errmsg(IntPtr db); + + [DllImport(path + "sqlite3.dll", EntryPoint = "sqlite3_column_count")] + static extern int sqlite3_column_count(IntPtr stmHandle); + + [DllImport(path + "sqlite3.dll", EntryPoint = "sqlite3_column_origin_name")] + static extern string sqlite3_column_origin_name( + IntPtr stmHandle, int iCol); + + [DllImport(path + "sqlite3.dll", EntryPoint = "sqlite3_column_type")] + static extern int sqlite3_column_type(IntPtr stmHandle, int iCol); + + [DllImport(path + "sqlite3.dll", EntryPoint = "sqlite3_column_int")] + static extern int sqlite3_column_int(IntPtr stmHandle, int iCol); + + [DllImport(path + "sqlite3.dll", EntryPoint = "sqlite3_column_text")] + static extern string sqlite3_column_text(IntPtr stmHandle, int iCol); + + [DllImport(path + "sqlite3.dll", EntryPoint = "sqlite3_column_double")] + static extern double sqlite3_column_double(IntPtr stmHandle, int iCol); + + private IntPtr _db; //pointer to SQLite database + private bool _open; //whether or not the database is open + + /// <summary> + /// Opens or creates SQLite database with the specified path + /// </summary> + /// <param name="path">Path to SQLite database</param> + public void OpenDatabase(string path) + { + if (sqlite3_open(path, out _db) != SQLITE_OK) + throw new SQLiteException("Could not open database file: " + path); + + _open = true; + } + + /// <summary> + /// Closes the SQLite database + /// </summary> + public void CloseDatabase() + { + if (_open) + sqlite3_close(_db); + + _open = false; + } + + /// <summary> + /// Executes a query that returns no results + /// </summary> + /// <param name="query">SQL query to execute</param> + public void ExecuteNonQuery(string query) + { + if (!_open) + throw new SQLiteException("SQLite database is not open."); + + //prepare the statement + IntPtr stmHandle = Prepare(query); + + if (sqlite3_step(stmHandle) != SQLITE_DONE) + throw new SQLiteException("Could not execute SQL statement."); + + Finalize(stmHandle); + } + + /// <summary> + /// Executes a query and stores the results in + /// a DataTable + /// </summary> + /// <param name="query">SQL query to execute</param> + /// <returns>DataTable of results</returns> + public DataTable ExecuteQuery(string query) + { + if (!_open) + throw new SQLiteException("SQLite database is not open."); + + //prepare the statement + IntPtr stmHandle = Prepare(query); + + //get the number of returned columns + int columnCount = sqlite3_column_count(stmHandle); + + //create datatable and columns + DataTable dTable = new DataTable(); + for (int i = 0; i < columnCount; i++) + dTable.Columns.Add(sqlite3_column_origin_name(stmHandle, i)); + + //populate datatable + while (sqlite3_step(stmHandle) == SQLITE_ROW) + { + object[] row = new object[columnCount]; + for (int i = 0; i < columnCount; i++) + { + switch (sqlite3_column_type(stmHandle, i)) + { + case SQLITE_INTEGER: + row[i] = sqlite3_column_int(stmHandle, i); + break; + case SQLITE_TEXT: + row[i] = sqlite3_column_text(stmHandle, i); + break; + case SQLITE_FLOAT: + row[i] = sqlite3_column_double(stmHandle, i); + break; + } + } + + dTable.Rows.Add(row); + } + + Finalize(stmHandle); + + return dTable; + } + + /// <summary> + /// Prepares a SQL statement for execution + /// </summary> + /// <param name="query">SQL query</param> + /// <returns>Pointer to SQLite prepared statement</returns> + private IntPtr Prepare(string query) + { + IntPtr stmHandle; + + if (sqlite3_prepare_v2(_db, query, query.Length, + out stmHandle, IntPtr.Zero) != SQLITE_OK) + throw new SQLiteException(sqlite3_errmsg(_db)); + + return stmHandle; + } + + /// <summary> + /// Finalizes a SQLite statement + /// </summary> + /// <param name="stmHandle"> + /// Pointer to SQLite prepared statement + /// </param> + private void Finalize(IntPtr stmHandle) + { + if (sqlite3_finalize(stmHandle) != SQLITE_OK) + throw new SQLiteException("Could not finalize SQL statement."); + } + } +} + Added: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/res/icon-48x48-mouse.png =================================================================== (Binary files differ) Property changes on: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/res/icon-48x48-mouse.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/todo.txt =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/todo.txt 2010-11-12 08:40:45 UTC (rev 3928) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/todo.txt 2010-11-13 16:22:50 UTC (rev 3929) @@ -7,9 +7,13 @@ bookmark add / edit can be set even url is not valid Ready for Info Service, Thanks to SilentExeption +V0.2.1 extract xulrunner first in setup +V0.2.2 add proxy support +V0.2.3 add force windowed mode + todo: nothing yet Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb.suo =================================================================== (Binary files differ) Modified: trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Skybound.Gecko.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |