コード例 #1
0
        /// <summary>
        /// overwritten Query method
        /// </summary>
        /// <param name="feedQuery">The FeedQuery to use</param>
        /// <returns>the retrieved NicknameFeed</returns>
        public NicknameFeed Query(NicknameQuery feedQuery)
        {
            try
            {
                Stream       feedStream = Query(feedQuery.Uri);
                NicknameFeed feed       = new NicknameFeed(feedQuery.Uri, this);
                feed.Parse(feedStream, AlternativeFormat.Atom);
                feedStream.Close();

                if (feedQuery.RetrieveAllNicknames)
                {
                    AtomLink next, prev = null;
                    while ((next = feed.Links.FindService("next", null)) != null && next != prev)
                    {
                        feedStream = Query(new Uri(next.HRef.ToString()));
                        feed.Parse(feedStream, AlternativeFormat.Atom);
                        feedStream.Close();

                        prev = next;
                    }
                }

                return(feed);
            }
            catch (GDataRequestException e)
            {
                AppsException a = AppsException.ParseAppsException(e);
                throw (a == null ? e : a);
            }
        }
コード例 #2
0
ファイル: nicknameservice.cs プロジェクト: mintwans/cpsc483
        /// <summary>
        /// overwritten Query method
        /// </summary>
        /// <param name="feedQuery">The FeedQuery to use</param>
        /// <returns>the retrieved NicknameFeed</returns>
        public NicknameFeed Query(NicknameQuery feedQuery)
        {
            try
            {
                Stream feedStream = Query(feedQuery.Uri);
                NicknameFeed feed = new NicknameFeed(feedQuery.Uri, this);
                feed.Parse(feedStream, AlternativeFormat.Atom);
                feedStream.Close();

                if (feedQuery.RetrieveAllNicknames)
                {
                    AtomLink next, prev = null;
                    while ((next = feed.Links.FindService("next", null)) != null && next != prev)
                    {
                        feedStream = Query(new Uri(next.HRef.ToString()));
                        feed.Parse(feedStream, AlternativeFormat.Atom);
                        feedStream.Close();

                        prev = next;
                    }
                }

                return feed;
            }
            catch (GDataRequestException e)
            {
                AppsException a = AppsException.ParseAppsException(e);
                throw (a == null ? e : a);
            }
        }
コード例 #3
0
ファイル: nicknameservice.cs プロジェクト: Zelxin/RPiKeg
 /// <summary>
 /// Inserts a new nickname entry into the specified feed.
 /// </summary>
 /// <param name="feed">the feed into which this entry should be inserted</param>
 /// <param name="entry">the entry to insert</param>
 /// <returns>the inserted entry</returns>
 public NicknameEntry Insert(NicknameFeed feed, NicknameEntry entry) {
     try {
         return base.Insert(feed, entry) as NicknameEntry;
     } catch (GDataRequestException e) {
         AppsException a = AppsException.ParseAppsException(e);
         throw a ?? e;
     }
 }
コード例 #4
0
 /// <summary>
 /// Inserts a new nickname entry into the specified feed.
 /// </summary>
 /// <param name="feed">the feed into which this entry should be inserted</param>
 /// <param name="entry">the entry to insert</param>
 /// <returns>the inserted entry</returns>
 public NicknameEntry Insert(NicknameFeed feed, NicknameEntry entry)
 {
     try {
         return(base.Insert(feed, entry) as NicknameEntry);
     } catch (GDataRequestException e) {
         AppsException a = AppsException.ParseAppsException(e);
         throw a ?? e;
     }
 }
コード例 #5
0
ファイル: appsservice.cs プロジェクト: zngduong/google-gdata
        /// <summary>
        /// Retrieves the specified nickname.
        /// </summary>
        /// <param name="nickname">the nickname to retrieve</param>
        /// <returns>the resulting NicknameEntry</returns>
        public NicknameEntry RetrieveNickname(string nickname)
        {
            NicknameQuery query = new NicknameQuery(Domain);

            query.Nickname = nickname;

            NicknameFeed feed = nicknameService.Query(query);

            // It's safe to access Entries[0] here, because the service will
            // have already thrown an exception if the nickname was invalid.
            return(feed.Entries[0] as NicknameEntry);
        }