Esempio n. 1
0
        public static Microsoft.Samples.FeedSync.Feed Create(string i_Title, string i_Description, string i_Link, Microsoft.Samples.FeedSync.Feed.FeedTypes i_FeedType)
        {
            Microsoft.Samples.FeedSync.Feed Feed = new Microsoft.Samples.FeedSync.Feed
                (
                i_Title,
                i_Description,
                i_Link,
                i_FeedType
                );

            return Feed;
        }
Esempio n. 2
0
        public SharingNode(Microsoft.Samples.FeedSync.Feed i_Feed, System.Xml.XmlElement i_SharingXmlElement)
        {
            m_Feed = i_Feed;

            m_XmlElement = i_SharingXmlElement;

            if (m_XmlElement.HasAttribute(Microsoft.Samples.FeedSync.Constants.SINCE_ATTRIBUTE))
                m_Since = m_XmlElement.GetAttribute(Microsoft.Samples.FeedSync.Constants.SINCE_ATTRIBUTE);

            if (m_XmlElement.HasAttribute(Microsoft.Samples.FeedSync.Constants.UNTIL_ATTRIBUTE))
                m_Until = m_XmlElement.GetAttribute(Microsoft.Samples.FeedSync.Constants.SINCE_ATTRIBUTE);

            if (m_XmlElement.HasAttribute(Microsoft.Samples.FeedSync.Constants.EXPIRES_ATTRIBUTE))
            {
                string Expires = m_XmlElement.GetAttribute(Microsoft.Samples.FeedSync.Constants.EXPIRES_ATTRIBUTE);
                System.DateTime ExpiresDateTime;

                if (System.DateTime.TryParse(Expires, out ExpiresDateTime))
                    m_Expires = ExpiresDateTime;
            }

            string XPathQuery = System.String.Format
                (
                "{0}:{1}",
                m_Feed.FeedSyncNamespacePrefix,
                Microsoft.Samples.FeedSync.Constants.RELATED_ELEMENT_NAME
                );

            System.Xml.XmlNodeList RelatedNodeList = i_SharingXmlElement.SelectNodes
                (
                XPathQuery,
                m_Feed.XmlNamespaceManager
                );

            foreach (System.Xml.XmlElement RelatedNodeXmlElement in RelatedNodeList)
            {
                Microsoft.Samples.FeedSync.RelatedNode RelatedNode = Microsoft.Samples.FeedSync.RelatedNode.CreateFromXmlElement
                    (
                    this,
                    RelatedNodeXmlElement
                    );

                m_RelatedNodeList.Add(RelatedNode);
            }
        }
Esempio n. 3
0
        private FeedItemNode(Microsoft.Samples.FeedSync.Feed i_Feed, System.Xml.XmlElement i_FeedItemXmlElement, string i_SyncNodeID, int i_Sequence, System.DateTime? i_WhenDateTime, string i_By, bool i_Deleted, bool i_NoConflicts, int i_Updates)
        {
            m_Feed = i_Feed;

            this.GetFeedItemDataFromXmlElement(i_FeedItemXmlElement);

            m_XmlElement = i_FeedItemXmlElement;

            m_SyncNode = Microsoft.Samples.FeedSync.SyncNode.CreateNew
                (
                m_Feed, 
                this,
                i_SyncNodeID,
                i_Sequence,
                i_WhenDateTime,
                i_By,
                i_Deleted,
                i_NoConflicts,
                i_Updates
                );

            if (m_XmlElement.ChildNodes.Count > 0)
                m_XmlElement.InsertBefore(m_SyncNode.XmlElement, m_XmlElement.ChildNodes[0]);
            else
                m_XmlElement.AppendChild(m_SyncNode.XmlElement);
            if (m_Feed.FeedType == Microsoft.Samples.FeedSync.Feed.FeedTypes.Atom)
                this.AddUpdatedElement();
        }
Esempio n. 4
0
        private FeedItemNode(Microsoft.Samples.FeedSync.Feed i_Feed, System.Xml.XmlElement i_FeedItemXmlElement, string i_SyncNodeID)
        {
            m_Feed = i_Feed;

            this.GetFeedItemDataFromXmlElement(i_FeedItemXmlElement);

            m_XmlElement = i_FeedItemXmlElement;

            m_SyncNode = Microsoft.Samples.FeedSync.SyncNode.CreateNew
                (
                m_Feed,
                this,
                i_SyncNodeID
                );

            if (m_XmlElement.ChildNodes.Count > 0)
                m_XmlElement.InsertBefore(m_SyncNode.XmlElement, m_XmlElement.ChildNodes[0]);
            else
                m_XmlElement.AppendChild(m_SyncNode.XmlElement);
        }
Esempio n. 5
0
        private FeedItemNode(Microsoft.Samples.FeedSync.Feed i_Feed, System.Xml.XmlElement i_FeedItemXmlElement)
        {
            m_Feed = i_Feed;

            this.GetFeedItemDataFromXmlElement(i_FeedItemXmlElement);

            m_XmlElement = i_FeedItemXmlElement;

            #region Get sx:sync element

            string ElementName = System.String.Format
                (
                "{0}:{1}",
                i_Feed.FeedSyncNamespacePrefix,
                Microsoft.Samples.FeedSync.Constants.SYNC_ELEMENT_NAME
                );

            System.Xml.XmlElement SyncNodeXmlElement = (System.Xml.XmlElement)m_XmlElement.SelectSingleNode
                (
                ElementName, 
                i_Feed.XmlNamespaceManager
                );

            if (SyncNodeXmlElement == null)
                throw new System.ArgumentException("Item is missing 'sx:sync' element!");

            m_SyncNode = Microsoft.Samples.FeedSync.SyncNode.CreateFromXmlElement(this, SyncNodeXmlElement);

            #endregion
        }
Esempio n. 6
0
        public static Microsoft.Samples.FeedSync.Feed ConvertFromFeed(System.Xml.XmlDocument i_FeedXmlDocument, int? i_SequenceIDBase, string i_Since, string i_Until)
        {
            Microsoft.Samples.FeedSync.Feed Feed = new Microsoft.Samples.FeedSync.Feed
                (
                i_FeedXmlDocument,
                i_SequenceIDBase,
                i_Since,
                i_Until
                );

            return Feed;
        }
Esempio n. 7
0
 public static Microsoft.Samples.FeedSync.Feed Create(System.Xml.XmlDocument i_FeedSyncXmlDocument)
 {
     Microsoft.Samples.FeedSync.Feed Feed = new Microsoft.Samples.FeedSync.Feed(i_FeedSyncXmlDocument);
     return Feed;
 }