コード例 #1
0
 static void UpdateReg(RegRecord rec)
 {
     if (rec.Deleted)
     {
         DeleteRegistryKeyReg(rec.Code);
     }
     else
     {
         CreateRegistryKeyReg(rec.Code);
         Registry.SetValue(RegistryPathReg + "\\" + rec.Code, "ApiKey", rec.ApiKey);
         Registry.SetValue(RegistryPathReg + "\\" + rec.Code, "SiteSlug", rec.SiteSlug);
         Registry.SetValue(RegistryPathReg + "\\" + rec.Code, "Url", rec.Url);
     }
 }
コード例 #2
0
        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);
        }