BlogEngine.Core/Providers/XmlProvider/Profiles.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml;

namespace BlogEngine.Core.Providers
{
	public partial class XmlBlogProvider : BlogProvider
	{
		public override AuthorProfile SelectProfile(string id)
		{
			string fileName = _Folder + "profiles" + Path.DirectorySeparatorChar + id.ToString() + ".xml";
			XmlDocument doc = new XmlDocument();
			doc.Load(fileName);

			AuthorProfile profile = new AuthorProfile(id);

			if (doc.SelectSingleNode("//DisplayName") != null)
				profile.DisplayName = doc.SelectSingleNode("//DisplayName").InnerText;

			if (doc.SelectSingleNode("//FirstName") != null)
				profile.FirstName = doc.SelectSingleNode("//FirstName").InnerText;

			if (doc.SelectSingleNode("//MiddleName") != null)
				profile.MiddleName = doc.SelectSingleNode("//MiddleName").InnerText;

			if (doc.SelectSingleNode("//LastName") != null)
				profile.LastName = doc.SelectSingleNode("//LastName").InnerText;

			//profile.Address1 = doc.SelectSingleNode("//Address1").InnerText;
			//profile.Address2 = doc.SelectSingleNode("//Address2").InnerText;
			if (doc.SelectSingleNode("//CityTown") != null)
				profile.CityTown = doc.SelectSingleNode("//CityTown").InnerText;

			if (doc.SelectSingleNode("//RegionState") != null)
				profile.RegionState = doc.SelectSingleNode("//RegionState").InnerText;

			if (doc.SelectSingleNode("//Country") != null)
				profile.Country = doc.SelectSingleNode("//Country").InnerText;

			if (doc.SelectSingleNode("//Birthday") != null)
			{
				DateTime date;
				if (DateTime.TryParse(doc.SelectSingleNode("//Birthday").InnerText, out date))
					profile.Birthday = date;
			}

			if (doc.SelectSingleNode("//AboutMe") != null)
				profile.AboutMe = doc.SelectSingleNode("//AboutMe").InnerText;

			if (doc.SelectSingleNode("//PhotoURL") != null)
				profile.PhotoURL = doc.SelectSingleNode("//PhotoURL").InnerText;

			if (doc.SelectSingleNode("//Company") != null)
				profile.Company = doc.SelectSingleNode("//Company").InnerText;

			if (doc.SelectSingleNode("//EmailAddress") != null)
				profile.EmailAddress = doc.SelectSingleNode("//EmailAddress").InnerText;

后面还有 89 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。