예제 #1
0
        protected override void Execute(CodeActivityContext context)
        {
            string hive = null;

            switch (Hive.Get(context))
            {
            case Microsoft.Win32.RegistryHive.ClassesRoot:
                hive = "HKEY_CLASSES_ROOT";
                break;

            case Microsoft.Win32.RegistryHive.CurrentConfig:
                hive = "HKEY_CURRENT_CONFIG";
                break;

            case Microsoft.Win32.RegistryHive.CurrentUser:
                hive = "HKEY_CURRENT_USER";
                break;

            case Microsoft.Win32.RegistryHive.DynData:
                hive = "HKEY_DYN_DATA";
                break;

            case Microsoft.Win32.RegistryHive.LocalMachine:
                hive = "HKEY_LOCAL_MACHINE";
                break;

            case Microsoft.Win32.RegistryHive.PerformanceData:
                hive = "HKEY_PERFORMANCE_DATA";
                break;

            case Microsoft.Win32.RegistryHive.Users:
                hive = "HKEY_USERS";
                break;
            }

            string keyName = string.Format("{0}\\{1}", hive, KeyPath.Get(context).TrimEnd('\\'));

            object returnValue = Microsoft.Win32.Registry.GetValue(keyName, ValueName.Get(context), DefaultValue.Get(context));

            OutputValue.Set(context, returnValue);
        }