Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool CanLogin(string user, string pass)
- {
- int i = 0;
- while (true) // try has a return
- {
- if (!Online())
- {
- textBox3.Text = "No internet.";
- return false;
- }
- else
- {
- textBox3.Text = "Please add leagues, enter username and password and click "Begin web scraping".";
- }
- try
- {
- String username = user;
- String password = pass;
- String consumerKey = EVERNOTE_CONSUMER_KEY;
- String consumerSecret = EVERNOTE_CONSUMER_SECRET;
- String evernoteHost = EVERNOTE_HOST;
- String edamBaseUrl = "http://" + evernoteHost;
- Uri userStoreUrl = new Uri(edamBaseUrl + "/edam/user");
- TTransport userStoreTransport = new THttpClient(userStoreUrl);
- TProtocol userStoreProtocol = new TBinaryProtocol(userStoreTransport);
- UserStore.Client userStore = new UserStore.Client(userStoreProtocol);
- bool versionOK =
- userStore.checkVersion(CLIENT_NAME,
- Evernote.EDAM.UserStore.Constants.EDAM_VERSION_MAJOR,
- Evernote.EDAM.UserStore.Constants.EDAM_VERSION_MINOR);
- if (!versionOK)
- {
- throw new Exception(ERROR_VERSION);
- }
- AuthenticationResult authResult = null;
- try
- {
- //authResult = userStore.authenticate(username, password,consumerKey, consumerSecret);
- }
- catch
- {
- return false;
- }
- return true;
- }
- catch(Exception e)
- {
- if (e.Message == ERROR_VERSION)
- throw;
- }
- if (i++ > 20)
- throw new Exception("Failed to connect to evernote. This application can not be started.");
- }
- }
Add Comment
Please, Sign In to add comment