/// <summary>
        /// Initialize a new instance of the WordPress Client class
        /// </summary>
        /// <param name="siteConfig">WordPress Site Config</param>
        public WordPressClient(WordPressSiteConfig siteConfig)
        {
            WordPressSiteConfig = siteConfig;

            WordPressService = (IWordPressService)XmlRpcProxyGen.Create(typeof(IWordPressService));
            WordPressService.Url = WordPressSiteConfig.FullUrl;
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WordPressClient" /> class.
        /// </summary>
        /// <param name="siteConfig">The site configuration.</param>
        public WordPressClient(WordPressSiteConfig siteConfig)
        {
            WordPressSiteConfig = siteConfig;

            WordPressService     = (IWordPressService)XmlRpcProxyGen.Create(typeof(IWordPressService));
            WordPressService.Url = WordPressSiteConfig.FullUrl;
        }
示例#3
0
文件: PostBuilder.cs 项目: semlie/ads
 public PostBuilder(string url,string userName,string password)
 {
     Config = new WordPressSiteConfig
     {
         BlogId = 1,
         BaseUrl = url,
         Username = userName,
         Password = password
     };
 }
示例#4
0
        private void OptionsSave_Click(object sender, EventArgs e)
        {
            // Encrypt the password - http://stackoverflow.com/questions/12657792/how-to-securely-save-username-password-local
            byte[] clearPassword = Encoding.UTF8.GetBytes(optionWordPressPassword.Text);
            byte[] ciphertext = ProtectedData.Protect(clearPassword, entropy, DataProtectionScope.CurrentUser);

            WordPressSiteConfig config = new WordPressSiteConfig();

            config.BaseUrl = optionWordPressURL.Text;
            config.Username = optionWordPressUsername.Text;
            config.Password = System.Convert.ToBase64String(ciphertext);
            config.BlogId = 1;

            if (Properties.Settings.Default.sitesList == null)
            {
                Properties.Settings.Default.sitesList = new List<WordPressSiteConfig>();
            }
            Properties.Settings.Default.sitesList.Add(config);

            Debug.Write(config.BaseUrl.ToString() + "\n");

            Properties.Settings.Default.Save();

            _sites.Add(optionWordPressURL.Text);
            siteListBox.DataSource = _sites;
        }