summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.BuildTasks/SignatureVerification.cs
blob: 86c36b158ad0ac0b15e0772c1a4715557289cff3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//-----------------------------------------------------------------------
// <copyright file="SignatureVerification.cs" company="Outercurve Foundation">
//     Copyright (c) Outercurve Foundation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace DotNetOpenAuth.BuildTasks {
	using Microsoft.Build.Utilities;

	public class SignatureVerification : SnToolTask {
		/// <summary>
		/// Gets or sets a value indicating whether to register the given assembly and public key token
		/// for skip verification or clear any pre-existing skip verification entry.
		/// </summary>
		public bool SkipVerification { get; set; }

		/// <summary>
		/// Gets or sets the name of the assembly.
		/// </summary>
		/// <value>The name of the assembly.</value>
		public string AssemblyName { get; set; }

		/// <summary>
		/// Gets or sets the public key token.
		/// </summary>
		/// <value>The public key token.</value>
		public string PublicKeyToken { get; set; }

		/// <summary>
		/// Generates the command line commands.
		/// </summary>
		protected override string GenerateCommandLineCommands() {
			CommandLineBuilder builder = new CommandLineBuilder();
			builder.AppendSwitch("-q");
			if (this.SkipVerification) {
				builder.AppendSwitch("-Vr");
			} else {
				builder.AppendSwitch("-Vu");
			}

			builder.AppendFileNameIfNotNull(this.AssemblyName + "," + this.PublicKeyToken);
			return builder.ToString();
		}
	}
}