예제 #1
0
        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);
        }
예제 #2
0
        static public void Clear()
        {
            LoginSuccess = false;
            CacheData    = new UserCacheData();
            RoomIdList.Clear();

            PhotoPath = null;
            Uid       = null;
            Token     = null;
            NickName  = null;
        }