BlueFenix.MetaWeblog/MetaBlog.cs
(开头部分) 10KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Web;
using System.Web.Security;
using System.Collections;
using CookComputing.XmlRpc;
using MarkItUp.SingleUserBlog.Common;
using MarkItUp.SingleUserBlog.Services;
using System.Security.Principal;
using System.IO;
namespace BlueFenix.MetaWeblog {
public class MetaBlog : XmlRpcService, IMetaWeblog, IBlogger {
public MetaBlog() {
}
private bool Authenticate(string username, string password) {
bool result = DataLayer.Instance.Authenticate(username, password);
if (result)
{
HttpContext.Current.User = new GenericPrincipal(new GenericIdentity(username), new string[] { });
}
return result;
}
private Post ToMetaWeblogPost(MarkItUp.SingleUserBlog.Services.Post subPost) {
Post convert = new Post();
convert.categories = this.ToCategoryNameArray(subPost.Id);
convert.dateCreated = subPost.DateCreated;
convert.description = subPost.Description;
convert.postid = subPost.Id;
convert.title = subPost.DisplayName;
convert.permalink = FormatPermalink(subPost);
convert.link = convert.permalink;
convert.userid = Globals.UserLoginName;
return convert;
}
private string[] ToCategoryNameArray(string postId) {
CategoryCollection subCategories = DataLayer.Instance.ListCategoriesByPost(postId);
ArrayList metaWeblogCategories = new ArrayList(subCategories.Count);
foreach (MarkItUp.SingleUserBlog.Services.Category category in subCategories) {
metaWeblogCategories.Add(category.DisplayName);
}
return (string[])metaWeblogCategories.ToArray(typeof(string));
}
private string[] ToCategoryIdArray(string[] categories) {
ArrayList categoryIds = new ArrayList(categories.Length);
// TODO: This isn't the nicest way of doing this
CategoryCollection subCategories = DataLayer.Instance.ListCategories();
foreach(MarkItUp.SingleUserBlog.Services.Category subCategory in subCategories) {
foreach (string cat in categories)
{
if (cat == subCategory.DisplayName)
categoryIds.Add(subCategory.Id);
后面还有 194 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
