예제 #1
0
        public static bool IsDingMessage(
            this IMessage message, ChannelSettingsModel settings, IEnumerable<string> dingTerms)
        {
            var safeMessage = HttpUtility.HtmlDecode(message.Message);

            if (!settings.NotifyIncludesCharacterNames) return safeMessage.HasDingTermMatch(dingTerms);

            var enumeratedDingTerm = dingTerms as string[] ?? dingTerms.ToArray();
            return message.Poster.Name.HasDingTermMatch(enumeratedDingTerm)
                   || safeMessage.HasDingTermMatch(enumeratedDingTerm);
        }
예제 #2
0
        public static bool IsDingMessage(
            this IMessage message, ChannelSettingsModel settings, IEnumerable <string> dingTerms)
        {
            var safeMessage = HttpUtility.HtmlDecode(message.Message);

            if (!settings.NotifyIncludesCharacterNames)
            {
                return(safeMessage.HasDingTermMatch(dingTerms));
            }

            var enumeratedDingTerm = dingTerms as string[] ?? dingTerms.ToArray();

            return(message.Poster.Name.HasDingTermMatch(enumeratedDingTerm) ||
                   safeMessage.HasDingTermMatch(enumeratedDingTerm));
        }
예제 #3
0
        private static ChannelSettingsModel GetDefaultSettings(string title, string id, bool isPm)
        {
            var path    = StringExtensions.MakeSafeFolderPath(DefaultsFolderName, title, id);
            var baseObj = new ChannelSettingsModel(isPm);

            if (!Directory.Exists(path))
            {
                return(baseObj);
            }

            var workingPath = Path.Combine(path, SettingsFileName);

            if (!File.Exists(workingPath))
            {
                return(baseObj);
            }

            return(ReadObjectFromXml(workingPath, new ChannelSettingsModel(isPm)));
        }
예제 #4
0
 public static void NotifyWithSettings(this IManageToasts toasts, NotificationModel notification,
     ChannelSettingsModel.NotifyLevel notifyLevel)
 {
     switch (notifyLevel)
     {
         case ChannelSettingsModel.NotifyLevel.NoNotification:
             break;
         case ChannelSettingsModel.NotifyLevel.NotificationOnly:
             toasts.AddNotification(notification);
             break;
         case ChannelSettingsModel.NotifyLevel.NotificationAndToast:
             toasts.AddNotification(notification);
             toasts.FlashWindow();
             toasts.ShowToast();
             break;
         case ChannelSettingsModel.NotifyLevel.NotificationAndSound:
             toasts.AddNotification(notification);
             toasts.FlashWindow();
             toasts.PlaySound();
             toasts.ShowToast();
             break;
     }
 }