public override void Logout() { User = null; }
public override void Login(string email, string password) { if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password)) { throw new FilesOnlineException("You must supply both a Login/E-mail and Password."); } var str = string.Format(Constants.LoginRequest, email, password); var request = new HttpRequest(Constants.BoxAPILoginUrl, Proxy) { ContentType = "text/xml", PostData = Utils.StrToByteArray(str) }; var document = new XmlDocument(); document.Load(request.GetResponse()); if (Utils.GetNodeTextString(document.SelectSingleNode("//status")).ToLower() != "logged") { throw new FilesOnlineAuthenticationException( string.Format("Login failed. Response from Box.net was '{0}'", Utils.GetNodeTextString(document.SelectSingleNode("//status")).ToLower())); } User = new BoxNetUser { Sid = Utils.GetNodeTextString(document.SelectSingleNode("//user/sid")), AccessId = Utils.GetNodeTextInt(document.SelectSingleNode("//user/access_id")), Email = Utils.GetNodeTextString(document.SelectSingleNode("//user/email")), Free = Utils.GetNodeTextBool(document.SelectSingleNode("//user/free")), Login = Utils.GetNodeTextString(document.SelectSingleNode("//user/login")), SpaceAmount = Utils.GetNodeTextLong(document.SelectSingleNode("//user/space_amount")), SpaceUsed = Utils.GetNodeTextLong(document.SelectSingleNode("//user/space_used")), UserId = Utils.GetNodeTextInt(document.SelectSingleNode("//user/user_id")) }; }