6 changed files with 0 additions and 546 deletions
@ -1,96 +0,0 @@ |
|||||||
<Components version="1.0"> |
|
||||||
<System.Windows.Forms.Form> |
|
||||||
<Name value="CreateKey" /> |
|
||||||
<MinimizeBox value="False" /> |
|
||||||
<FormBorderStyle value="FixedDialog" /> |
|
||||||
<AcceptButton value="okButton [System.Windows.Forms.Button], Text: ${Global.OK}" /> |
|
||||||
<CancelButton value="cancelButton [System.Windows.Forms.Button], Text: ${Global.Cancel}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.Signing.CreateKey.Title}" /> |
|
||||||
<MaximizeBox value="False" /> |
|
||||||
<ClientSize value="{Width=416, Height=206}" /> |
|
||||||
<Controls> |
|
||||||
<System.Windows.Forms.Button> |
|
||||||
<Name value="cancelButton" /> |
|
||||||
<Location value="{X=329,Y=177}" /> |
|
||||||
<Text value="${res:Global.CancelButtonText}" /> |
|
||||||
<Size value="{Width=75, Height=23}" /> |
|
||||||
<Anchor value="Bottom, Right" /> |
|
||||||
<TabIndex value="5" /> |
|
||||||
<DialogResult value="Cancel" /> |
|
||||||
</System.Windows.Forms.Button> |
|
||||||
<System.Windows.Forms.Button> |
|
||||||
<Name value="okButton" /> |
|
||||||
<Location value="{X=248,Y=177}" /> |
|
||||||
<Text value="${res:Global.OKButtonText}" /> |
|
||||||
<Size value="{Width=75, Height=23}" /> |
|
||||||
<Anchor value="Bottom, Right" /> |
|
||||||
<TabIndex value="4" /> |
|
||||||
</System.Windows.Forms.Button> |
|
||||||
<System.Windows.Forms.Panel> |
|
||||||
<Name value="passwordPanel" /> |
|
||||||
<Location value="{X=12,Y=87}" /> |
|
||||||
<Enabled value="False" /> |
|
||||||
<Size value="{Width=392, Height=84}" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
<TabIndex value="3" /> |
|
||||||
<Controls> |
|
||||||
<System.Windows.Forms.TextBox> |
|
||||||
<Name value="confirmPasswordTextBox" /> |
|
||||||
<TabIndex value="3" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
<Size value="{Width=372, Height=21}" /> |
|
||||||
<UseSystemPasswordChar value="True" /> |
|
||||||
<Location value="{X=17,Y=60}" /> |
|
||||||
</System.Windows.Forms.TextBox> |
|
||||||
<System.Windows.Forms.Label> |
|
||||||
<Name value="label3" /> |
|
||||||
<Location value="{X=8,Y=41}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.Signing.CreateKey.ConfirmPassword}" /> |
|
||||||
<Size value="{Width=381, Height=19}" /> |
|
||||||
<TabIndex value="2" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
</System.Windows.Forms.Label> |
|
||||||
<System.Windows.Forms.TextBox> |
|
||||||
<Name value="passwordTextBox" /> |
|
||||||
<TabIndex value="1" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
<Size value="{Width=372, Height=21}" /> |
|
||||||
<UseSystemPasswordChar value="True" /> |
|
||||||
<Location value="{X=17,Y=17}" /> |
|
||||||
</System.Windows.Forms.TextBox> |
|
||||||
<System.Windows.Forms.Label> |
|
||||||
<Name value="label2" /> |
|
||||||
<Location value="{X=8,Y=0}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.Signing.CreateKey.EnterPassword}" /> |
|
||||||
<Size value="{Width=381, Height=23}" /> |
|
||||||
<TabIndex value="0" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
</System.Windows.Forms.Label> |
|
||||||
</Controls> |
|
||||||
</System.Windows.Forms.Panel> |
|
||||||
<System.Windows.Forms.CheckBox> |
|
||||||
<Name value="usePasswordCheckBox" /> |
|
||||||
<Location value="{X=12,Y=57}" /> |
|
||||||
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.Signing.CreateKey.UsePassword}" /> |
|
||||||
<TabIndex value="2" /> |
|
||||||
<Size value="{Width=392, Height=24}" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
</System.Windows.Forms.CheckBox> |
|
||||||
<System.Windows.Forms.TextBox> |
|
||||||
<Name value="keyFileTextBox" /> |
|
||||||
<TabIndex value="1" /> |
|
||||||
<Size value="{Width=384, Height=21}" /> |
|
||||||
<Location value="{X=20,Y=28}" /> |
|
||||||
</System.Windows.Forms.TextBox> |
|
||||||
<System.Windows.Forms.Label> |
|
||||||
<Name value="label1" /> |
|
||||||
<Location value="{X=12,Y=9}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.Signing.CreateKey.KeyName}" /> |
|
||||||
<Size value="{Width=392, Height=23}" /> |
|
||||||
<TabIndex value="0" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
</System.Windows.Forms.Label> |
|
||||||
</Controls> |
|
||||||
</System.Windows.Forms.Form> |
|
||||||
</Components> |
|
||||||
@ -1,109 +0,0 @@ |
|||||||
<Components version="1.0"> |
|
||||||
<System.Windows.Forms.UserControl> |
|
||||||
<Name value="XmlUserControl1" /> |
|
||||||
<ClientSize value="{Width=480, Height=312}" /> |
|
||||||
<Controls> |
|
||||||
<System.Windows.Forms.GroupBox> |
|
||||||
<Name value="startActionGroupBox" /> |
|
||||||
<Location value="{X=8,Y=8}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.DebugOptions.StartAction}" /> |
|
||||||
<Size value="{Width=464, Height=100}" /> |
|
||||||
<TabIndex value="0" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
<Controls> |
|
||||||
<System.Windows.Forms.TextBox> |
|
||||||
<Name value="startBrowserInURLTextBox" /> |
|
||||||
<TabIndex value="8" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
<Size value="{Width=300, Height=21}" /> |
|
||||||
<Location value="{X=156,Y=68}" /> |
|
||||||
</System.Windows.Forms.TextBox> |
|
||||||
<System.Windows.Forms.Button> |
|
||||||
<Name value="startExternalProgramBrowseButton" /> |
|
||||||
<Location value="{X=416,Y=44}" /> |
|
||||||
<Text value="..." /> |
|
||||||
<Size value="{Width=40, Height=21}" /> |
|
||||||
<Anchor value="Top, Right" /> |
|
||||||
<TabIndex value="7" /> |
|
||||||
</System.Windows.Forms.Button> |
|
||||||
<System.Windows.Forms.TextBox> |
|
||||||
<Name value="startExternalProgramTextBox" /> |
|
||||||
<TabIndex value="3" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
<Size value="{Width=252, Height=21}" /> |
|
||||||
<Location value="{X=156,Y=44}" /> |
|
||||||
</System.Windows.Forms.TextBox> |
|
||||||
<System.Windows.Forms.RadioButton> |
|
||||||
<Name value="startBrowserInURLRadioButton" /> |
|
||||||
<Location value="{X=4,Y=68}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.DebugOptions.StartBrowser}" /> |
|
||||||
<Size value="{Width=152, Height=20}" /> |
|
||||||
<TabIndex value="2" /> |
|
||||||
</System.Windows.Forms.RadioButton> |
|
||||||
<System.Windows.Forms.RadioButton> |
|
||||||
<Name value="startExternalProgramRadioButton" /> |
|
||||||
<Location value="{X=4,Y=44}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.DebugOptions.StartProgram}" /> |
|
||||||
<Size value="{Width=152, Height=20}" /> |
|
||||||
<TabIndex value="1" /> |
|
||||||
</System.Windows.Forms.RadioButton> |
|
||||||
<System.Windows.Forms.RadioButton> |
|
||||||
<Name value="startProjectRadioButton" /> |
|
||||||
<Location value="{X=4,Y=20}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.DebugOptions.StartProject}" /> |
|
||||||
<Size value="{Width=152, Height=20}" /> |
|
||||||
<TabIndex value="0" /> |
|
||||||
</System.Windows.Forms.RadioButton> |
|
||||||
</Controls> |
|
||||||
</System.Windows.Forms.GroupBox> |
|
||||||
<System.Windows.Forms.GroupBox> |
|
||||||
<Name value="startOptionsGroupBox" /> |
|
||||||
<Location value="{X=8,Y=120}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.DebugOptions.StartOptions}" /> |
|
||||||
<Size value="{Width=464, Height=80}" /> |
|
||||||
<TabIndex value="9" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
<Controls> |
|
||||||
<System.Windows.Forms.Label> |
|
||||||
<Name value="label2" /> |
|
||||||
<Location value="{X=4,Y=48}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.DebugOptions.WorkingDir}" /> |
|
||||||
<TextAlign value="MiddleRight" /> |
|
||||||
<Size value="{Width=148, Height=20}" /> |
|
||||||
<TabIndex value="12" /> |
|
||||||
</System.Windows.Forms.Label> |
|
||||||
<System.Windows.Forms.Label> |
|
||||||
<Name value="label1" /> |
|
||||||
<Location value="{X=8,Y=20}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.DebugOptions.Arguments}" /> |
|
||||||
<TextAlign value="MiddleRight" /> |
|
||||||
<Size value="{Width=148, Height=20}" /> |
|
||||||
<TabIndex value="11" /> |
|
||||||
</System.Windows.Forms.Label> |
|
||||||
<System.Windows.Forms.TextBox> |
|
||||||
<Name value="commandLineArgumentsTextBox" /> |
|
||||||
<TabIndex value="10" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
<Size value="{Width=300, Height=21}" /> |
|
||||||
<Location value="{X=156,Y=20}" /> |
|
||||||
</System.Windows.Forms.TextBox> |
|
||||||
<System.Windows.Forms.Button> |
|
||||||
<Name value="workingDirectoryBrowseButton" /> |
|
||||||
<Location value="{X=416,Y=52}" /> |
|
||||||
<Text value="..." /> |
|
||||||
<Size value="{Width=40, Height=21}" /> |
|
||||||
<Anchor value="Top, Right" /> |
|
||||||
<TabIndex value="7" /> |
|
||||||
</System.Windows.Forms.Button> |
|
||||||
<System.Windows.Forms.TextBox> |
|
||||||
<Name value="workingDirectoryTextBox" /> |
|
||||||
<TabIndex value="3" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
<Size value="{Width=252, Height=21}" /> |
|
||||||
<Location value="{X=156,Y=52}" /> |
|
||||||
</System.Windows.Forms.TextBox> |
|
||||||
</Controls> |
|
||||||
</System.Windows.Forms.GroupBox> |
|
||||||
</Controls> |
|
||||||
</System.Windows.Forms.UserControl> |
|
||||||
</Components> |
|
||||||
@ -1,92 +0,0 @@ |
|||||||
<Components version="1.0"> |
|
||||||
<System.Windows.Forms.UserControl> |
|
||||||
<Name value="XmlUserControl1" /> |
|
||||||
<ClientSize value="{Width=392, Height=312}" /> |
|
||||||
<Controls> |
|
||||||
<System.Windows.Forms.GroupBox> |
|
||||||
<Name value="clickOnceGroupBox" /> |
|
||||||
<Location value="{X=3,Y=156}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.Signing.ClickOnce}" /> |
|
||||||
<Size value="{Width=368, Height=48}" /> |
|
||||||
<TabIndex value="2" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
<Controls> |
|
||||||
<System.Windows.Forms.Label> |
|
||||||
<Name value="label2" /> |
|
||||||
<Location value="{X=8,Y=17}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.Signing.ClickOnceNotSupported}" /> |
|
||||||
<Size value="{Width=352, Height=23}" /> |
|
||||||
<TabIndex value="0" /> |
|
||||||
</System.Windows.Forms.Label> |
|
||||||
</Controls> |
|
||||||
</System.Windows.Forms.GroupBox> |
|
||||||
<System.Windows.Forms.GroupBox> |
|
||||||
<Name value="signingGroupBox" /> |
|
||||||
<Location value="{X=3,Y=3}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.Signing.StrongName}" /> |
|
||||||
<Size value="{Width=368, Height=147}" /> |
|
||||||
<TabIndex value="1" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
<Controls> |
|
||||||
<System.Windows.Forms.Panel> |
|
||||||
<Name value="strongNameSignPanel" /> |
|
||||||
<Location value="{X=7,Y=41}" /> |
|
||||||
<Size value="{Width=353, Height=100}" /> |
|
||||||
<Anchor value="Top, Bottom, Left, Right" /> |
|
||||||
<TabIndex value="1" /> |
|
||||||
<Controls> |
|
||||||
<System.Windows.Forms.Label> |
|
||||||
<Name value="label1" /> |
|
||||||
<Location value="{X=0,Y=77}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.Signing.DelaySignWarning}" /> |
|
||||||
<Size value="{Width=354, Height=23}" /> |
|
||||||
<TabIndex value="10" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
</System.Windows.Forms.Label> |
|
||||||
<System.Windows.Forms.CheckBox> |
|
||||||
<Name value="delaySignOnlyCheckBox" /> |
|
||||||
<Location value="{X=0,Y=50}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.Signing.DelaySignOnly}" /> |
|
||||||
<TabIndex value="8" /> |
|
||||||
<Size value="{Width=354, Height=24}" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
</System.Windows.Forms.CheckBox> |
|
||||||
<System.Windows.Forms.ComboBox> |
|
||||||
<Name value="keyFileComboBox" /> |
|
||||||
<TabIndex value="1" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
<Size value="{Width=198, Height=21}" /> |
|
||||||
<FormattingEnabled value="True" /> |
|
||||||
<Location value="{X=0,Y=23}" /> |
|
||||||
</System.Windows.Forms.ComboBox> |
|
||||||
<System.Windows.Forms.Label> |
|
||||||
<Name value="label3" /> |
|
||||||
<Location value="{X=0,Y=1}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.Signing.ChooseKeyFile}" /> |
|
||||||
<Size value="{Width=354, Height=19}" /> |
|
||||||
<TabIndex value="9" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
</System.Windows.Forms.Label> |
|
||||||
<System.Windows.Forms.Button> |
|
||||||
<Name value="changePasswordButton" /> |
|
||||||
<Location value="{X=204,Y=22}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.Signing.ChangePassword}" /> |
|
||||||
<Size value="{Width=150, Height=22}" /> |
|
||||||
<Anchor value="Top, Right" /> |
|
||||||
<TabIndex value="2" /> |
|
||||||
</System.Windows.Forms.Button> |
|
||||||
</Controls> |
|
||||||
</System.Windows.Forms.Panel> |
|
||||||
<System.Windows.Forms.CheckBox> |
|
||||||
<Name value="signAssemblyCheckBox" /> |
|
||||||
<Location value="{X=8,Y=20}" /> |
|
||||||
<Text value="${res:Dialog.ProjectOptions.Signing.SignAssembly}" /> |
|
||||||
<TabIndex value="0" /> |
|
||||||
<Size value="{Width=352, Height=24}" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
</System.Windows.Forms.CheckBox> |
|
||||||
</Controls> |
|
||||||
</System.Windows.Forms.GroupBox> |
|
||||||
</Controls> |
|
||||||
</System.Windows.Forms.UserControl> |
|
||||||
</Components> |
|
||||||
@ -1,119 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Diagnostics; |
|
||||||
using System.IO; |
|
||||||
using System.Windows.Forms; |
|
||||||
|
|
||||||
using ICSharpCode.Core; |
|
||||||
using ICSharpCode.SharpDevelop.Gui.XmlForms; |
|
||||||
|
|
||||||
namespace ICSharpCode.SharpDevelop.Gui.OptionPanels |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// A form that creates keys for assembly signing.
|
|
||||||
/// </summary>
|
|
||||||
public class old_CreateKeyForm : BaseSharpDevelopForm |
|
||||||
{ |
|
||||||
string baseDirectory; |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes the CreateKeyFrom() dialog setting the b ase directory for adding keys to the
|
|
||||||
/// location specified.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="baseDirectory">The folder for placing the key.</param>
|
|
||||||
public old_CreateKeyForm(string baseDirectory) |
|
||||||
{ |
|
||||||
this.baseDirectory = baseDirectory; |
|
||||||
SetupFromXmlResource("ProjectOptions.CreateKey.xfrm"); |
|
||||||
Get<CheckBox>("usePassword").CheckedChanged += delegate { |
|
||||||
ControlDictionary["passwordPanel"].Enabled = Get<CheckBox>("usePassword").Checked; |
|
||||||
}; |
|
||||||
ControlDictionary["okButton"].Click += OkButtonClick; |
|
||||||
} |
|
||||||
|
|
||||||
void OkButtonClick(object sender, EventArgs e) |
|
||||||
{ |
|
||||||
KeyFile = KeyFile.Trim(); |
|
||||||
if (KeyFile.Length == 0) { |
|
||||||
MessageService.ShowMessage("${res:Dialog.ProjectOptions.Signing.EnterKeyName}"); |
|
||||||
return; |
|
||||||
} |
|
||||||
bool usePassword = Get<CheckBox>("usePassword").Checked; |
|
||||||
if (usePassword) { |
|
||||||
if (!CheckPassword(ControlDictionary["passwordTextBox"], |
|
||||||
ControlDictionary["confirmPasswordTextBox"])) |
|
||||||
{ |
|
||||||
return; |
|
||||||
} |
|
||||||
MessageService.ShowMessage("Creating a key file with a password is currently not supported."); |
|
||||||
return; |
|
||||||
} |
|
||||||
if (!KeyFile.EndsWith(".snk") && !KeyFile.EndsWith(".pfx")) |
|
||||||
KeyFile += ".snk"; |
|
||||||
if (CreateKey(Path.Combine(baseDirectory, KeyFile))) { |
|
||||||
this.DialogResult = DialogResult.OK; |
|
||||||
Close(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a key with the sn.exe utility.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="keyPath">The path of the key to create.</param>
|
|
||||||
/// <returns>True if the key was created correctly.</returns>
|
|
||||||
public static bool CreateKey(string keyPath) |
|
||||||
{ |
|
||||||
if (File.Exists(keyPath)) { |
|
||||||
string question = "${res:ICSharpCode.SharpDevelop.Internal.Templates.ProjectDescriptor.OverwriteQuestion}"; |
|
||||||
question = StringParser.Parse(question, new StringTagPair("fileNames", keyPath)); |
|
||||||
if (!MessageService.AskQuestion(question, "${res:ICSharpCode.SharpDevelop.Internal.Templates.ProjectDescriptor.OverwriteQuestion.InfoName}")) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
} |
|
||||||
Process p = Process.Start(StrongNameTool, "-k \"" + keyPath + "\""); |
|
||||||
p.WaitForExit(); |
|
||||||
if (p.ExitCode != 0) { |
|
||||||
MessageService.ShowMessage("${res:Dialog.ProjectOptions.Signing.ErrorCreatingKey}"); |
|
||||||
return false; |
|
||||||
} |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
public string KeyFile { |
|
||||||
get { |
|
||||||
return ControlDictionary["keyFileTextBox"].Text; |
|
||||||
} |
|
||||||
set { |
|
||||||
ControlDictionary["keyFileTextBox"].Text = value; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static bool CheckPassword(Control password, Control confirm) |
|
||||||
{ |
|
||||||
password.Text = password.Text.Trim(); |
|
||||||
confirm.Text = confirm.Text.Trim(); |
|
||||||
if (password.Text.Length < 6) { |
|
||||||
MessageService.ShowMessage("${res:Dialog.ProjectOptions.Signing.PasswordTooShort}"); |
|
||||||
password.Focus(); |
|
||||||
return false; |
|
||||||
} |
|
||||||
if (password.Text != confirm.Text) { |
|
||||||
MessageService.ShowMessage("${res:Dialog.ProjectOptions.Signing.PasswordsDontMatch}"); |
|
||||||
return false; |
|
||||||
} |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the path of the "strong named" executable. This is used to create keys for strongly signing
|
|
||||||
/// .NET assemblies.
|
|
||||||
/// </summary>
|
|
||||||
public static string StrongNameTool { |
|
||||||
get { |
|
||||||
return FileUtility.GetSdkPath("sn.exe"); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,121 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.IO; |
|
||||||
using System.Windows.Forms; |
|
||||||
|
|
||||||
using ICSharpCode.Core; |
|
||||||
using ICSharpCode.SharpDevelop.Project; |
|
||||||
|
|
||||||
namespace ICSharpCode.SharpDevelop.Gui.OptionPanels |
|
||||||
{ |
|
||||||
public class old_Signing : AbstractXmlFormsProjectOptionPanel |
|
||||||
{ |
|
||||||
ComboBox keyFile; |
|
||||||
ConfigurationGuiBinding signAssemblyBinding; |
|
||||||
|
|
||||||
const string KeyFileExtensions = "*.snk;*.pfx;*.key"; |
|
||||||
|
|
||||||
public override void LoadPanelContents() |
|
||||||
{ |
|
||||||
SetupFromXmlResource("ProjectOptions.Signing.xfrm"); |
|
||||||
InitializeHelper(); |
|
||||||
|
|
||||||
ConfigurationGuiBinding b; |
|
||||||
ChooseStorageLocationButton locationButton; |
|
||||||
|
|
||||||
signAssemblyBinding = helper.BindBoolean("signAssemblyCheckBox", "SignAssembly", false); |
|
||||||
locationButton = signAssemblyBinding.CreateLocationButtonInPanel("signingGroupBox"); |
|
||||||
Get<CheckBox>("signAssembly").CheckedChanged += new EventHandler(UpdateEnabledStates); |
|
||||||
|
|
||||||
|
|
||||||
keyFile = Get<ComboBox>("keyFile"); |
|
||||||
b = helper.BindString(keyFile, "AssemblyOriginatorKeyFile", TextBoxEditMode.EditRawProperty); |
|
||||||
b.RegisterLocationButton(locationButton); |
|
||||||
FindKeys(baseDirectory); |
|
||||||
if (keyFile.Text.Length > 0) { |
|
||||||
if (!keyFile.Items.Contains(keyFile.Text)) { |
|
||||||
keyFile.Items.Add(keyFile.Text); |
|
||||||
} |
|
||||||
} |
|
||||||
keyFile.Items.Add(StringParser.Parse("<${res:Global.CreateButtonText}...>")); |
|
||||||
keyFile.Items.Add(StringParser.Parse("<${res:Global.BrowseText}...>")); |
|
||||||
keyFile.SelectedIndexChanged += delegate { |
|
||||||
if (keyFile.SelectedIndex == keyFile.Items.Count - 1) { |
|
||||||
BeginInvoke(new MethodInvoker(BrowseKeyFile)); |
|
||||||
} |
|
||||||
if (keyFile.SelectedIndex == keyFile.Items.Count - 2) { |
|
||||||
BeginInvoke(new MethodInvoker(CreateKeyFile)); |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
b = helper.BindBoolean("delaySignOnlyCheckBox", "DelaySign", false); |
|
||||||
b.RegisterLocationButton(locationButton); |
|
||||||
|
|
||||||
UpdateEnabledStates(this, EventArgs.Empty); |
|
||||||
|
|
||||||
helper.AddConfigurationSelector(this); |
|
||||||
|
|
||||||
helper.Saved += delegate { |
|
||||||
if (Get<CheckBox>("signAssembly").Checked) { |
|
||||||
helper.SetProperty("AssemblyOriginatorKeyMode", "File", true, signAssemblyBinding.Location); |
|
||||||
} |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
void FindKeys(string directory) |
|
||||||
{ |
|
||||||
directory = FileUtility.NormalizePath(directory); |
|
||||||
while (true) { |
|
||||||
try { |
|
||||||
foreach (string fileName in Directory.GetFiles(directory, "*.snk")) { |
|
||||||
keyFile.Items.Add(MSBuildInternals.Escape(FileUtility.GetRelativePath(baseDirectory, fileName))); |
|
||||||
} |
|
||||||
foreach (string fileName in Directory.GetFiles(directory, "*.pfx")) { |
|
||||||
keyFile.Items.Add(MSBuildInternals.Escape(FileUtility.GetRelativePath(baseDirectory, fileName))); |
|
||||||
} |
|
||||||
foreach (string fileName in Directory.GetFiles(directory, "*.key")) { |
|
||||||
keyFile.Items.Add(MSBuildInternals.Escape(FileUtility.GetRelativePath(baseDirectory, fileName))); |
|
||||||
} |
|
||||||
} catch { |
|
||||||
// can happen for networked drives / network locations
|
|
||||||
break; |
|
||||||
} |
|
||||||
int pos = directory.LastIndexOf(Path.DirectorySeparatorChar); |
|
||||||
if (pos < 0) |
|
||||||
break; |
|
||||||
directory = directory.Substring(0, pos); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
void BrowseKeyFile() |
|
||||||
{ |
|
||||||
keyFile.SelectedIndex = -1; |
|
||||||
BrowseForFile(ControlDictionary["keyFileComboBox"], "${res:SharpDevelop.FileFilter.KeyFiles} (" + KeyFileExtensions + ")|" + KeyFileExtensions + "|${res:SharpDevelop.FileFilter.AllFiles}|*.*", TextBoxEditMode.EditRawProperty); |
|
||||||
} |
|
||||||
|
|
||||||
void CreateKeyFile() |
|
||||||
{ |
|
||||||
if (File.Exists(old_CreateKeyForm.StrongNameTool)) { |
|
||||||
using (old_CreateKeyForm createKey = new old_CreateKeyForm(baseDirectory)) { |
|
||||||
createKey.KeyFile = project.Name; |
|
||||||
if (createKey.ShowDialog(WorkbenchSingleton.MainWin32Window) == DialogResult.OK) { |
|
||||||
keyFile.Text = MSBuildInternals.Escape(createKey.KeyFile); |
|
||||||
return; |
|
||||||
} |
|
||||||
} |
|
||||||
} else { |
|
||||||
MessageService.ShowMessage("${res:Dialog.ProjectOptions.Signing.SNnotFound}"); |
|
||||||
} |
|
||||||
keyFile.Text = ""; |
|
||||||
} |
|
||||||
|
|
||||||
void UpdateEnabledStates(object sender, EventArgs e) |
|
||||||
{ |
|
||||||
ControlDictionary["strongNameSignPanel"].Enabled = Get<CheckBox>("signAssembly").Checked; |
|
||||||
|
|
||||||
Get<Button>("changePassword").Enabled = false; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
Loading…
Reference in new issue