Exemple #1
0
        /// <summary>
        /// Reads the assessment section settings from a line of text.
        /// </summary>
        /// <param name="lineToParse">The line to be parsed.</param>
        /// <returns>The initialized <see cref="AssessmentSectionSettings"/>.</returns>
        /// <exception cref="IndexOutOfRangeException">Thrown when <paramref name="lineToParse"/>
        /// does not have at least 2 columns or when the columns are not separated by a ';'.</exception>
        /// <exception cref="FormatException">Thrown when the second column text does not represent a number.</exception>
        /// <exception cref="OverflowException">Thrown when the second column text represents a number
        /// that is too big or too small to be stored in an <see cref="int"/>.</exception>
        private static AssessmentSectionSettings ReadAssessmentSectionSettings(string lineToParse)
        {
            string[] lineValues = lineToParse.Split(new[]
            {
                separatorCharacter
            }, StringSplitOptions.None);
            string assessmentSectionId = lineValues[assessmentSectionIdColumnIndex];
            string nValue = lineValues[lengthEffectColumnIndex];

            if (nValue == duneAssessmentSectionFlag)
            {
                return(AssessmentSectionSettings.CreateDuneAssessmentSectionSettings(assessmentSectionId));
            }

            int n = int.Parse(nValue);

            return(AssessmentSectionSettings.CreateDikeAssessmentSectionSettings(assessmentSectionId, n));
        }