- Status bar 추가

- webview 삭제
- double click 시 브라우저로 이동
- Dart API 적용
- 종목명 검색 개선
This commit is contained in:
2017-01-09 08:01:43 +09:00
parent f9057cea61
commit 349de89a05
11 changed files with 1430 additions and 691 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text.RegularExpressions;
namespace NewsCrawler
{
@@ -225,15 +226,41 @@ namespace NewsCrawler
public CODE_VALUE SearchCode(string strText)
{
CODE_VALUE Result = m_CodeList.Find(s => strText.Contains(s.m_strName));
if(Result != null)
return Result;
try
{
string strReplace = Regex.Replace(strText, @"(\(|\[|\<).*(\)|\]|\>)", "");
string[] words = strReplace.Trim().Split(' ');
string strCodeWord = words[0];
SYNONYM_VALUE Synonym = m_SynonymList.Find(s => strText.Contains(s.m_strName));
if(Synonym == null)
return null;
//int iBracesPos = strText.Trim().IndexOfAny(new char[] { ']', '>', ')' });
//string[] astrWords = strText.Substring(iBracesPos).Trim().Split(' ');
return m_CodeList.Find(s => s.m_strCode == Synonym.m_strCode);
//string[] astrWords = strText.Trim().Split(' ');
//if(astrWords.Length < 1)
// return null;
//string strCodeWord;
//if(astrWords.Length > 1 && astrWords[0].IndexOfAny(new char[] { ']', '>', ')' }) >= 0)
// strCodeWord = astrWords[1];
//else
// strCodeWord = astrWords[0];
CODE_VALUE Result = m_CodeList.Find(s => strCodeWord.Contains(s.m_strName));
if(Result != null)
return Result;
SYNONYM_VALUE Synonym = m_SynonymList.Find(s => strCodeWord.Contains(s.m_strName));
if(Synonym == null)
return null;
return m_CodeList.Find(s => s.m_strCode == Synonym.m_strCode);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
return null;
}
public CODE_VALUE GetCode(string strCode)
@@ -241,5 +268,11 @@ namespace NewsCrawler
CODE_VALUE Result = m_CodeList.Find(s => s.m_strCode == strCode);
return Result;
}
public CODE_VALUE GetCodeByName(string strCodeName)
{
CODE_VALUE Result = m_CodeList.Find(s => s.m_strName == strCodeName);
return Result;
}
}
}

View File

@@ -12,11 +12,29 @@ namespace NewsCrawler
{
static Dictionary<string, string> m_Data = new Dictionary<string, string>();
static Random m_Random = new Random();
static int m_iDartAPIKeyCnt = 0;
static bool[] m_abDartAPIKeyLimit = null;
public static void Init()
{
m_Data.Add("manual-price", "100000");
m_Data.Add("buy-price", "1000000");
m_Data.Add("supply-contract-rate", "5.0");
Load();
int iIdx = 1;
while(true)
{
if(m_Data.ContainsKey("dart-api-key"+iIdx) == false)
break;
iIdx++;
}
m_iDartAPIKeyCnt = iIdx-1;
m_abDartAPIKeyLimit = new bool[m_iDartAPIKeyCnt];
for(int i = 0; i<m_iDartAPIKeyCnt; i++)
m_abDartAPIKeyLimit[i] = false;
}
static void Load()
@@ -94,5 +112,45 @@ namespace NewsCrawler
{
return m_Data["sub-account"];
}
public static void SetSupplyContractRate(float fRate)
{
m_Data["supply-contract-rate"] = fRate.ToString();
Save();
}
public static float GetSupplyContractRate()
{
float fRate;
float.TryParse(m_Data["supply-contract-rate"], out fRate);
return fRate;
}
public static string GetDartAPIKey()
{
if(m_iDartAPIKeyCnt <= 0)
return "";
if(m_abDartAPIKeyLimit.All(s => s == true) == true)
return "";
int iNum = -1;
while(iNum < 0 || m_abDartAPIKeyLimit[iNum-1] == true)
iNum = m_Random.Next(0, 10000)%m_iDartAPIKeyCnt + 1;
return m_Data["dart-api-key"+iNum];
}
public static void SetDartAPIKeyLimit(string strKey)
{
for(int i=0; i<m_iDartAPIKeyCnt; i++)
{
if(m_Data["dart-api-key"+(i+1).ToString()] == strKey)
{
m_abDartAPIKeyLimit[i] = true;
break;
}
}
}
}
}

53
ConfigForm.Designer.cs generated
View File

@@ -62,6 +62,10 @@
this.tbAccountSub = new System.Windows.Forms.TextBox();
this.groupBox11 = new System.Windows.Forms.GroupBox();
this.btnAccountApply = new System.Windows.Forms.Button();
this.groupBox12 = new System.Windows.Forms.GroupBox();
this.label5 = new System.Windows.Forms.Label();
this.tbSupplyContractRate = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox6.SuspendLayout();
@@ -73,6 +77,7 @@
this.groupBox9.SuspendLayout();
this.groupBox10.SuspendLayout();
this.groupBox11.SuspendLayout();
this.groupBox12.SuspendLayout();
this.SuspendLayout();
//
// tbVolume
@@ -426,11 +431,53 @@
this.btnAccountApply.UseVisualStyleBackColor = true;
this.btnAccountApply.Click += new System.EventHandler(this.btnAccountApply_Click);
//
// groupBox12
//
this.groupBox12.Controls.Add(this.label6);
this.groupBox12.Controls.Add(this.tbSupplyContractRate);
this.groupBox12.Controls.Add(this.label5);
this.groupBox12.Location = new System.Drawing.Point(280, 316);
this.groupBox12.Name = "groupBox12";
this.groupBox12.Size = new System.Drawing.Size(262, 57);
this.groupBox12.TabIndex = 19;
this.groupBox12.TabStop = false;
this.groupBox12.Text = "공시";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(28, 23);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(77, 12);
this.label5.TabIndex = 0;
this.label5.Text = "공급계약체결";
//
// tbSupplyContractRate
//
this.tbSupplyContractRate.Location = new System.Drawing.Point(111, 20);
this.tbSupplyContractRate.Name = "tbSupplyContractRate";
this.tbSupplyContractRate.Size = new System.Drawing.Size(100, 21);
this.tbSupplyContractRate.TabIndex = 1;
this.tbSupplyContractRate.Text = "5.0";
this.tbSupplyContractRate.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.tbSupplyContractRate.TextChanged += new System.EventHandler(this.tbSupplyContractRate_TextChanged);
this.tbSupplyContractRate.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbSupplyContractRate_KeyPress);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(217, 23);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(15, 12);
this.label6.TabIndex = 2;
this.label6.Text = "%";
//
// ConfigForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(548, 385);
this.Controls.Add(this.groupBox12);
this.Controls.Add(this.groupBox11);
this.Controls.Add(this.groupBox10);
this.Controls.Add(this.groupBox9);
@@ -456,6 +503,8 @@
this.groupBox10.PerformLayout();
this.groupBox11.ResumeLayout(false);
this.groupBox11.PerformLayout();
this.groupBox12.ResumeLayout(false);
this.groupBox12.PerformLayout();
this.ResumeLayout(false);
}
@@ -495,5 +544,9 @@
private System.Windows.Forms.TextBox tbAccountSub;
private System.Windows.Forms.GroupBox groupBox11;
private System.Windows.Forms.Button btnAccountApply;
private System.Windows.Forms.GroupBox groupBox12;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox tbSupplyContractRate;
private System.Windows.Forms.Label label5;
}
}

View File

@@ -26,6 +26,8 @@ namespace NewsCrawler
cbAccount.Items.AddRange(Accounts);
if(Config.GetAccount() != "" && Accounts.Contains(Config.GetAccount()))
cbAccount.SelectedItem = Config.GetAccount();
tbSupplyContractRate.Text = Config.GetSupplyContractRate().ToString();
}
private void OpenFile(string strName)
@@ -141,5 +143,18 @@ namespace NewsCrawler
{
m_Listener.OnConfigFormClosing();
}
private void tbSupplyContractRate_TextChanged(object sender, EventArgs e)
{
float fSupplyContractRate;
float.TryParse(tbSupplyContractRate.Text, out fSupplyContractRate);
m_Listener.OnSupplyContractRateChanged(fSupplyContractRate);
}
private void tbSupplyContractRate_KeyPress(object sender, KeyPressEventArgs e)
{
if(char.IsDigit(e.KeyChar) == false && e.KeyChar != '.')
e.Handled = true;
}
}
}

899
Crawler.cs Normal file
View File

@@ -0,0 +1,899 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace NewsCrawler
{
public class Crawler
{
NewsForm m_Listener = null;
DateTime m_Today = DateTime.Now;
int m_iDartAPIRetry = 5;
public Crawler(NewsForm Listener)
{
m_Listener = Listener;
}
class REQUEST_STATUS
{
public HttpWebRequest m_HTTPReq = null;
public bool m_bInitial = false;
public Stopwatch m_Timer = new Stopwatch();
public string m_strCodeName = "";
public string m_strAuthKey = "";
};
void ResponseAsiaE(IAsyncResult result)
{
REQUEST_STATUS State = (REQUEST_STATUS)result.AsyncState;
HttpWebRequest HttpReq = State.m_HTTPReq;
bool bInitial = State.m_bInitial;
State.m_Timer.Stop();
try
{
string strServerURL = "http://www.asiae.co.kr";
using(HttpWebResponse response = (HttpWebResponse)HttpReq.GetResponse())
{
using(Stream dataStream = response.GetResponseStream())
{
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("EUC-KR")))
{
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
responseFromServer = responseFromServer.Replace("\"\"", "\"");
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(responseFromServer);
string strXPath = "//div[contains(@class, 'txtform')]/ul/li";
var lists = doc.DocumentNode.SelectNodes(strXPath);
foreach(var item in lists)
{
string strTitle1 = item.SelectSingleNode(".//a").GetAttributeValue("title", "");
string strTitle2 = item.SelectSingleNode(".//a").FirstChild.InnerText;
string strTitle = (strTitle1.Length > strTitle2.Length ? strTitle1 : strTitle2);
string strTime = item.SelectSingleNode(".//span").InnerText;
string strURL = strServerURL+item.SelectSingleNode(".//a").GetAttributeValue("href", "");
if(Regex.IsMatch(strTime, @"\d+/\d+")==true)
{
//Console.WriteLine("어제 기사 : " + item.InnerHtml);
continue;
}
m_Listener.InsertItem(strTitle, "", "",
DateTime.ParseExact(strTime, "HH:mm", CultureInfo.CurrentCulture),
DateTime.Now,
strURL, "아시아경제", State.m_Timer.Elapsed.TotalMilliseconds, bInitial);
}
}
}
}
HttpReq.EndGetResponse(result);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
public void ReadAsiaE(bool bInitial = false)
{
try
{
HttpWebRequest HttpReq = WebRequest.Create("http://www.asiae.co.kr/news/sokbo/sokbo_left.htm") as HttpWebRequest;
HttpReq.Credentials = CredentialCache.DefaultCredentials;
HttpReq.Timeout = 2000;
REQUEST_STATUS State = new REQUEST_STATUS();
State.m_HTTPReq = HttpReq;
State.m_bInitial = bInitial;
State.m_Timer.Start();
HttpReq.BeginGetResponse(new AsyncCallback(ResponseAsiaE), State);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
void ResponseEtoday(IAsyncResult result)
{
REQUEST_STATUS State = (REQUEST_STATUS)result.AsyncState;
HttpWebRequest HttpReq = State.m_HTTPReq;
bool bInitial = State.m_bInitial;
State.m_Timer.Stop();
try
{
using(HttpWebResponse response = (HttpWebResponse)HttpReq.GetResponse())
{
using(Stream dataStream = response.GetResponseStream())
{
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
{
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(responseFromServer);
string strXPath = "//div[contains(@class, 'flash_tab_lst')]/ul/li";
var lists = doc.DocumentNode.SelectNodes(strXPath);
foreach(var item in lists)
{
string strTitle = item.SelectSingleNode(".//a").InnerText;
string strTime = item.SelectSingleNode(".//span[contains(@class, 'flash_press')]").InnerText;
string strURL = item.SelectSingleNode(".//a").GetAttributeValue("href", "");
strURL="http://www.etoday.co.kr/news/section/newsview.php?idxno="+Regex.Replace(strURL, @"\D", "");
if(Regex.IsMatch(strTime, @"\d+/\d+")==true)
{
//Console.WriteLine("어제 기사 : " + item.InnerHtml);
continue;
}
m_Listener.InsertItem(strTitle, "", "",
DateTime.ParseExact(strTime, "HH:mm", CultureInfo.CurrentCulture),
DateTime.Now,
strURL, "이투데이", State.m_Timer.Elapsed.TotalMilliseconds, bInitial);
}
}
}
}
HttpReq.EndGetResponse(result);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
public void ReadEtoday(bool bInitial = false)
{
try
{
HttpWebRequest HttpReq = WebRequest.Create("http://www.etoday.co.kr/news/flash/flash_list.php?tab=1") as HttpWebRequest;
HttpReq.Credentials = CredentialCache.DefaultCredentials;
HttpReq.Timeout = 2000;
REQUEST_STATUS State = new REQUEST_STATUS();
State.m_HTTPReq = HttpReq;
State.m_bInitial = bInitial;
State.m_Timer.Start();
HttpReq.BeginGetResponse(new AsyncCallback(ResponseEtoday), State);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
void ResponseEtoday2(IAsyncResult result)
{
REQUEST_STATUS State = (REQUEST_STATUS)result.AsyncState;
HttpWebRequest HttpReq = State.m_HTTPReq;
bool bInitial = State.m_bInitial;
State.m_Timer.Stop();
try
{
WebRequest request = WebRequest.Create("http://rss.etoday.co.kr/etoday/etoday_news_all.xml");
request.Credentials=CredentialCache.DefaultCredentials;
request.Timeout=2000;
int iCDATALen = "<![CDATA[".Length;
using(HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using(Stream dataStream = response.GetResponseStream())
{
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
{
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(responseFromServer);
string strXPath = "//item";
var lists = doc.DocumentNode.SelectNodes(strXPath);
if(lists == null)
return;
foreach(var item in lists)
{
string strTitle = item.SelectSingleNode(".//title").InnerText;
strTitle = strTitle.Substring(iCDATALen, strTitle.Length-iCDATALen-3);
string strTime = item.ChildNodes["pubDate"].InnerText;
DateTime time = Convert.ToDateTime(strTime);
strTime = time.ToString("HH:mm:ss");
string strURL = "[rss] " + item.ChildNodes["link"].NextSibling.InnerText;
if(time.Day != m_Today.Day)
{
//Console.WriteLine("어제 기사 : " + item.InnerHtml);
continue;
}
m_Listener.InsertItem(strTitle, "", "",
DateTime.ParseExact(strTime, "HH:mm:ss", CultureInfo.CurrentCulture),
DateTime.Now,
strURL, "이투데이 rss", State.m_Timer.Elapsed.TotalMilliseconds, bInitial);
}
}
}
}
HttpReq.EndGetResponse(result);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
public void ReadEtoday2(bool bInitial = false)
{
try
{
HttpWebRequest HttpReq = WebRequest.Create("http://rss.etoday.co.kr/etoday/etoday_news_all.xml") as HttpWebRequest;
HttpReq.Credentials = CredentialCache.DefaultCredentials;
HttpReq.Timeout = 2000;
REQUEST_STATUS State = new REQUEST_STATUS();
State.m_HTTPReq = HttpReq;
State.m_bInitial = bInitial;
State.m_Timer.Start();
HttpReq.BeginGetResponse(new AsyncCallback(ResponseEtoday2), State);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
void ResponseDart(IAsyncResult result)
{
REQUEST_STATUS State = (REQUEST_STATUS)result.AsyncState;
HttpWebRequest HttpReq = State.m_HTTPReq;
bool bInitial = State.m_bInitial;
State.m_Timer.Stop();
try
{
string strServerURL = "https://dart.fss.or.kr";
using(HttpWebResponse response = (HttpWebResponse)HttpReq.GetResponse())
{
using(Stream dataStream = response.GetResponseStream())
{
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
{
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(responseFromServer);
string strXPath = "//div[@id='listContents']/div[contains(@class, 'table_list')]/table/tr";
var lists = doc.DocumentNode.SelectNodes(strXPath);
foreach(var item in lists)
{
var rows = item.SelectNodes(".//td");
if(rows.Count < 3)
continue;
string strTitle = rows[2].InnerText;
strTitle=strTitle.Trim();
string strTime = item.SelectSingleNode(".//td[contains(@class, 'cen_txt')]").InnerText;
strTime=strTime.Trim();
string strURL = rows[2].SelectSingleNode(".//a").GetAttributeValue("href", "");
strURL=strURL.Trim();
strURL =strServerURL+strURL;
if(Regex.IsMatch(strTime, @"\d+/\d+")==true)
{
//Console.WriteLine("어제 기사 : " + item.InnerHtml);
continue;
}
m_Listener.InsertItem(strTitle, "", "",
DateTime.ParseExact(strTime, "HH:mm", CultureInfo.CurrentCulture),
DateTime.Now,
strURL, "DART", State.m_Timer.Elapsed.TotalMilliseconds, bInitial);
}
}
}
}
HttpReq.EndGetResponse(result);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
public void ReadDart(bool bInitial = false)
{
try
{
HttpWebRequest HttpReq = WebRequest.Create("https://dart.fss.or.kr/dsac001/mainAll.do") as HttpWebRequest;
HttpReq.Credentials = CredentialCache.DefaultCredentials;
HttpReq.Timeout = 2000;
REQUEST_STATUS State = new REQUEST_STATUS();
State.m_HTTPReq = HttpReq;
State.m_bInitial = bInitial;
State.m_Timer.Start();
HttpReq.BeginGetResponse(new AsyncCallback(ResponseDart), State);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
void ResponseSupplyContract(IAsyncResult result)
{
REQUEST_STATUS State = (REQUEST_STATUS)result.AsyncState;
HttpWebRequest HttpReq = State.m_HTTPReq;
bool bInitial = State.m_bInitial;
State.m_Timer.Stop();
try
{
using(HttpWebResponse response = (HttpWebResponse)HttpReq.GetResponse())
{
using(Stream dataStream = response.GetResponseStream())
{
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
{
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
string strBody = jObj["reportBody"];
strBody = strBody.Replace("\\\"", "\"");
strBody = strBody.Replace("\r\n", "");
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(strBody);
string strXPath = "//tr";
var lists = doc.DocumentNode.SelectNodes(strXPath);
foreach(var item in lists)
{
var cols = item.SelectNodes(".//td");
foreach(var col in cols)
{
if(col.InnerText.Contains("매출액 대비") == true)
{
string strRate = cols[cols.Count-1].InnerText;
float fRate;
float.TryParse(strRate, out fRate);
m_Listener.OnReceivedSupplyContract(State.m_strCodeName, fRate);
break;
}
}
}
}
}
}
HttpReq.EndGetResponse(result);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
private void ReadSupplyContract(bool bInitial, string strCodeName, string strURL)
{
if(m_iDartAPIRetry <= 0)
return;
try
{
HttpWebRequest HttpReq = WebRequest.Create(strURL) as HttpWebRequest;
HttpReq.Credentials = CredentialCache.DefaultCredentials;
HttpReq.Timeout = 2000;
REQUEST_STATUS State = new REQUEST_STATUS();
State.m_HTTPReq = HttpReq;
State.m_bInitial = bInitial;
State.m_Timer.Start();
State.m_strCodeName = strCodeName;
HttpReq.BeginGetResponse(new AsyncCallback(ResponseSupplyContract), State);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
void ResponseDartAPI(IAsyncResult result)
{
REQUEST_STATUS State = (REQUEST_STATUS)result.AsyncState;
HttpWebRequest HttpReq = State.m_HTTPReq;
bool bInitial = State.m_bInitial;
State.m_Timer.Stop();
try
{
using(HttpWebResponse response = (HttpWebResponse)HttpReq.GetResponse())
{
using(Stream dataStream = response.GetResponseStream())
{
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
{
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
string strErrCode = jObj["err_code"];
if(strErrCode == "020")
{
Config.SetDartAPIKeyLimit(State.m_strAuthKey);
Util.Log(Util.LOG_TYPE.ERROR, string.Format("[DartAPI] {0} ({1})", jObj["err_msg"], m_iDartAPIRetry));
return;
}
else if(strErrCode != "000")
{
Util.Log(Util.LOG_TYPE.ERROR, string.Format("[DartAPI] {0} ({1})", jObj["err_msg"], m_iDartAPIRetry));
m_iDartAPIRetry--;
return;
}
foreach(var data in jObj["list"])
{
string strTime = "00:00";
string strTitle = data["rpt_nm"];
string strCodeName = data["crp_nm"];
string strURL = "http://m.dart.fss.or.kr/html_mdart/MD1007.html?rcpNo=" + data["rcp_no"];
if(strCodeName != "" && strTitle.Contains("공급계약체결") && m_Listener.IsDuplicatedURL(strURL) == false)
{
string strURL2 = "http://m.dart.fss.or.kr/viewer/main.st?rcpNo=" + data["rcp_no"];
ReadSupplyContract(bInitial, strCodeName, strURL2);
}
m_Listener.InsertItem(strTitle, strCodeName, "",
DateTime.ParseExact(strTime, "HH:mm", CultureInfo.CurrentCulture),
DateTime.Now,
strURL, "DART API", State.m_Timer.Elapsed.TotalMilliseconds, bInitial);
}
}
}
}
HttpReq.EndGetResponse(result);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
public void ReadDartAPI(bool bInitial = false)
{
if(m_iDartAPIRetry <= 0)
return;
try
{
string strAuthKey = Config.GetDartAPIKey();
string strURL = "http://dart.fss.or.kr/api/search.json?auth="+strAuthKey+"&end_dt="+m_Today.ToString("yyyyMMdd");
HttpWebRequest HttpReq = WebRequest.Create(strURL) as HttpWebRequest;
HttpReq.Credentials = CredentialCache.DefaultCredentials;
HttpReq.Timeout = 2000;
REQUEST_STATUS State = new REQUEST_STATUS();
State.m_HTTPReq = HttpReq;
State.m_bInitial = bInitial;
State.m_Timer.Start();
State.m_strAuthKey = strAuthKey;
HttpReq.BeginGetResponse(new AsyncCallback(ResponseDartAPI), State);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
void ResponseKIND(IAsyncResult result)
{
REQUEST_STATUS State = (REQUEST_STATUS)result.AsyncState;
HttpWebRequest HttpReq = State.m_HTTPReq;
bool bInitial = State.m_bInitial;
State.m_Timer.Stop();
try
{
//string strServerURL = "https://dart.fss.or.kr";
int iCDATALen = "<![CDATA[".Length;
using(HttpWebResponse response = (HttpWebResponse)HttpReq.GetResponse())
{
using(Stream dataStream = response.GetResponseStream())
{
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("utf-8")))
{
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(responseFromServer);
string strXPath = "//item";
var lists = doc.DocumentNode.SelectNodes(strXPath);
if(lists == null)
return;
foreach(var item in lists)
{
string strTitle = item.SelectSingleNode(".//title").InnerText;
strTitle = strTitle.Substring(iCDATALen, strTitle.Length-iCDATALen-3);
string strTime = item.ChildNodes["pubDate"].InnerText;
DateTime time = Convert.ToDateTime(strTime);
strTime = time.ToString("HH:mm:ss");
string strURL = item.ChildNodes["link"].NextSibling.InnerText;
strURL = strURL.Substring(iCDATALen, strURL.Length-iCDATALen-3);
if(Regex.IsMatch(strTime, @"\d+/\d+")==true)
{
//Console.WriteLine("어제 기사 : " + item.InnerHtml);
continue;
}
m_Listener.InsertItem(strTitle, "", "",
DateTime.ParseExact(strTime, "HH:mm:ss", CultureInfo.CurrentCulture),
DateTime.Now,
strURL, "KIND", State.m_Timer.Elapsed.TotalMilliseconds, bInitial);
}
}
}
}
HttpReq.EndGetResponse(result);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
public void ReadKIND(bool bInitial = false)
{
try
{
HttpWebRequest HttpReq = WebRequest.Create("http://kind.krx.co.kr/disclosure/rsstodaydistribute.do?method=searchRssTodayDistribute&repIsuSrtCd=&mktTpCd=0&searchCorpName=&currentPageSize=1000") as HttpWebRequest;
HttpReq.Credentials = CredentialCache.DefaultCredentials;
HttpReq.Timeout = 2000;
REQUEST_STATUS State = new REQUEST_STATUS();
State.m_HTTPReq = HttpReq;
State.m_bInitial = bInitial;
State.m_Timer.Start();
HttpReq.BeginGetResponse(new AsyncCallback(ResponseKIND), State);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
void ResponseEdaily(IAsyncResult result)
{
REQUEST_STATUS State = (REQUEST_STATUS)result.AsyncState;
HttpWebRequest HttpReq = State.m_HTTPReq;
bool bInitial = State.m_bInitial;
State.m_Timer.Stop();
try
{
string strServerURL = "http://www.edaily.co.kr/news/realtime/realtime_NewsRead.asp";
DateTime PrevTime = DateTime.Now;
using(HttpWebResponse response = (HttpWebResponse)HttpReq.GetResponse())
{
using(Stream dataStream = response.GetResponseStream())
{
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("EUC-KR")))
{
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(responseFromServer);
string strXPath = "//li[contains(@id, 'NewsIcon')]";
var lists = doc.DocumentNode.SelectNodes(strXPath);
foreach(var item in lists)
{
string strTitle = item.SelectSingleNode(".//a").GetAttributeValue("title", "");
string strTime = item.SelectSingleNode(".//span").InnerText;
string strID = item.GetAttributeValue("id", "");
strID = strID.Substring("NewsIcon_".Length);
string strURL = strServerURL+"?newsid="+strID;
DateTime Time;
DateTime.TryParseExact(strTime, "HH:mm", CultureInfo.CurrentCulture, DateTimeStyles.None, out Time);
if(Time > PrevTime)
break;
PrevTime = Time;
m_Listener.InsertItem(strTitle, "", "", Time, DateTime.Now, strURL, "이데일리", State.m_Timer.Elapsed.TotalMilliseconds, bInitial);
}
}
}
}
HttpReq.EndGetResponse(result);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
public void ReadEdaily(bool bInitial = false)
{
try
{
HttpWebRequest HttpReq = WebRequest.Create("http://www.edaily.co.kr/news/realtime/realtime_NewsList_1.asp") as HttpWebRequest;
HttpReq.Credentials = CredentialCache.DefaultCredentials;
HttpReq.Timeout = 2000;
REQUEST_STATUS State = new REQUEST_STATUS();
State.m_HTTPReq = HttpReq;
State.m_bInitial = bInitial;
State.m_Timer.Start();
HttpReq.BeginGetResponse(new AsyncCallback(ResponseEdaily), State);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
void ResponseMoneyToday(IAsyncResult result)
{
REQUEST_STATUS State = (REQUEST_STATUS)result.AsyncState;
HttpWebRequest HttpReq = State.m_HTTPReq;
bool bInitial = State.m_bInitial;
State.m_Timer.Stop();
try
{
string strServerURL = "http://news.mt.co.kr/mtview.php?no=";
DateTime PrevTime = DateTime.Now;
using(HttpWebResponse response = (HttpWebResponse)HttpReq.GetResponse())
{
using(Stream dataStream = response.GetResponseStream())
{
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("EUC-KR")))
{
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(responseFromServer);
string strXPath = "//div[@id='articleList']//li[@class='bundle']";
var lists = doc.DocumentNode.SelectNodes(strXPath);
foreach(var item in lists)
{
string strTitle = item.SelectSingleNode(".//a").InnerText;
string strTime = item.SelectSingleNode(".//span").InnerText;
string strID = item.SelectSingleNode(".//a").GetAttributeValue("href", "");
int iStart = strID.IndexOf('\'', 0);
iStart = strID.IndexOf('\'', iStart+1);
iStart = strID.IndexOf('\'', iStart+1);
int iEnd = strID.IndexOf('\'', iStart+1);
strID = strID.Substring(iStart+1, iEnd-iStart+1);
string strURL = strServerURL+strID;
DateTime Time;
DateTime.TryParseExact(strTime, "HH:mm", CultureInfo.CurrentCulture, DateTimeStyles.None, out Time);
if(Time > PrevTime)
break;
PrevTime = Time;
m_Listener.InsertItem(strTitle, "", "", Time, DateTime.Now, strURL, "머니투데이", State.m_Timer.Elapsed.TotalMilliseconds, bInitial);
}
}
}
}
HttpReq.EndGetResponse(result);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
public void ReadMoneyToday(bool bInitial = false)
{
try
{
HttpWebRequest HttpReq = WebRequest.Create("http://news.mt.co.kr/newsflash/newsflash.html") as HttpWebRequest;
HttpReq.Credentials = CredentialCache.DefaultCredentials;
HttpReq.Timeout = 2000;
REQUEST_STATUS State = new REQUEST_STATUS();
State.m_HTTPReq = HttpReq;
State.m_bInitial = bInitial;
State.m_Timer.Start();
HttpReq.BeginGetResponse(new AsyncCallback(ResponseMoneyToday), State);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
void ResponseFinancialNewsJson(IAsyncResult result)
{
REQUEST_STATUS State = (REQUEST_STATUS)result.AsyncState;
HttpWebRequest HttpReq = State.m_HTTPReq;
bool bInitial = State.m_bInitial;
State.m_Timer.Stop();
try
{
string strServerURL = "http://www.fnnews.com/news/";
using(HttpWebResponse response = (HttpWebResponse)HttpReq.GetResponse())
{
using(Stream dataStream = response.GetResponseStream())
{
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("UTF-8")))
{
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
dynamic jObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseFromServer);
foreach(var data in jObj)
{
string strTitle = data["title"];
string strTime = data["date"];
DateTime Time;
DateTime.TryParseExact(strTime, "yyyy.MM.dd HH:mm", CultureInfo.CurrentCulture, DateTimeStyles.None, out Time);
string strCode = data["code"];
string strURL = strServerURL+strCode;
if(Time.DayOfYear == m_Today.DayOfYear)
m_Listener.InsertItem(strTitle, "", "", Time, DateTime.Now, strURL, "파이낸셜뉴스", State.m_Timer.Elapsed.TotalMilliseconds, bInitial);
}
}
}
}
HttpReq.EndGetResponse(result);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
public void ReadFinancialNewsJson(bool bInitial = false)
{
try
{
HttpWebRequest HttpReq = WebRequest.Create("http://www.fnnews.com/newsflash/today/data?type=json") as HttpWebRequest;
HttpReq.Credentials = CredentialCache.DefaultCredentials;
HttpReq.Timeout = 2000;
REQUEST_STATUS State = new REQUEST_STATUS();
State.m_HTTPReq = HttpReq;
State.m_bInitial = bInitial;
State.m_Timer.Start();
HttpReq.BeginGetResponse(new AsyncCallback(ResponseFinancialNewsJson), State);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
void ResponseFinancialNews(IAsyncResult result)
{
REQUEST_STATUS State = (REQUEST_STATUS)result.AsyncState;
HttpWebRequest HttpReq = State.m_HTTPReq;
bool bInitial = State.m_bInitial;
State.m_Timer.Stop();
try
{
string strServerURL = "http://www.fnnews.com";
DateTime Today = DateTime.Now;
using(HttpWebResponse response = (HttpWebResponse)HttpReq.GetResponse())
{
using(Stream dataStream = response.GetResponseStream())
{
using(StreamReader reader = new StreamReader(dataStream, Encoding.GetEncoding("UTF-8")))
{
string responseFromServer = WebUtility.HtmlDecode(reader.ReadToEnd());
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(responseFromServer);
string strXPath = "//div[@class='categoryList']//li";
var lists = doc.DocumentNode.SelectNodes(strXPath);
foreach(var item in lists)
{
string strTitle = item.SelectNodes(".//a")[1].InnerText;
string strDateTime = item.SelectSingleNode(".//span[@class='category_date']").InnerText;
string strURL = strServerURL+item.SelectNodes(".//a")[1].GetAttributeValue("href", "");
DateTime Time;
DateTime.TryParseExact(strDateTime, "yyyy.MM.dd HH:mm", CultureInfo.CurrentCulture, DateTimeStyles.None, out Time);
if(Time.DayOfYear < m_Today.DayOfYear)
break;
m_Listener.InsertItem(strTitle, "", "", Time, DateTime.Now, strURL, "파이낸셜뉴스", State.m_Timer.Elapsed.TotalMilliseconds, bInitial);
}
}
}
}
HttpReq.EndGetResponse(result);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
public void ReadFinancialNews(bool bInitial = false)
{
try
{
HttpWebRequest HttpReq = WebRequest.Create("http://www.fnnews.com/newsflash") as HttpWebRequest;
HttpReq.Credentials = CredentialCache.DefaultCredentials;
HttpReq.Timeout = 2000;
REQUEST_STATUS State = new REQUEST_STATUS();
State.m_HTTPReq = HttpReq;
State.m_bInitial = bInitial;
State.m_Timer.Start();
HttpReq.BeginGetResponse(new AsyncCallback(ResponseFinancialNews), State);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
}
}
}
}

View File

@@ -155,9 +155,12 @@ namespace NewsCrawler
public int GetCurPrice(CodeList.CODE_VALUE Code)
{
while(GetLimitRemainCountRQ() < 1)
Thread.Sleep(100);
m_CPStockMst.SetInputValue(0, Code.m_strCode);
m_CPStockMst.BlockRequest2(0);
int iCurPrice = m_CPStockMst.GetHeaderValue(13);
int iCurPrice = m_CPStockMst.GetHeaderValue(11);
return iCurPrice;
}
@@ -184,8 +187,6 @@ namespace NewsCrawler
int iTimeStart;
int.TryParse(StartTime.ToString("HHmm"), out iTimeStart);
int iCheckCnt = 0;
int iCount = m_StockChart.GetHeaderValue(3);
for(int i=0; i<iCount; i++)
{
@@ -201,11 +202,9 @@ namespace NewsCrawler
iPriceLow = Math.Min(iPriceLow, (int)iPriceLowLocal);
iPriceHigh = Math.Max(iPriceLow, (int)iPriceHighLocal);
iCheckCnt++;
}
if(iCheckCnt >= 5)
if(iTime < iTimeStart)
break;
}
}

View File

@@ -97,6 +97,7 @@
<Compile Include="ConfigForm.Designer.cs">
<DependentUpon>ConfigForm.cs</DependentUpon>
</Compile>
<Compile Include="Crawler.cs" />
<Compile Include="CybosHelper.cs" />
<Compile Include="ModelessPopup.cs">
<SubType>Form</SubType>

156
NewsForm.Designer.cs generated
View File

@@ -37,27 +37,29 @@
this.chResponseT = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chPriceS = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chPriceLow = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chPriceLowP = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chPriceHigh = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chPriceHighP = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chLink = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.wbView = new System.Windows.Forms.WebBrowser();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.statusBar = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel();
this.tbLog = new System.Windows.Forms.RichTextBox();
this.chAutoReload = new System.Windows.Forms.CheckBox();
this.chAutoSelect = new System.Windows.Forms.CheckBox();
this.tbInterval = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.btnConfig = new System.Windows.Forms.Button();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.tbLog = new System.Windows.Forms.RichTextBox();
this.chBuy = new System.Windows.Forms.CheckBox();
this.cbPriceCheck = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.statusBar.SuspendLayout();
this.SuspendLayout();
//
// lvList
@@ -71,7 +73,9 @@
this.chResponseT,
this.chPriceS,
this.chPriceLow,
this.chPriceLowP,
this.chPriceHigh,
this.chPriceHighP,
this.chLink});
this.lvList.Dock = System.Windows.Forms.DockStyle.Fill;
this.lvList.FullRowSelect = true;
@@ -80,12 +84,12 @@
this.lvList.Location = new System.Drawing.Point(0, 0);
this.lvList.MultiSelect = false;
this.lvList.Name = "lvList";
this.lvList.Size = new System.Drawing.Size(1100, 603);
this.lvList.Size = new System.Drawing.Size(1412, 587);
this.lvList.TabIndex = 0;
this.lvList.UseCompatibleStateImageBehavior = false;
this.lvList.View = System.Windows.Forms.View.Details;
this.lvList.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.lvList_ColumnClick);
this.lvList.SelectedIndexChanged += new System.EventHandler(this.lvList_SelectedIndexChanged);
this.lvList.DoubleClick += new System.EventHandler(this.lvList_DoubleClick);
//
// chId
//
@@ -126,29 +130,30 @@
this.chPriceLow.Text = "최저가";
this.chPriceLow.Width = 75;
//
// chPriceLowP
//
this.chPriceLowP.Text = "최저가 대비(%)";
//
// chPriceHigh
//
this.chPriceHigh.Text = "최고가";
this.chPriceHigh.Width = 73;
//
// chPriceHighP
//
this.chPriceHighP.Text = "최고가 대비(%)";
//
// chLink
//
this.chLink.Text = "링크";
this.chLink.Width = 241;
//
// wbView
//
this.wbView.Dock = System.Windows.Forms.DockStyle.Fill;
this.wbView.Location = new System.Drawing.Point(0, 0);
this.wbView.MinimumSize = new System.Drawing.Size(20, 20);
this.wbView.Name = "wbView";
this.wbView.Size = new System.Drawing.Size(1100, 27);
this.wbView.TabIndex = 1;
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer1.Location = new System.Drawing.Point(0, 27);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
@@ -158,11 +163,62 @@
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.wbView);
this.splitContainer1.Size = new System.Drawing.Size(1100, 634);
this.splitContainer1.SplitterDistance = 603;
this.splitContainer1.Panel2.Controls.Add(this.statusBar);
this.splitContainer1.Panel2.Controls.Add(this.tbLog);
this.splitContainer1.Size = new System.Drawing.Size(1412, 805);
this.splitContainer1.SplitterDistance = 587;
this.splitContainer1.TabIndex = 2;
//
// statusBar
//
this.statusBar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1,
this.toolStripStatusLabel2,
this.toolStripStatusLabel3,
this.toolStripStatusLabel4});
this.statusBar.Location = new System.Drawing.Point(0, 192);
this.statusBar.Name = "statusBar";
this.statusBar.Size = new System.Drawing.Size(1412, 22);
this.statusBar.TabIndex = 1;
this.statusBar.Text = "statusStrip1";
//
// toolStripStatusLabel1
//
this.toolStripStatusLabel1.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right;
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
this.toolStripStatusLabel1.Size = new System.Drawing.Size(4, 17);
//
// toolStripStatusLabel2
//
this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
this.toolStripStatusLabel2.Size = new System.Drawing.Size(1389, 17);
this.toolStripStatusLabel2.Spring = true;
//
// toolStripStatusLabel3
//
this.toolStripStatusLabel3.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)));
this.toolStripStatusLabel3.Name = "toolStripStatusLabel3";
this.toolStripStatusLabel3.Size = new System.Drawing.Size(4, 17);
//
// toolStripStatusLabel4
//
this.toolStripStatusLabel4.Name = "toolStripStatusLabel4";
this.toolStripStatusLabel4.Size = new System.Drawing.Size(0, 17);
//
// tbLog
//
this.tbLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tbLog.BackColor = System.Drawing.SystemColors.Window;
this.tbLog.Location = new System.Drawing.Point(0, 0);
this.tbLog.Name = "tbLog";
this.tbLog.ReadOnly = true;
this.tbLog.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
this.tbLog.Size = new System.Drawing.Size(1412, 189);
this.tbLog.TabIndex = 0;
this.tbLog.Text = "";
//
// chAutoReload
//
this.chAutoReload.AutoSize = true;
@@ -209,7 +265,7 @@
// btnConfig
//
this.btnConfig.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnConfig.Location = new System.Drawing.Point(1026, 1);
this.btnConfig.Location = new System.Drawing.Point(1336, 1);
this.btnConfig.Name = "btnConfig";
this.btnConfig.Size = new System.Drawing.Size(75, 23);
this.btnConfig.TabIndex = 7;
@@ -217,38 +273,6 @@
this.btnConfig.UseVisualStyleBackColor = true;
this.btnConfig.Click += new System.EventHandler(this.btnConfig_Click);
//
// splitContainer2
//
this.splitContainer2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer2.Location = new System.Drawing.Point(1, 26);
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.splitContainer1);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.tbLog);
this.splitContainer2.Size = new System.Drawing.Size(1100, 803);
this.splitContainer2.SplitterDistance = 634;
this.splitContainer2.TabIndex = 8;
//
// tbLog
//
this.tbLog.BackColor = System.Drawing.SystemColors.Window;
this.tbLog.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbLog.Location = new System.Drawing.Point(0, 0);
this.tbLog.Name = "tbLog";
this.tbLog.ReadOnly = true;
this.tbLog.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
this.tbLog.Size = new System.Drawing.Size(1100, 165);
this.tbLog.TabIndex = 0;
this.tbLog.Text = "";
//
// chBuy
//
this.chBuy.Appearance = System.Windows.Forms.Appearance.Button;
@@ -275,10 +299,10 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1102, 829);
this.ClientSize = new System.Drawing.Size(1412, 829);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.cbPriceCheck);
this.Controls.Add(this.chBuy);
this.Controls.Add(this.splitContainer2);
this.Controls.Add(this.btnConfig);
this.Controls.Add(this.label1);
this.Controls.Add(this.tbInterval);
@@ -289,12 +313,11 @@
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.NewsForm_FormClosing);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.statusBar.ResumeLayout(false);
this.statusBar.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -307,14 +330,12 @@
private System.Windows.Forms.ColumnHeader chTitle;
private System.Windows.Forms.ColumnHeader chReference;
private System.Windows.Forms.ColumnHeader chLink;
private System.Windows.Forms.WebBrowser wbView;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.CheckBox chAutoReload;
private System.Windows.Forms.CheckBox chAutoSelect;
private System.Windows.Forms.TextBox tbInterval;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnConfig;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.RichTextBox tbLog;
private System.Windows.Forms.CheckBox chBuy;
private System.Windows.Forms.ColumnHeader chResponseT;
@@ -324,6 +345,13 @@
private System.Windows.Forms.ColumnHeader chPriceLow;
private System.Windows.Forms.ColumnHeader chPriceHigh;
private System.Windows.Forms.CheckBox cbPriceCheck;
private System.Windows.Forms.ColumnHeader chPriceLowP;
private System.Windows.Forms.ColumnHeader chPriceHighP;
private System.Windows.Forms.StatusStrip statusBar;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel4;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -117,4 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="statusBar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>96</value>
</metadata>
</root>

View File

@@ -93,6 +93,9 @@ namespace NewsCrawler
public static void Log(LOG_TYPE enType, string strLog)
{
if(strLog.Contains("인덱스"))
Console.WriteLine("ddddddddd");
if(Directory.Exists(GetLogPath()) == false)
Directory.CreateDirectory(GetLogPath());