コード例 #1
0
ファイル: TwitterBot.cs プロジェクト: link2026/SysBot.NET
        public TwitterBot(TwitterSettings settings, PokeTradeHub <PK8> hub)
        {
            Hub      = hub;
            Settings = settings;

            client = new TwitterClient(Settings.ConsumerKey, Settings.ConsumerSecret, Settings.AccessToken, Settings.AccessTokenSecret);

            client.Events.OnTwitterException += HandleTwitterException;

            try
            {
                var taskAuthenticate = Task.Run(async() => await client.Users.GetAuthenticatedUserAsync());
                TwitterUser = taskAuthenticate.Result;
                LogUtil.LogText($"Successfully authenticated as: @{TwitterUser.ScreenName}");

                MentionParams = new GetMentionsTimelineParameters {
                    PageSize = Settings.MentionCount
                };
                var taskGetInitialMentions = Task.Run(async() => await client.Timelines.GetMentionsTimelineAsync(MentionParams));
                localMentions = new TwitterMentions(taskGetInitialMentions.Result);
                Task.Run(() => CheckMentionsForTradesAsync(localMentions, CancellationToken.None));
            }
            catch (Exception e)
            {
                LogUtil.LogError($"Unable to authenticate with error: {e.Message}", nameof(TwitterBot));
            }
        }
コード例 #2
0
        public static void AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
        {
            services.AddHttpClient();

            services.AddDbContext <FilmunityDataContext>(options =>
                                                         options.UseSqlServer(configuration.GetConnectionString("FilmunityDatabase")));

            services.AddScoped <IUnitOfWork, UnitOfWork>();

            services.Configure <CloudinarySettings>(configuration.GetSection("CloudinarySettings"));
            services.AddScoped <ICloudUploadService, CloudUploadService>();

            services.Configure <FacebookSettings>(configuration.GetSection("FacebookSettings"));
            var facebookSettings = new FacebookSettings();

            configuration.Bind(nameof(FacebookSettings), facebookSettings);
            services.AddSingleton(facebookSettings);
            services.AddScoped <IFacebookService, FacebookService>();

            services.Configure <OmdbSettings>(configuration.GetSection("OmdbSettings"));
            var omdbSettings = new OmdbSettings();

            configuration.Bind(nameof(OmdbSettings), omdbSettings);
            services.AddSingleton(omdbSettings);
            services.AddScoped <IOmdbService, OmdbService>();

            services.Configure <TwitterSettings>(configuration.GetSection("TwitterSettings"));
            var twitterSettings = new TwitterSettings();

            configuration.Bind(nameof(TwitterSettings), twitterSettings);
            services.AddSingleton(twitterSettings);
            services.AddScoped <TweetSharp.ITwitterService, TweetSharp.TwitterService>();
            services.AddScoped <ITwitterService, TwitterService>();
        }
コード例 #3
0
        public IEnumerable <ValidationResult> ValidateSettings(TwitterSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (string.IsNullOrWhiteSpace(settings.ConsumerKey))
            {
                yield return(new ValidationResult(S["ConsumerKey is required"], new string[] { nameof(settings.ConsumerKey) }));
            }

            if (string.IsNullOrWhiteSpace(settings.ConsumerSecret))
            {
                yield return(new ValidationResult(S["ConsumerSecret is required"], new string[] { nameof(settings.ConsumerSecret) }));
            }

            if (string.IsNullOrWhiteSpace(settings.AccessToken))
            {
                yield return(new ValidationResult(S["Access Token is required"], new string[] { nameof(settings.AccessToken) }));
            }

            if (string.IsNullOrWhiteSpace(settings.AccessTokenSecret))
            {
                yield return(new ValidationResult(S["Access Token Secret is required"], new string[] { nameof(settings.AccessTokenSecret) }));
            }
        }
コード例 #4
0
        private TwitterSettings GetTwitterSettings(IConfiguration configuration)
        {
            TwitterSettings twitterSettings;

            if (EnvironmentHelper.InDocker)
            {
                twitterSettings = new TwitterSettings
                {
                    ConsumerKey       = Environment.GetEnvironmentVariable("ConsumerKey"),
                    ConsumerSecret    = Environment.GetEnvironmentVariable("ConsumerSecret"),
                    AccessToken       = Environment.GetEnvironmentVariable("AccessToken"),
                    AccessTokenSecret = Environment.GetEnvironmentVariable("AccessTokenSecret")
                };
            }
            else
            {
                twitterSettings = configuration.GetSection("Twitter").Get <TwitterSettings>();
            }

            this.logger.LogInformation("Twitter Consumer Key: {0}", GetStatus(twitterSettings.ConsumerKey));
            this.logger.LogInformation("Twitter Consumer Secret: {0}", GetStatus(twitterSettings.ConsumerSecret));
            this.logger.LogInformation("Twitter Access Token: {0}", GetStatus(twitterSettings.AccessToken));
            this.logger.LogInformation("Twitter Access Token Secret: {0}", GetStatus(twitterSettings.AccessTokenSecret));

            return(twitterSettings);
        }
コード例 #5
0
        /// <summary>
        /// Check that twitter credentials in Settings are still valid.
        /// If the credentials provided are invalid then clear them to force re-entry.
        /// </summary>
        /// <returns>trus if valid</returns>
        private static bool VerifyCredentials()
        {
#if UNITY_EDITOR
            float time = (float)EditorApplication.timeSinceStartup;
#else
            float time = Time.time;
#endif
            if (time > verifyCredentialsTime)
            {
                Dictionary <string, string> dict = new Dictionary <string, string>();
                OAuthHelper.AddDefaultOAuthParams(dict, TwitterSettings.EDITOR_PREFS_TWITTER_API_KEY, TwitterSettings.EDITOR_PREFS_TWITTER_API_SECRET);
                if (ApiGetRequest(TwitterSettings.VerifyCredentialsURL, dict, out string response))
                {
                    verifyCredentialsTime = time + 600; // validate every 10 minutes
                    return(true);
                }
                else
                {
                    TwitterSettings.ClearAccessTokens();
                    Debug.LogError(response);
                    return(false);
                }
            }
            else
            {
                return(true);
            }
        }
コード例 #6
0
        private static Settings CreateSettings()
        {
            SettingConfigurationSection section = (SettingConfigurationSection)ConfigurationManager.GetSection(SettingConfigurationSection.SectionName);

            ApiSettings api = new ApiSettings(section.Api.Allowed, section.Api.DailyLimit);

            ThumbnailSettings thumbnail = new ThumbnailSettings(section.Thumbnail.ApiKey, section.Thumbnail.Endpoint);

            GoogleSafeBrowsingSettings google = new GoogleSafeBrowsingSettings(section.Google.ApiKey, section.Google.Endpoint, HttpContext.Current.Server.MapPath(section.Google.PhishingFile), HttpContext.Current.Server.MapPath(section.Google.MalwareFile));

            TwitterSettings twitter = null;

            if (section.Twitter != null)
            {
                twitter = new TwitterSettings(section.Twitter.UserName, section.Twitter.Password, section.Twitter.Endpoint, section.Twitter.MessageTemplate, section.Twitter.MaximumMessageLength, section.Twitter.Recipients.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
            }

            IList <User> defaultUsers = new List <User>();

            foreach (DefaultUserConfigurationElement configuration in section.DefaultUsers)
            {
                defaultUsers.Add(new User {
                    Name = configuration.Name, Email = configuration.Email, Role = configuration.Role
                });
            }

            Settings settings = new Settings(section.RedirectPermanently, section.UrlPerPage, section.BaseType, api, thumbnail, google, twitter, defaultUsers);

            return(settings);
        }
コード例 #7
0
 public TwitterUserService(TwitterSettings settings, ITwitterStatisticsHandler statisticsHandler, ILogger <TwitterUserService> logger)
 {
     _settings          = settings;
     _statisticsHandler = statisticsHandler;
     _logger            = logger;
     Auth.SetApplicationOnlyCredentials(_settings.ConsumerKey, _settings.ConsumerSecret, true);
     ExceptionHandler.SwallowWebExceptions = false;
 }
コード例 #8
0
 public TweetCashController(ITweetsCashRepository tweetCashRepository,
                            ITwitterAppAccountRepository twitterAppAccountRepository,
                            TwitterSettings twitterSettings,
                            ILog log, ITweetsManager tweetsManager)
 {
     _tweetCashRepository         = tweetCashRepository;
     _twitterAppAccountRepository = twitterAppAccountRepository;
     _twitterSettings             = twitterSettings;
     _log           = log;
     _tweetsManager = tweetsManager;
 }
コード例 #9
0
 public TwitterApiService(ILogger logger, TwitterSettings twitterSettings)
 {
     _logger          = logger;
     _twitterSettings = twitterSettings;
     _httpClient      = new HttpClient()
     {
         BaseAddress = new Uri(_twitterSettings.BaseUrl),
         Timeout     = TimeSpan.FromDays(1)
     };
     _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _twitterSettings.BearerToken);
 }
コード例 #10
0
ファイル: TwitterManager.cs プロジェクト: yappy/DollsKit
        public static void Initialize()
        {
            account = new DollsLib.Twitter.AccountManager();
            settings = SettingManager.Settings.Twitter;

            if (!settings.WriteEnabled)
            {
                Log.Trace.TraceEvent(TraceEventType.Warning, 0,
                    "Twitter write feature is disabled. Only to log.");
            }
        }
コード例 #11
0
 public AuthenticationController(
     SignInManager<ApplicationUser> signInManager,
     UserManager<ApplicationUser> userManager,
     RolesSettings rolesSettings,
     TwitterSettings twitterSettings)
 {
     _signInManager = signInManager;
     _userManager = userManager;
     _rolesSettings = rolesSettings;
     _twitterSettings = twitterSettings;
 }    
コード例 #12
0
 public SocialSettingsViewModel()
 {
     if (Configuration.Instance.Social is TwitterSettings)
     {
         TwitterSettings s = Configuration.Instance.Social as TwitterSettings;
         ConsumerKey    = s.ConsumerKey;
         ConsumerSecret = s.ConsumerSecret;
         AccessKey      = s.AccessToken;
         AccessSecret   = s.AccessTokenSecret;
     }
     MessengerInstance.Register <NotificationMessage>(this, (m) => Save(m));
 }
コード例 #13
0
        public TwitterTradeNotifier(T data, PokeTradeTrainerInfo info, int code, string username, TwitterClient client, IUser user, TwitterSettings settings)
        {
            Data     = data;
            Info     = info;
            Code     = code;
            Username = username;
            Client   = client;
            UserToDM = user;
            Settings = settings;

            LogUtil.LogText($"Created trade details for {Username} - {Code}");
        }
コード例 #14
0
ファイル: TwitterService.cs プロジェクト: mike-tesch/Sonarr
        public void SendNotification(string message, TwitterSettings settings)
        {
            try
            {
                var oAuth = new TinyTwitter.OAuthInfo
                {
                    ConsumerKey = settings.ConsumerKey,
                    ConsumerSecret = settings.ConsumerSecret,
                    AccessToken = settings.AccessToken,
                    AccessSecret = settings.AccessTokenSecret
                };

                var twitter = new TinyTwitter.TinyTwitter(oAuth);

                if (settings.DirectMessage)
                {
                    twitter.DirectMessage(message, settings.Mention);
                }

                else
                {
                    if (settings.Mention.IsNotNullOrWhiteSpace())
                    {
                        message += string.Format(" @{0}", settings.Mention);
                    }

                    twitter.UpdateStatus(message);
                }
            }
            catch (WebException ex)
            {
                using (var response = ex.Response)
                {
                    var httpResponse = (HttpWebResponse)response;

                    using (var responseStream = response.GetResponseStream())
                    {
                        if (responseStream == null)
                        {
                            _logger.Trace("Status Code: {0}", httpResponse.StatusCode);
                            throw new TwitterException("Error received from Twitter: " + httpResponse.StatusCode, ex);
                        }

                        using (var reader = new StreamReader(responseStream))
                        {
                            var responseBody = reader.ReadToEnd();
                            _logger.Trace("Reponse: {0} Status Code: {1}", responseBody, httpResponse.StatusCode);
                            throw new TwitterException("Error received from Twitter: " + responseBody, ex);
                        }
                    }
                }
            }
        }
コード例 #15
0
        public StreamManager(
            ITwitterStreamingClient twitterStreamingClient,
            ISentimentAnalysisService sentimentAnalysisService,
            IEventHubService eventHubService,
            ILoggerFactory loggerFactory,
            TwitterSettings twitterSettings)
        {
            this.twitterStreamingClient   = twitterStreamingClient;
            this.sentimentAnalysisService = sentimentAnalysisService;
            this.eventHubService          = eventHubService;
            this.twitterSettings          = twitterSettings;

            this.logger = loggerFactory.CreateLogger(nameof(StreamManager));
        }
コード例 #16
0
        public async Task UpdateSettingsAsync(TwitterSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            var container = await _siteService.LoadSiteSettingsAsync();

            container.Alter <TwitterSettings>(nameof(TwitterSettings), aspect =>
            {
                aspect.ConsumerKey       = settings.ConsumerKey;
                aspect.ConsumerSecret    = settings.ConsumerSecret;
                aspect.AccessToken       = settings.AccessToken;
                aspect.AccessTokenSecret = settings.AccessTokenSecret;
            });
            await _siteService.UpdateSiteSettingsAsync(container);
        }
コード例 #17
0
        public static async Task ExportTwitterSettings(TwitterSettings TwitterSettings)
        {
            List <TwitterSettings> ToWrite = new List <TwitterSettings>();

            ToWrite.Add(TwitterSettings);

            string FilePath = Path.Combine(Constants.AppFolder(Constants.AppDirectory.DataTwitterSettings));

            //TwitterSettings = TwitterSettings;

            FilePath = Path.Combine(FilePath, "TwSettings.csv");
            using (StreamWriter write = new StreamWriter(FilePath, false))
            {
                CsvWriter csw = new CsvWriter(write, CultureInfo.InvariantCulture);
                csw.WriteHeader <TwitterSettings>(); // writes the csv header for this class
                csw.NextRecord();
                csw.WriteRecords(ToWrite);           //WriteRecords, if you convert to list.
            }
        }
コード例 #18
0
        public static void SetSettings(this ITwitterService service, TwitterBindingAttribute attribute)
        {
            if (service == null)
            {
                throw new NullReferenceException(nameof(service));
            }
            if (attribute == null)
            {
                throw new ArgumentNullException(nameof(attribute));
            }

            var twitterSettings = new TwitterSettings();

            twitterSettings.ConsumerKey       = attribute.ConsumerKey;
            twitterSettings.ConsumerSecret    = attribute.ConsumerSecret;
            twitterSettings.AccessToken       = attribute.AccessToken;
            twitterSettings.AccessTokenSecret = attribute.AccessTokenSecret;

            service.Settings = twitterSettings;
        }
コード例 #19
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            var twitterKeys = new TwitterSettings();

            Configuration.Bind("Twitter", twitterKeys);
            services.AddSingleton(twitterKeys);
            services.AddSingleton <ILogger, ConsoleLogService>();
            services.AddSingleton <ITwitterApiService, TwitterApiService>();
            services.AddSingleton <IEmojiService, EmojiService>();
            services.AddSingleton <ITwitterService, TwitterService>();
            services.AddSingleton <ITwitterDatabase, TwitterDatabase>();
            services.AddSwaggerGen(swagger =>
            {
                swagger.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "Twitter  Statistics", Version = "v1"
                });
            });
        }
コード例 #20
0
        public TwitterClientTests()
        {
            mockFakeHttpMessageHandler = new Mock <FakeHttpMessageHandler>()
            {
                CallBase = true
            };

            var fakeDataProtector = new FakeDataProtector();
            var settings          = new TwitterSettings
            {
                AccessToken       = "370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb",
                AccessTokenSecret = "LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE",
                ConsumerKey       = "xvz1evFS4wEEPTGEFPHBog",
                ConsumerSecret    = "kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw"
            };

            settings.AccessTokenSecret = fakeDataProtector.Protect(settings.AccessTokenSecret);
            settings.ConsumerSecret    = fakeDataProtector.Protect(settings.ConsumerSecret);

            var signinSettings = new TwitterSigninSettings
            {
                CallbackPath = null
            };

            mockSiteService = Mock.Of <ISiteService>(ss =>
                                                     ss.GetSiteSettingsAsync() == Task.FromResult(
                                                         Mock.Of <ISite>(s => s.Properties == JObject.FromObject(new { TwitterSettings = settings, TwitterSignInSettings = signinSettings }))
                                                         )
                                                     );

            mockDataProtectionProvider = Mock.Of <IDataProtectionProvider>(dpp =>
                                                                           dpp.CreateProtector(It.IsAny <string>()) == fakeDataProtector
                                                                           );

            var ticks = 13186229580000000 + 621355968000000000;

            mockHttpMessageHandler = new Mock <TwitterClientMessageHandler>(
                Mock.Of <IClock>(i => i.UtcNow == new DateTime(ticks)),
                mockSiteService, mockDataProtectionProvider);
        }
コード例 #21
0
ファイル: widget.ascx.cs プロジェクト: abuhmead1987/code2code
    public override void LoadWidget()
    {
        TwitterSettings settings = GetTwitterSettings();

        if (settings.AccountUrl != null && !string.IsNullOrEmpty(settings.FollowMeText))
        {
            hlTwitterAccount.NavigateUrl = settings.AccountUrl.ToString();
            hlTwitterAccount.Text        = settings.FollowMeText;
        }

        if (settings.FeedUrl != null)
        {
            if (HttpRuntime.Cache[TWITTER_FEEDS_CACHE_KEY] == null)
            {
                XmlDocument doc = GetLastFeed();
                if (doc != null)
                {
                    HttpRuntime.Cache[TWITTER_FEEDS_CACHE_KEY] = doc.OuterXml;
                }
            }

            if (HttpRuntime.Cache[TWITTER_FEEDS_CACHE_KEY] != null)
            {
                string      xml = (string)HttpRuntime.Cache[TWITTER_FEEDS_CACHE_KEY];
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(xml);
                BindFeed(doc, settings.MaxItems);
            }

            if (DateTime.Now > settings.LastModified.AddMinutes(settings.PollingInterval))
            {
                settings.LastModified = DateTime.Now;
                BeginGetFeed(settings.FeedUrl);
            }
        }
    }
コード例 #22
0
        public static async Task <TwitterSettings> ImportTwitterSettings()
        {
            string          FilePath        = Path.Combine(Constants.AppFolder(Constants.AppDirectory.DataTwitterSettings));
            TwitterSettings TwitterSettings = new TwitterSettings();

            if (!String.IsNullOrEmpty(FilePath))
            {
                // First see if we have the file we want where we want it. To do that, we need to get the filepath to our app folder in my documents
                if (Directory.Exists(FilePath))
                {
                    // We can only do this because the directory exists
                    // Now check if the file exists
                    string ourfilepath = Path.Combine(FilePath, "TwSettings.csv");

                    // Get trade info, and Account balance
                    if (File.Exists(ourfilepath))
                    {
                        // handle backward compatibility: if new fields were added, the CsvReader cannot find these and throws a CsvHelper.ValidationException.
                        // in this case, we try to load the csv with our compatibility class that we copied before the additional fields were added and this shoudl go fine.
                        // after that we create the new instances out of the old values and add default values for the new fields.
                        try
                        {
                            using (var reader = new CsvReader(new StreamReader(ourfilepath), CultureInfo.InvariantCulture))
                            {
                                TwitterSettings = reader.GetRecords <TwitterSettings>().FirstOrDefault();
                            }
                        }
                        catch (CsvHelper.ValidationException valex)
                        {
                        }
                    }
                }
            }

            return(TwitterSettings);
        }
コード例 #23
0
        /// <summary>
        /// Gets the twitter settings.
        /// </summary>
        /// <returns>
        /// The twitter settings.
        /// </returns>
        private TwitterSettings GetTwitterSettings()
        {
            var twitterSettings = Blog.CurrentInstance.Cache[TwitterSettingsCacheKey] as TwitterSettings;

            if (twitterSettings != null)
            {
                return(twitterSettings);
            }

            twitterSettings = new TwitterSettings();

            // Defaults
            var          maxItems        = 3;
            var          pollingInterval = 15;
            const string FollowMeText    = "Follow me";

            var settings = this.GetSettings();

            if (settings.ContainsKey("accounturl") && !string.IsNullOrEmpty(settings["accounturl"]))
            {
                Uri accountUrl;
                Uri.TryCreate(settings["accounturl"], UriKind.Absolute, out accountUrl);
                twitterSettings.AccountUrl = accountUrl;
            }

            if (settings.ContainsKey("feedurl") && !string.IsNullOrEmpty(settings["feedurl"]))
            {
                Uri feedUrl;
                Uri.TryCreate(settings["feedurl"], UriKind.Absolute, out feedUrl);
                twitterSettings.FeedUrl = feedUrl;
            }

            if (settings.ContainsKey("pollinginterval") && !string.IsNullOrEmpty(settings["pollinginterval"]))
            {
                int tempPollingInterval;
                if (int.TryParse(settings["pollinginterval"], out tempPollingInterval))
                {
                    if (tempPollingInterval > 0)
                    {
                        pollingInterval = tempPollingInterval;
                    }
                }
            }

            twitterSettings.PollingInterval = pollingInterval;

            if (settings.ContainsKey("maxitems") && !string.IsNullOrEmpty(settings["maxitems"]))
            {
                int tempMaxItems;
                if (int.TryParse(settings["maxitems"], out tempMaxItems))
                {
                    if (tempMaxItems > 0)
                    {
                        maxItems = tempMaxItems;
                    }
                }
            }

            twitterSettings.MaxItems = maxItems;

            twitterSettings.FollowMeText = settings.ContainsKey("followmetext") &&
                                           !string.IsNullOrEmpty(settings["followmetext"])
                                               ? settings["followmetext"]
                                               : FollowMeText;

            Blog.CurrentInstance.Cache[TwitterSettingsCacheKey] = twitterSettings;

            return(twitterSettings);
        }
コード例 #24
0
ファイル: widget.ascx.cs プロジェクト: abuhmead1987/code2code
    private TwitterSettings GetTwitterSettings()
    {
        TwitterSettings twitterSettings = HttpRuntime.Cache[TWITTER_SETTINGS_CACHE_KEY] as TwitterSettings;

        if (twitterSettings != null)
        {
            return(twitterSettings);
        }

        twitterSettings = new TwitterSettings();

        // Defaults
        int    maxItems        = 3;
        int    pollingInterval = 15;
        string followMeText    = "Follow me";
        Uri    accountUrl;
        Uri    feedUrl;

        StringDictionary settings = GetSettings();

        if (settings.ContainsKey("accounturl") && !string.IsNullOrEmpty(settings["accounturl"]))
        {
            Uri.TryCreate(settings["accounturl"], UriKind.Absolute, out accountUrl);
            twitterSettings.AccountUrl = accountUrl;
        }

        if (settings.ContainsKey("feedurl") && !string.IsNullOrEmpty(settings["feedurl"]))
        {
            Uri.TryCreate(settings["feedurl"], UriKind.Absolute, out feedUrl);
            twitterSettings.FeedUrl = feedUrl;
        }

        if (settings.ContainsKey("pollinginterval") && !string.IsNullOrEmpty(settings["pollinginterval"]))
        {
            int tempPollingInterval;
            if (int.TryParse(settings["pollinginterval"], out tempPollingInterval))
            {
                if (tempPollingInterval > 0)
                {
                    pollingInterval = tempPollingInterval;
                }
            }
        }
        twitterSettings.PollingInterval = pollingInterval;

        if (settings.ContainsKey("maxitems") && !string.IsNullOrEmpty(settings["maxitems"]))
        {
            int tempMaxItems;
            if (int.TryParse(settings["maxitems"], out tempMaxItems))
            {
                if (tempMaxItems > 0)
                {
                    maxItems = tempMaxItems;
                }
            }
        }
        twitterSettings.MaxItems = maxItems;

        if (settings.ContainsKey("followmetext") && !string.IsNullOrEmpty(settings["followmetext"]))
        {
            twitterSettings.FollowMeText = settings["followmetext"];
        }
        else
        {
            twitterSettings.FollowMeText = followMeText;
        }

        HttpRuntime.Cache[TWITTER_SETTINGS_CACHE_KEY] = twitterSettings;

        return(twitterSettings);
    }
コード例 #25
0
 public TwitterAuthenticationInitializer(TwitterSettings settings, ILogger <TwitterAuthenticationInitializer> logger)
 {
     _settings = settings;
     _logger   = logger;
 }
コード例 #26
0
 public TwitterService(TwitterSettings twitterSettings)
 {
     _twitterSettings = twitterSettings;
 }
コード例 #27
0
 public Twitter()
 {
     Settings = new TwitterSettings();
     Initalize();
     NavigateTo(Url);
 }
コード例 #28
0
ファイル: TwitterController.cs プロジェクト: evencart/plugins
 public TwitterController(TwitterSettings twitterSettings, ISettingService settingService)
 {
     _twitterSettings = twitterSettings;
     _settingService  = settingService;
 }
コード例 #29
0
 public TwitterStreamingApiAdapter(TwitterSettings twitterSettings)
 {
     this.twitterSettings = twitterSettings ?? throw new ArgumentNullException("twitterSettings");
 }
コード例 #30
0
ファイル: TwitterAlertClient.cs プロジェクト: NoExitTV/pi-dns
 public TwitterAlertClient(
     IOptions <TwitterSettings> twitterSettings)
 {
     _logger          = Log.ForContext("SourceContext", nameof(TwitterAlertClient));
     _twitterSettings = twitterSettings.Value;
 }
コード例 #31
0
ファイル: TwitterManager.cs プロジェクト: yappy/DollsKit
 public static void Terminate()
 {
     account = null;
     settings = null;
 }
コード例 #32
0
 public TwitterSettingsEditor()
 {
     TwitterSettings.RegisterChangeEventCallback(this.SettingsChanged);
 }
コード例 #33
0
ファイル: TwitterService.cs プロジェクト: mike-tesch/Sonarr
        public ValidationFailure Test(TwitterSettings settings)
        {
            try
            {
                var body = "Sonarr: Test Message @ " + DateTime.Now;

                SendNotification(body, settings);
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Unable to send test message: " + ex.Message);
                return new ValidationFailure("Host", "Unable to send test message");
            }
            return null;
        }
コード例 #34
0
 public TwitterQuery(IOptions <TwitterSettings> settings)
 {
     this.settings = settings.Value;
 }