Exemplo n.º 1
0
        public static bool BlogIdIsValid(string id)
        {
            BlogSettings blogSettings = null;

            try
            {
                blogSettings = BlogSettings.ForBlogId(id);
                if (!blogSettings.IsValid)
                {
                    return(false);
                }
                return(BlogClientManager.IsValidClientType(blogSettings.ClientType));
            }
            catch (ArgumentException)
            {
                Trace.WriteLine("Default blog has invalid client type, ignoring blog.");
                return(false);
            }
            finally
            {
                if (blogSettings != null)
                {
                    blogSettings.Dispose();
                }
            }
        }
Exemplo n.º 2
0
 public static WinInetCredentialsContext GetCredentialsContext(string blogId, string url)
 {
     using (BlogSettings blogSettings = BlogSettings.ForBlogId(blogId))
     {
         IBlogSettingsAccessor settings = blogSettings as IBlogSettingsAccessor;
         return(GetCredentialsContext(BlogClientManager.CreateClient(settings), settings.Credentials, url));
     }
 }
Exemplo n.º 3
0
 public static BlogDescriptor[] GetBlogs(bool sortByName)
 {
     string[]         ids   = GetBlogIds();
     BlogDescriptor[] blogs = new BlogDescriptor[ids.Length];
     for (int i = 0; i < ids.Length; i++)
     {
         using (BlogSettings settings = BlogSettings.ForBlogId(ids[i]))
             blogs[i] = new BlogDescriptor(ids[i], settings.BlogName, settings.HomepageUrl);
     }
     if (sortByName)
     {
         Array.Sort(blogs, new BlogDescriptor.Comparer());
     }
     return(blogs);
 }
Exemplo n.º 4
0
 public Blog(string blogId)
 {
     _settings = BlogSettings.ForBlogId(blogId);
 }