UnixTimestampToDate() static private method

Converts a long, representing a unix timestamp number into a DateTime object.
static private UnixTimestampToDate ( long timestamp ) : System.DateTime
timestamp long The unix timestamp.
return System.DateTime
Exemplo n.º 1
0
        internal Comment(string photoId, XmlNode node)
        {
            _photoId = photoId;

            if (node.Attributes["id"] != null)
            {
                _commentId = node.Attributes["id"].Value;
            }
            if (node.Attributes["author"] != null)
            {
                _authorUserId = node.Attributes["author"].Value;
            }
            if (node.Attributes["authorname"] != null)
            {
                _authorUserName = node.Attributes["authorname"].Value;
            }
            if (node.Attributes["permalink"] != null)
            {
                _permaLink = new Uri(node.Attributes["permalink"].Value, true);
            }
            if (node.Attributes["datecreate"] != null)
            {
                _dateCreated = Utils.UnixTimestampToDate(node.Attributes["datecreate"].Value);
            }
            if (node.InnerXml.Length > 0)
            {
                _comment = node.InnerText;
            }
        }
Exemplo n.º 2
0
        internal ActivityEvent(XmlNode eventNode)
        {
            XmlNode node;

            node = eventNode.Attributes.GetNamedItem("type");
            if (node == null)
            {
                _type = ActivityEventType.Unknown;
            }
            else if (node.Value == "comment")
            {
                _type = ActivityEventType.Comment;
            }
            else if (node.Value == "note")
            {
                _type = ActivityEventType.Note;
            }
            else if (node.Value == "fave")
            {
                _type = ActivityEventType.Favourite;
            }
            else
            {
                _type = ActivityEventType.Unknown;
            }

            node = eventNode.Attributes.GetNamedItem("user");
            if (node != null)
            {
                _userId = node.Value;
            }

            node = eventNode.Attributes.GetNamedItem("username");
            if (node != null)
            {
                _userName = node.Value;
            }

            node = eventNode.Attributes.GetNamedItem("dateadded");
            if (node != null)
            {
                _dateAdded = Utils.UnixTimestampToDate(node.Value);
            }

            node = eventNode.FirstChild;
            if (node != null && node.NodeType == XmlNodeType.Text)
            {
                _content = node.Value;
            }
        }