public void InitUserDB() { userdb = UserDB.Load(); this.UserJoinedChannel += new EventHandler<UserJoinEventArgs>(UserDB_UserJoined); this.UserPartedChannel += new EventHandler<UserPartEventArgs>(UserDB_UserPart); this.ChannelListRecieved += new EventHandler<ChannelListEventArgs>(PS2StatBot_ChannelListRecieved); }
public static UserDB Load() { if (!File.Exists(Filename)) { UserDB b = new UserDB(); b.Save(); } UserDB db; JsonSerializer ser = new JsonSerializer(); using (StreamReader r = new StreamReader(Filename)) using (JsonTextReader reader = new JsonTextReader(r)) { db = ser.Deserialize<UserDB>(reader); } return db; }