Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. private async void backupData(Uri strUri)
  2. {
  3. using (IsolatedStorageFile myIsolated = IsolatedStorageFile.GetUserStoreForApplication())
  4. {
  5. using (IsolatedStorageFileStream stream = myIsolated.OpenFile("Password.xml", FileMode.Open))
  6. {
  7. byte[] buffer = new byte[stream.Length];
  8. int x = await stream.ReadAsync(buffer, 0, (int)stream.Length);
  9.  
  10. if (x != stream.Length)
  11. {
  12. return;
  13. }
  14.  
  15. IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
  16. object tmpObject = new object();
  17. if (settings.TryGetValue("masterPassword", out tmpObject))
  18. {
  19. string mstPass = (string)tmpObject;
  20.  
  21. tmpObject = new object();
  22. if (settings.TryGetValue("username", out tmpObject))
  23. {
  24. string uname = (string)tmpObject;
  25. string strParameter = String.Format("masterPass={0}&username={1}&xml={2}", mstPass, uname, buffer);
  26.  
  27. WebClient wc = new WebClient();
  28.  
  29. wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
  30.  
  31. string testHeader = wc.Headers.ToString();
  32.  
  33.  
  34. wc.UploadStringAsync(strUri, "POST", strParameter);
  35.  
  36.  
  37. }
  38. else
  39. {
  40. return;
  41. }
  42. }
  43. else
  44. {
  45. return;
  46. }
  47.  
  48.  
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement