60 lines
1.6 KiB
C#
60 lines
1.6 KiB
C#
using ImageHandlingLibrary.InterFaces;
|
|
using Microsoft.Win32;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ImageHandlingLibrary
|
|
{
|
|
public class Registring :IRegistring
|
|
{
|
|
public Registring()
|
|
{
|
|
CU = Registry.CurrentUser;
|
|
}
|
|
public RegistryKey CU { get; set; }
|
|
|
|
public string GetRegistryRootDir()
|
|
{
|
|
string output;
|
|
RegistryKey PictureHandling = CU.OpenSubKey(@"SOFTWARE\IdoIt4u\PictureHandling");
|
|
if (PictureHandling == null)
|
|
{
|
|
output = @"D:\OurPictures";
|
|
SetRegistryValues(output);
|
|
}
|
|
else
|
|
{
|
|
output = (string)PictureHandling.GetValue(@"RootMap");
|
|
}
|
|
return output;
|
|
}
|
|
|
|
public void SetRegistryValues(string rootDir)
|
|
{
|
|
RegistryKey IdoIt4u = CU.OpenSubKey(@"SOFTWARE\IdoIt4u", true);
|
|
RegistryKey PictureHandling = null;
|
|
if (IdoIt4u != null)
|
|
{
|
|
PictureHandling = IdoIt4u.OpenSubKey(@"PictureHandling", true);
|
|
}
|
|
|
|
if (PictureHandling == null)
|
|
{
|
|
if (IdoIt4u == null)
|
|
{
|
|
IdoIt4u = Registry.CurrentUser.CreateSubKey(@"Software\IdoIt4u", true);
|
|
}
|
|
else
|
|
PictureHandling = IdoIt4u.CreateSubKey(@"PictureHandling", true);
|
|
}
|
|
else
|
|
{
|
|
PictureHandling.SetValue(@"RootMap", rootDir);
|
|
}
|
|
}
|
|
}
|
|
}
|