private static void must_start_with(Simple_Setting NewSetting, string StartsWith)
        {
            if (NewSetting.Value.Length == 0)
                return;

            if (!NewSetting.Value.StartsWith(StartsWith, StringComparison.OrdinalIgnoreCase))
            {
                NewSetting.Value = StartsWith + NewSetting.Value;
            }
        }
        private static void must_start_with(Simple_Setting NewSetting, string[] StartsWith)
        {
            if (NewSetting.Value.Length == 0)
                return;

            // Check for the start against all possible combinations
            bool missing_start = StartsWith.All(possibleStart => !NewSetting.Value.StartsWith(possibleStart, StringComparison.OrdinalIgnoreCase));

            if (missing_start)
            {
                NewSetting.Value = StartsWith[0] + NewSetting.Value;
            }
        }
        private static void must_start_end_with(Simple_Setting NewSetting, string StartsWith, string EndsWith)
        {
            if (NewSetting.Value.Length == 0)
                return;

            if ((!NewSetting.Value.StartsWith(StartsWith, StringComparison.OrdinalIgnoreCase)) || (!NewSetting.Value.EndsWith(EndsWith, StringComparison.InvariantCultureIgnoreCase)))
            {
                if (!NewSetting.Value.StartsWith(StartsWith, StringComparison.OrdinalIgnoreCase))
                    NewSetting.Value = StartsWith + NewSetting.Value;
                if (!NewSetting.Value.EndsWith(EndsWith, StringComparison.OrdinalIgnoreCase))
                    NewSetting.Value = NewSetting.Value + EndsWith;
            }
        }
        private static void must_end_with(Simple_Setting NewSetting, string EndsWith)
        {
            if (NewSetting.Value.Length == 0)
                return;

            if (!NewSetting.Value.EndsWith(EndsWith, StringComparison.OrdinalIgnoreCase))
            {
                NewSetting.Value = NewSetting.Value + EndsWith;
            }
        }
        private void must_be_valid_regular_expression(Simple_Setting NewSetting)
        {
            if (NewSetting.Value.Length == 0)
                return;

            // This is really just a check that it is a valid regular expression by
            // attempting to perform a regular expression match.  The match itself
            // ( and the resulting value ) is not important.
            try
            {
                Regex.Match("any_old_file.tif", NewSetting.Value);
            }
            catch (ArgumentException)
            {
                isValid = false;
                errorBuilder.AppendLine(NewSetting.Key + ": Value must be empty or a valid regular expression.");
            }
        }
        private void must_be_positive_number(Simple_Setting NewSetting)
        {
            bool appears_valid = false;
            int number;
            if ((Int32.TryParse(NewSetting.Value, out number)) && (number >= 0))
            {
                appears_valid = true;
            }

            if (!appears_valid)
            {
                isValid = false;
                errorBuilder.AppendLine(NewSetting.Key + ": Value must be a positive integer or zero.");
            }
        }
        private static void must_start_end_with( Simple_Setting NewSetting, string[] StartsWith, string EndsWith )
        {
            if (NewSetting.Value.Length == 0)
                return;

            // Check for the start against all possible combinations
            bool missing_start = true;
            foreach (string possibleStart in StartsWith)
            {
                if (NewSetting.Value.StartsWith(possibleStart, StringComparison.OrdinalIgnoreCase))
                {
                    missing_start = false;
                    break;
                }
            }

            if ((missing_start) || (!NewSetting.Value.EndsWith(EndsWith, StringComparison.OrdinalIgnoreCase)))
            {
                if (missing_start)
                    NewSetting.Value = StartsWith[0] + NewSetting.Value;
                if (!NewSetting.Value.EndsWith(EndsWith, StringComparison.OrdinalIgnoreCase))
                    NewSetting.Value = NewSetting.Value + EndsWith;
            }
        }