示例#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;
     }
 }