示例#1
0
        public JsonResult GetClipboard(string Username, string Password, int SequenceNumber, int version)
        {
            if (WebSecurity.Login(Encrypter.base64Decode(Username), Encrypter.base64Decode(Password)) == true)
            {
                int UserId = WebSecurity.GetUserId(Encrypter.base64Decode(Username));

                // Business Logic to get the clipboard if any or hold the socket open
                SyncUser userClipboard = DatabaseClipBoard.GetClipboard(UserId, SequenceNumber);
                if (userClipboard != null)
                {
                    return(Json(userClipboard, JsonRequestBehavior.AllowGet));
                }
            }
            return(Json("", JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public JsonResult SendClipboard(string Username, string Password, string Clipboard, int version)
        {
            if (WebSecurity.Login(Encrypter.base64Decode(Username), Encrypter.base64Decode(Password)) == true)
            {
                int UserId = WebSecurity.GetUserId(Encrypter.base64Decode(Username));

                // Can I decode?
                string cleanClipboard = "";
                try
                {
                    cleanClipboard = Encrypter.base64Decode(Clipboard);
                }
                catch
                {
                    return(Json(-1, JsonRequestBehavior.AllowGet));
                }

                int SyncID = DatabaseClipBoard.SendClipboard(UserId, cleanClipboard);

                return(Json(SyncID, JsonRequestBehavior.AllowGet));
            }
            return(Json(0, JsonRequestBehavior.AllowGet));
        }