// // 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); }
/// <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 { } }
/// <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); }
/// <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(); }
// // 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); }