<commit_before>﻿/*
    Copyright (c) 2017 <NAME> (https://github.com/Klocman/)
    Apache License Version 2.0
*/

using System.Collections.Generic;
using System.IO;
using System.Security.Permissions;
using Klocman.Tools;
namespace UninstallTools.Junk
{
    public class RegistryValueJunkNode : RegistryJunkNode
    {
        public RegistryValueJunkNode(string keyPath, string valueName, string uninstallerName)
            : base(keyPath, valueName, uninstallerName)
        {
        }

        public override void Backup(string backupDirectory)
        {
            using (var key = RegistryTools.OpenRegistryKey(ParentPath))
            {
                var dir = CreateBackupDirectory(backupDirectory);
                var fileName = PathTools.SanitizeFileName(FullName.TrimStart('\\')) + ".reg";
                RegistryTools.ExportRegistryStringValues(Path.Combine(dir, fileName), ParentPath,
                    new KeyValuePair<string, string>(Name, key.GetValue(Name)?.ToString()));
            }
        }

        public override void Delete()
        {
            using (var key = RegistryTools.OpenRegistryKey(ParentPath, true))
            {
                key?.DeleteValue(Name);
            }
        }

        [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
        public override void Open()
        {
            RegistryTools.OpenRegKeyInRegedit(ParentPath);
        }
    }
}
<commit_msg>Fixed RegistryValueJunkNode backup failing if value name has a dot in its name. Fixes #47<commit_after>﻿/*
    Copyright (c) 2017 <NAME> (https://github.com/Klocman/)
    Apache License Version 2.0
*/

using System.Collections.Generic;
using System.IO;
using System.Security.Permissions;
using Klocman.Tools;
namespace UninstallTools.Junk
{
    public class RegistryValueJunkNode : RegistryJunkNode
    {
        public RegistryValueJunkNode(string keyPath, string valueName, string uninstallerName)
            : base(keyPath, valueName, uninstallerName)
        {
        }

        public override void Backup(string backupDirectory)
        {
            using (var key = RegistryTools.OpenRegistryKey(ParentPath))
            {
                var dir = CreateBackupDirectory(backupDirectory);
                var fileName = PathTools.SanitizeFileName(FullName.TrimStart('\\').Replace('.', '_')) + ".reg";
                RegistryTools.ExportRegistryStringValues(Path.Combine(dir, fileName), ParentPath,
                    new KeyValuePair<string, string>(Name, key.GetValue(Name)?.ToString()));
            }
        }

        public override void Delete()
        {
            using (var key = RegistryTools.OpenRegistryKey(ParentPath, true))
            {
                key?.DeleteValue(Name);
            }
        }

        [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
        public override void Open()
        {
            RegistryTools.OpenRegKeyInRegedit(ParentPath);
        }
    }
}

{'fraction_non_alphanumeric': 0.09422193040052528, 'fraction_numerical': 0.004596191726854892, 'mean_word_length': 2.106014271151886, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '7310439', 'n_tokens_mistral': 827, 'n_tokens_neox': 785, 'n_words': 164}