示例#1
0
        public bool IsRating(RatingFlags flags)
        {
            switch (flags)
            {
            case RatingFlags.Safe:
                return(Rating == "s");

            case RatingFlags.Questionable:
                return(Rating == "q");

            case RatingFlags.Explicit:
                return(Rating == "e");

            case RatingFlags.SafeQuestionable:
                return(Rating == "s" || Rating == "q");

            case RatingFlags.QuestionableExplicit:
                return(Rating == "q" || Rating == "e");

            case RatingFlags.Any:
                return(Rating == "s" || Rating == "q" || Rating == "e");
            }

            return(false);
        }
示例#2
0
 public TaglistRegisteredUser(string Username, int ID, RatingFlags AcceptedRatings, ICollection <string> CategoryBlacklist)
 {
     if (Username is null)
     {
         throw new ArgumentNullException(nameof(Username));
     }
     this.Username          = Username;
     this.ID                = ID;
     this.AcceptedRatings   = AcceptedRatings;
     this.CategoryBlacklist = (
         from C in CategoryBlacklist select C.Normalize(NormalizationForm.FormKD)
         ).ToImmutableHashSet();
 }
示例#3
0
        public static ImageTag RatingTag(RatingFlags flags)
        {
            switch (flags)
            {
            case RatingFlags.Safe:
            case RatingFlags.Questionable:
            case RatingFlags.Explicit:
                return(new ImageTag(RatingString(flags), ImageTag.TagFilter.Rating, false));

            case RatingFlags.SafeQuestionable:
            case RatingFlags.QuestionableExplicit:
                return(new ImageTag(RatingString(flags), ImageTag.TagFilter.Rating, true));
            }

            return(null);
        }
示例#4
0
        public static string RatingString(RatingFlags flags)
        {
            switch (flags)
            {
            case RatingFlags.Safe:
                return("rating:s");

            case RatingFlags.Questionable:
                return("rating:q");

            case RatingFlags.Explicit:
                return("rating:e");

            case RatingFlags.SafeQuestionable:
                return("-rating:e");

            case RatingFlags.QuestionableExplicit:
                return("-rating:s");
            }

            return(String.Empty);
        }