xml-rpc(2)-first demo_v2

None.gif         [XmlRpcMethod( " blogger.getUsersBlogs " , Description  =   " 获取博客信息 " )]
None.gif        
public  BlogInfo[] getUsersBlogs( string  appKey,  string  username,  string  password)
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif            BlogInfo[] infoarr 
= new BlogInfo[1];
InBlock.gif            
for (int i = 0; i < 1; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Member member 
= GetUser(username, password);
InBlock.gif                
if (member != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    infoarr[i].url 
= GetAppPath() + "Blog/User/Default.aspx?UserName=" + HttpContext.Current.Server.UrlEncode(member.UserName);
InBlock.gif                    infoarr[i].blogName 
= GetBlogSetting(Convert.ToInt32(member.MemberID)).BlogName;
InBlock.gif                    infoarr[i].blogid 
= member.MemberID.ToString();
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif            
return infoarr;
ExpandedBlockEnd.gif        }

None.gif
None.gif        [XmlRpcMethod(
" metaWeblog.getCategories " , Description  =   " 获取分类列表 " )]
None.gif        
public  CategoryInfo[] getCategories( string  blogid,  string  username,  string  password)
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif
InBlock.gif            TList
<BlogKind> list = GetBlogKind(int.Parse(blogid));
InBlock.gif
InBlock.gif            CategoryInfo[] infoarr 
= new CategoryInfo[list.Count];
InBlock.gif
InBlock.gif            
for (int i = 0; i < infoarr.Length; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                infoarr[i].categoryid 
= list[i].BlogKindID.ToString();
InBlock.gif                infoarr[i].description 
= list[i].KindName;
InBlock.gif                infoarr[i].htmlUrl 
= "";
InBlock.gif                infoarr[i].rssUrl 
= "";
InBlock.gif                infoarr[i].title 
= list[i].KindName;
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif            
return infoarr;
ExpandedBlockEnd.gif        }

None.gif
None.gif        [XmlRpcMethod(
" metaWeblog.newPost " , Description  =   " 发表日志 " )]
None.gif        
public   string  newPost( string  blogid,  string  username,  string  password, CookComputing.MetaWeblog.Post post,  bool  publish)
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif            Member member 
= GetUser(username, password);
InBlock.gif            
if (member != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                BlogTopic xBlogTopic 
= new BlogTopic();
InBlock.gif
InBlock.gif                xBlogTopic.Title 
= post.title;
InBlock.gif                xBlogTopic.Content 
= post.description;
InBlock.gif                xBlogTopic.Weather 
= 0;
InBlock.gif                xBlogTopic.Face 
= 1;
InBlock.gif                xBlogTopic.CommentNum 
= 0;
InBlock.gif                xBlogTopic.IsBast 
= 0;
InBlock.gif                xBlogTopic.IsShow 
= 1;
InBlock.gif                xBlogTopic.ComeFrom 
= username;
InBlock.gif                xBlogTopic.Summary 
= "";
InBlock.gif                xBlogTopic.IsTop 
= 0;
InBlock.gif                xBlogTopic.LastIp 
= HttpContext.Current.Request.Url.Host;
InBlock.gif                xBlogTopic.Hits 
= 0;
InBlock.gif                xBlogTopic.CheckInTime 
= DateTime.Now;
InBlock.gif                xBlogTopic.Status 
= 1;
InBlock.gif                xBlogTopic.MemberID 
= Convert.ToInt32(blogid);
InBlock.gif                xBlogTopic.Tags 
= "";
InBlock.gif                xBlogTopic.BlogSystemTypeID 
= null;
InBlock.gif                xBlogTopic.Score 
= 0;
InBlock.gif                
if (!string.IsNullOrEmpty(post.categories[0]))
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
foreach (CategoryInfo info in getCategories(blogid, username, password))
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
if (info.title == post.categories[0])
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            xBlogTopic.BlogKindID 
= int.Parse(info.categoryid);
InBlock.gif                            
break;
ExpandedSubBlockEnd.gif                        }

ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

InBlock.gif                xBlogTopic.BastTime 
= null;
InBlock.gif
InBlock.gif                BlogTopicSystem.Instance.Create(xBlogTopic);
InBlock.gif
InBlock.gif                
return xBlogTopic.BlogTopicID.ToString();
ExpandedSubBlockEnd.gif            }

InBlock.gif            
return "0";
ExpandedBlockEnd.gif        }

None.gif
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值