Exemplo n.º 1
0
        private void btnPost_Click(object sender, EventArgs e)
        {
            blogInfo newBlogPost = default(blogInfo);

            newBlogPost.title       = txtTitle.Text;
            newBlogPost.description = txtPost.Text;

            categories     = (IgetCatList)XmlRpcProxyGen.Create(typeof(IgetCatList));
            clientProtocol = (XmlRpcClientProtocol)categories;

            clientProtocol.Url = "http://127.0.0.1/wpl/xmlrpc.php";

            string result = null;

            result = "";

            try {
                result = categories.NewPage(1, "shoban", "shoban", newBlogPost, 1);
                MessageBox.Show("Posted to Blog successfullly! Post ID : " + result);
                txtPost.Text  = "";
                txtTitle.Text = "";
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
        private void btn匯至網站_Click(object sender, EventArgs e)
        {
            blogInfo newBlogPost = default(blogInfo);

            ICL  = (IgetCatList)XmlRpcProxyGen.Create(typeof(IgetCatList));
            XRCP = (XmlRpcClientProtocol)ICL;

            XRCP.Url = tb網址.Text;

            string result = null;

            result = "";

            string[] strArrFilePaths = Directory.GetFiles(tb已加值文目錄.Text);

            foreach (string strFilePath in strArrFilePaths)
            {
                newBlogPost.title       = Path.GetFileNameWithoutExtension(strFilePath);
                newBlogPost.description = File.ReadAllText(strFilePath, Encoding.Default);

                try
                {
                    result = ICL.NewPage(1, tb帳號.Text, tb密碼.Text, newBlogPost, 1);
                    MessageBox.Show("Posted to Blog successfullly! Post ID : " + result);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Exemplo n.º 3
0
        private void ProcessDataWordpress(String url)
        {
            blogInfo newBlogPost = default(blogInfo);

            newBlogPost.title       = Spinner.Spin(txtTitle.Text);
            newBlogPost.description = Spinner.Spin(editor1.BodyHtml);
            categories     = (IgetCatList)XmlRpcProxyGen.Create(typeof(IgetCatList));
            clientProtocol = (XmlRpcClientProtocol)categories;

            string linkwordpress = "";
            string username      = "";
            string password      = "";

            string[] words = url.Split('|');

            linkwordpress = words[0];
            username      = words[1];
            password      = words[2];

            txtSite.Text = linkwordpress;
            txtUser.Text = username;
            txtPass.Text = password;

            clientProtocol.Url = "https://" + linkwordpress + "/xmlrpc.php";

            string result = null;

            result = "";
            try
            {
                result = categories.NewPage(1, username, password, newBlogPost, 1);
                //MessageBox.Show("Posted to Blog successfullly! Post ID : " + result);
                //txtPost.Text = "";
                //txtTitle.Text = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }