master
syneffort 2 years ago
parent 96262b8225
commit 30fb612bda
  1. 9
      WoL/Waker/App.config
  2. 37
      WoL/Waker/MainForm.cs
  3. 74
      WoL/Waker/Settings.Designer.cs
  4. 18
      WoL/Waker/Settings.settings
  5. 14
      WoL/Waker/Waker.csproj

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ip" value="" />
<add key="mac" value="" />
<add key="ports" value="7,9" />
<add key="pingPort" value="" />
</appSettings>
</configuration>

@ -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));

@ -1,74 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Waker {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string ip {
get {
return ((string)(this["ip"]));
}
set {
this["ip"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string mac {
get {
return ((string)(this["mac"]));
}
set {
this["mac"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("7, 9")]
public string ports {
get {
return ((string)(this["ports"]));
}
set {
this["ports"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string pingPort {
get {
return ((string)(this["pingPort"]));
}
set {
this["pingPort"] = value;
}
}
}
}

@ -1,18 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Waker" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="ip" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="mac" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="ports" Type="System.String" Scope="User">
<Value Profile="(Default)">7, 9</Value>
</Setting>
<Setting Name="pingPort" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<AssemblyVersion>1.0.0.1</AssemblyVersion>
@ -27,18 +27,6 @@
</ItemGroup>
<ItemGroup>
<Compile Update="Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="..\..\Resource\Designcontest-Ecommerce-Business-Idea.ico">
<Pack>True</Pack>
<PackagePath></PackagePath>

Loading…
Cancel
Save