public static void UpdateData(RegistryData data) { Registry.SetValue(RegistryPathReg, "DefaultSiteSlug", data.DefaultSiteSlug); foreach (RegRecord rec in data.List) { UpdateReg(rec); } }
public static RegistryData GetData() { RegistryData registryData = new RegistryData(); registryData.DefaultSiteSlug = Registry.GetValue(RegistryPathReg, "DefaultSiteSlug", "").ToString(); foreach (string item in Registry.CurrentUser.OpenSubKey(RegistryPathReg.Replace(@"HKEY_CURRENT_USER\", "")).GetSubKeyNames().ToList()) { RegRecord rec = new RegRecord(); rec.Code = item; string regpath = RegistryPathReg + "\\" + rec.Code; rec.ApiKey = Registry.GetValue(regpath, "ApiKey", "").ToString(); rec.SiteSlug = Registry.GetValue(regpath, "SiteSlug", "").ToString(); rec.Url = Registry.GetValue(regpath, "Url", "").ToString(); rec.Deleted = false; registryData.List.Add(rec); } return(registryData); }