1
namespace dbversion.Console.Command.Version
3
using System.ComponentModel.Composition;
4
using System.Diagnostics;
7
/// Displays the current application version.
9
[Export(typeof(IConsoleCommand))]
10
public class DisplayVersionCommand : IConsoleCommand
13
/// Gets or sets the message service.
16
/// The message service.
19
public IMessageService MessageService
26
/// Gets the name of the command.
29
/// The name of the command.
33
get { return "version"; }
37
/// Execute the command using the specified args.
39
/// <param name='args'>
42
public void Execute(string[] args)
44
var assembly = typeof(DisplayVersionCommand).Assembly;
45
var assemblyName = typeof(DisplayVersionCommand).Assembly.GetName();
46
var fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
48
this.MessageService.WriteLine(string.Format("{0} {1}", assemblyName.Name, assemblyName.Version));
49
this.MessageService.WriteLine(fileVersionInfo.LegalCopyright);
50
this.MessageService.WriteLine("License MIT: The MIT License");
51
this.MessageService.WriteLine("This is free software: you are free to change and redistribute it.");
52
this.MessageService.WriteLine("There is NO WARRANTY, to the extent permitted by law.");