private bool CanReset(RegistryEntry entry)
        {
            if (entry is null)
            {
                return(false);
            }

            if (entry.IsUserSpecific() && !entry.IsHiveAvailable())
            {
                Logger.Log($"User hive is not available, cannot reset registry key '{entry}'!");

                return(false);
            }

            return(true);
        }
示例#2
0
 private static void Reset(RegistryEntry entry, object value)
 {
     try
     {
         if (entry.IsUserSpecific() && !entry.IsHiveAvailable())
         {
             OutputAndLog($"User hive is not available, cannot reset registry key '{entry}'!");
         }
         else
         {
             entry.SetValue(value);
             Console.ForegroundColor = ConsoleColor.Green;
             OutputAndLog($@"Successfully set '{entry}' to '{value}'");
         }
     }
     catch (Exception e)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         OutputAndLog($@"Failed to set '{entry}' to '{value}'");
         Log(e);
     }
 }