using System;
using Microsoft.Win32;
using DasBlogNewsGatorPlugin;
namespace NGPlugins{
public class Media
{
public Media()
{
}
public static string GetMediaString()
{
if (ConfigInfo.IncludeMedia)
{
RegistryKey regKey = Registry.CurrentUser.OpenSubKey(keyName);
if (regKey == null)
return "";
string author = regKey.GetValue("Author","").ToString();
string title = regKey.GetValue("Title","").ToString();
string duration = regKey.GetValue("DurationString","").ToString();
string album = regKey.GetValue("Album","").ToString();
regKey.Close();
string str = ConfigInfo.MediaTemplate;
string compareStr = str;
str = str.Replace("{$author}",author);
str = str.Replace("{$title}",title);
str = str.Replace("{$duration}",duration);
str = str.Replace("{$album}",album);
compareStr = compareStr.Replace("{$author}","");
compareStr = compareStr.Replace("{$title}","");
compareStr = compareStr.Replace("{$duration}","");
compareStr = compareStr.Replace("{$album}","");
if (str.CompareTo(compareStr) == 0)
return "";
else
return str;
}
else
return "";
}
static protected string keyName = "Software\\Microsoft\\MediaPlayer\\CurrentMetadata";
}
}
|