Modified
This commit is contained in:
parent
723858ec9b
commit
eb69a3cf12
|
@ -1,6 +1,8 @@
|
||||||
using Catswords.DataType.Client.Model;
|
using Catswords.DataType.Client.Model;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
|
@ -19,17 +21,11 @@ namespace Catswords.DataType.Client.Helper
|
||||||
Indicators = new List<Indicator>();
|
Indicators = new List<Indicator>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Fetch(string q)
|
public void Fetch(string q)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool isConnected = NetworkInterface.GetIsNetworkAvailable();
|
|
||||||
if (isConnected == false)
|
|
||||||
{
|
|
||||||
MessageBox.Show("인터넷에 연결되어 있지 않습니다.", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 원격 주소에서 XML 다운로드
|
// 원격 주소에서 XML 다운로드
|
||||||
string url = Config.SEARCH_URL + q;
|
string url = Config.SEARCH_URL + q;
|
||||||
WebClient client = new WebClient();
|
WebClient client = new WebClient();
|
||||||
|
|
|
@ -85,7 +85,6 @@ namespace Catswords.DataType.Client
|
||||||
bool IsInternetConnected()
|
bool IsInternetConnected()
|
||||||
{
|
{
|
||||||
const string NCSI_TEST_URL = "http://www.msftncsi.com/ncsi.txt";
|
const string NCSI_TEST_URL = "http://www.msftncsi.com/ncsi.txt";
|
||||||
const string NCSI_TEST_RESULT = "Microsoft NCSI";
|
|
||||||
const string NCSI_DNS = "dns.msftncsi.com";
|
const string NCSI_DNS = "dns.msftncsi.com";
|
||||||
const string NCSI_DNS_IP_ADDRESS = "131.107.255.255";
|
const string NCSI_DNS_IP_ADDRESS = "131.107.255.255";
|
||||||
|
|
||||||
|
@ -94,7 +93,7 @@ namespace Catswords.DataType.Client
|
||||||
// Check NCSI test link
|
// Check NCSI test link
|
||||||
var webClient = new WebClient();
|
var webClient = new WebClient();
|
||||||
string result = webClient.DownloadString(NCSI_TEST_URL);
|
string result = webClient.DownloadString(NCSI_TEST_URL);
|
||||||
if (result != NCSI_TEST_RESULT)
|
if (result != "Microsoft NCSI")
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -118,9 +117,7 @@ namespace Catswords.DataType.Client
|
||||||
private void FetchFromFileExtensionDB()
|
private void FetchFromFileExtensionDB()
|
||||||
{
|
{
|
||||||
if (IsInternetConnected())
|
if (IsInternetConnected())
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
var search = new FileExtensionDB();
|
var search = new FileExtensionDB();
|
||||||
search.Fetch(fileExtension);
|
search.Fetch(fileExtension);
|
||||||
foreach (Indicator ind in search.Indicators)
|
foreach (Indicator ind in search.Indicators)
|
||||||
|
@ -129,7 +126,8 @@ namespace Catswords.DataType.Client
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
MessageBox.Show("네트워크 상태 좋지 않습니다.");
|
MessageBox.Show("인터넷에 연결되어 있지 않습니다.", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user