1. 타이핑 분해 작성 (C++ 라이브러리 -> C# 코드)

2. 사일런트 모드에서 탭 진행 불가 (테스트 완료)
This commit is contained in:
2021-08-03 19:32:27 +09:00
parent 3a53a27240
commit 240e6c3b45
5 changed files with 770 additions and 393 deletions

View File

@@ -3,18 +3,30 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 16
VisualStudioVersion = 16.0.31424.327 VisualStudioVersion = 16.0.31424.327
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NaverSearcher", "NaverSearcher\NaverSearcher.csproj", "{54262938-66CB-4A5F-926B-48C3ACDCE9CF}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NaverSearcher", "NaverSearcher\NaverSearcher.csproj", "{54262938-66CB-4A5F-926B-48C3ACDCE9CF}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Debug|Any CPU.Build.0 = Debug|Any CPU {54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Debug|x64.ActiveCfg = Debug|Any CPU
{54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Debug|x64.Build.0 = Debug|Any CPU
{54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Debug|x86.ActiveCfg = Debug|Any CPU
{54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Debug|x86.Build.0 = Debug|Any CPU
{54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Release|Any CPU.ActiveCfg = Release|Any CPU {54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Release|Any CPU.Build.0 = Release|Any CPU {54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Release|Any CPU.Build.0 = Release|Any CPU
{54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Release|x64.ActiveCfg = Release|Any CPU
{54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Release|x64.Build.0 = Release|Any CPU
{54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Release|x86.ActiveCfg = Release|Any CPU
{54262938-66CB-4A5F-926B-48C3ACDCE9CF}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -3,14 +3,8 @@ using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI; using OpenQA.Selenium.Support.UI;
using SeleniumExtras.WaitHelpers; using SeleniumExtras.WaitHelpers;
using System; using System;
using System.Collections.Generic; using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace NaverSearcher namespace NaverSearcher
@@ -44,8 +38,8 @@ namespace NaverSearcher
ChromeDriverService _ChromeDriverService = ChromeDriverService.CreateDefaultService(); ChromeDriverService _ChromeDriverService = ChromeDriverService.CreateDefaultService();
_ChromeDriverService.HideCommandPromptWindow = true; _ChromeDriverService.HideCommandPromptWindow = true;
_ChromeDriver = new ChromeDriver(_ChromeDriverService, _ChromeOptions); //_ChromeDriver = new ChromeDriver(_ChromeDriverService, _ChromeOptions);
//_ChromeDriver = new ChromeDriver(); _ChromeDriver = new ChromeDriver();
//_ChromeOptions.add_argument("user-agent=Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko") //_ChromeOptions.add_argument("user-agent=Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko")
@@ -54,11 +48,7 @@ namespace NaverSearcher
// 검색어 1페어 // 검색어 1페어
// 로그인 여부 확인
// 로그아웃 실행
// 네이버 메인
// 스크롤 내린다.
// 20 ~ 60초 대기
// 검색어 입력 (검색어 1) // 검색어 입력 (검색어 1)
// 검색어 확인 // 검색어 확인
@@ -152,9 +142,64 @@ namespace NaverSearcher
_ChromeDriver.get('http://www.google.com/') _ChromeDriver.get('http://www.google.com/')
*/ */
_ChromeDriver.Navigate().GoToUrl(@"https://naver.com");
WebDriverWait _WebDriverWait = new WebDriverWait(_ChromeDriver, TimeSpan.FromSeconds(3)); WebDriverWait _WebDriverWait = new WebDriverWait(_ChromeDriver, TimeSpan.FromSeconds(3));
var rand = new Random();
string[][] key_word =
{
new string[] {"바나나우유 라떼", "초코우유 라떼" },
new string[] { "민트초코바", "민트색" }
};
foreach (string[] key_pair in key_word)
{
// 로그인 여부 확인
// 로그아웃 실행
// 네이버 메인
// 스크롤 내린다.
// 20 ~ 60초 대기
foreach (string key in key_pair)
{
// 검색어 입력 (검색어 1)
// 검색어 확인
// 스크롤 내린다.
// 20 ~ 60초 대기
// 아무 게시글 클릭
// 이동된 페이지 작업
// 스크롤 내리기
// 20 ~ 60초 대기
// 새창 닫기
_ChromeDriver.Navigate().GoToUrl(@"https://naver.com");
string _search_xpath = "//*[@id=\"query\"]";
_WebDriverWait.Until(ExpectedConditions.ElementIsVisible(By.XPath(_search_xpath)));
var _elment = _ChromeDriver.FindElement(By.XPath(_search_xpath));
foreach (var item in HangulString.CharacterMakeHistory(key))
{
_elment.Clear();
_elment.SendKeys(item);
Delay(rand.Next(500, 1000));
}
_elment.SendKeys(OpenQA.Selenium.Keys.Enter);
((IJavaScriptExecutor)_ChromeDriver).ExecuteScript("window.scrollBy(0, document.body.scrollHeight);");
Delay(rand.Next(2000, 6000));
ReadOnlyCollection<IWebElement> links = _ChromeDriver.FindElements(By.TagName("a"));
links[rand.Next(0, links.Count)].Click();
((IJavaScriptExecutor)_ChromeDriver).ExecuteScript("window.scrollBy(0, document.body.scrollHeight);");
Delay(rand.Next(2000, 6000));
}
}
return;
var elem = _ChromeDriver.FindElementByXPath("//*"); var elem = _ChromeDriver.FindElementByXPath("//*");
var source_code = elem.GetAttribute("outerHTML"); var source_code = elem.GetAttribute("outerHTML");
@@ -246,11 +291,11 @@ namespace NaverSearcher
{ {
} }
string _search_xpath = "//*[@id=\"react-root\"]/section/nav/div[2]/div/div/div[2]/input"; //_search_xpath = "//*[@id=\"react-root\"]/section/nav/div[2]/div/div/div[2]/input";
_WebDriverWait.Until(ExpectedConditions.ElementIsVisible(By.XPath(_search_xpath))); //_WebDriverWait.Until(ExpectedConditions.ElementIsVisible(By.XPath(_search_xpath)));
_ChromeDriver.FindElement(By.XPath(_search_xpath)).SendKeys(@"인플 검색"); //_ChromeDriver.FindElement(By.XPath(_search_xpath)).SendKeys(@"인플 검색");
} }
catch (Exception ex) catch (Exception ex)
@@ -261,25 +306,36 @@ namespace NaverSearcher
private void Form1_Load(object sender, EventArgs e) private void Form1_Load(object sender, EventArgs e)
{ {
#region
string kknd = HangulString.SplitToPhonemes("ㅄ");
MessageBox.Show(kknd);
char[] arr = kknd.ToCharArray();
foreach (var item in arr)
{
Trace.WriteLine(item);
}
#endregion
} }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{ {
_ChromeDriver.Quit(); _ChromeDriver.Quit();
} }
private static DateTime Delay(int MS)
{
DateTime ThisMoment = DateTime.Now;
TimeSpan duration = new TimeSpan(0, 0, 0, 0, MS);
DateTime AfterWards = ThisMoment.Add(duration);
while (AfterWards >= ThisMoment)
{
System.Windows.Forms.Application.DoEvents();
ThisMoment = DateTime.Now;
}
return DateTime.Now;
}
} }
} }

View File

@@ -18,9 +18,9 @@ namespace NaverSearcher
private static readonly char[] Onset = { 'ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ', 'ㅆ', private static readonly char[] Onset = { 'ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ', 'ㅆ',
'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ' }; 'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ' };
private static readonly char[] Nucleus = { 'ㅏ', 'ㅐ', 'ㅑ', 'ㅒ', 'ㅓ', 'ㅔ', 'ㅕ', 'ㅖ', 'ㅗ', 'ㅘ', 'ㅙ', private static readonly char[] Nucleus = { 'ㅏ', 'ㅐ', 'ㅑ', 'ㅒ', 'ㅓ', 'ㅔ', 'ㅕ', 'ㅖ', 'ㅗ', 'ㅘ', 'ㅙ',
'ㅚ', 'ㅛ', 'ㅜ', 'ㅝ', 'ㅞ', 'ㅟ', 'ㅠ', 'ㅡ', 'ㅢ', 'ㅣ' }; 'ㅚ', 'ㅛ', 'ㅜ', 'ㅝ', 'ㅞ', 'ㅟ', 'ㅠ', 'ㅡ', 'ㅢ', 'ㅣ' };
private static readonly char[] Coda = { (char)0x00, 'ㄱ', 'ㄲ', 'ㄳ', 'ㄴ', 'ㄵ', 'ㄶ', 'ㄷ', 'ㄹ', 'ㄺ', 'ㄻ', private static readonly char[] Coda = { (char)0x00, 'ㄱ', 'ㄲ', 'ㄳ', 'ㄴ', 'ㄵ', 'ㄶ', 'ㄷ', 'ㄹ', 'ㄺ', 'ㄻ',
'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅁ', 'ㅂ', 'ㅄ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ' }; 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅁ', 'ㅂ', 'ㅄ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ' };
// 문자 획수: 초성, 중성, 종성 // 문자 획수: 초성, 중성, 종성
private static readonly int[] OnsetStrokes = { 1, 2, 1, 2, 4, 3, 3, 4, 8, 2, 4, 1, 2, 4, 3, 2, 3, 4, 3 }; private static readonly int[] OnsetStrokes = { 1, 2, 1, 2, 4, 3, 3, 4, 8, 2, 4, 1, 2, 4, 3, 2, 3, 4, 3 };

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace NaverSearcher namespace NaverSearcher