using System;
using Microsoft.Win32;
namespace PublicBill.RegeditAction
{
class RegeditAction
{
[STAThread]
static void Main(string[] args)
{
string mediaPlayerVersion = new RegeditAction().GetRegeditData();
Console.WriteLine("Windows Media Player Version: " + mediaPlayerVersion);
}
/// <summary>
/// Get local machine the highest version of media player.
/// </summary>
/// <returns></returns>
private string GetRegeditData()
{
RegistryKey localMachine = Registry.LocalMachine;
RegistryKey software = localMachine.OpenSubKey("SOFTWARE");
RegistryKey microsoft = software.OpenSubKey("Microsoft");
RegistryKey mediaPlayer = microsoft.OpenSubKey("MediaPlayer");
RegistryKey playerUpgrade = mediaPlayer.OpenSubKey("PlayerUpgrade");
string registData = playerUpgrade.GetValue("PlayerVersion", "have no this value.").ToString();
return registData;
}
}
}
using Microsoft.Win32;
namespace PublicBill.RegeditAction
{
class RegeditAction
{
[STAThread]
static void Main(string[] args)
{
string mediaPlayerVersion = new RegeditAction().GetRegeditData();
Console.WriteLine("Windows Media Player Version: " + mediaPlayerVersion);
}
/// <summary>
/// Get local machine the highest version of media player.
/// </summary>
/// <returns></returns>
private string GetRegeditData()
{
RegistryKey localMachine = Registry.LocalMachine;
RegistryKey software = localMachine.OpenSubKey("SOFTWARE");
RegistryKey microsoft = software.OpenSubKey("Microsoft");
RegistryKey mediaPlayer = microsoft.OpenSubKey("MediaPlayer");
RegistryKey playerUpgrade = mediaPlayer.OpenSubKey("PlayerUpgrade");
string registData = playerUpgrade.GetValue("PlayerVersion", "have no this value.").ToString();
return registData;
}
}
}