public override string ToString()
{
const int extraLength = 10;
StringBuilder builder = new StringBuilder(this.heading.Length +
GetLength(this.copyright) + GetLength(this.preOptionsHelp) +
GetLength(this.optionsHelp) + extraLength);
builder.Append(this.heading);
if (!string.IsNullOrEmpty(this.copyright))
{
builder.Append(Environment.NewLine);
builder.Append(this.copyright);
}
if (this.preOptionsHelp.Length > 0)
{
builder.Append(Environment.NewLine);
builder.Append(this.preOptionsHelp.ToString());
}
if (this.optionsHelp != null && this.optionsHelp.Length > 0)
{
builder.Append(Environment.NewLine);
builder.Append(Environment.NewLine);
builder.Append(this.optionsHelp.ToString());
}
return builder.ToString();
}
private static void Main(string[] args) { try { var options = new Options(); if (!Parser.Default.ParseArguments(args, options)) { var helpText = new HelpText("Laan SolutionConverter", Assembly.GetEntryAssembly().GetName().Version.ToString()); helpText.AddOptions(options); Console.WriteLine(helpText.ToString()); return; } switch (options.Mode) { case Mode.Xml: ConvertToXml(options); break; case Mode.Sln: ConvertToSln(options); break; } } catch (Exception exception) { Console.WriteLine(exception); } }