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; }
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); }
public void SaveDB() { userdb.Save(); }