forked from Inedo/bmx-windowssdklegacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SignExeActionEditor.cs
59 lines (55 loc) · 2.75 KB
/
SignExeActionEditor.cs
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using Inedo.BuildMaster;
using Inedo.BuildMaster.Extensibility.Actions;
using Inedo.BuildMaster.Web.Controls;
using Inedo.BuildMaster.Web.Controls.Extensions;
using Inedo.Web.Controls;
namespace Inedo.BuildMasterExtensions.WindowsSdk
{
internal sealed class SignExeActionEditor : ActionEditorBase
{
private ValidatingTextBox txtSubject;
private ValidatingTextBox txtTimestampServer;
private ValidatingTextBox txtContentDescription;
private ValidatingTextBox txtContentUrl;
private SourceControlFileFolderPicker ctlSignExe;
public override void BindToForm(ActionBase extension)
{
var action = (SignExeAction)extension;
this.txtSubject.Text = action.SubjectName;
this.txtTimestampServer.Text = action.TimestampServer;
this.txtContentDescription.Text = action.ContentDescription;
this.txtContentUrl.Text = action.ContentUrl;
if (string.IsNullOrEmpty(action.OverriddenSourceDirectory))
this.ctlSignExe.Text = action.SignExePath;
else
this.ctlSignExe.Text = Util.Path2.Combine(action.OverriddenSourceDirectory, action.SignExePath);
}
public override ActionBase CreateFromForm()
{
return new SignExeAction
{
SubjectName = this.txtSubject.Text,
TimestampServer = this.txtTimestampServer.Text,
ContentDescription = this.txtContentDescription.Text,
ContentUrl = this.txtContentUrl.Text,
SignExePath = Util.Path2.GetFileName(this.ctlSignExe.Text),
OverriddenSourceDirectory = Util.Path2.GetDirectoryName(this.ctlSignExe.Text)
};
}
protected override void CreateChildControls()
{
this.txtSubject = new ValidatingTextBox { Required = true };
this.txtTimestampServer = new ValidatingTextBox { DefaultText = "(none)" };
this.txtContentDescription = new ValidatingTextBox { DefaultText = "(none)", };
this.txtContentUrl = new ValidatingTextBox { DefaultText = "(none)" };
this.ctlSignExe = new SourceControlFileFolderPicker { DisplayMode = SourceControlBrowser.DisplayModes.FoldersAndFiles };
this.Controls.Add(
new SlimFormField("File to sign:", this.ctlSignExe),
new SlimFormField("Certificate subject:", this.txtSubject),
new SlimFormField("Timestamp server URL:", this.txtTimestampServer),
new SlimFormField("Description:", this.txtContentDescription),
new SlimFormField("Information URL:", this.txtContentUrl)
);
}
}
}