示例#1
0
        private static double?TryParseLimitValue(
            Target target, XElement competitionNode,
            CompetitionLimitProperties limitProperty,
            CompetitionState competitionState)
        {
            double?result = null;

            var limitText = competitionNode.Attribute(limitProperty.ToString())?.Value;

            if (limitText != null)
            {
                var    culture = EnvironmentInfo.MainCultureInfo;
                double parsed;
                if (double.TryParse(limitText, NumberStyles.Any, culture, out parsed))
                {
                    result = parsed;
                }
                else
                {
                    competitionState.WriteMessage(
                        MessageSource.Analyser, MessageSeverity.SetupError,
                        $"XML anotation for {target.MethodTitle}: could not parse {limitProperty}.");
                }
            }

            return(result);
        }
 private void MarkAsChanged(CompetitionLimitProperties property) =>
 _changedProperties = _changedProperties.SetFlag(property);
 /// <summary>Determines whether all specified properties are changed.</summary>
 /// <param name="property">The properties to check.</param>
 /// <returns><c>true</c> if all specified properties are changed. </returns>
 public bool IsChanged(CompetitionLimitProperties property) =>
 property != CompetitionLimitProperties.None &&
 _changedProperties.IsFlagSet(property);
 /// <summary>Marks limits as saved.</summary>
 public void MarkAsSaved() => _changedProperties = CompetitionLimitProperties.None;