banshee r3299 - in trunk/banshee: . src/Libraries/Hyena/Hyena.Query src/Libraries/Lastfm/Lastfm.Data
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3299 - in trunk/banshee: . src/Libraries/Hyena/Hyena.Query src/Libraries/Lastfm/Lastfm.Data
- Date: Thu, 21 Feb 2008 22:43:30 +0000 (GMT)
Author: gburt
Date: Thu Feb 21 22:43:30 2008
New Revision: 3299
URL: http://svn.gnome.org/viewvc/banshee?rev=3299&view=rev
Log:
2008-02-21 Gabriel Burt <gabriel burt gmail com>
* src/Libraries/Hyena/Hyena.Query/DateQueryValue.cs: Make the regex
static.
* src/Libraries/Lastfm/Lastfm.Data/DataEntryCollection.cs:
* src/Libraries/Lastfm/Lastfm.Data/DataEntry.cs: Enforce the Root as being
a XmlElement, and if it doesn't have a child element of the requied name,
see if it has an attribute.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Libraries/Hyena/Hyena.Query/DateQueryValue.cs
trunk/banshee/src/Libraries/Lastfm/Lastfm.Data/DataEntry.cs
trunk/banshee/src/Libraries/Lastfm/Lastfm.Data/DataEntryCollection.cs
Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Query/DateQueryValue.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Query/DateQueryValue.cs (original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Query/DateQueryValue.cs Thu Feb 21 22:43:30 2008
@@ -88,7 +88,7 @@
get { return offset; }
}
- private Regex number_regex = new Regex ("\\d+", RegexOptions.Compiled);
+ private static Regex number_regex = new Regex ("\\d+", RegexOptions.Compiled);
public override void ParseUserQuery (string input)
{
try {
Modified: trunk/banshee/src/Libraries/Lastfm/Lastfm.Data/DataEntry.cs
==============================================================================
--- trunk/banshee/src/Libraries/Lastfm/Lastfm.Data/DataEntry.cs (original)
+++ trunk/banshee/src/Libraries/Lastfm/Lastfm.Data/DataEntry.cs Thu Feb 21 22:43:30 2008
@@ -35,8 +35,8 @@
{
public class DataEntry
{
- private XmlNode root;
- public XmlNode Root {
+ private XmlElement root;
+ public XmlElement Root {
get { return root; }
set { root = value; }
}
@@ -45,7 +45,7 @@
{
}
- public DataEntry (XmlNode root)
+ public DataEntry (XmlElement root)
{
this.root = root;
}
@@ -53,11 +53,14 @@
public T Get<T> (string name)
{
try {
- XmlNode node = root[name];
- return (T) Convert.ChangeType (node.InnerText, typeof(T));
- } catch (Exception) {
- return default(T);
- }
+ XmlElement node = root[name];
+ if (node != null) {
+ return (T) Convert.ChangeType (node.InnerText, typeof(T));
+ } else if (root.HasAttribute (name)) {
+ return (T) Convert.ChangeType (root.GetAttribute (name), typeof(T));
+ }
+ } catch (Exception) {}
+ return default(T);
}
}
Modified: trunk/banshee/src/Libraries/Lastfm/Lastfm.Data/DataEntryCollection.cs
==============================================================================
--- trunk/banshee/src/Libraries/Lastfm/Lastfm.Data/DataEntryCollection.cs (original)
+++ trunk/banshee/src/Libraries/Lastfm/Lastfm.Data/DataEntryCollection.cs Thu Feb 21 22:43:30 2008
@@ -60,7 +60,7 @@
get {
if (!collection.ContainsKey (i)) {
T t = (T) Activator.CreateInstance (typeof(T));
- t.Root = nodes.Item (i);
+ t.Root = nodes.Item (i) as XmlElement;
collection[i] = t;
}
return collection[i];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]