Пример #1
0
        static IEnumerable <Post> GetPosts(string username, string password, string[] postIds)
        {
            string   url     = string.Format("http://www.cppblog.com/{0}/services/metaweblog.aspx", username);
            ICppblog cppblog = XmlRpcClient.Create <ICppblog>(url);

            int count = 0;

            foreach (var id in postIds)
            {
                Post post = null;
                try
                {
                    post = cppblog.GetPost(id, username, password);
                    Console.WriteLine("{0}/{1}", ++count, postIds.Length);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Post {0}: {1}", id, ex.Message);
                }
                if (post != null)
                {
                    yield return(post);
                }
            }
        }