public static Token ReadFromFile(string name) { var token = new Token(); using (var streamReader = new StreamReader(name)) { ReadToken(streamReader, token); } return token; }
private static InMemoryCredentials MapToCredentials(Token consumerToken, Tweet tweet) { return new InMemoryCredentials { ConsumerKey = consumerToken.Key, ConsumerSecret = consumerToken.Secret, AccessToken = tweet.AccessToken, OAuthToken = tweet.OAuthToken }; }
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; }
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"); }
public TweetStore(Token mongoToken) { this.mongoToken = mongoToken; }
private static void ReadToken(StreamReader streamReader, Token token) { token.Key = streamReader.ReadLine(); token.Secret = streamReader.ReadLine(); }