Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
using System;
using Microsoft.Win32;
// Add a ref to C:\Program Files (x86)\Windows Live\Writer\WindowsLive.Writer.BlogClient.dll
using WindowsLive.Writer.BlogClient;
// Add a ref to C:\Program Files (x86)\Windows Live\Writer\WindowsLive.Writer.CoreServices.dll
using WindowsLive.Writer.CoreServices.Settings;
using WindowsLive.Writer.CoreServices;
namespace RecoverLiveWriterCredentials
{
class Program
{
static void Main(string[] args)
{
ApplicationEnvironment.Initialize();
RegistrySettingsPersister persister =
new RegistrySettingsPersister(Registry.CurrentUser,
@"Software\\Microsoft\\Windows Live\\Writer\\Weblogs");
string[] names = persister.GetSubSettings();
for (int i = 0; i < names.Length; i++)
{
ISettingsPersister blogPersister = persister.GetSubSettings(names[i]);
SettingsPersisterHelper settings = new SettingsPersisterHelper(blogPersister);
CredentialsDomain domain = new CredentialsDomain("name", "description", null, null);
BlogCredentials creds = new BlogCredentials(settings, domain);
Console.WriteLine("Blog: {0}", blogPersister.Get("BlogName"));
Console.WriteLine("Username: {0}", creds.Username);
Console.WriteLine("Password: {0}", creds.Password);
Console.WriteLine();
}
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment