using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using newtelligence.DasBlog.Web.Core;
using System.IO;
namespace newtelligence.DasBlog.Runtime.Azure{
public class ProfileDataServiceAzure : StreamDataServiceAzure, IProfileDataService
{
public ProfileDataServiceAzure(string location)
{
// ...
}
public string LoadProfileContent(string username)
{
var writer = new StringWriter();
using (var stream = base.LoadFileStream(username, "profiles"))
{
if (stream == null || stream.Length == 0) { return ""; }
stream.Position = 0;
using (var sr = new StreamReader(stream))
{
return sr.ReadToEnd();
}
}
}
public void SaveProfileContent(string username, string content)
{
if (string.IsNullOrEmpty(username)) { throw new ArgumentNullException("username"); }
if (content == null) { return; }
var data = new MemoryStream( Encoding.UTF8.GetBytes(content));
data.Position = 0;
base.SaveFileStream(username, "profiles", data);
}
}
}
|