Example #1
0
        public static INotifier Create(NotifierType type, ILogger logger, IConfigurationSection section)
        {
            NotifierFactory factory;

            switch (type)
            {
            case NotifierType.Pushbullet:
                factory = new PushbulletFactory();
                break;

            case NotifierType.Webhook:
                factory = new WebhookFactory();
                break;

            case NotifierType.Email:
                factory = new EmailFactory();
                break;

            case NotifierType.Telegram:
                factory = new TelegramFactory();
                break;

            default:
                throw new NotImplementedException(type.ToString());
            }

            INotifier notifier = factory.Create(logger, section);

            notifier.Cameras = section.GetSection("Cameras").Get <List <string> >();

            return(notifier);
        }
Example #2
0
 public static extern int RasDial(
     [In] ref RASDIALEXTENSIONS lpRasDialExtensions,
     string lpszPhoneBook,
     [In] ref RASDIALPARAMS lpRasDialParams,
     NotifierType dwNotifierType,
     Delegate lpvNotifier,
     out IntPtr lphRasConn);
Example #3
0
        private async Task SendLeaderboardsAsync(RestDMChannel channel, NotifierType type)
        {
            if (type == NotifierType.PlayerSeasonWins)
            {
                var pswLb = await ScrapClient.GetPlayerSeasonWinLeaderboardAsync();

                var page = PageUtils.LeaderBoardPage(pswLb.Take(15),
                                                     0,
                                                     member => member.Name,
                                                     member => member.SeasonWins.ToString(),
                                                     "Most Active Players",
                                                     ":muscle:",
                                                     EmbedColor.Leaderboard);

                await channel.SendMessageAsync(embed : page.Build().Embed);
            }
            else if (type == NotifierType.TeamSeasonWins)
            {
                var pswLb = await ScrapClient.GetTeamSeasonWinLeaderboardAsync();

                var page = PageUtils.LeaderBoardPage(pswLb.Take(15),
                                                     0,
                                                     teamwin => teamwin.Team.Name,
                                                     teamwin => teamwin.SeasonWins.ToString(),
                                                     "Most Active Teams",
                                                     ":muscle:",
                                                     EmbedColor.Leaderboard);

                await channel.SendMessageAsync(embed : page.Build().Embed);
            }
        }
Example #4
0
 private void Put(NotifierType notifierType, IconStatus status)
 {
     if (this.unitaryStatus.ContainsKey(notifierType))
     {
         this.unitaryStatus.Remove(notifierType);
     }
     this.unitaryStatus.Add(notifierType, status);
 }
Example #5
0
        public Notifier(ulong discordId, bool compactDisplay, NotifierType type, TimeSpan interval)
        {
            Id = Guid.NewGuid();

            DiscordId      = discordId;
            CompactDisplay = compactDisplay;
            Type           = type;
            Interval       = interval;
        }
Example #6
0
        public INotifier GetNotifier(NotifierType notifierType)
        {
            switch (notifierType)
            {
            case NotifierType.MESSAGE_BOX:
            default:
                return(new MessageBoxNotifier(_serviceProvider));

            case NotifierType.PUSHBULLET:
                return(new PushbulletNotifier(_options.Pushbullet));
            }
        }
Example #7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (NotifierType.Length != 0)
            {
                hash ^= NotifierType.GetHashCode();
            }
            if (shmLocator_ != null)
            {
                hash ^= ShmLocator.GetHashCode();
            }
            return(hash);
        }
Example #8
0
 public ServiceResponse <Notifier> AddNotifier(NotifierType type, string emailFromAddress, string emailFromName, string successEmailSubject, string successEmail, string failureEmailSubject, string failureEmail, bool alwaysEmailOnSuccess, List <NotifierFilter> filters, List <string> tags)
 {
     return(this.rest.Post <Notifier>("/notifier", new Dictionary <string, string>()
     {
         { "emailFromAddress", emailFromAddress },
         { "emailFromName", emailFromName },
         { "successEmailSubject", successEmailSubject },
         { "successEmail", System.Net.WebUtility.UrlEncode(successEmail) },
         { "failureEmailSubject", failureEmailSubject },
         { "failureEmail", System.Net.WebUtility.UrlEncode(failureEmail) },
         { "alwaysEmailOnSuccess", alwaysEmailOnSuccess.ToString() },
         { "type", type.ToString() },
         { "filters", ListToString <NotifierFilter>(filters) },
         { "tags", ListToString <string>(tags) }
     }));
 }
Example #9
0
 public IEnumerable <User> GetUsersConcernedByThisNotifier(NotifierType notifierType, IEnumerable <User> users) => users
 .Where(user => (user.NotificationSetting.AcceptedNotifiers & (int)notifierType) != 0);
Example #10
0
 private void Put(NotifierType notifierType, IconStatus status)
 {
     if (this.unitaryStatus.ContainsKey(notifierType))
     {
         this.unitaryStatus.Remove(notifierType);
     }
     this.unitaryStatus.Add(notifierType, status);
 }
Example #11
0
 public async Task <IEnumerable <UserNotificationOptions> > GetUserOptionsAsync(IEnumerable <int> userIds, NotifierType type)
 {
     return(await _db.UserOptions.Where(x => userIds.Contains(x.UserId) && type == x.Type).ToListAsync());
 }
Example #12
0
 public async Task <UserNotificationOptions> GetUserOptionsAsync(int userId, NotifierType type)
 {
     return(await _db.UserOptions.SingleOrDefaultAsync(x => x.UserId == userId && type == x.Type));
 }
Example #13
0
 public void DefineNormalStatus(NotifierType notifierType)
 {
     this.Put(notifierType, IconStatus.Normal);
     this.updateApplicationStatus();
 }
Example #14
0
 private static string GetDescription(NotifierType notifierType)
 {
     return(notifierType.GetType().GetMember(notifierType.ToString())[0].GetCustomAttribute <DescriptionAttribute>().Description);
 }
Example #15
0
        public int RasDial(ref RASDIALEXTENSIONS lpRasDialExtensions, string lpszPhoneBook, ref RASDIALPARAMS lpRasDialParams, NotifierType dwNotifierType, RasDialFunc2 lpvNotifier, out IntPtr lphRasConn)
        {
            var stopwatch = Stopwatch.StartNew();
            var result    = AttachedObject.RasDial(ref lpRasDialExtensions, lpszPhoneBook, ref lpRasDialParams, dwNotifierType, lpvNotifier, out lphRasConn);

            stopwatch.Stop();

            var callEvent = new PInvokeInt32CallCompletedTraceEvent
            {
                DllName    = RasApi32Dll,
                Duration   = stopwatch.Elapsed,
                MethodName = nameof(RasDial),
                Result     = result,
            };

            callEvent.Args.Add(nameof(lpRasDialExtensions), lpRasDialExtensions);
            callEvent.Args.Add(nameof(lpszPhoneBook), lpszPhoneBook);
            callEvent.Args.Add(nameof(lpRasDialParams), lpRasDialParams);
            callEvent.Args.Add(nameof(dwNotifierType), dwNotifierType);
            callEvent.Args.Add(nameof(lpvNotifier), lpvNotifier);
            callEvent.OutArgs.Add(nameof(lphRasConn), lphRasConn);

            LogVerbose(callEvent);
            return(result);
        }
Example #16
0
 public void DefineDisconnectStatus(NotifierType notifierType)
 {
     this.Put(notifierType, IconStatus.Disconnect);
     this.updateApplicationStatus();
 }
Example #17
0
 public void DefineDisconnectStatus(NotifierType notifierType)
 {
     this.Put(notifierType, IconStatus.Disconnect);
     this.updateApplicationStatus();
 }
Example #18
0
 public void DefineMessageStatus(NotifierType notifierType)
 {
     this.Put(notifierType, IconStatus.Message);
     this.updateApplicationStatus();
 }
Example #19
0
 public void DefineNormalStatus(NotifierType notifierType)
 {
     this.Put(notifierType, IconStatus.Normal);
     this.updateApplicationStatus();
 }
Example #20
0
 public WebServiceChecker(IconeStatusManager iconStatusManager, NotifierType notifierType)
 {
     this.iconStatusManager = iconStatusManager;
     this.notifierType      = notifierType;
 }
 public NotifierBuilder OfType(NotifierType type)
 {
     this.type = type;
     return(this);
 }
Example #22
0
 private static string GetString(NotifierType notifierType)
 {
     return(GetDescription(notifierType));
 }
Example #23
0
 public NotifierFactory(NotifierType notifierType, ISlackOutputConfig slackOutputConfig)
 {
     _notifierType      = notifierType;
     _slackOutputConfig = slackOutputConfig;
 }
Example #24
0
 public void DefineMessageStatus(NotifierType notifierType)
 {
     this.Put(notifierType, IconStatus.Message);
     this.updateApplicationStatus();
 }
Example #25
0
 public int RasDial(ref RASDIALEXTENSIONS lpRasDialExtensions, string lpszPhoneBook, ref RASDIALPARAMS lpRasDialParams, NotifierType dwNotifierType, RasDialFunc2 lpvNotifier, out IntPtr lphRasConn)
 {
     return(UnsafeNativeMethods.RasDial(ref lpRasDialExtensions, lpszPhoneBook, ref lpRasDialParams, dwNotifierType, lpvNotifier, out lphRasConn));
 }
Example #26
0
 public TransformerFactory(NotifierType notifierType, Level level)
 {
     _notifierType = notifierType;
     _level        = level;
 }