QSoft.Registry 1.0.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package QSoft.Registry --version 1.0.0.2                
NuGet\Install-Package QSoft.Registry -Version 1.0.0.2                
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="QSoft.Registry" Version="1.0.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add QSoft.Registry --version 1.0.0.2                
#r "nuget: QSoft.Registry, 1.0.0.2"                
#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 QSoft.Registry as a Cake Addin
#addin nuget:?package=QSoft.Registry&version=1.0.0.2

// Install QSoft.Registry as a Cake Tool
#tool nuget:?package=QSoft.Registry&version=1.0.0.2                

Use Linq style read registry(Linq to Registry)

Use Queryable read data

  • Full Linq support provide Queryable function
  • Auto control Registry resource no control resource create and dispose

sample code

Create definition

public class InstalledApp
{
    public string DisplayName { set; get; }
    public string DisplayVersion { set; get; }
    public int? EstimatedSize { set; get; }
}

Create Query

var regt = new RegQuery<InstalledApp>()
	.useSetting(x =>
	{
	    x.Hive = RegistryHive.LocalMachine;
	    x.SubKey = @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall";
	});

Query data

var first1 = regt.First();
var first2 = regt.First(x => x.DisplayName != "");
var last1 = regt.Last();
var last2 = regt.Last(x => x.DisplayName != "");
var take = regt.Take(10);
var takewhile = regt.TakeWhile(x => x.DisplayName == "AA");

var count1 = regt.Count();
var count2 = regt.Count(x => x.DisplayName == "AA");
var all = regt.All(x => x.DisplayName != "");
var any = regt.Any(x => x.EstimatedSize > 0);
var reverse = regt.Reverse();
var average = regt.Average(x => x.EstimatedSize);
var sum = regt.Sum(x => x.EstimatedSize);
var skip1 = regt.Skip(1);
var skipwhile = regt.SkipWhile(x => x.DisplayName == "B");
var min = regt.Min(x => x.EstimatedSize);
var max = regt.Max(x => x.EstimatedSize);

var loopup = regt.ToLookup(x => x.DisplayName);
var tolist = regt.ToList();
var toarray = regt.ToArray();
var dictonary = regt.ToDictionary(x => x.EstimatedSize);
var orderbydesc = regt.OrderByDescending(x => x.EstimatedSize);
var oderby = regt.OrderBy(x => x.EstimatedSize);
var where1 = regt.Where(x => x.DisplayName != "");

Join data definition and create

public class AppData
{
    public AppData()
    {

    }

    public AppData(string name)
    {
        this.Name = name;
    }
    public string Name { set; get; }
    public string Ver { set; get; }
    public string Uninstallstring { set; get; }
    public bool IsOfficial { set; get; }
}
List<AppData> apps = new List<AppData>();
apps.Add(new AppData() { Name = "A", IsOfficial = true });
apps.Add(new AppData() { Name = "AA", IsOfficial = false });
var join1 = regt.Join(apps, x => x.DisplayName, y => y.Name, (x, y) => new { x.DisplayName, x.EstimatedSize, y.IsOfficial });
var groupjoin = regt.GroupJoin(apps, x => x.DisplayName, y => y.Name, (x, y) => x);

ver 1.0.0.2 less

Use extension linq function like below code

using QSoft.Registry;
using QSoft.Registry.Linq;

RegistryKey reg = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
RegistryKey uninstall = reg.OpenSubKey(@"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall");
var where = uninstall.Where(x => x.GetValue<string>("DisplayName") == "Intel(R) Processor Graphics");

Open RegistryKey

var regs = RegistryHive.LocalMachine.OpenView(@"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall");
foreach(var reg in regs)
{

}
RegistryKey reg_32 = RegistryHive.LocalMachine.OpenView32(@"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall");
RegistryKey reg_64 = RegistryHive.LocalMachine.OpenView64(@"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall");

Current provide

FirstOrDefault, LastOrDefault

var first = uninstall.FirstOrDefault(x => x.GetValue<string>("DisplayName") == "Intel(R) Processor Graphics");
var last = uninstall.LastOrDefault(x => x.GetValue<string>("DisplayName") == "Intel(R) Processor Graphics");

Count

var count = uninstall.Count();
var count_1 = uninstall.Count(x => string.IsNullOrEmpty(x.GetValue<string>("DisplayName")) == false);

Where

var where = uninstall.Where(x => x.GetValue<string>("DisplayName") == "Intel(R) Processor Graphics");

ToList, ToDictionary

var list = uninstall.ToList();
var dic = uninstall.ToDictionary(x => x.Name);

ToLookup

var lookups = uninstall.ToLookup(x => x.GetValue<string>("DisplayName"));
foreach (var item in lookups)
{
    System.Diagnostics.Trace.WriteLine($"DisplayName:{item.Key} count:{item.Count()}");
}
Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.0

    • No dependencies.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETFramework 4.8

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0.7 441 9/30/2022
1.0.0.6 466 2/21/2022
1.0.0.5 288 12/20/2021
1.0.0.4 301 12/9/2021
1.0.0.3 860 12/3/2021
1.0.0.2 338 10/25/2021
1.0.0.1 355 2/18/2021
1.0.0 366 1/14/2021