This commit is contained in:
MaxXor 2015-05-26 16:14:03 +02:00
parent de11c7e7c4
commit 7a1e6a82ab
2 changed files with 16 additions and 12 deletions

View File

@ -11,7 +11,6 @@ namespace xServer.Forms
{ {
public partial class FrmBuilder : Form public partial class FrmBuilder : Form
{ {
private bool _loadedProfile;
private bool _changed; private bool _changed;
public FrmBuilder() public FrmBuilder()
@ -21,7 +20,8 @@ namespace xServer.Forms
private void HasChanged() private void HasChanged()
{ {
_changed = (_loadedProfile && !_changed); if (!_changed)
_changed = true;
} }
private void UpdateControlStates() private void UpdateControlStates()
@ -44,19 +44,17 @@ namespace xServer.Forms
txtPassword.Text = pm.ReadValue("Password"); txtPassword.Text = pm.ReadValue("Password");
txtDelay.Text = pm.ReadValue("Delay"); txtDelay.Text = pm.ReadValue("Delay");
txtMutex.Text = pm.ReadValue("Mutex"); txtMutex.Text = pm.ReadValue("Mutex");
chkInstall.Checked = bool.Parse(pm.ReadValue("InstallClient")); chkInstall.Checked = bool.Parse(pm.ReadValueSafe("InstallClient", "False"));
txtInstallname.Text = pm.ReadValue("InstallName"); txtInstallname.Text = pm.ReadValue("InstallName");
GetInstallPath(int.Parse(pm.ReadValue("InstallPath"))).Checked = true; GetInstallPath(int.Parse(pm.ReadValue("InstallPath"))).Checked = true;
txtInstallsub.Text = pm.ReadValue("InstallSub"); txtInstallsub.Text = pm.ReadValue("InstallSub");
chkHide.Checked = bool.Parse(pm.ReadValue("HideFile")); chkHide.Checked = bool.Parse(pm.ReadValueSafe("HideFile", "False"));
chkStartup.Checked = bool.Parse(pm.ReadValue("AddStartup")); chkStartup.Checked = bool.Parse(pm.ReadValueSafe("AddStartup", "False"));
txtRegistryKeyName.Text = pm.ReadValue("RegistryName"); txtRegistryKeyName.Text = pm.ReadValue("RegistryName");
chkElevation.Checked = bool.Parse(pm.ReadValue("AdminElevation")); chkElevation.Checked = bool.Parse(pm.ReadValueSafe("AdminElevation", "False"));
chkIconChange.Checked = bool.Parse(pm.ReadValue("ChangeIcon")); chkIconChange.Checked = bool.Parse(pm.ReadValueSafe("ChangeIcon", "False"));
chkChangeAsmInfo.Checked = bool.Parse(pm.ReadValue("ChangeAsmInfo")); chkChangeAsmInfo.Checked = bool.Parse(pm.ReadValueSafe("ChangeAsmInfo", "False"));
chkKeylogger.Checked = chkKeylogger.Checked = bool.Parse(pm.ReadValueSafe("Keylogger", "False"));
bool.Parse(!string.IsNullOrEmpty(pm.ReadValue("Keylogger")) ? pm.ReadValue("Keylogger") : "False");
//fallback
txtProductName.Text = pm.ReadValue("ProductName"); txtProductName.Text = pm.ReadValue("ProductName");
txtDescription.Text = pm.ReadValue("Description"); txtDescription.Text = pm.ReadValue("Description");
txtCompanyName.Text = pm.ReadValue("CompanyName"); txtCompanyName.Text = pm.ReadValue("CompanyName");
@ -65,7 +63,6 @@ namespace xServer.Forms
txtOriginalFilename.Text = pm.ReadValue("OriginalFilename"); txtOriginalFilename.Text = pm.ReadValue("OriginalFilename");
txtProductVersion.Text = pm.ReadValue("ProductVersion"); txtProductVersion.Text = pm.ReadValue("ProductVersion");
txtFileVersion.Text = pm.ReadValue("FileVersion"); txtFileVersion.Text = pm.ReadValue("FileVersion");
_loadedProfile = true;
} }
private void SaveProfile(string profilename) private void SaveProfile(string profilename)

View File

@ -39,6 +39,7 @@ namespace xServer.Settings
root.AppendChild(doc.CreateElement("AdminElevation")).InnerText = "False"; root.AppendChild(doc.CreateElement("AdminElevation")).InnerText = "False";
root.AppendChild(doc.CreateElement("ChangeIcon")).InnerText = "False"; root.AppendChild(doc.CreateElement("ChangeIcon")).InnerText = "False";
root.AppendChild(doc.CreateElement("ChangeAsmInfo")).InnerText = "False"; root.AppendChild(doc.CreateElement("ChangeAsmInfo")).InnerText = "False";
root.AppendChild(doc.CreateElement("Keylogger")).InnerText = "False";
root.AppendChild(doc.CreateElement("ProductName")); root.AppendChild(doc.CreateElement("ProductName"));
root.AppendChild(doc.CreateElement("Description")); root.AppendChild(doc.CreateElement("Description"));
root.AppendChild(doc.CreateElement("CompanyName")); root.AppendChild(doc.CreateElement("CompanyName"));
@ -78,6 +79,12 @@ namespace xServer.Settings
} }
} }
public string ReadValueSafe(string pstrValueToRead, string defaultValue = "")
{
string value = ReadValue(pstrValueToRead);
return (!string.IsNullOrEmpty(value)) ? value : defaultValue;
}
public bool WriteValue(string pstrValueToRead, string pstrValueToWrite) public bool WriteValue(string pstrValueToRead, string pstrValueToWrite)
{ {
try try