markus / DnsCheckTest / MainWindow.xaml.cs @ 43bbd277
이력 | 보기 | 이력해설 | 다운로드 (1.54 KB)
1 |
using Newtonsoft.Json; |
---|---|
2 |
using System; |
3 |
using System.Collections.Generic; |
4 |
using System.Linq; |
5 |
using System.Text; |
6 |
using System.Threading.Tasks; |
7 |
using System.Windows; |
8 |
using System.Windows.Controls; |
9 |
using System.Windows.Data; |
10 |
using System.Windows.Documents; |
11 |
using System.Windows.Input; |
12 |
using System.Windows.Media; |
13 |
using System.Windows.Media.Imaging; |
14 |
using System.Windows.Navigation; |
15 |
using System.Windows.Shapes; |
16 |
|
17 |
namespace DnsCheckTest |
18 |
{ |
19 |
/// <summary> |
20 |
/// MainWindow.xaml에 대한 상호 작용 논리 |
21 |
/// </summary> |
22 |
public partial class MainWindow : Window |
23 |
{ |
24 |
public MainWindow() |
25 |
{ |
26 |
InitializeComponent(); |
27 |
|
28 |
DnsCheck(); |
29 |
} |
30 |
|
31 |
private void Button_Click(object sender, RoutedEventArgs e) |
32 |
{ |
33 |
DnsCheck(); |
34 |
} |
35 |
|
36 |
private void DnsCheck() |
37 |
{ |
38 |
var host = CommonLib.DNSHelper.GetHostEntryTask(); |
39 |
|
40 |
StringBuilder builder = new StringBuilder(); |
41 |
|
42 |
builder.AppendLine($"hostName : {host.HostName}"); |
43 |
|
44 |
builder.AppendLine(""); |
45 |
builder.AppendLine(" - Aliases"); |
46 |
|
47 |
foreach (var item in host.Aliases) |
48 |
{ |
49 |
builder.AppendLine($" {item}"); |
50 |
} |
51 |
|
52 |
builder.AppendLine(""); |
53 |
builder.AppendLine(" - Address List"); |
54 |
|
55 |
foreach (var item in host.AddressList) |
56 |
{ |
57 |
builder.AppendLine($" {item.AddressFamily.ToString()} : {item.ToString()}"); |
58 |
} |
59 |
|
60 |
txtHostInfo.Text = builder.ToString(); |
61 |
} |
62 |
} |
63 |
} |