コード例 #1
0
ファイル: WPUpload.cs プロジェクト: mrfreitag/Avigero
        static void Main(string[] args)
        {
            WPMetaWeblog mw = new WPMetaWeblog();
            Console.Write("Please enter your username: "******"Please enter your password: "******"..\Output\TimeSeries\";

            try
            {

                // Space3Pqc3yUo00Y0
                foreach (string file in Directory.GetFiles(inputFolder))
                {
                    FileInfo finfo = new FileInfo(file);

                    Page page = new Page();
                    page.categories = new string[] { "Time Series" };
                    page.title = finfo.Name.Replace(".htm", string.Empty);

                    TextReader FileReader = null;
                    FileReader = File.OpenText(file);
                    string Content = FileReader.ReadToEnd();
                    FileReader.Close();

                    page.description = Content;
                    page.dateCreated = DateTime.Now;

                    string id = mw.newPage("Avigero", username, password, page, true);
                }
                //Post post = new Post();
                //post.categories = new string[] { "Test Posts" };
                //post.title = "Tets 3";
                //post.description = "This is my 3rd test post";
                //post.dateCreated = DateTime.Now;

                //post.title = "Test 3 (typo fixed)";

                //mw.editPost(id, username, password, post, true);

                //post = mw.getPost(id, username, password);
                //Console.WriteLine("Just edited the post with the title '{0}' at '{1}'", post.title, post.dateCreated);

                ///* display list of categories used on the blog */
                //Category[] categories = mw.getCategories("MyBlog", username, password);

                //foreach (Category c in categories)
                //{
                //    Console.WriteLine("Category: {0}", c.description);
                //}

                ///* display title of the ten most recent posts */
                //Post[] posts = mw.getRecentPosts("MyBlog", username, password, 10);

                //foreach (Post p in posts)
                //{
                //    Console.WriteLine("Post Title: {0}", p.title);
                //}

                //mw.deletePost(String.Empty, id, username, password, true);
                //Console.WriteLine("The post entitled '{0}' has been deleted", post.title);

                ///* get info on user's blogs */
                //UserBlog[] blogs = mw.getUsersBlogs(String.Empty, username, password);

                //foreach (UserBlog b in blogs)
                //{
                //    Console.WriteLine("The URL of '{0}' is {1}", b.blogName, b.url);
                //}

                ///* get info on the user */
                //UserInfo user = mw.getUserInfo(String.Empty, username, password);
                //Console.WriteLine("{0} {1} ({2}) is the owner of the space whose URL is {3}", user.firstname, user.lastname, user.email, user.url);

            }
            catch (XmlRpcFaultException xrfe)
            {
                Console.WriteLine("ERROR: {0}", xrfe.FaultString);
            }

            Console.ReadLine();
        }
コード例 #2
0
ファイル: WPUpload.cs プロジェクト: mrfreitag/Avigero
        public string newPage(
        string blogid,
        string username,
        string password,
        Page content,
        bool publish)
        {
            Uri bypass = new Uri("http://www.avigero.com");
            IWebProxy myProxy = new WebProxy();
            this.Proxy = myProxy;
            bool dobp = this.Proxy.IsBypassed(bypass);

            return (string)this.Invoke("newPage", new object[] { blogid, username, password, content, publish });
        }