internal Scheduler(string fileName, ITwitterContextList contextList, ITwitterConfiguration twitterConfig, IJobProcessor testProcessor, int sleepTime = 1000) : this(fileName, contextList, twitterConfig) { JobProcessors.Add(SchedulerJobType.Test, testProcessor); SleepTime = sleepTime; }
public Scheduler(string fileName, ITwitterContextList contextList, ITwitterConfiguration twitterConfig) { FileName = fileName; JobProcessors.Add(SchedulerJobType.DeleteStatus, new DeleteStatusProcessor(contextList)); JobProcessors.Add(SchedulerJobType.CreateStatus, new CreateStatusProcessor(contextList, twitterConfig)); if (File.Exists(FileName)) { var json = File.ReadAllText(FileName); try { Jobs.AddRange(JsonConvert.DeserializeObject <List <SchedulerJob> >(json)); } catch (Exception ex) { LogTo.WarnException("Failed to load joblist from file", ex); } } JobIdCounter = Jobs.Any() ? Jobs.Max(j => j.JobId) + 1 : 0; SleepTime = 1000; }
public XconnectRepository(IXconnectConfiguration xconnectConfiguration, ILogger logger, IModelProvider modelProvider, ITwitterConfiguration twitterConfiguration) { _xconnectConfiguration = xconnectConfiguration; _logger = logger; _modelProvider = modelProvider; _twitterConfiguration = twitterConfiguration; Initialize(); }
public TwitterOutputClient(ITwitterConfiguration config) { if (string.IsNullOrWhiteSpace(config.ConsumerKey) || string.IsNullOrWhiteSpace(config.ConsumerSecret) || string.IsNullOrWhiteSpace(config.AccessToken) || string.IsNullOrWhiteSpace(config.AccessSecret)) { throw new NullReferenceException("One or more of the fields in appsettings.json are empty. Please fill them out and try again."); } _twitterClient = new TwitterClient(config.ConsumerKey, config.ConsumerSecret, config.AccessToken, config.AccessSecret); }
/// <summary> /// Applies Unicode Normalization to a text and then counts characters. /// </summary> /// <remarks> /// See https://dev.twitter.com/basics/counting-characters for details on how twitter counts characters. /// </remarks> /// <param name="text"></param> /// <param name="twitterConfig"></param> /// <returns></returns> public static int CountCharacters(string text, ITwitterConfiguration twitterConfig) { text = ReplaceUrls(text, twitterConfig.UrlLength, twitterConfig.UrlLengthHttps); try { var norm = NormalizeText(text); var inf = new StringInfo(norm); return(inf.LengthInTextElements); } catch (ArgumentException) { return(text.Length); } }
public CreateStatusProcessor(ITwitterContextList contextList, ITwitterConfiguration twitterConfig) : base(contextList) { TwitterConfig = twitterConfig; }
public OAuthTwitterWrapper(IOAuthConfiguration authConfig, ITwitterConfiguration twitConfig) { _authConfig = authConfig; _twitConfig = twitConfig; }
public TwitterHarvester(ITwitterConfiguration configuration, ILogger logger) { _configuration = configuration; _logger = logger; }