1. 맥주소 변경 준비

This commit is contained in:
2022-01-29 18:35:49 +09:00
parent 34c80ced83
commit bda3619988

View File

@@ -6,6 +6,7 @@ using SeleniumExtras.WaitHelpers;
using System; using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Net.NetworkInformation;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using WebSocketSharp; using WebSocketSharp;
@@ -79,6 +80,11 @@ namespace NaverSearcher
} }
} }
if (_JObject.ContainsKey("MacChange"))
{
}
if (_JObject.ContainsKey("keyword")) if (_JObject.ContainsKey("keyword"))
{ {
if (m_Thread.ThreadState != ThreadState.Unstarted) if (m_Thread.ThreadState != ThreadState.Unstarted)
@@ -458,5 +464,24 @@ namespace NaverSearcher
((IJavaScriptExecutor)_IWebDriver).ExecuteScript("window.scrollBy(0, document.body.scrollHeight);"); ((IJavaScriptExecutor)_IWebDriver).ExecuteScript("window.scrollBy(0, document.body.scrollHeight);");
Thread.Sleep(m_Random.Next((int)optSearchWaitMin, (int)optSearchWaitMax)); Thread.Sleep(m_Random.Next((int)optSearchWaitMin, (int)optSearchWaitMax));
} }
private static NetworkInterface GetCurrentOnlineNetworkInterface()
{
//현재 PC의 모든 네트워크 인터페이스에 대해 루프. foreach문을 써도 상관없음.
for (int i = 0; i < NetworkInterface.GetAllNetworkInterfaces().Length; i++)
{
NetworkInterface ni = NetworkInterface.GetAllNetworkInterfaces()[i];
// 필터링 조건.
if (ni.OperationalStatus == OperationalStatus.Up && // 현재 사용중
ni.NetworkInterfaceType != NetworkInterfaceType.Loopback && // 루프백이 아님
ni.NetworkInterfaceType != NetworkInterfaceType.Tunnel && // 터널이 아님
ni.NetworkInterfaceType != NetworkInterfaceType.Wireless80211 && // 무선이 아님. (무선 랜을 사용하시는 분은 이 조건을 삭제하시면 됩니다)
!ni.Name.ToLower().Contains("loopback")) // 사용자 정의 필터링 조건. 저같은 경우, Wireshark를 설치할 때 같이 설치된 가상NIC가 loopback이라는 이름이 들어가있어서 추가한 조건입니다.
return ni;
}
return null;
}
} }
} }