Exemplo n.º 1
0
 public static Token ReadFromFile(string name) {
     var token = new Token();
     using (var streamReader = new StreamReader(name)) {
         ReadToken(streamReader, token);
     }
     return token;
 }
Exemplo n.º 2
0
 private static InMemoryCredentials MapToCredentials(Token consumerToken, Tweet tweet) {
     return new InMemoryCredentials {
         ConsumerKey = consumerToken.Key,
         ConsumerSecret = consumerToken.Secret,
         AccessToken = tweet.AccessToken,
         OAuthToken = tweet.OAuthToken
     };
 }
Exemplo n.º 3
0
 public static Token ReadFromRessource(Assembly assembly, string name) {
     var token = new Token();
     var stream = assembly.GetManifestResourceStream(name);
     using (var streamReader = new StreamReader(stream)) {
         ReadToken(streamReader, token);
     }
     return token;
 }
Exemplo n.º 4
0
 private static void Main(string[] args) {
     var consumerToken = Token.ReadFromRessource(typeof(Program).Assembly, "twitter.authenticate.console.consumer.credentials.txt");
     var credentials = Twitter.Authenticate(consumerToken.Key, consumerToken.Secret);
     var accessToken = new Token {
         Key = credentials.AccessToken,
         Secret = credentials.OAuthToken
     };
     accessToken.WriteToFile("access.credentials.txt");
 }
Exemplo n.º 5
0
 public TweetStore(Token mongoToken) {
     this.mongoToken = mongoToken;
 }
Exemplo n.º 6
0
 private static void ReadToken(StreamReader streamReader, Token token) {
     token.Key = streamReader.ReadLine();
     token.Secret = streamReader.ReadLine();
 }