EZPPClient-Installer/EZPPClient Installer/Utils/RegistryUtil.cs

42 lines
988 B
C#

using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EZPPClient_Installer.Utils
{
class RegistryUtil
{
public static void SetUsedReleaseStream(string release)
{
RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\EZPPClientInstaller");
key.SetValue("ReleaseStream", release);
key.Close();
}
public static String GetUsedReleaseStream(string defaultRelease)
{
string release = defaultRelease;
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\EZPPClientInstaller");
//if it does exist, retrieve the stored values
if (key != null)
{
release = (string) key.GetValue("ReleaseStream");
key.Close();
}
return release;
}
public static void DeleteUsedReleaseStream()
{
Registry.CurrentUser.DeleteSubKey(@"SOFTWARE\EZPPClientInstaller");
}
}
}