<commit_before>﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;

namespace OsVersionDetect
{
	public static class OsVersionAnother
	{
		#region Registry

		public static string CurrentVersion => GetRegistryValue(nameof(CurrentVersion));
		public static string CurrentBuild => GetRegistryValue(nameof(CurrentBuild));
		public static string BuildLab => GetRegistryValue(nameof(BuildLab));
		public static string ReleaseId => GetRegistryValue(nameof(ReleaseId));

		private static string GetRegistryValue(string name)
		{
			return _currentVersionRegistryValues.Value.ContainsKey(name)
				? _currentVersionRegistryValues.Value[name]
				: null;
		}

		private static Lazy<Dictionary<string, string>> _currentVersionRegistryValues =
			new Lazy<Dictionary<string, string>>(() => GetCurrentVersionRegistryValues() ?? new Dictionary<string, string>());

		private static Dictionary<string, string> GetCurrentVersionRegistryValues()
		{
			using (var localMachine = Registry.LocalMachine)
			using (var currentVersion = localMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion"))
			{
				return currentVersion?.GetValueNames()
					.ToDictionary(x => x, x => currentVersion.GetValue(x)?.ToString());<commit_msg>Refactored<commit_after>﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;

namespace OsVersionDetect
{
	public static class OsVersionAnother
	{
		#region Registry

		public static string CurrentVersion => GetRegistryValue();
		public static string CurrentBuild => GetRegistryValue();
		public static string BuildLab => GetRegistryValue();
		public static string ReleaseId => GetRegistryValue();
		
		private static string GetRegistryValue([CallerMemberName] string keyName = null)
		{
			return _currentVersionRegistryValues.Value.ContainsKey(keyName)
				? _currentVersionRegistryValues.Value[keyName]
				: null;
		}

		private static Lazy<Dictionary<string, string>> _currentVersionRegistryValues =
			new Lazy<Dictionary<string, string>>(() => GetCurrentVersionRegistryValues() ?? new Dictionary<string, string>());

		private static Dictionary<string, string> GetCurrentVersionRegistryValues()
		{
			using (var localMachine = Registry.LocalMachine)
			using (var currentVersion = localMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion"))
			{
				return currentVersion?.GetValueNames()
					.ToDictionary(x => x, x => currentVersion.GetValue(x)?.ToString());
{'fraction_non_alphanumeric': 0.09977827050997783, 'fraction_numerical': 0.0014781966001478197, 'mean_word_length': 6.123684210526315, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3727737', 'n_tokens_mistral': 791, 'n_tokens_neox': 701, 'n_words': 173}