static public bool Upsert(string UserName, string Passwd, int id = 1) { UserCacheData data = new UserCacheData(); data.Id = id; data.UserName = UserName; data.Passwd = Passwd; string DBPath = GetPath(); var db = new SQLiteConnection(DBPath); db.CreateTable <UserCacheData>(); var list = db.Query <UserCacheData>("select * from User where _id = ?", data.Id); if (list.Count == 0) { // only insert the data if it doesn't already exist db.Insert(data); } else { db.Update(data); } return(true); }
static public void Clear() { LoginSuccess = false; CacheData = new UserCacheData(); RoomIdList.Clear(); PhotoPath = null; Uid = null; Token = null; NickName = null; }