예제 #1
0
        //
        // UserIDs
        //

        /// <summary>
        /// Get a list of all stored usernames and userids
        /// </summary>
        /// <returns>A dictory of [username]->[userid] values</returns>
        public static Dictionary <string, string> GetAllUsers()
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            try
            {
                RegistryKey key = DEFAULT.CreateSubKey("UserID");
                foreach (string name in key.GetValueNames())
                {
                    if (dic.ContainsKey(name))
                    {
                        continue;
                    }
                    string uid  = key.GetValue(name).ToString();
                    long   test = 0;
                    if (!long.TryParse(uid, out test))
                    {
                        continue;
                    }
                    if (uid != test.ToString())
                    {
                        continue;
                    }
                    dic.Add(name, uid);
                }
            }
            catch { }
            return(dic);
        }
예제 #2
0
 /// <summary>
 /// Sets the category file version
 /// </summary>
 public static void SetCategoryVersion(string category, long version)
 {
     try
     {
         RegistryKey key = DEFAULT.CreateSubKey("Category Index");
         key.SetValue(category, version, RegistryValueKind.QWord);
     }
     catch { }
 }
예제 #3
0
        /// <summary>
        /// Gets the category file version
        /// </summary>
        public static long GetCategoryVersion(string category)
        {
            RegistryKey key = DEFAULT.CreateSubKey("Category Index");
            object      ob  = key.GetValue(category);

            if (ob == null || ob.GetType() != typeof(long))
            {
                return(-1);
            }
            return((long)ob);
        }
예제 #4
0
        /// <summary>
        /// Delete a username from registry entry
        /// </summary>
        /// <param name="name">Username to delete</param>
        public static void DeleteUserid(string name)
        {
            if (!LocalDatabase.usernames.ContainsKey(name))
            {
                return;
            }
            LocalDatabase.usernames.Remove(name);
            RegistryKey key = DEFAULT.CreateSubKey("UserID");

            key.DeleteValue(name, false);
            Interactivity.UserNameListChanged();
        }
예제 #5
0
        //
        // UserIDs
        //

        /// <summary>
        /// Get a list of all stored usernames and userids
        /// </summary>
        /// <returns>A dictory of [username]->[userid] values</returns>
        public static Dictionary <string, string> GetAllUsers()
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            try
            {
                RegistryKey key = DEFAULT.CreateSubKey("UserID");
                foreach (string name in key.GetValueNames())
                {
                    dic.Add(name, key.GetValue(name).ToString());
                }
            }
            catch { }
            return(dic);
        }