// Copyright 2005 by Omar Al Zabir. All rights are reserved.
//
// If you like this code then feel free to go ahead and use it.
// The only thing I ask is that you don't remove or alter my copyright notice.
//
// Your use of this software is entirely at your own risk. I make no claims or
// warrantees about the reliability or fitness of this code for any particular purpose.
// If you make changes or additions to this code please mark your code as being yours.
//
// website http://www.oazabir.com, email OmarAlZabir@gmail.com, msn oazabir@hotmail.com
using System;
using System.Collections;
using System.Configuration;
namespace RSSBlogAPI{
using DotText;
/// <summary>
/// Blog API for .Text
/// </summary>
public class DotTextAPI : BlogAPIBase
{
public override bool HasCategories
{
get { return true; }
}
public override bool HasBlogId
{
get { return false; }
}
public override string EngineName
{
get { return ".TEXT SimpleBlogService"; }
}
public override string HelpText
{
get { return ".Text Blog sites"; }
}
public override void Test()
{
this.GetCategories();
}
/// <summary>
/// Retrieve categories by calling the SimpleBlogService webservice
/// </summary>
/// <returns></returns>
public override Category [] GetCategories()
{
SBSSimpleBlogService svc = new SBSSimpleBlogService();
svc.Url = this.Url;
svc.Proxy = this.ProxyServer;
string password = this.Password;
string [] categories = svc.GetCategories( this.Username, password );
Category [] output = new Category [ categories.Length ];
for( int i=0; i<categories.Length; i++ )
output[i] = new Category( 0, string.Empty, categories[i] );
return output;
}
/// <summary>
/// Post a blog entry by calling simple blog service
/// </summary>
/// <param name="post"></param>
/// <returns></returns>
public override string PostItem( Post post )
{
SBSSimpleBlogService svc = new SBSSimpleBlogService();
svc.Proxy = this.ProxyServer;
svc.Url = this.Url;
string [] cats = new string[ post.Categories.Length ];
for( int i=0; i<post.Categories.Length; i++ )
cats[i] = post.Categories[i].Title;
string password = this.Password;
return svc.InsertCategoryPost(
this.Username,
password,
post.Date,
post.Title,
post.Text,
cats ).ToString();
}
}
}
|