|
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();
...
[truncated message content] |
|
From: <kro...@us...> - 2011-01-27 15:34:06
|
Revision: 4082
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4082&view=rev
Author: kroko_koenig
Date: 2011-01-27 15:34:00 +0000 (Thu, 27 Jan 2011)
Log Message:
-----------
change zip packer
Modified Paths:
--------------
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.cs
trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb.suo
trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Skybound.Gecko.suo
Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj 2011-01-27 08:09:30 UTC (rev 4081)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj 2011-01-27 15:34:00 UTC (rev 4082)
@@ -53,6 +53,11 @@
<HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\HtmlAgilityPack.dll</HintPath>
<Private>False</Private>
</Reference>
+ <Reference Include="Ionic.Zip, Version=1.7.2.18, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Ionic.Zip.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>
Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj.user
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj.user 2011-01-27 08:09:30 UTC (rev 4081)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj.user 2011-01-27 15:34:00 UTC (rev 4082)
@@ -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 2011-01-27 08:09:30 UTC (rev 4081)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs 2011-01-27 15:34:00 UTC (rev 4082)
@@ -1,7 +1,7 @@
-#region Copyright (C) 2005-2010 Team MediaPortal
+#region Copyright (C) 2005-2011 Team MediaPortal
/*
- * Copyright (C) 2005-2010 Team MediaPortal
+ * Copyright (C) 2005-2011 Team MediaPortal
* http://www.team-mediaportal.com
*
* This Program is free software; you can redistribute it and/or modify
@@ -175,7 +175,15 @@
public override bool Init()
{
- Xpcom.Initialize(Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + "\\xulrunner");
+ try
+ {
+ Xpcom.Initialize(Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + "\\xulrunner");
+ }
+ catch (Exception ex)
+ {
+ MyLog.debug("Could not find xulrunner under : " + Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + "\\xulrunner");
+ MyLog.debug("Reason : " + ex.Message);
+ }
#region add forms
webBrowser = new GeckoWebBrowser();
@@ -412,9 +420,18 @@
}
}
+ public override bool OnMessage(GUIMessage message)
+ {
+ Console.WriteLine("message :" + message.Label);
+ return base.OnMessage(message);
+ }
+
public override void OnAction(Action action)
{
- base.OnAction(action);
+ if (linkId != string.Empty)
+ GUIPropertyManager.SetProperty("#btWeb.linkid", "Link ID = " + linkId);
+ else
+ GUIPropertyManager.SetProperty("#btWeb.linkid", linkId);
#region remote diagnostic
if (remote)
@@ -540,45 +557,44 @@
case Action.ActionType.ACTION_PLAY:
case Action.ActionType.ACTION_MUSIC_PLAY:
OnEnterNewLink();
- break;
+ return;
case Action.ActionType.ACTION_PAUSE:
webBrowser.Navigate(homepage);
MyLog.debug("load home page " + homepage);
if (!remote) GUIPropertyManager.SetProperty("#btWeb.status", "go to homepage");
- break;
+ return;
case Action.ActionType.ACTION_STOP:
webBrowser.Navigate("about:blank");
if (!remote) GUIPropertyManager.SetProperty("#btWeb.status", "Stop");
- break;
+ return;
case Action.ActionType.ACTION_PREV_ITEM:
case Action.ActionType.ACTION_REWIND:
webBrowser.GoBack();
if (!remote) GUIPropertyManager.SetProperty("#btWeb.status", "go backward");
MyLog.debug("navigate go back");
- break;
+ return;
case Action.ActionType.ACTION_NEXT_ITEM:
case Action.ActionType.ACTION_FORWARD:
webBrowser.GoForward();
if (!remote) GUIPropertyManager.SetProperty("#btWeb.status", "go forward");
MyLog.debug("navigate go forward");
- break;
+ return;
case Action.ActionType.ACTION_RECORD:
OnAddBookmark();
- break;
+ return;
#region move
case Action.ActionType.ACTION_MOVE_RIGHT:
OnMoveRight();
- break;
+ return;
case Action.ActionType.ACTION_MOVE_LEFT:
OnMoveLeft();
- break;
+ return;
case Action.ActionType.ACTION_MOVE_UP:
OnMoveUp();
- break;
+ return;
case Action.ActionType.ACTION_MOVE_DOWN:
- OnMoveDown();
- break;
+ return;
case Action.ActionType.ACTION_SELECT_ITEM:
if (mouse.Visible)
{
@@ -587,16 +603,11 @@
int y = GUIGraphicsContext.form.Location.Y + mouse.Location.Y + 50;
System.Windows.Forms.Cursor.Position = new Point(x, y);
}
- break;
+ return;
#endregion
}
- if (linkId != string.Empty)
- GUIPropertyManager.SetProperty("#btWeb.linkid", "Link ID = " + linkId);
- else
- GUIPropertyManager.SetProperty("#btWeb.linkid", linkId);
+ }
-
- }
private void webBrowser_DomKeyDown(object sender, GeckoDomKeyEventArgs e)
{
if (useMouse)
@@ -945,6 +956,7 @@
}
#endregion
}
+
#region reset zoom
if (zoomPage)
{
Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.cs
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.cs 2011-01-27 08:09:30 UTC (rev 4081)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.cs 2011-01-27 15:34:00 UTC (rev 4082)
@@ -1,7 +1,7 @@
-#region Copyright (C) 2005-2010 Team MediaPortal
+#region Copyright (C) 2005-2011 Team MediaPortal
/*
- * Copyright (C) 2005-2010 Team MediaPortal
+ * Copyright (C) 2005-2011 Team MediaPortal
* http://www.team-mediaportal.com
*
* This Program is free software; you can redistribute it and/or modify
@@ -34,7 +34,10 @@
using System.IO;
using Skybound.Gecko;
+using Ionic.Zip;
+
using MediaPortal.Configuration;
+using MediaPortal.GUI.Library;
namespace BrowseTheWeb
{
@@ -56,33 +59,48 @@
InitializeComponent();
#region create xulrunner if needed
- string dir = Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + "\\xulrunner";
- string dirCache = Config.GetFolder(MediaPortal.Configuration.Config.Dir.Cache);
- try
+ string zipToUnpack = Config.GetFolder(MediaPortal.Configuration.Config.Dir.Cache) + "\\xulrunner.zip";
+ string unpackDirectory = Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config);
+
+ if (File.Exists(zipToUnpack))
{
- if (!Directory.Exists(dir))
+ Log.Debug("BrowseTheWeb | zip found : " + zipToUnpack, new object[0]);
+ try
{
- System.Diagnostics.ProcessStartInfo procStartInfo =
- new System.Diagnostics.ProcessStartInfo("cmd", "/c unzip.exe -o xulrunner -d ../");
- procStartInfo.WorkingDirectory = dirCache;
+ using (ZipFile zip1 = ZipFile.Read(zipToUnpack))
+ {
+ foreach (ZipEntry e in zip1)
+ {
+ e.Extract(unpackDirectory, true);
+ }
+ }
+ Log.Debug("BrowseTheWeb | unpack finished to " + unpackDirectory, new object[0]);
+ }
+ catch (Exception ex)
+ {
+ Log.Debug("BrowseTheWeb | Exception : " + ex.Message, new object[0]);
+ }
+ }
- procStartInfo.RedirectStandardOutput = true;
- procStartInfo.UseShellExecute = false;
+ #endregion
- procStartInfo.CreateNoWindow = true;
+ string plugins = Config.GetFolder(MediaPortal.Configuration.Config.Dir.Plugins);
- System.Diagnostics.Process proc = new System.Diagnostics.Process();
- proc.StartInfo = procStartInfo;
- proc.Start();
+ FileInfo info = new FileInfo(plugins + "\\Windows\\HtmlAgilityPack.dll");
+ Log.Debug("BrowseTheWeb | HtmlAgilityPack: " + info.CreationTime);
- string result = proc.StandardOutput.ReadToEnd();
- }
+ info = new FileInfo(plugins + "\\Windows\\Skybound.Gecko.dll.dll");
+ Log.Debug("BrowseTheWeb | Skybound.Gecko.dll: " + info.CreationTime);
+
+ try
+ {
+ Xpcom.Initialize(Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + "\\xulrunner");
}
- catch { }
- #endregion
-
- Xpcom.Initialize(Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + "\\xulrunner");
+ catch (Exception ex)
+ {
+ Log.Debug("BrowseTheWeb | Exception on init Xpcom : " + ex.Message, new object[0]);
+ }
}
private void Setup_Load(object sender, EventArgs e)
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.
|
|
From: <dos...@us...> - 2012-03-12 19:34:34
|
Revision: 4465
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4465&view=rev
Author: doskabouter
Date: 2012-03-12 19:34:28 +0000 (Mon, 12 Mar 2012)
Log Message:
-----------
deleted user-specific files
Removed Paths:
-------------
trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj.user
trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb.suo
trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Skybound.Gecko.csproj.user
trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Skybound.Gecko.suo
Deleted: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj.user
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj.user 2012-03-05 20:45:05 UTC (rev 4464)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj.user 2012-03-12 19:34:28 UTC (rev 4465)
@@ -1,9 +0,0 @@
-<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>
- </PropertyGroup>
- <PropertyGroup>
- <ProjectView>ProjectFiles</ProjectView>
- </PropertyGroup>
-</Project>
\ No newline at end of file
Deleted: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb.suo
===================================================================
(Binary files differ)
Deleted: trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Skybound.Gecko.csproj.user
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Skybound.Gecko.csproj.user 2012-03-05 20:45:05 UTC (rev 4464)
+++ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Skybound.Gecko.csproj.user 2012-03-12 19:34:28 UTC (rev 4465)
@@ -1,16 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <PublishUrlHistory>
- </PublishUrlHistory>
- <InstallUrlHistory>
- </InstallUrlHistory>
- <SupportUrlHistory>
- </SupportUrlHistory>
- <UpdateUrlHistory>
- </UpdateUrlHistory>
- <BootstrapperUrlHistory>
- </BootstrapperUrlHistory>
- <FallbackCulture>de-DE</FallbackCulture>
- <VerifyUploadedFiles>false</VerifyUploadedFiles>
- </PropertyGroup>
-</Project>
\ No newline at end of file
Deleted: 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.
|
|
From: <dos...@us...> - 2012-04-04 21:12:52
|
Revision: 4470
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4470&view=rev
Author: doskabouter
Date: 2012-04-04 21:12:44 +0000 (Wed, 04 Apr 2012)
Log Message:
-----------
- skybound.gecko now on 3.5 also
- rework of configuration settings
- added pageup/pagedown functionality
Modified Paths:
--------------
trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj
trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIBookmark.cs
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/Skybound.Gecko/Skybound.Gecko.csproj
Added Paths:
-----------
trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Settings.cs
Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj 2012-04-02 12:04:32 UTC (rev 4469)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj 2012-04-04 21:12:44 UTC (rev 4470)
@@ -145,6 +145,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
+ <Compile Include="Settings.cs" />
<Compile Include="Setup.cs">
<SubType>Form</SubType>
</Compile>
Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIBookmark.cs
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIBookmark.cs 2012-04-02 12:04:32 UTC (rev 4469)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIBookmark.cs 2012-04-04 21:12:44 UTC (rev 4470)
@@ -46,8 +46,6 @@
[SkinControlAttribute(3)]
protected GUISortButtonControl btnSortBy = null;
- private static string view = string.Empty;
-
public override int GetID
{
get
@@ -67,27 +65,10 @@
protected override void OnPageLoad()
{
- string dir = Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config);
-
- view = "Large icons";
- using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(dir + "\\MediaPortal.xml"))
- {
- view = xmlreader.GetValueAsString("btWeb", "bookmark", "Large icons");
- }
-
LoadFacade(Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + "\\bookmarks.xml", "");
Bookmark.InitCachePath();
base.OnPageLoad();
}
- protected override void OnPageDestroy(int new_windowId)
- {
- string dir = Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config);
- using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(dir + "\\MediaPortal.xml"))
- {
- xmlwriter.SetValue("btWeb", "bookmark", view);
- }
- base.OnPageDestroy(new_windowId);
- }
protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
{
if (actionType == MediaPortal.GUI.Library.Action.ActionType.ACTION_SELECT_ITEM)
@@ -112,32 +93,21 @@
if (control == btnViewAs)
{
- switch (view)
- {
- case "Small icons":
- view = "Large icons";
- break;
- case "Large icons":
- view = "List view";
- break;
- case "List view":
- view = "Small icons";
- break;
- }
+ Settings.Instance.View++;
+ if (Settings.Instance.View > GUIFacadeControl.Layout.LargeIcons)
+ Settings.Instance.View = GUIFacadeControl.Layout.List;
string strLine = string.Empty;
- switch (view)
+ facade.CurrentLayout = Settings.Instance.View;
+ switch (Settings.Instance.View)
{
- case "Small icons":
- facade.CurrentLayout = GUIFacadeControl.Layout.SmallIcons;
+ case GUIFacadeControl.Layout.SmallIcons:
strLine = GUILocalizeStrings.Get(100);
break;
- case "Large icons":
- facade.CurrentLayout = GUIFacadeControl.Layout.LargeIcons;
+ case GUIFacadeControl.Layout.LargeIcons:
strLine = GUILocalizeStrings.Get(417);
break;
- case "List view":
- facade.CurrentLayout = GUIFacadeControl.Layout.List;
+ case GUIFacadeControl.Layout.List:
strLine = GUILocalizeStrings.Get(101);
break;
}
@@ -147,18 +117,7 @@
public void LoadFacade(string Path, string Folder)
{
- switch (view)
- {
- case "Small icons":
- facade.CurrentLayout = GUIFacadeControl.Layout.SmallIcons;
- break;
- case "Large icons":
- facade.CurrentLayout = GUIFacadeControl.Layout.LargeIcons;
- break;
- case "List view":
- facade.CurrentLayout = GUIFacadeControl.Layout.List;
- break;
- }
+ facade.CurrentLayout = Settings.Instance.View;
facade.Clear();
GUIListItem item = new GUIListItem();
Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs 2012-04-02 12:04:32 UTC (rev 4469)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs 2012-04-04 21:12:44 UTC (rev 4470)
@@ -70,40 +70,15 @@
private int linkTime = 0;
private System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
- private bool usehome = false;
- private string homepage = string.Empty;
- private int remoteTime = 0;
- private string pluginName = "Browse Web";
- private bool blankBrowser = false;
- private bool statusBar = true;
- private bool osd = false;
- private bool windowed = false;
- private bool useMouse = false;
- private bool zoomPage = false;
- private bool zoomDomain = false;
private string lastDomain = string.Empty;
- private bool cacheThumbs = false;
- private bool remote = false;
- private string remote_confirm = string.Empty;
- private string remote_bookmark = string.Empty;
- private string remote_zoom_in = string.Empty;
- private string remote_zoom_out = string.Empty;
- private string remote_status = string.Empty;
-
- private bool useProxy = false;
- private string Server = string.Empty;
- private int Port = 8080;
-
- private float defaultZoom = 1.0f;
private float zoom = 1.0f;
- private float font = 1.0f;
+ private Settings settings = Settings.Instance;
public static bool ParameterSupported = false;
public static string Parameter = string.Empty;
public static string loadFav = string.Empty;
- private string lastUrl = string.Empty;
#endregion
@@ -127,7 +102,7 @@
}
public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
{
- strButtonText = pluginName;
+ strButtonText = settings.PluginName;
strButtonImage = String.Empty;
strButtonImageFocus = String.Empty;
strPictureImage = @"hover_browsetheweb.png";
@@ -201,7 +176,7 @@
}
#endregion
- LoadSettings();
+ TrySetProxy();
BookmarkXml.AddFolder(Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) +
"\\bookmarks.xml", "Saved by MP");
@@ -245,7 +220,7 @@
protected override void OnPageLoad()
{
- GUIPropertyManager.SetProperty("#currentmodule", pluginName);
+ GUIPropertyManager.SetProperty("#currentmodule", settings.PluginName);
try
{
@@ -255,7 +230,7 @@
GUIPropertyManager.SetProperty("#btWeb.linkid", "");
linkId = string.Empty;
- if (useMouse)
+ if (settings.UseMouse)
{
MyLog.debug("Mouse support is enabled");
GUIGraphicsContext.MouseSupport = true;
@@ -270,7 +245,7 @@
#region init browser
webBrowser.Visible = true;
- if (!useMouse) webBrowser.Enabled = false;
+ if (!settings.UseMouse) webBrowser.Enabled = false;
else webBrowser.Enabled = true;
webBrowser.Dock = System.Windows.Forms.DockStyle.None;
@@ -285,17 +260,17 @@
webBrowser.DomKeyDown += new GeckoDomKeyEventHandler(webBrowser_DomKeyDown);
webBrowser.DomClick += new GeckoDomEventHandler(webBrowser_DomClick);
- if (statusBar)
+ if (settings.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);
- MyLog.debug("set zoom size to " + font + "/" + zoom);
+ MyLog.debug("set zoom size to " + settings.FontZoom + "/" + zoom);
- webBrowser.Window.TextZoom = font;
+ webBrowser.Window.TextZoom = settings.FontZoom;
webBrowser.Zoom = zoom;
- if (windowed)
+ if (settings.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);
@@ -306,10 +281,10 @@
if (webBrowser.Document.Domain == string.Empty)
{
- if ((usehome) && (string.IsNullOrEmpty(loadFav)))
+ if ((settings.UseHome) && (string.IsNullOrEmpty(loadFav)))
{
- webBrowser.Navigate(homepage);
- MyLog.debug("load home page " + homepage);
+ webBrowser.Navigate(settings.HomePage);
+ MyLog.debug("load home page " + settings.HomePage);
}
}
@@ -329,7 +304,7 @@
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
- if (useMouse)
+ if (settings.UseMouse)
GUIGraphicsContext.form.Controls["BrowseTheWeb"].Select();
}
catch (Exception ex)
@@ -345,12 +320,13 @@
{
if (new_windowId != 54537688)
{ // not if you got favs
- if (blankBrowser)
+ if (settings.BlankBrowser)
{
webBrowser.Navigate("about:blank");
MyLog.debug("blank on destroy");
}
}
+ settings.SaveToXml(false);
webBrowser.Visible = false;
GUIGraphicsContext.form.Focus();
@@ -367,64 +343,16 @@
base.OnPageDestroy(new_windowId);
}
- private void LoadSettings()
- {
- string dir = Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config);
- using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(dir + "\\MediaPortal.xml"))
- {
- usehome = xmlreader.GetValueAsBool("btWeb", "usehome", true);
- homepage = xmlreader.GetValueAsString("btWeb", "homepage", "http://team-mediaportal.com");
- 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);
- osd = xmlreader.GetValueAsBool("btWeb", "osd", true);
- windowed = xmlreader.GetValueAsBool("btWeb", "window", false);
- useMouse = xmlreader.GetValueAsBool("btWeb", "mouse", false);
-
- defaultZoom = (float)xmlreader.GetValueAsInt("btWeb", "zoom", 100) / 100;
- zoom = defaultZoom;
- font = (float)xmlreader.GetValueAsInt("btWeb", "font", 100) / 100;
- zoomPage = xmlreader.GetValueAsBool("btWeb", "page", true);
- zoomDomain = xmlreader.GetValueAsBool("btWeb", "domain", false);
-
- cacheThumbs = xmlreader.GetValueAsBool("btWeb", "cachethumbs", false);
-
- remote = xmlreader.GetValueAsBool("btWeb", "remote", false);
-
- remote_confirm = xmlreader.GetValueAsString("btWeb", "key_1", "ACTION_SELECT_ITEM");
- remote_bookmark = xmlreader.GetValueAsString("btWeb", "key_2", "ACTION_SHOW_INFO");
- remote_zoom_in = xmlreader.GetValueAsString("btWeb", "key_3", "ACTION_PAGE_DOWN");
- remote_zoom_out = xmlreader.GetValueAsString("btWeb", "key_4", "ACTION_PAGE_UP");
- remote_status = xmlreader.GetValueAsString("btWeb", "key_5", "ACTION_SHOW_GUI");
-
- lastUrl = xmlreader.GetValueAsString("btWeb", "lastUrl", string.Empty);
-
- useProxy = xmlreader.GetValueAsBool("btWeb", "proxy", false);
- Server = xmlreader.GetValueAsString("btWeb", "proxy_server", "127.0.0.1");
- Port = xmlreader.GetValueAsInt("btWeb", "proxy_port", 8888);
- TrySetProxy();
- }
- }
- private void SaveSettings()
- {
- string dir = Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config);
- using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(dir + "\\MediaPortal.xml"))
- {
- xmlwriter.SetValue("btWeb", "lastUrl", lastUrl);
- }
- }
-
private void TrySetProxy()
{
try
{
- if (useProxy)
+ if (settings.UseProxy)
MyLog.debug("use proxy settings");
else
MyLog.debug("no proxy selected");
- SetProxy(Server, Port, useProxy);
+ SetProxy(settings.Server, settings.Port, settings.UseProxy);
}
catch (Exception ex)
{
@@ -446,12 +374,12 @@
private void timer_Tick(object sender, EventArgs e)
{
- if (useMouse)
+ if (settings.UseMouse)
Cursor.Show();
if (linkId != string.Empty)
{
- if (osd)
+ if (settings.OSD)
{
osd_linkID.Visible = true;
osd_linkID.BringToFront();
@@ -464,7 +392,7 @@
osd_linkID.Visible = false;
}
- if (linkTime > remoteTime)
+ if (linkTime > settings.RemoteTime)
{
linkId = string.Empty;
linkTime = 0;
@@ -487,7 +415,7 @@
GUIPropertyManager.SetProperty("#btWeb.linkid", linkId);
#region remote diagnostic
- if (remote)
+ if (settings.Remote)
{
if (action.wID != MediaPortal.GUI.Library.Action.ActionType.ACTION_KEY_PRESSED)
GUIPropertyManager.SetProperty("#btWeb.status", DateTime.Now.ToLongTimeString() + " : " +
@@ -498,13 +426,12 @@
}
#endregion
- string strAction = action.wID.ToString();
#region selectable buttons
- if (strAction == remote_confirm)
+ if (action.wID == settings.Remote_Confirm)
{
if (!mouse.Visible)
{
- if (!useMouse)
+ if (!settings.UseMouse)
{
if (linkId != string.Empty)
@@ -538,29 +465,37 @@
mouse.BringToFront();
}
}
- if (strAction == remote_bookmark)
+ if (action.wID == settings.Remote_Bookmark)
{
GUIWindowManager.ActivateWindow(54537688);
return;
}
- if ((strAction == remote_zoom_in) ||
+ if ((action.wID == settings.Remote_Zoom_In) ||
(action.wID == MediaPortal.GUI.Library.Action.ActionType.ACTION_MUSIC_FORWARD))
{
OnZoomIn();
}
- if ((strAction == remote_zoom_out) ||
+ if ((action.wID == settings.Remote_Zoom_Out) ||
(action.wID == MediaPortal.GUI.Library.Action.ActionType.ACTION_MUSIC_REWIND))
{
OnZoomOut();
}
- if (strAction == remote_status)
+ if (action.wID == settings.Remote_Status)
{
- statusBar = !statusBar;
- if (statusBar)
+ settings.StatusBar = !settings.StatusBar;
+ if (settings.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 (action.wID == settings.Remote_PageUp)
+ {
+ OnPageUp();
+ }
+ if (action.wID == settings.Remote_PageDown)
+ {
+ OnPageDown();
+ }
#endregion
switch (action.wID)
@@ -570,7 +505,7 @@
break;
}
case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOUSE_MOVE:
- if (useMouse)
+ if (settings.UseMouse)
{
}
@@ -590,7 +525,7 @@
}
break;
case MediaPortal.GUI.Library.Action.ActionType.ACTION_KEY_PRESSED:
- if (!useMouse)
+ if (!settings.UseMouse)
{
linkTime = 0;
MyLog.debug("action key press=" + action.m_key.KeyChar);
@@ -622,24 +557,24 @@
OnEnterNewLink();
return;
case MediaPortal.GUI.Library.Action.ActionType.ACTION_PAUSE:
- webBrowser.Navigate(homepage);
- MyLog.debug("load home page " + homepage);
- if (!remote) GUIPropertyManager.SetProperty("#btWeb.status", "go to homepage");
+ webBrowser.Navigate(settings.HomePage);
+ MyLog.debug("load home page " + settings.HomePage);
+ if (!settings.Remote) GUIPropertyManager.SetProperty("#btWeb.status", "go to homepage");
return;
case MediaPortal.GUI.Library.Action.ActionType.ACTION_STOP:
webBrowser.Navigate("about:blank");
- if (!remote) GUIPropertyManager.SetProperty("#btWeb.status", "Stop");
+ if (!settings.Remote) GUIPropertyManager.SetProperty("#btWeb.status", "Stop");
return;
case MediaPortal.GUI.Library.Action.ActionType.ACTION_PREV_ITEM:
case MediaPortal.GUI.Library.Action.ActionType.ACTION_REWIND:
webBrowser.GoBack();
- if (!remote) GUIPropertyManager.SetProperty("#btWeb.status", "go backward");
+ if (!settings.Remote) GUIPropertyManager.SetProperty("#btWeb.status", "go backward");
MyLog.debug("navigate go back");
return;
case MediaPortal.GUI.Library.Action.ActionType.ACTION_NEXT_ITEM:
case MediaPortal.GUI.Library.Action.ActionType.ACTION_FORWARD:
webBrowser.GoForward();
- if (!remote) GUIPropertyManager.SetProperty("#btWeb.status", "go forward");
+ if (!settings.Remote) GUIPropertyManager.SetProperty("#btWeb.status", "go forward");
MyLog.debug("navigate go forward");
return;
case MediaPortal.GUI.Library.Action.ActionType.ACTION_RECORD:
@@ -675,7 +610,7 @@
private void webBrowser_DomKeyDown(object sender, GeckoDomKeyEventArgs e)
{
- if (useMouse)
+ if (settings.UseMouse)
{
//System.Diagnostics.Debug.WriteLine("DOM " + e.KeyCode.ToString());
@@ -706,7 +641,7 @@
}
void webBrowser_DomClick(object sender, GeckoDomEventArgs e)
{
- if (useMouse)
+ if (settings.UseMouse)
{
// this is a workarround until i know what wrong on the links...
GeckoWebBrowser g = (GeckoWebBrowser)sender;
@@ -737,9 +672,9 @@
GUIGraphicsContext.form.Focus();
string selectedUrl = "http://";
- if (lastUrl != string.Empty)
+ if (settings.LastUrl != string.Empty)
{
- selectedUrl = lastUrl;
+ selectedUrl = settings.LastUrl;
}
if (ShowKeyboard(ref selectedUrl, false) == System.Windows.Forms.DialogResult.OK)
@@ -749,15 +684,14 @@
webBrowser.Navigate(selectedUrl);
MyLog.debug("navigate to " + selectedUrl);
- lastUrl = selectedUrl;
- SaveSettings();
+ settings.LastUrl = selectedUrl;
}
else
ShowAlert("Wrong link ?", " The link you entered seems to be not valid.", "Input:", selectedUrl);
}
webBrowser.Visible = true;
- if (useMouse)
+ if (settings.UseMouse)
GUIGraphicsContext.form.Controls["BrowseTheWeb"].Select();
}
@@ -807,20 +741,20 @@
}
webBrowser.Visible = true;
- if (useMouse)
+ if (settings.UseMouse)
GUIGraphicsContext.form.Controls["BrowseTheWeb"].Select();
}
private void OnZoomIn()
{
if (zoom < 3) zoom += 0.1f;
webBrowser.Zoom = zoom;
- if (!remote) GUIPropertyManager.SetProperty("#btWeb.status", "Zoom set to " + (int)(zoom * 100));
+ if (!settings.Remote) GUIPropertyManager.SetProperty("#btWeb.status", "Zoom set to " + (int)(zoom * 100));
}
private void OnZoomOut()
{
if (zoom > 0.1f) zoom -= 0.1f;
webBrowser.Zoom = zoom;
- if (!remote) GUIPropertyManager.SetProperty("#btWeb.status", "Zoom set to " + (int)(zoom * 100));
+ if (!settings.Remote) GUIPropertyManager.SetProperty("#btWeb.status", "Zoom set to " + (int)(zoom * 100));
}
private void OnMoveLeft()
{
@@ -870,6 +804,34 @@
Cursor.Position = new Point(mouse.Location.X, mouse.Location.Y);
}
}
+ private void OnPageUp()
+ {
+ if (!mouse.Visible)
+ {
+ int height = webBrowser.Size.Height;
+ if (webBrowser.Window != null) ScrollTo(webBrowser.Window.ScrollX, webBrowser.Window.ScrollY - height + 100);
+ }
+ else
+ {
+ //not yet tested
+ mouse.Location = new Point(mouse.Location.X, mouse.Location.Y - 20);
+ Cursor.Position = new Point(mouse.Location.X, mouse.Location.Y);
+ }
+ }
+ private void OnPageDown()
+ {
+ if (!mouse.Visible)
+ {
+ int height = webBrowser.Size.Height;
+ if (webBrowser.Window != null) ScrollTo(webBrowser.Window.ScrollX, webBrowser.Window.ScrollY + height - 100);
+ }
+ else
+ {
+ //not yet tested
+ mouse.Location = new Point(mouse.Location.X, mouse.Location.Y - 20);
+ Cursor.Position = new Point(mouse.Location.X, mouse.Location.Y);
+ }
+ }
private Bitmap CopyBitmap(Bitmap srcBitmap, Rectangle section)
{
@@ -917,7 +879,7 @@
GUIPropertyManager.SetProperty("#btWeb.status", str);
#endregion
- if (!useMouse)
+ if (!settings.UseMouse)
{
#region add links to page
_htmlLinkNumbers.Clear();
@@ -1039,19 +1001,19 @@
}
#region reset zoom
- if (zoomPage)
+ if (settings.ZoomPage)
{
- webBrowser.Zoom = defaultZoom;
- zoom = defaultZoom;
+ webBrowser.Zoom = settings.DefaultZoom;
+ zoom = settings.DefaultZoom;
GUIPropertyManager.SetProperty("#btWeb.status", "Zoom set to " + (int)(zoom * 100));
}
- if (zoomDomain)
+ if (settings.ZoomDomain)
{
if (lastDomain != webBrowser.Document.Domain)
{
{
- webBrowser.Zoom = defaultZoom;
- zoom = defaultZoom;
+ webBrowser.Zoom = settings.DefaultZoom;
+ zoom = settings.DefaultZoom;
GUIPropertyManager.SetProperty("#btWeb.status", "Zoom set to " + (int)(zoom * 100));
}
}
Added: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Settings.cs
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Settings.cs (rev 0)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Settings.cs 2012-04-04 21:12:44 UTC (rev 4470)
@@ -0,0 +1,170 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MediaPortal.GUI.Library;
+using MediaPortal.Dialogs;
+using MediaPortal.Util;
+using MediaPortal.Configuration;
+using Action = MediaPortal.GUI.Library.Action;
+
+namespace BrowseTheWeb
+{
+ public class Settings
+ {
+ public bool UseHome { get; set; }
+ public string HomePage { get; set; }
+ public int RemoteTime { get; set; }
+ public string PluginName { get; set; }
+ public bool BlankBrowser { get; set; }
+ public bool StatusBar { get; set; }
+ public bool OSD { get; set; }
+ public bool Windowed { get; set; }
+ public bool UseMouse { get; set; }
+
+ public int DefaultZoom_percentage { get; set; }
+ public int FontZoom_percentage { get; set; }
+ public float FontZoom { get { return FontZoom_percentage / 100; } }
+ public float DefaultZoom { get { return DefaultZoom_percentage / 100; } }
+
+ public bool ZoomPage { get; set; }
+ public bool ZoomDomain { get; set; }
+ public bool UseThumbs { get; set; }
+ public bool CacheThumbs { get; set; }
+ public bool Remote { get; set; }
+ public Action.ActionType Remote_Confirm { get; set; }
+ public Action.ActionType Remote_Bookmark { get; set; }
+ public Action.ActionType Remote_Zoom_In { get; set; }
+ public Action.ActionType Remote_Zoom_Out { get; set; }
+ public Action.ActionType Remote_Status { get; set; }
+ public Action.ActionType Remote_PageUp { get; set; }
+ public Action.ActionType Remote_PageDown { get; set; }
+
+ public static Action.ActionType Default_Remote_Confirm = Action.ActionType.ACTION_SELECT_ITEM;
+ public static Action.ActionType Default_Remote_Bookmark = Action.ActionType.ACTION_SHOW_INFO;
+ public static Action.ActionType Default_Remote_Zoom_In = Action.ActionType.ACTION_ZOOM_IN;
+ public static Action.ActionType Default_Remote_Zoom_Out = Action.ActionType.ACTION_ZOOM_OUT;
+ public static Action.ActionType Default_Remote_Status = Action.ActionType.ACTION_SHOW_GUI;
+ public static Action.ActionType Default_Remote_PageUp = Action.ActionType.ACTION_PAGE_UP;
+ public static Action.ActionType Default_Remote_PageDown = Action.ActionType.ACTION_PAGE_DOWN;
+
+ public string LastUrl { get; set; }
+ public bool UseProxy { get; set; }
+ public string Server { get; set; }
+ public int Port { get; set; }
+ public GUIFacadeControl.Layout View { get; set; }
+
+ private const string section = "btweb";
+
+ #region Singleton
+ private static Settings _Instance = null;
+ public static Settings Instance
+ {
+ get
+ {
+ if (_Instance == null) _Instance = new Settings();
+ return _Instance;
+ }
+ }
+ private Settings() { LoadFromXml(); }
+ #endregion
+
+ private void LoadFromXml()
+ {
+ string dir = Config.GetFolder(Config.Dir.Co...
[truncated message content] |
|
From: <dos...@us...> - 2012-04-15 14:13:32
|
Revision: 4481
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4481&view=rev
Author: doskabouter
Date: 2012-04-15 14:13:24 +0000 (Sun, 15 Apr 2012)
Log Message:
-----------
- removed reference to htmlagilitypack
- cleanup code
- added ParentNode to GeckoNode
Modified Paths:
--------------
trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj
trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs
trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoDom.cs
Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj 2012-04-15 14:08:54 UTC (rev 4480)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj 2012-04-15 14:13:24 UTC (rev 4481)
@@ -66,9 +66,6 @@
<Reference Include="Dialogs">
<HintPath>C:\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\Dialogs.dll</HintPath>
</Reference>
- <Reference Include="HtmlAgilityPack">
- <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\HtmlAgilityPack.dll</HintPath>
- </Reference>
<Reference Include="Ionic.Zip">
<HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Ionic.Zip.dll</HintPath>
</Reference>
Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs 2012-04-15 14:08:54 UTC (rev 4480)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs 2012-04-15 14:13:24 UTC (rev 4481)
@@ -48,13 +48,14 @@
private const int MOUSEEVENTF_LEFTUP = 0x04;
private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
private const int MOUSEEVENTF_RIGHTUP = 0x10;
+ private const bool logHtml = false;
#region Links
private Dictionary<int, HtmlLinkNumber> _htmlLinkNumbers = new Dictionary<int, HtmlLinkNumber>();
#endregion
#region Constants
- private const string _span = "<span style=\"font-family: arial,sans-serif; font-size: 12px ! important; line-height: 130% ! important; border-width: 1px ! important; border-style: solid ! important; -moz-border-radius: 2px 2px 2px 2px ! important; padding: 0px 2px ! important; margin-left: 2px; max-width: 20px; max-height: 10px ! important; overflow: visible ! important; float: none ! important; display: inline;\" gecko_id=\"{0}\" gecko_action=\"{1}\" gecko_type=\"{2}\" class=\"{3}\">{0}</span>";
+ private const string _spanstyle = "font-family: arial,sans-serif; font-size: 12px ! important; line-height: 130% ! important; border-width: 1px ! important; border-style: solid ! important; -moz-border-radius: 2px 2px 2px 2px ! important; padding: 0px 2px ! important; margin-left: 2px; max-width: 20px; max-height: 10px ! important; overflow: visible ! important; float: none ! important; display: inline;";
#endregion
#region declare vars
@@ -859,9 +860,44 @@
GUIPropertyManager.SetProperty("#btWeb.status", str);
}
}
+
+ private void AddElements(List<GeckoElement> list, GeckoNode parent, string elName)
+ {
+ if (parent is GeckoElement && ((GeckoElement)parent).TagName.ToLowerInvariant() == elName)
+ list.Add((GeckoElement)parent);
+ foreach (GeckoNode child in parent.ChildNodes)
+ AddElements(list, child, elName);
+ }
+
+ private List<GeckoElement> getElements(GeckoNode parent, string elName)
+ {
+ List<GeckoElement> res = new List<GeckoElement>();
+ AddElements(res, parent, elName);
+ return res;
+ }
+
+ private GeckoElement insertSpan(int geckoId, string geckoAction, string geckoType, string className, GeckoNode after)
+ {
+ if (after == null)
+ throw new ArgumentNullException("after");
+ GeckoElement newChild = after.OwnerDocument.CreateElement("span");
+ newChild.SetAttribute("style", _spanstyle);
+ newChild.SetAttribute("gecko_id", geckoId.ToString());
+ newChild.SetAttribute("gecko_action", geckoAction);
+ newChild.SetAttribute("gecko_type", geckoType);
+ newChild.InnerHtml = geckoId.ToString();
+ if (!String.IsNullOrEmpty(className))
+ newChild.SetAttribute("class", className);
+ if (after.NextSibling != null)
+ after.ParentNode.InsertBefore(newChild, after.NextSibling);
+ else
+ after.ParentNode.AppendChild(newChild);
+ return newChild;
+ }
+
private void webBrowser_DocumentCompleted(object sender, EventArgs e)
{
- MyLog.debug("page completetd : " + webBrowser.Url.ToString());
+ MyLog.debug("page completed : " + webBrowser.Url.ToString());
try
{
@@ -900,7 +936,8 @@
};
if (!element.InnerHtml.Contains("gecko_id"))
{
- element.InnerHtml += string.Format(_span, i, "", "LINK", lastSpan.ClassName);
+ insertSpan(i, String.Empty, "LINK", lastSpan.ClassName,
+ element.LastChild == null ? element : element.LastChild);
}
string gb = element.GetAttribute("gb");
@@ -921,86 +958,79 @@
}
GeckoElementCollection forms = webBrowser.Document.GetElementsByTagName("form");
- HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
MyLog.debug("page forms cnt : " + forms.Count);
foreach (GeckoElement element in forms)
{
+ List<GeckoElement> inps = getElements(element, "input");
string action = element.GetAttribute("action");
- doc.LoadHtml(element.InnerHtml);
- foreach (HtmlAgilityPack.HtmlNode link in doc.DocumentNode.SelectNodes("//*"))
+ foreach (GeckoElement link in inps)
{
- if (link.OriginalName == "input")
+ string linkType = link.GetAttribute("type");
+ if (!String.IsNullOrEmpty(linkType))
{
- if (link.Attributes["type"] != null)
+ if (linkType != "hidden")
{
- if (link.Attributes["type"].Value != "hidden")
- {
- string gb = link.GetAttributeValue("gb", "");
- string id = link.GetAttributeValue("id", "");
- string name = link.GetAttributeValue("name", "");
- string outerHtml = link.OuterHtml;
- if (string.IsNullOrEmpty(gb))
- {
- link.SetAttributeValue("gb", "gecko_link" + i);
- }
- if (string.IsNullOrEmpty(id))
- {
- link.SetAttributeValue("id", "gb" + i);
- id = "gb" + i;
- }
-
- if (!element.InnerHtml.Contains("gecko_id=\"" + i + "\""))
- {
- string newLink = link.OuterHtml + string.Format(_span, i, action, "INPUT", "");
- element.InnerHtml = element.InnerHtml.Replace(outerHtml, newLink);
- }
- if (link.Attributes["type"].Value == "submit" ||
- link.Attributes["type"].Value == "reset" ||
- link.Attributes["type"].Value == "radio" ||
- link.Attributes["type"].Value == "image" ||
- link.Attributes["type"].Value == "checkbox")
- {
- _htmlLinkNumbers.Add(i, new HtmlLinkNumber(i, id, name, action, HtmlInputType.Action));
- }
- else
- {
- if (link.Attributes["type"].Value == "password")
- _htmlLinkNumbers.Add(i, new HtmlLinkNumber(i, id, name, action, HtmlInputType.InputPassword));
- else
- _htmlLinkNumbers.Add(i, new HtmlLinkNumber(i, id, name, action, HtmlInputType.Input));
- }
- i++;
- }
- }
- else
- {
- string gb = link.GetAttributeValue("gb", "");
- string id = link.GetAttributeValue("id", "");
- string name = link.GetAttributeValue("name", "");
- string outerHtml = link.OuterHtml;
+ string gb = link.GetAttribute("gb");
+ string id = link.GetAttribute("id");
+ string name = link.GetAttribute("name");
if (string.IsNullOrEmpty(gb))
{
- link.SetAttributeValue("gb", "gecko_link" + i);
+ link.SetAttribute("gb", "gecko_link" + i);
}
if (string.IsNullOrEmpty(id))
{
- link.SetAttributeValue("id", "gb" + i);
+ link.SetAttribute("id", "gb" + i);
id = "gb" + i;
}
if (!element.InnerHtml.Contains("gecko_id=\"" + i + "\""))
{
- string newLink = link.OuterHtml + string.Format(_span, i, action, "INPUT", "");
- element.InnerHtml = element.InnerHtml.Replace(outerHtml, newLink);
+ insertSpan(i, action, "INPUT", null, link);
}
-
- _htmlLinkNumbers.Add(i, new HtmlLinkNumber(i, id, name, action, HtmlInputType.Input));
+ if (linkType == "submit" ||
+ linkType == "reset" ||
+ linkType == "radio" ||
+ linkType == "image" ||
+ linkType == "checkbox")
+ {
+ _htmlLinkNumbers.Add(i, new HtmlLinkNumber(i, id, name, action, HtmlInputType.Action));
+ }
+ else
+ {
+ if (linkType == "password")
+ _htmlLinkNumbers.Add(i, new HtmlLinkNumber(i, id, name, action, HtmlInputType.InputPassword));
+ else
+ _htmlLinkNumbers.Add(i, new HtmlLinkNumber(i, id, name, action, HtmlInputType.Input));
+ }
i++;
}
}
+ else
+ {
+ string gb = link.GetAttribute("gb");
+ string id = link.GetAttribute("id");
+ string name = link.GetAttribute("name");
+ if (string.IsNullOrEmpty(gb))
+ {
+ link.SetAttribute("gb", "gecko_link" + i);
+ }
+ if (string.IsNullOrEmpty(id))
+ {
+ link.SetAttribute("id", "gb" + i);
+ id = "gb" + i;
+ }
+
+ if (!element.InnerHtml.Contains("gecko_id=\"" + i + "\""))
+ {
+ insertSpan(i, action, "INPUT", null, link);
+ }
+
+ _htmlLinkNumbers.Add(i, new HtmlLinkNumber(i, id, name, action, HtmlInputType.Input));
+ i++;
+ }
}
}
#endregion
@@ -1026,6 +1056,13 @@
lastDomain = webBrowser.Document.Domain;
}
#endregion
+ if (logHtml)
+ {
+ using (System.IO.StreamWriter tw = new System.IO.StreamWriter(@"e:\last.html"))
+ {
+ tw.WriteLine(webBrowser.Document.DocumentElement.InnerHtml);
+ }
+ }
}
catch (Exception ex)
{
@@ -1105,27 +1142,27 @@
string result = string.Empty;
if (ShowKeyboard(ref result, id.Type == HtmlInputType.InputPassword) == DialogResult.OK)
{
- SetInputFieldText(id.Number, result);
+ SetInputElementValue(webBrowser.Document, id.Number, result);
}
webBrowser.Visible = true;
}
- public void SetInputFieldText(int id, string text)
+
+ private bool SetInputElementValue(GeckoNode parent, int geckoId, string text)
{
- HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
- doc.LoadHtml(webBrowser.Document.Body.InnerHtml);
-
- foreach (HtmlAgilityPack.HtmlNode element in doc.DocumentNode.SelectNodes("//input"))
+ GeckoElement el = parent as GeckoElement;
+ if (el != null && el.TagName.ToLowerInvariant() == "input" && el.GetAttribute("gb") == "gecko_link" + geckoId)
{
- string name = element.GetAttributeValue("gb", "");
- if (!string.IsNullOrEmpty(name))
+ el.SetAttribute("value", text);
+ return true;
+ }
+ else
+ {
+ foreach (GeckoNode child in parent.ChildNodes)
{
- if (name == "gecko_link" + id)
- {
- element.SetAttributeValue("value", text);
- webBrowser.Document.Body.InnerHtml = doc.DocumentNode.InnerHtml;
- break;
- }
+ if (SetInputElementValue(child, geckoId, text))
+ return true;
}
+ return false;
}
}
Modified: trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoDom.cs
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoDom.cs 2012-04-15 14:08:54 UTC (rev 4480)
+++ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoDom.cs 2012-04-15 14:13:24 UTC (rev 4481)
@@ -40,1033 +40,1038 @@
namespace Skybound.Gecko
{
- /// <summary>
- /// Provides a base class for DOM nodes.
- /// </summary>
- public class GeckoNode
- {
- internal GeckoNode(nsIDOMNode domObject)
- {
- _DomObject = domObject;
- }
-
- internal static GeckoNode Create(nsIDOMNode domObject)
- {
- if (domObject == null)
- return null;
-
- nsIDOMHTMLElement element = Xpcom.QueryInterface<nsIDOMHTMLElement>(domObject);
- if (element != null)
- return GeckoElement.Create(element);
-
- nsIDOMAttr attr = Xpcom.QueryInterface<nsIDOMAttr>(domObject);
- if (attr != null)
- return GeckoAttribute.Create(attr);
-
- return new GeckoNode(domObject);
- }
-
- /// <summary>
- /// Gets the underlying XPCOM object.
- /// </summary>
- public object DomObject
- {
- get { return _DomObject; }
- }
- nsIDOMNode _DomObject;
-
- public override bool Equals(object obj)
- {
- if (this == obj)
- return true;
- else if (obj is GeckoNode)
- return this.GetHashCode() == (obj as GeckoNode).GetHashCode();
-
- return base.Equals(obj);
- }
-
- public override int GetHashCode()
- {
- IntPtr pUnk = Marshal.GetIUnknownForObject(this._DomObject);
- try
- {
- return pUnk.GetHashCode();
- }
- finally
- {
- if (pUnk != IntPtr.Zero)
- Marshal.Release(pUnk);
- }
- }
-
- /// <summary>
- /// Gets the text contents of the node.
- /// </summary>
- public string TextContent
- {
- get { return nsString.Get(((nsIDOM3Node)_DomObject).GetTextContent); }
- set { nsString.Set(((nsIDOM3Node)_DomObject).SetTextContent, value); }
- }
-
- /// <summary>
- /// Gets or sets the value of the node.
- /// </summary>
- public string NodeValue
- {
- get { return nsString.Get(((nsIDOMNode)_DomObject).GetNodeValue); }
- set { nsString.Set(((nsIDOMNode)_DomObject).SetNodeValue, value); }
- }
-
- /// <summary>
- /// Gets a collection containing all child nodes of this node.
- /// </summary>
- public GeckoNodeCollection ChildNodes
- {
- get { return new GeckoNodeCollection(_DomObject.GetChildNodes()); }
- }
-
- public GeckoNode FirstChild { get { return GeckoNode.Create(_DomObject.GetFirstChild()); } }
- public GeckoNode LastChild { get { return GeckoNode.Create(_DomObject.GetLastChild()); } }
- public GeckoNode NextSibling { get { return GeckoNode.Create(_DomObject.GetNextSibling()); } }
- public GeckoNode PreviousSibling { get { return GeckoNode.Create(_DomObject.GetPreviousSibling()); } }
- public bool HasChildNodes { get { return _DomObject.HasChildNodes(); } }
- public bool HasAttributes { get { return _DomObject.HasAttributes(); } }
-
- public GeckoDocument OwnerDocument { get { return GeckoDocument.Create(Xpcom.QueryInterface<nsIDOMHTMLDocument>(_DomObject.GetOwnerDocument())); } }
-
- public GeckoNode AppendChild(GeckoNode node)
- {
- if (node == null)
- throw new ArgumentNullException("node");
-
- _DomObject.AppendChild(node._DomObject);
- return node;
- }
-
- public GeckoNode CloneNode(bool deep)
- {
- return GeckoNode.Create(_DomObject.CloneNode(deep));
- }
-
- public GeckoNode InsertBefore(GeckoNode newChild, GeckoNode before)
- {
- if (newChild == null)
- throw new ArgumentNullException("newChild");
- if (before == null)
- throw new ArgumentNullException("before");
-
- _DomObject.InsertBefore(newChild._DomObject, before._DomObject);
- return newChild;
- }
-
- public GeckoNode RemoveChild(GeckoNode node)
- {
- if (node == null)
- throw new ArgumentNullException("node");
-
- _DomObject.RemoveChild(node._DomObject);
- return node;
- }
-
- public GeckoNode ReplaceChild(GeckoNode newChild, GeckoNode oldChild)
- {
- if (newChild == null)
- throw new ArgumentNullException("newChild");
- if (oldChild == null)
- throw new ArgumentNullException("oldChild");
-
- _DomObject.ReplaceChild(newChild._DomObject, oldChild._DomObject);
- return newChild;
- }
-
- public GeckoNamedNodeMap Attributes
- {
- get { return new GeckoNamedNodeMap(_DomObject.GetAttributes()); }
- }
- }
-
- /// <summary>
- /// Represents a DOM attribute.
- /// </summary>
- public class GeckoAttribute : GeckoNode
- {
- internal GeckoAttribute(nsIDOMAttr attr) : base(attr)
- {
- this.DomAttr = attr;
- }
- nsIDOMAttr DomAttr;
-
- internal static GeckoAttribute Create(nsIDOMAttr attr)
- {
- return (attr == null) ? null : new GeckoAttribute(attr);
- }
-
- /// <summary>
- /// Gets the name of the attribute.
- /// </summary>
- public string Name
- {
- get { return nsString.Get(DomAttr.GetName); }
- }
-
- /// <summary>
- /// Gets the value of the attribute.
- /// </summary>
- public string Value
- {
- get { return nsString.Get(DomAttr.GetValue); }
- set { nsString.Set(DomAttr.SetValue, value); }
- }
-
- /// <summary>
- /// Gets a value indicating whether the attribute is specified.
- /// </summary>
- public bool Specified
- {
- get { return DomAttr.GetSpecified(); }
- }
-
- /// <summary>
- /// Gets the <see cref="GeckoElement"/> which contains this attribute.
- /// </summary>
- public GeckoElement OwnerElement
- {
- get { return GeckoElement.Create((nsIDOMHTMLElement)DomAttr.GetOwnerElement()); }
- }
- }
-
- /// <summary>
- /// Represents a DOM element.
- /// </summary>
- public class GeckoElement : GeckoNode
- {
- internal GeckoElement(nsIDOMHTMLElement element) : base(element)
- {
- this.DomElement = element;
- this.DomNSElement = (nsIDOMNSElement)element;
- this.DomNSHTMLElement = (nsIDOMNSHTMLElement)element;
-
- // since a reference is stored in the base class, we only need weak references here
- Marshal.ChangeWrapperHandleStrength(DomNSElement, true);
- Marshal.ChangeWrapperHandleStrength(DomNSHTMLElement, true);
- }
-
- internal static GeckoElement Create(nsIDOMHTMLElement element)
- {
- return (element == null) ? null : new GeckoElement(element);
- }
-
- nsIDOMHTMLElement DomElement;
- nsIDOMNSElement DomNSElement;
- nsIDOMNSHTMLElement DomNSHTMLElement;
-
- /// <summary>
- /// Gets the parent element of this one.
- /// </summary>
- public GeckoElement Parent
- {
- get
- {
- // note: the parent node could also be the document
- return GeckoElement.Create(Xpcom.QueryInterface<nsIDOMHTMLElement>(DomElement.GetParentNode()));
- }
- }
-
- /// <summary>
- /// Gets the name of the tag.
- /// </summary>
- public string TagName
- {
- get { return nsString.Get(DomElement.GetTagName); }
- }
-
- /// <summary>
- /// Gets the value of the id attribute.
- /// </summary>
- public string Id
- {
- get { return nsString.Get(DomElement.GetId); }
- set { nsString.Set(DomElement.SetId, value); }
- }
-
- /// <summary>
- /// Gets the value of the class attribute.
- /// </summary>
- public string ClassName
- {
- get { return nsString.Get(DomElement.GetClassName); }
- set { nsString.Set(DomElement.SetClassName, value); }
- }
-
- /// <summary>
- /// Returns a collection containing the child elements of this element with a given tag name.
- /// </summary>
- /// <param name="tagName"></param>
- /// <returns></returns>
- public GeckoElementCollection GetElementsByTagName(string tagName)
- {
- if (string.IsNullOrEmpty(tagName))
- return null;
-
- return new GeckoElementCollection(DomElement.GetElementsByTagName(new nsAString(tagName)));
- }
-
- /// <summary>
- /// Gets the value of an attribute on this element with the specified name.
- /// </summary>
- /// <param name="attributeName"></param>
- /// <returns></returns>
- public string GetAttribute(string attributeName)
- {
- if (string.IsNullOrEmpty(attributeName))
- throw new ArgumentException("attributeName");
-
- using (nsAString retval = new nsAString())
- {
- DomElement.GetAttribute(new nsAString(attributeName), retval);
- return retval.ToString();
- }
- }
-
- /// <summary>
- /// Gets the value of an attribute on this element with the specified name and namespace.
- /// </summary>
- /// <param name="attributeName"></param>
- /// <returns></returns>
- public string GetAttributeNS(string namespaceUri, string attributeName)
- {
- if (string.IsNullOrEmpty(namespaceUri))
- return GetAttribute(attributeName);
-
- if (string.IsNullOrEmpty(attributeName))
- throw new ArgumentException("attributeName");
-
- using (nsAString retval = new nsAString())
- {
- DomElement.GetAttributeNS(new nsAString(namespaceUri), new nsAString(attributeName), retval);
- return retval.ToString();
- }
- }
-
- /// <summary>
- /// Sets the value of an attribute on this element with the specified name.
- /// </summary>
- /// <param name="attributeName"></param>
- /// <param name="value"></param>
- public void SetAttribute(string attributeName, string value)
- {
- if (string.IsNullOrEmpty(attributeName))
- throw new ArgumentException("attributeName");
-
- DomElement.SetAttribute(new nsAString(attributeName), new nsAString(value));
- }
-
- /// <summary>
- /// Sets the value of an attribute on this element with the specified name and namespace.
- /// </summary>
- /// <param name="attributeName"></param>
- /// <param name="value"></param>
- public void SetAttributeNS(string namespaceUri, string attributeName, string value)
- {
- if (string.IsNullOrEmpty(namespaceUri))
- {
- SetAttribute(attributeName, value);
- }
- else
- {
- if (string.IsNullOrEmpty(attributeName))
- throw new ArgumentException("attributeName");
-
- DomElement.SetAttributeNS(new nsAString(namespaceUri), new nsAString(attributeName), new nsAString(value));
- }
- }
-
- /// <summary>
- /// Removes an attribute from this element.
- /// </summary>
- /// <param name="attributeName"></param>
- public void RemoveAttribute(string attributeName)
- {
- if (string.IsNullOrEmpty(attributeName))
- throw new ArgumentException("attributeName");
-
- DomElement.RemoveAttribute(new nsAString(attributeName));
- }
-
- #if GECKO_1_9_1
- public int ScrollLeft { get { return DomNSElement.GetScrollLeft(); } set { DomNSElement.SetScrollLeft(value); } }
- public int ScrollTop { get { return DomNSElement.GetScrollTop(); } set { DomNSElement.SetScrollTop(value); } }
- public int ScrollWidth { get { return DomNSElement.GetScrollWidth(); } }
- public int ScrollHeight { get { return DomNSElement.GetScrollHeight(); } }
- public int ClientWidth { get { return DomNSElement.GetClientWidth(); } }
- public int ClientHeight { get { return DomNSElement.GetClientHeight(); } }
- #else
+ /// <summary>
+ /// Provides a base class for DOM nodes.
+ /// </summary>
+ public class GeckoNode
+ {
+ internal GeckoNode(nsIDOMNode domObject)
+ {
+ _DomObject = domObject;
+ }
+
+ internal static GeckoNode Create(nsIDOMNode domObject)
+ {
+ if (domObject == null)
+ return null;
+
+ nsIDOMHTMLElement element = Xpcom.QueryInterface<nsIDOMHTMLElement>(domObject);
+ if (element != null)
+ return GeckoElement.Create(element);
+
+ nsIDOMAttr attr = Xpcom.QueryInterface<nsIDOMAttr>(domObject);
+ if (attr != null)
+ return GeckoAttribute.Create(attr);
+
+ return new GeckoNode(domObject);
+ }
+
+ /// <summary>
+ /// Gets the underlying XPCOM object.
+ /// </summary>
+ public object DomObject
+ {
+ get { return _DomObject; }
+ }
+ nsIDOMNode _DomObject;
+
+ public override bool Equals(object obj)
+ {
+ if (this == obj)
+ return true;
+ else if (obj is GeckoNode)
+ return this.GetHashCode() == (obj as GeckoNode).GetHashCode();
+
+ return base.Equals(obj);
+ }
+
+ public override int GetHashCode()
+ {
+ IntPtr pUnk = Marshal.GetIUnknownForObject(this._DomObject);
+ try
+ {
+ return pUnk.GetHashCode();
+ }
+ finally
+ {
+ if (pUnk != IntPtr.Zero)
+ Marshal.Release(pUnk);
+ }
+ }
+
+ /// <summary>
+ /// Gets the text contents of the node.
+ /// </summary>
+ public string TextContent
+ {
+ get { return nsString.Get(((nsIDOM3Node)_DomObject).GetTextContent); }
+ set { nsString.Set(((nsIDOM3Node)_DomObject).SetTextContent, value); }
+ }
+
+ /// <summary>
+ /// Gets or sets the value of the node.
+ /// </summary>
+ public string NodeValue
+ {
+ get { return nsString.Get(((nsIDOMNode)_DomObject).GetNodeValue); }
+ set { nsString.Set(((nsIDOMNode)_DomObject).SetNodeValue, value); }
+ }
+
+ /// <summary>
+ /// Gets a collection containing all child nodes of this node.
+ /// </summary>
+ public GeckoNodeCollection ChildNodes
+ {
+ get { return new GeckoNodeCollection(_DomObject.GetChildNodes()); }
+ }
+
+ public GeckoNode ParentNode { get { return GeckoNode.Create(_DomObject.GetParentNode()); } }
+ public GeckoNode FirstChild { get { return GeckoNode.Create(_DomObject.GetFirstChild()); } }
+ public GeckoNode LastChild { get { return GeckoNode.Create(_DomObject.GetLastChild()); } }
+ public GeckoNode NextSibling { get { return GeckoNode.Create(_DomObject.GetNextSibling()); } }
+ public GeckoNode PreviousSibling { get { return GeckoNode.Create(_DomObject.GetPreviousSibling()); } }
+ public bool HasChildNodes { get { return _DomObject.Has...
[truncated message content] |
|
From: <dos...@us...> - 2014-01-23 20:59:26
|
Revision: 4751
http://sourceforge.net/p/mp-plugins/code/4751
Author: doskabouter
Date: 2014-01-23 20:59:24 +0000 (Thu, 23 Jan 2014)
Log Message:
-----------
Added solution configuration to easily debug setup
Modified Paths:
--------------
trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj
trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb.sln
Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj 2014-01-19 19:34:48 UTC (rev 4750)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj 2014-01-23 20:59:24 UTC (rev 4751)
@@ -53,6 +53,24 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug Config|AnyCPU'">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>C:\Program Files %28x86%29\Team MediaPortal\MediaPortal\plugins\Windows\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <CodeAnalysisLogFile>C:\Program Files (x86)\Team MediaPortal\MediaPortal\plugins\Windows\BrowseTheWeb.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+ <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
+ <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+ <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
+ <CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
+ </PropertyGroup>
<ItemGroup>
<Reference Include="Common.Utils">
<HintPath>$(ProgramFiles)\Team MediaPortal\MediaPortal\Common.Utils.dll</HintPath>
@@ -207,6 +225,6 @@
</Target>
-->
<PropertyGroup>
- <PostBuildEvent>if $(ConfigurationName) == Release "$(ProgramFiles)\Team MediaPortal\MediaPortal\MpeMaker" ..\..\BrowseTheWeb.xmp2 /B /UpdateXML</PostBuildEvent>
+ <PostBuildEvent>if "$(ConfigurationName)" == "Release" "$(ProgramFiles)\Team MediaPortal\MediaPortal\MpeMaker" ..\..\BrowseTheWeb.xmp2 /B /UpdateXML</PostBuildEvent>
</PropertyGroup>
</Project>
\ No newline at end of file
Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb.sln
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb.sln 2014-01-19 19:34:48 UTC (rev 4750)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb.sln 2014-01-23 20:59:24 UTC (rev 4751)
@@ -5,6 +5,9 @@
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug Config|Any CPU = Debug Config|Any CPU
+ Debug Config|Mixed Platforms = Debug Config|Mixed Platforms
+ Debug Config|x86 = Debug Config|x86
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
@@ -13,6 +16,11 @@
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug Config|Any CPU.ActiveCfg = Debug Config|Any CPU
+ {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug Config|Any CPU.Build.0 = Debug Config|Any CPU
+ {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug Config|Mixed Platforms.ActiveCfg = Debug Config|Any CPU
+ {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug Config|Mixed Platforms.Build.0 = Debug Config|Any CPU
+ {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug Config|x86.ActiveCfg = Debug Config|Any CPU
{70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug|Any CPU.Build.0 = Debug|Any CPU
{70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|