Saving last Release Stream in Registry

This commit is contained in:
2021-05-27 10:40:02 +02:00
parent d71f0d38fc
commit 0937fa43a3
3 changed files with 62 additions and 6 deletions

View File

@@ -0,0 +1,41 @@
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");
}
}
}