private bool TryFixBenchmarkResource(
            AnnotateContext annotateContext, string xmlFileName,
            CompetitionTarget competitionTarget)
        {
            var competitionName = competitionTarget.CompetitionName;
            var candidateName   = competitionTarget.CandidateName;

            var xdoc        = annotateContext.GetXmlAnnotation(xmlFileName);
            var competition = GetOrAdd(xdoc.Root, CompetitionTargetHelpers.CompetitionNode, competitionName);
            var candidate   = GetOrAdd(competition, CompetitionTargetHelpers.CandidateNode, candidateName);

            var minText = !competitionTarget.IgnoreMin ? competitionTarget.MinText : null;
            // Always prints
            var maxText = competitionTarget.MaxText;

            SetAttribute(candidate, CompetitionTargetHelpers.MinRatioAttribute, minText);
            SetAttribute(candidate, CompetitionTargetHelpers.MaxRatioAttribute, maxText);

            annotateContext.MarkAsChanged(xmlFileName);

            return(true);
        }
Пример #2
0
        private static bool TryFixBenchmarkXmlAnnotation(
            AnnotateContext annotateContext, string xmlFileName,
            CompetitionTarget competitionTarget,
            CompetitionState competitionState)
        {
            Code.AssertArgument(
                competitionTarget.CompetitionMetadata != null, nameof(competitionTarget),
                "Competition metadata cannot be null for xml annotations.");

            var xmlAnnotationDoc = annotateContext.TryGetXmlAnnotation(
                xmlFileName,
                competitionTarget.CompetitionMetadata.UseFullTypeName,
                competitionState);

            if (xmlAnnotationDoc == null)
            {
                return(false);
            }

            XmlAnnotations.AddOrUpdateXmlAnnotation(xmlAnnotationDoc, competitionTarget);
            annotateContext.MarkAsChanged(xmlFileName);

            return(true);
        }