Rättat registryhantering + .CopyTo istället för MoveTo

This commit is contained in:
2021-04-21 20:55:34 +02:00
parent fbb246d09b
commit 96ca8d0424
2 changed files with 22 additions and 3 deletions

View File

@ -20,7 +20,7 @@ namespace PictureReposit
{
InitializeComponent();
RegistryKey PictureHandling = Registry.LocalMachine.OpenSubKey(@"Software\Tfoman\PictureHandling");
RegistryKey PictureHandling = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Tfoman\PictureReposit");
if (PictureHandling == null)
{
txtRootDir.Text = @"D:\Bildlabb\LabRotCat";
@ -188,7 +188,22 @@ namespace PictureReposit
private void txtRootDir_TextChanged(object sender, EventArgs e)
{
}
//Software\Tfoman\PictureReposit
RegistryKey Tfoman = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Tfoman", true);
RegistryKey PictureHandling = Tfoman.OpenSubKey(@"PictureReposit", true);
if (PictureHandling == null)
{
if (Tfoman == null)
{
Tfoman = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Tfoman");
}
else
PictureHandling = Tfoman.CreateSubKey(@"PictureReposit");
}
else
{
PictureHandling.SetValue(@"RootMap", txtRootDir.Text);
}
}
}
}