Hopex.RegEdit 23.0.1

dotnet add package Hopex.RegEdit --version 23.0.1
NuGet\Install-Package Hopex.RegEdit -Version 23.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hopex.RegEdit" Version="23.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Hopex.RegEdit --version 23.0.1
#r "nuget: Hopex.RegEdit, 23.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Hopex.RegEdit as a Cake Addin
#addin nuget:?package=Hopex.RegEdit&version=23.0.1

// Install Hopex.RegEdit as a Cake Tool
#tool nuget:?package=Hopex.RegEdit&version=23.0.1

Windows registry supports classes by Schizo

The library contains auxiliary utility for writing and reading data from the windows registry.

Adding to the project

.NET CLI
> dotnet add package Hopex.RegEdit --version 23.0.1
Package Manager
PM> NuGet\Install-Package Hopex.RegEdit -Version 23.0.1
PackageReference
<PackageReference Include="Hopex.RegEdit" Version="23.0.1" />
Paket CLI
> paket add Hopex.RegEdit --version 23.0.1
Script & Interactive
> #r "nuget: Hopex.RegEdit, 23.0.1"
Cake
// Install Hopex.RegEdit as a Cake Addin
#addin nuget:?package=Hopex.RegEdit&version=23.0.1

// Install Hopex.RegEdit as a Cake Tool
#tool nuget:?package=Hopex.RegEdit&version=23.0.1

How to use

Writing data

public void WriteToRegistry()
{
    // Create a registry instance
    RegEdit regEdit = new RegEdit(registryKey: Registry.CurrentUser);
    
    // Initialize the registry variables
    string registryPath = @"Software\YourOrganization\YourApplicationName\Settings";
    string registryParameter = "Theme";
    KnownColor registryValue = Color.Red.ToKnownColor();
    
    // Writing data to the register
    regEdit.Write(
        path: registryPath, 
        parameter: registryParameter, 
        value: registryValue
    );
}

Reading data

    // Create a registry instance
    RegEdit regEdit = new RegEdit(registryKey: Registry.CurrentUser);
    
    // Initialize the registry variables
    string registryPath = @"Software\YourOrganization\YourApplicationName\Settings";
    string registryParameter = "Theme";
    
    // Get the saved value
    var savedValue = regEdit.Read(
        path: registryPath,
        parameter: registryParameter
    );
    
    Console.WriteLine(savedValue); // output color name for console application
    BackColor = Color.FromName((string)savedValue); // changing background color for WinForm application
    
    // You can also get the number of keys in the specified section and the number of child sections
    Console.WriteLine(regEdit.GetSubKeyCount(path: registryPath)); // Number of subsections for the specified section
    Console.WriteLine(regEdit.GetValueCount(path: registryPath)); // Number of values in the specified section

License

MIT License

Product Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.7.2

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Hopex.RegEdit:

Package Downloads
Hopex.OSI

Provides the ability to quickly obtain detailed information about the Windows operating system, processor, installed SP, .NET Frameworks and BIOS. Also allows you to get information about running system processes and manage them.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
23.0.1 161 6/8/2023