#region Using Statements
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.RecipeFramework;
using Microsoft.Win32; 
#endregion

namespace Microsoft.Practices.RecipeFramework.Extensions.Actions.OS
{
    /// <summary>
    /// Action that reads a Local Machine registry entry
    /// </summary>
	public class ReadLocalMachineEntryAction : ReadRegistryEntryAction
	{
		#region ReadRegistryEntryAction Implementation
        /// <summary>
        /// Executes this instance.
        /// </summary>
		public override void Execute()
        {
            RegistryKey key = Registry.LocalMachine.OpenSubKey(this.registryPath) as RegistryKey;

            if(key != null)
            {
                if(key.GetValue(this.registryEntry) != null)
                {
                    this._value = key.GetValue(this.registryEntry).ToString();
                }
            }
        }

        /// <summary>
        /// Undoes this instance.
        /// </summary>
        public override void Undo()
        {
            //Do Nothing
        }
        #endregion
    }
}
