internal ActivityItem(XmlNode itemNode)
{
XmlNode node;
node = itemNode.Attributes.GetNamedItem("type");
if( node == null )
_activityType = ActivityItemType.Unknown;
else if( node.Value == "photoset" )
_activityType = ActivityItemType.Photoset;
else if( node.Value == "photo" )
_activityType = ActivityItemType.Photo;
else
_activityType = ActivityItemType.Unknown;
node = itemNode.Attributes.GetNamedItem("owner");
if( node != null ) _ownerId = node.Value;
node = itemNode.Attributes.GetNamedItem("id");
if( node != null ) _id = node.Value;
node = itemNode.Attributes.GetNamedItem("secret");
if( node != null ) _secret = node.Value;
node = itemNode.Attributes.GetNamedItem("server");
if( node != null ) _server = node.Value;
node = itemNode.Attributes.GetNamedItem("farm");
if( node != null ) _farm = node.Value;
node = itemNode.Attributes.GetNamedItem("commentsnew");
if( node != null ) _commentsNew = Convert.ToInt32(node.Value);
node = itemNode.Attributes.GetNamedItem("commentsold");
if( node != null ) _commentsOld = Convert.ToInt32(node.Value);
node = itemNode.Attributes.GetNamedItem("comments");
if( node != null ) _comments = Convert.ToInt32(node.Value);
node = itemNode.Attributes.GetNamedItem("more");
if( node != null ) _more = Convert.ToInt32(node.Value);
node = itemNode.Attributes.GetNamedItem("views");
if( node != null ) _views = Convert.ToInt32(node.Value);
node = itemNode.SelectSingleNode("title");
if( node != null ) _title = node.InnerText;
XmlNodeList list = itemNode.SelectNodes("activity/event");
_events = new ActivityEvent[list.Count];
for(int i = 0; i < _events.Length; i++)
{
node = list[i];
_events[i] = new ActivityEvent(node);
}
// Photoset specific
// Photos, PrimaryPhotoId
node = itemNode.Attributes.GetNamedItem("photos");
if( node != null ) _photos = Convert.ToInt32(node.Value);
node = itemNode.Attributes.GetNamedItem("primary");
if( node != null ) _primaryId = node.Value;
// Photo specific
// NodesNew and NodesOld, Favourites
node = itemNode.Attributes.GetNamedItem("notesnew");
if( node != null ) _notesNew = Convert.ToInt32(node.Value);
node = itemNode.Attributes.GetNamedItem("notesold");
if( node != null ) _notesOld = Convert.ToInt32(node.Value);
node = itemNode.Attributes.GetNamedItem("notes");
if( node != null ) _notes = Convert.ToInt32(node.Value);
node = itemNode.Attributes.GetNamedItem("faves");
if( node != null ) _favs = Convert.ToInt32(node.Value);
}