|
|
|
@ -19,6 +19,8 @@ namespace Waker |
|
|
|
|
{ |
|
|
|
|
public partial class MainForm : Form |
|
|
|
|
{ |
|
|
|
|
private Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); |
|
|
|
|
|
|
|
|
|
private readonly Color PING_SUCCESS = Color.Green; |
|
|
|
|
private readonly Color PING_FAIL = Color.Red; |
|
|
|
|
private readonly Color PING_UNKNOWN = Color.Gray; |
|
|
|
@ -38,19 +40,17 @@ namespace Waker |
|
|
|
|
|
|
|
|
|
private void InitInstance() |
|
|
|
|
{ |
|
|
|
|
string path = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath; |
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(Settings.Default.ip)) |
|
|
|
|
ip = Settings.Default.ip; |
|
|
|
|
if (!string.IsNullOrEmpty(config.AppSettings.Settings["ip"].Value)) |
|
|
|
|
ip = config.AppSettings.Settings["ip"].Value; |
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(Settings.Default.mac)) |
|
|
|
|
mac = Settings.Default.mac; |
|
|
|
|
if (!string.IsNullOrEmpty(config.AppSettings.Settings["mac"].Value)) |
|
|
|
|
mac = config.AppSettings.Settings["mac"].Value; |
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(Settings.Default.ports)) |
|
|
|
|
ports = Settings.Default.ports; |
|
|
|
|
if (!string.IsNullOrEmpty(config.AppSettings.Settings["ports"].Value)) |
|
|
|
|
ports = config.AppSettings.Settings["ports"].Value; |
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(Settings.Default.pingPort)) |
|
|
|
|
pingPort = Settings.Default.pingPort; |
|
|
|
|
if (!string.IsNullOrEmpty(config.AppSettings.Settings["pingPort"].Value)) |
|
|
|
|
pingPort = config.AppSettings.Settings["pingPort"].Value; |
|
|
|
|
|
|
|
|
|
FillInformation(); |
|
|
|
|
|
|
|
|
@ -73,8 +73,8 @@ namespace Waker |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
AddressTextBox.Text = ip; |
|
|
|
|
Settings.Default.ip = ip; |
|
|
|
|
Settings.Default.Save(); |
|
|
|
|
config.AppSettings.Settings["ip"].Value = ip; |
|
|
|
|
config.Save(ConfigurationSaveMode.Modified); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
@ -92,11 +92,10 @@ namespace Waker |
|
|
|
|
MacTextBox.Text = mac; |
|
|
|
|
PortTextBox.Text = ports; |
|
|
|
|
|
|
|
|
|
Settings.Default.ip = ip; |
|
|
|
|
Settings.Default.mac = mac; |
|
|
|
|
Settings.Default.ports = ports; |
|
|
|
|
|
|
|
|
|
Settings.Default.Save(); |
|
|
|
|
config.AppSettings.Settings["ip"].Value = ip; |
|
|
|
|
config.AppSettings.Settings["mac"].Value = mac; |
|
|
|
|
config.AppSettings.Settings["ports"].Value = ports; |
|
|
|
|
config.Save(ConfigurationSaveMode.Modified); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
@ -197,8 +196,8 @@ namespace Waker |
|
|
|
|
if (string.IsNullOrEmpty(ip)) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
Settings.Default.pingPort = pingPort; |
|
|
|
|
Settings.Default.Save(); |
|
|
|
|
config.AppSettings.Settings["pingPort"].Value = pingPort; |
|
|
|
|
config.Save(ConfigurationSaveMode.Modified); |
|
|
|
|
|
|
|
|
|
object[] parameters = new object[2] { ip, targetPort }; |
|
|
|
|
pingThread = new Thread(new ParameterizedThreadStart(SendPing)); |
|
|
|
|