/// <summary>
/// The delete profile.
/// </summary>
/// <param name="profile">
/// The profile.
/// </param>
public override void DeleteProfile(AuthorProfile profile)
{
var fileName = string.Format("{0}profiles{1}{2}.xml", GetFolder(profile.Blog), Path.DirectorySeparatorChar, profile.Id);
if (File.Exists(fileName))
{
File.Delete(fileName);
}
if (AuthorProfile.Profiles.Contains(profile))
{
AuthorProfile.Profiles.Remove(profile);
}
// remove profile picture
var dir = BlogService.GetDirectory("/avatars");
foreach (var f in dir.Files)
{
var dot = f.Name.IndexOf(".");
var img = dot > 0 ? f.Name.Substring(0, dot) : f.Name;
if (profile.UserName == img)
{
f.Delete();
}
}
}