Exemplo n.º 1
0
        public static List <RecordItem> GetList(Keys key)
        {
            List <RecordItem> list = new List <RecordItem>();

            try
            {
                RegistryKey minerKey = CurrentUserKey.OpenSubKey(SubKey, true);

                if (minerKey != null)
                {
                    for (int i = 0; i <= Length - 1; i++)
                    {
                        try
                        {
                            object name = minerKey.GetValue(key.ToDescriptionString() + "_name_" + i.ToString());
                            object time = minerKey.GetValue(key.ToDescriptionString() + "_time_" + i.ToString());

                            if ((name != null) && (time != null))
                            {
                                list.Add(new RecordItem(name.ToString(), (int)time));
                            }
                        }
                        catch { }
                    }
                }
                minerKey.Close();
            }
            catch
            {
                return(list);
            }

            return(list);
        }
Exemplo n.º 2
0
 public static void SetValue(Keys key, List <RecordItem> value)
 {
     if (value != null)
     {
         RegistryKey minerKey = CurrentUserKey.CreateSubKey(SubKey);
         for (int i = 0; (i <= Length - 1 && i <= value.Count - 1); i++)
         {
             minerKey.SetValue(key.ToDescriptionString() + "_name_" + i.ToString(), value[i].Name);
             minerKey.SetValue(key.ToDescriptionString() + "_time_" + i.ToString(), value[i].Time);
         }
     }
 }