예제 #1
0
        public static IEnumerable <Issue> GetInconsistencies(
            BeatmapSet beatmapSet,
            Func <Beatmap, string> ConsistencyCheck,
            IssueTemplate template)
        {
            List <KeyValuePair <Beatmap, string> > pairs = new List <KeyValuePair <Beatmap, string> >();

            foreach (Beatmap beatmap in beatmapSet.beatmaps)
            {
                pairs.Add(new KeyValuePair <Beatmap, string>(beatmap, ConsistencyCheck(beatmap)));
            }

            var groups =
                pairs
                .Where(pair => pair.Value != null)
                .GroupBy(pair => pair.Value)
                .Select(group =>
                        new KeyValuePair <string, IEnumerable <Beatmap> >(group.Key, group.Select(pair => pair.Key)))
                .ToList();

            if (groups.Count <= 1)
            {
                yield break;
            }

            foreach (var(key, value) in groups)
            {
                string message = key + " : " + string.Join(" ", value);
                yield return(new Issue(template, null, message));
            }
        }
예제 #2
0
 public TimeTagIssue(HitObject lyric, IssueTemplate template, Dictionary <TimeTagInvalid, TimeTag[]> invalidTimeTags, bool missingStartTimeTag, bool missingEndTimeTag, params object[] args)
     : base(lyric, template, args)
 {
     InvalidTimeTags     = invalidTimeTags;
     MissingStartTimeTag = missingStartTimeTag;
     MissingEndTimeTag   = missingEndTimeTag;
 }
예제 #3
0
 private static Issue EdgeWalkGeneralIssue(IssueTemplate template, Beatmap beatmap, string stamp, params Beatmap.Difficulty[] difficulties)
 {
     return(new Issue(
                template,
                beatmap,
                stamp
                ).ForDifficulties(difficulties));
 }
예제 #4
0
 private static Issue EdgeWalkIssue(IssueTemplate template, Beatmap beatmap, CatchHitObject currentObject, params Beatmap.Difficulty[] difficulties)
 {
     return(new Issue(
                template,
                beatmap,
                Timestamp.Get(currentObject.time)
                ).ForDifficulties(difficulties));
 }
예제 #5
0
 private static Issue EdgeDashIssue(IssueTemplate template, Beatmap beatmap, CatchHitObject currentObject, params Beatmap.Difficulty[] difficulties)
 {
     return(new Issue(
                template,
                beatmap,
                Timestamp.Get(currentObject.time),
                $"{Math.Floor(currentObject.DistanceToHyperDash)}"
                ).ForDifficulties(difficulties));
 }
        /// <summary>
        /// update
        /// </summary>
        /// <param name="id">id</param>
        /// <param name="resource">resource</param>
        /// <returns>ApiResultIssueTemplate</returns>
        public ApiResultIssueTemplate UpdateIssueTemplate(string id, IssueTemplate resource)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new ApiException(400, "Missing required parameter 'id' when calling UpdateIssueTemplate");
            }

            // verify the required parameter 'resource' is set
            if (resource == null)
            {
                throw new ApiException(400, "Missing required parameter 'resource' when calling UpdateIssueTemplate");
            }


            var path = "/issueTemplates/{id}";

            path = path.Replace("{format}", "json");
            path = path.Replace("{" + "id" + "}", ApiClient.ParameterToString(id));

            var    queryParams  = new Dictionary <String, String>();
            var    headerParams = new Dictionary <String, String>();
            var    formParams   = new Dictionary <String, String>();
            var    fileParams   = new Dictionary <String, FileParameter>();
            String postBody     = null;

            postBody = ApiClient.Serialize(resource);                                     // http body (model) parameter

            // authentication setting, if any
            String[] authSettings = new String[] { "FortifyToken" };

            // make the HTTP request
            IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings);

            if (((int)response.StatusCode) >= 400)
            {
                throw new ApiException((int)response.StatusCode, "Error calling UpdateIssueTemplate: " + response.Content, response.Content);
            }
            else if (((int)response.StatusCode) == 0)
            {
                throw new ApiException((int)response.StatusCode, "Error calling UpdateIssueTemplate: " + response.ErrorMessage, response.ErrorMessage);
            }

            return((ApiResultIssueTemplate)ApiClient.Deserialize(response.Content, typeof(ApiResultIssueTemplate), response.Headers));
        }
예제 #7
0
        public static IEnumerable <Issue> GetInconsistencies(
            BeatmapSet aBeatmapSet,
            Func <Beatmap, string> aConsistencyCheck,
            IssueTemplate aTemplate)
        {
            List <KeyValuePair <Beatmap, string> > pairs = new List <KeyValuePair <Beatmap, string> >();

            foreach (Beatmap beatmap in aBeatmapSet.beatmaps)
            {
                pairs.Add(new KeyValuePair <Beatmap, string>(beatmap, aConsistencyCheck(beatmap)));
            }

            var groups = pairs.Where(aPair => aPair.Value != null).GroupBy(aPair => aPair.Value).Select(aGroup =>
                                                                                                        new KeyValuePair <string, IEnumerable <Beatmap> >(aGroup.Key, aGroup.Select(aPair => aPair.Key)));

            if (groups.Count() > 1)
            {
                foreach (var group in groups)
                {
                    string message = group.Key + " : " + String.Join(" ", group.Value);
                    yield return(new Issue(aTemplate, null, message));
                }
            }
        }
예제 #8
0
 public RubyTagIssue(HitObject lyric, IssueTemplate template, Dictionary <RubyTagInvalid, RubyTag[]> invalidRubyTags, params object[] args)
     : base(lyric, template, args)
 {
     InvalidRubyTags = invalidRubyTags;
 }
예제 #9
0
 private IEnumerable <AttributeError> GetIssuses(Component component, IEnumerable <DependencyFieldInfo> dependencyList, IssueTemplate template)
 {
     return(from info in _fieldAttributeVisitor.DependencyObjects
            where info.IsInOrder && info.Required
            select new AttributeError {
         Message = template?.Invoke(component, info)
     });
 }
예제 #10
0
 public LyricTimeIssue(HitObject lyric, IssueTemplate template, TimeInvalid[] invalidLyricTime, params object[] args)
     : base(lyric, template, args)
 {
     InvalidLyricTime = invalidLyricTime;
 }