Пример #1
0
		public static void DefaultParsingErrorsHandler(CommandLineOptionsBase options, HelpText current)
		{
			if (options.InternalLastPostParsingState.Errors.Count > 0)
			{
				var errors = current.RenderParsingErrorsText(options, 2); // indent with two spaces
				if (!string.IsNullOrEmpty(errors))
				{
					current.AddPreOptionsLine(string.Concat(Environment.NewLine, current.SentenceBuilder.ErrorsHeadingText));
					//current.AddPreOptionsLine(errors);
					var lines = errors.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
					foreach (var line in lines) { current.AddPreOptionsLine(line); }
				}
			}
		}
Пример #2
0
		/*
		public string FullText
		{
			get
			{
				if (string.IsNullOrEmpty(_fullText))
				{
					if (!string.IsNullOrEmpty(_line1))
					{
						var builder = new StringBuilder(_line1);
						builder.AppendLineIfNotNullOrEmpty(_line2);
						builder.AppendLineIfNotNullOrEmpty(_line3);
						builder.AppendLineIfNotNullOrEmpty(_line4);
						builder.AppendLineIfNotNullOrEmpty(_line5);
						_fullText = builder.ToString();
					}
				}
				return _fullText;
			}
		}
		*/

		internal void AddToHelpText(HelpText helpText, bool before)
		{
			if (before)
			{
				if (!string.IsNullOrEmpty(_line1)) helpText.AddPreOptionsLine(_line1);
				if (!string.IsNullOrEmpty(_line2)) helpText.AddPreOptionsLine(_line2);
				if (!string.IsNullOrEmpty(_line3)) helpText.AddPreOptionsLine(_line3);
				if (!string.IsNullOrEmpty(_line4)) helpText.AddPreOptionsLine(_line4);
				if (!string.IsNullOrEmpty(_line5)) helpText.AddPreOptionsLine(_line5);
			}
			else
			{
				if (!string.IsNullOrEmpty(_line1)) helpText.AddPostOptionsLine(_line1);
				if (!string.IsNullOrEmpty(_line2)) helpText.AddPostOptionsLine(_line2);
				if (!string.IsNullOrEmpty(_line3)) helpText.AddPostOptionsLine(_line3);
				if (!string.IsNullOrEmpty(_line4)) helpText.AddPostOptionsLine(_line4);
				if (!string.IsNullOrEmpty(_line5)) helpText.AddPostOptionsLine(_line5);
			}
		}