fork download
  1. public abstract class BaseOAuthRepository
  2. {
  3.  
  4. private static string REQUEST_URL = "https://e...content-available-to-author-only...e.com/oauth/request_token";
  5. private static string AUTHORIZE_URL = "https://u...content-available-to-author-only...e.com/e/t/etws/authorize";
  6. private static string ACCESS_URL = "https://e...content-available-to-author-only...e.com/oauth/access_token";
  7.  
  8. private readonly TokenBase _tokenBase;
  9. private readonly string _consumerSecret;
  10.  
  11. protected BaseOAuthRepository(TokenBase tokenBase,
  12. string consumerSecret)
  13. {
  14. _tokenBase = tokenBase;
  15. _consumerSecret = consumerSecret;
  16. }
  17.  
  18. public TokenBase MyTokenBase
  19. {
  20. get { return _tokenBase; }
  21. }
  22.  
  23. public string MyConsumerSecret
  24. {
  25. get { return _consumerSecret; }
  26. }
  27.  
  28.  
  29. public OAuthSession CreateSession()
  30. {
  31. var consumerContext = new OAuthConsumerContext
  32. {
  33. ConsumerKey = MyTokenBase.ConsumerKey,
  34. ConsumerSecret = MyConsumerSecret,
  35. SignatureMethod = SignatureMethod.HmacSha1,
  36. UseHeaderForOAuthParameters = true,
  37. CallBack = "oob"
  38. };
  39.  
  40. var session = new OAuthSession(consumerContext, REQUEST_URL, AUTHORIZE_URL, ACCESS_URL);
  41. return session;
  42. }
  43.  
  44. public IToken GetAccessToken(OAuthSession session)
  45. {
  46. IToken requestToken = session.GetRequestToken();
  47. string authorizationLink = session.GetUserAuthorizationUrlForToken(MyTokenBase.ConsumerKey, requestToken);
  48. Process.Start(authorizationLink);
  49. Console.Write("Please enter pin from browser: ");
  50. string pin = Console.ReadLine();
  51. IToken accessToken = session.ExchangeRequestTokenForAccessToken(requestToken, pin.ToUpper());
  52.  
  53. return accessToken;
  54. }
  55.  
  56. public string GetResponse(OAuthSession session, string url)
  57. {
  58. IToken accessToken = MyTokenBase;
  59.  
  60. var response = session.Request(accessToken).Get().ForUrl(url).ToString();
  61. return response;
  62. }
  63.  
  64. public XDocument GetWebResponseAsXml(HttpWebResponse response)
  65. {
  66. XmlReader xmlReader = XmlReader.Create(response.GetResponseStream());
  67. XDocument xdoc = XDocument.Load(xmlReader);
  68. xmlReader.Close();
  69. return xdoc;
  70. }
  71.  
  72. public string GetWebResponseAsString(HttpWebResponse response)
  73. {
  74. Encoding enc = System.Text.Encoding.GetEncoding(1252);
  75. StreamReader loResponseStream = new
  76. StreamReader(response.GetResponseStream(), enc);
  77. return loResponseStream.ReadToEnd();
  78. }
  79. }
  80.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Visual Basic.Net Compiler version 0.0.0.5914 (Mono 2.4.2 - r)
Copyright (C) 2004-2008 Rolf Bjarne Kvinge. All rights reserved.


/home/xT28h9/prog.vb (1,18) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (2,2) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (4,19) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (4,86) : Error VBNC30037: Symbol is not valid.
/home/xT28h9/prog.vb (5,19) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (5,85) : Error VBNC30037: Symbol is not valid.
/home/xT28h9/prog.vb (6,19) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (6,84) : Error VBNC30037: Symbol is not valid.
/home/xT28h9/prog.vb (8,21) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (8,42) : Error VBNC30037: Symbol is not valid.
/home/xT28h9/prog.vb (9,21) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (9,44) : Error VBNC30037: Symbol is not valid.
/home/xT28h9/prog.vb (11,34) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (12,41) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (13,6) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (14,19) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (14,31) : Error VBNC30037: Symbol is not valid.
/home/xT28h9/prog.vb (15,24) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (15,41) : Error VBNC30037: Symbol is not valid.
/home/xT28h9/prog.vb (16,6) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (18,21) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (19,6) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (20,12) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (20,32) : Error VBNC30037: Symbol is not valid.
/home/xT28h9/prog.vb (21,6) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (23,18) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (24,6) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (25,12) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (25,37) : Error VBNC30037: Symbol is not valid.
/home/xT28h9/prog.vb (26,6) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (29,24) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (30,6) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (31,12) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (32,10) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (33,24) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (34,27) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (35,28) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (36,40) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (37,21) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (38,10) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (38,10) : Error VBNC30037: Symbol is not valid.
/home/xT28h9/prog.vb (40,12) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (40,96) : Error VBNC30037: Symbol is not valid.
/home/xT28h9/prog.vb (41,15) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (41,23) : Error VBNC30037: Symbol is not valid.
/home/xT28h9/prog.vb (42,6) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (44,18) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (45,6) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (46,15) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (46,56) : Error VBNC30037: Symbol is not valid.
/home/xT28h9/prog.vb (47,15) : Error VBNC30203: Not valid as identifier.
/home/xT28h9/prog.vb (47,15) : Error VBNC30041: Too many errors.
Exception of type 'vbnc.TooManyErrorsException' was thrown.
  at vbnc.Report.ShowMessage (Boolean SaveIt, vbnc.Message Message) [0x00080] in /var/tmp/portage/dev-lang/mono-basic-2.4.2/work/mono-basic-2.4.2/vbnc/vbnc/source/General/Report.vb:342 
  at vbnc.Report.ShowMessage (Messages Message, Span Location, System.String[] Parameters) [0x00000] in /var/tmp/portage/dev-lang/mono-basic-2.4.2/work/mono-basic-2.4.2/vbnc/vbnc/source/General/Report.vb:259 
  at vbnc.Report.ShowMessage (Messages Message, System.String[] Parameters) [0x00054] in /var/tmp/portage/dev-lang/mono-basic-2.4.2/work/mono-basic-2.4.2/vbnc/vbnc/source/General/Report.vb:269 
  at vbnc.Compiler.Compile () [0x005a3] in /var/tmp/portage/dev-lang/mono-basic-2.4.2/work/mono-basic-2.4.2/vbnc/vbnc/source/General/Compiler.vb:651 
  at vbnc.Compiler.Compile (System.String[] CommandLine) [0x00057] in /var/tmp/portage/dev-lang/mono-basic-2.4.2/work/mono-basic-2.4.2/vbnc/vbnc/source/General/Compiler.vb:279 
  at vbnc.Main.Main (System.String[] CmdArgs) [0x0000f] in /var/tmp/portage/dev-lang/mono-basic-2.4.2/work/mono-basic-2.4.2/vbnc/vbnc/source/General/Main.vb:55 
Failed compilation took 00:00:00.5691860
stdout
Standard output is empty