diff --git a/.gitignore b/.gitignore
index 2842f7a..2c62ef4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ bin/
obj/
log/
publish/
+.vs/
diff --git a/Crawler.cs b/Crawler.cs
index 69ceb99..22f6564 100644
--- a/Crawler.cs
+++ b/Crawler.cs
@@ -501,6 +501,9 @@ namespace NewsCrawler
public void ReadDartAPI(bool bInitial = false)
{
+ if (Util.IsDebugging() == true)
+ return;
+
if(m_iDartAPIRetry <= 0)
return;
diff --git a/ExcelHandler.cs b/ExcelHandler.cs
index 2edd60a..b119475 100644
--- a/ExcelHandler.cs
+++ b/ExcelHandler.cs
@@ -1,119 +1,119 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-using Excel = Microsoft.Office.Interop.Excel;
-using System.Reflection;
-namespace NewsCrawler
-{
- public class ExcelHandler
- {
- bool m_bAvailable = true;
- string m_strFileName = "";
- string m_strToday = DateTime.Now.ToString("yyyy-MM-dd");
+//using System;
+//using System.Collections.Generic;
+//using System.IO;
+//using System.Linq;
+//using System.Runtime.InteropServices;
+//using System.Text;
+//using System.Threading.Tasks;
+//using Excel = Microsoft.Office.Interop.Excel;
+//using System.Reflection;
+//namespace NewsCrawler
+//{
+// public class ExcelHandler
+// {
+// bool m_bAvailable = true;
+// string m_strFileName = "";
+// string m_strToday = DateTime.Now.ToString("yyyy-MM-dd");
- public ExcelHandler(string strFileName)
- {
- m_strFileName = strFileName;
- }
+// public ExcelHandler(string strFileName)
+// {
+// m_strFileName = strFileName;
+// }
- public bool IsAvailable()
- {
- return m_bAvailable;
- }
+// public bool IsAvailable()
+// {
+// return m_bAvailable;
+// }
- private void Create()
- {
- try
- {
- Excel.Application App = new Excel.Application();
- if(App == null)
- {
- Util.Log(Util.LOG_TYPE.ERROR, "엑셀이 설치되지 않음");
- m_bAvailable = false;
- return;
- }
+// private void Create()
+// {
+// try
+// {
+// Excel.Application App = new Excel.Application();
+// if(App == null)
+// {
+// Util.Log(Util.LOG_TYPE.ERROR, "엑셀이 설치되지 않음");
+// m_bAvailable = false;
+// return;
+// }
- Excel._Workbook Workbook = App.Workbooks.Add(Missing.Value);
- Excel._Worksheet Worksheet = Workbook.ActiveSheet;
+// Excel._Workbook Workbook = App.Workbooks.Add(Missing.Value);
+// Excel._Worksheet Worksheet = Workbook.ActiveSheet;
- Worksheet.Cells[1, 1] = "날짜";
- Worksheet.Cells[1, 2] = "기사 시간";
- Worksheet.Cells[1, 3] = "받은 시간";
- Worksheet.Cells[1, 4] = "출처";
- Worksheet.Cells[1, 5] = "제목";
- Worksheet.Cells[1, 6] = "요청 시간";
- Worksheet.Cells[1, 7] = "시가";
- Worksheet.Cells[1, 8] = "저가";
- Worksheet.Cells[1, 9] = "대비";
- Worksheet.Cells[1, 10] = "고가";
- Worksheet.Cells[1, 11] = "대비";
- Worksheet.Cells[1, 12] = "링크";
+// Worksheet.Cells[1, 1] = "날짜";
+// Worksheet.Cells[1, 2] = "기사 시간";
+// Worksheet.Cells[1, 3] = "받은 시간";
+// Worksheet.Cells[1, 4] = "출처";
+// Worksheet.Cells[1, 5] = "제목";
+// Worksheet.Cells[1, 6] = "요청 시간";
+// Worksheet.Cells[1, 7] = "시가";
+// Worksheet.Cells[1, 8] = "저가";
+// Worksheet.Cells[1, 9] = "대비";
+// Worksheet.Cells[1, 10] = "고가";
+// Worksheet.Cells[1, 11] = "대비";
+// Worksheet.Cells[1, 12] = "링크";
- Workbook.SaveAs(m_strFileName, Excel.XlFileFormat.xlOpenXMLWorkbook, Missing.Value,
- Missing.Value, false, false, Excel.XlSaveAsAccessMode.xlNoChange,
- Excel.XlSaveConflictResolution.xlUserResolution, true,
- Missing.Value, Missing.Value, Missing.Value);
- Workbook.Close();
- }
- catch(Exception ex)
- {
- Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
- }
- }
+// Workbook.SaveAs(m_strFileName, Excel.XlFileFormat.xlOpenXMLWorkbook, Missing.Value,
+// Missing.Value, false, false, Excel.XlSaveAsAccessMode.xlNoChange,
+// Excel.XlSaveConflictResolution.xlUserResolution, true,
+// Missing.Value, Missing.Value, Missing.Value);
+// Workbook.Close();
+// }
+// catch(Exception ex)
+// {
+// Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
+// }
+// }
- public bool AddRow(string strNewsTime, string strResTime, string strRef, string strTitle, float fReqTime, int iPriceS, int iPriceLow, float fPriceLowP, int iPriceHigh, float fPriceHighP, string strLink)
- {
- lock(this)
- {
- if(m_bAvailable == false)
- return false;
+// public bool AddRow(string strNewsTime, string strResTime, string strRef, string strTitle, float fReqTime, int iPriceS, int iPriceLow, float fPriceLowP, int iPriceHigh, float fPriceHighP, string strLink)
+// {
+// lock(this)
+// {
+// if(m_bAvailable == false)
+// return false;
- if(File.Exists(m_strFileName) == false)
- Create();
+// if(File.Exists(m_strFileName) == false)
+// Create();
- try
- {
- Excel.Application App = new Excel.Application();
- if(App == null)
- {
- Util.Log(Util.LOG_TYPE.ERROR, "엑셀이 설치되지 않음");
- m_bAvailable = false;
- return false;
- }
- App.DisplayAlerts = false;
+// try
+// {
+// Excel.Application App = new Excel.Application();
+// if(App == null)
+// {
+// Util.Log(Util.LOG_TYPE.ERROR, "엑셀이 설치되지 않음");
+// m_bAvailable = false;
+// return false;
+// }
+// App.DisplayAlerts = false;
- Excel._Workbook Workbook = App.Workbooks.Open(m_strFileName);
- Excel._Worksheet Worksheet = Workbook.ActiveSheet;
+// Excel._Workbook Workbook = App.Workbooks.Open(m_strFileName);
+// Excel._Worksheet Worksheet = Workbook.ActiveSheet;
- int iRow = Worksheet.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell, Type.Missing).Row+1;
- Worksheet.Cells[iRow, 1] = m_strToday;
- Worksheet.Cells[iRow, 2] = strNewsTime;
- Worksheet.Cells[iRow, 3] = strResTime;
- Worksheet.Cells[iRow, 4] = strRef;
- Worksheet.Cells[iRow, 5] = strTitle;
- Worksheet.Cells[iRow, 6] = fReqTime;
- Worksheet.Cells[iRow, 7] = iPriceS;
- Worksheet.Cells[iRow, 8] = iPriceLow;
- Worksheet.Cells[iRow, 9] = fPriceLowP;
- Worksheet.Cells[iRow, 10] = iPriceHigh;
- Worksheet.Cells[iRow, 11] = fPriceHighP;
- Worksheet.Cells[iRow, 12] = strLink;
+// int iRow = Worksheet.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell, Type.Missing).Row+1;
+// Worksheet.Cells[iRow, 1] = m_strToday;
+// Worksheet.Cells[iRow, 2] = strNewsTime;
+// Worksheet.Cells[iRow, 3] = strResTime;
+// Worksheet.Cells[iRow, 4] = strRef;
+// Worksheet.Cells[iRow, 5] = strTitle;
+// Worksheet.Cells[iRow, 6] = fReqTime;
+// Worksheet.Cells[iRow, 7] = iPriceS;
+// Worksheet.Cells[iRow, 8] = iPriceLow;
+// Worksheet.Cells[iRow, 9] = fPriceLowP;
+// Worksheet.Cells[iRow, 10] = iPriceHigh;
+// Worksheet.Cells[iRow, 11] = fPriceHighP;
+// Worksheet.Cells[iRow, 12] = strLink;
- Workbook.Save();
- Workbook.Close();
- }
- catch(Exception ex)
- {
- Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
- return false;
- }
- }
+// Workbook.Save();
+// Workbook.Close();
+// }
+// catch(Exception ex)
+// {
+// Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
+// return false;
+// }
+// }
- return true;
- }
- }
-}
+// return true;
+// }
+// }
+//}
diff --git a/ExcelLibrary.dll b/ExcelLibrary.dll
new file mode 100644
index 0000000..76bd483
Binary files /dev/null and b/ExcelLibrary.dll differ
diff --git a/ListViewNF.cs b/ListViewNF.cs
new file mode 100644
index 0000000..9176aef
--- /dev/null
+++ b/ListViewNF.cs
@@ -0,0 +1,26 @@
+using System.Windows.Forms;
+
+namespace NewsCrawler
+{
+ class ListViewNF : System.Windows.Forms.ListView
+ {
+ public ListViewNF()
+ {
+ //Activate double buffering
+ this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
+
+ //Enable the OnNotifyMessage event so we get a chance to filter out
+ // Windows messages before they get to the form's WndProc
+ this.SetStyle(ControlStyles.EnableNotifyMessage, true);
+ }
+
+ protected override void OnNotifyMessage(Message m)
+ {
+ //Filter out the WM_ERASEBKGND message
+ if (m.Msg != 0x14)
+ {
+ base.OnNotifyMessage(m);
+ }
+ }
+ }
+}
diff --git a/NewsCrawler.csproj b/NewsCrawler.csproj
index 7e0cabf..ce4dbdd 100644
--- a/NewsCrawler.csproj
+++ b/NewsCrawler.csproj
@@ -38,6 +38,7 @@
DEBUG;TRACE
prompt
4
+ true
AnyCPU
@@ -89,6 +90,9 @@
+
+ Component
+
@@ -213,33 +217,6 @@
False
True
-
- {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}
- 2
- 4
- 0
- primary
- False
- True
-
-
- {00020813-0000-0000-C000-000000000046}
- 1
- 6
- 0
- primary
- False
- True
-
-
- {0002E157-0000-0000-C000-000000000046}
- 5
- 3
- 0
- primary
- False
- True
-
diff --git a/NewsForm.Designer.cs b/NewsForm.Designer.cs
index 7873e12..13e0db7 100644
--- a/NewsForm.Designer.cs
+++ b/NewsForm.Designer.cs
@@ -28,7 +28,7 @@
///
private void InitializeComponent()
{
- this.lvList = new System.Windows.Forms.ListView();
+ this.lvList = new NewsCrawler.ListViewNF();
this.chId = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chResT = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@@ -279,7 +279,7 @@
//
this.chBuy.Appearance = System.Windows.Forms.Appearance.Button;
this.chBuy.AutoSize = true;
- this.chBuy.Location = new System.Drawing.Point(356, 1);
+ this.chBuy.Location = new System.Drawing.Point(359, 1);
this.chBuy.Name = "chBuy";
this.chBuy.Size = new System.Drawing.Size(39, 22);
this.chBuy.TabIndex = 9;
@@ -329,7 +329,7 @@
#endregion
- private System.Windows.Forms.ListView lvList;
+ private ListViewNF lvList;
private System.Windows.Forms.ColumnHeader chTime;
private System.Windows.Forms.ColumnHeader chTitle;
private System.Windows.Forms.ColumnHeader chReference;
diff --git a/NewsForm.cs b/NewsForm.cs
index 72f9f44..d64c86c 100644
--- a/NewsForm.cs
+++ b/NewsForm.cs
@@ -86,7 +86,7 @@ namespace NewsCrawler
Crawler m_Crawler = null;
- ExcelHandler m_Excel = null;
+ //ExcelHandler m_Excel = null;
float m_fSupplyContractRate;
@@ -148,13 +148,13 @@ namespace NewsCrawler
lvList.SelectedItems[0].EnsureVisible();
}
- foreach(ColumnHeader col in lvList.Columns)
- {
- if(!(col == chPriceS || col == chPriceLow || col == chPriceHigh))
- col.Width = -2;
- }
+ //foreach(ColumnHeader col in lvList.Columns)
+ //{
+ // if(!(col == chPriceS || col == chPriceLow || col == chPriceHigh))
+ // col.Width = -2;
+ //}
- m_Excel = new ExcelHandler(Util.GetLogPath()+"/PriceCheck"+DateTime.Now.ToString("yyyy-MM-dd")+".xlsx");
+ //m_Excel = new ExcelHandler(Util.GetLogPath()+"/PriceCheck"+DateTime.Now.ToString("yyyy-MM-dd")+".xlsx");
m_CrawlTimer.Elapsed+=CrawlTimer_Tick;
m_CrawlTimer.Interval = m_iCrawlInterval;
@@ -387,6 +387,15 @@ namespace NewsCrawler
"",
strURL }));
+ if(lvList.Items.Count == 0)
+ {
+ foreach (ColumnHeader col in lvList.Columns)
+ {
+ if (!(col == chPriceS || col == chPriceLow || col == chPriceHigh))
+ col.Width = -2;
+ }
+ }
+
lock(m_URLs)
m_URLs.Add(strURL);
@@ -548,11 +557,11 @@ namespace NewsCrawler
if(Data.m_bLog == false)
{
- Data.m_bLog = m_Excel.AddRow(Data.m_NewsItem.m_NewsTime.ToString("HH:mm:ss:fff"), Data.m_NewsItem.m_ResTime.ToString("HH:mm:ss:fff"), Data.m_NewsItem.m_strRef, Data.m_NewsItem.m_strTitle, Data.m_NewsItem.m_fElapseT,
- Data.m_iPriceStart,
- Data.m_iPriceLow, (Data.m_iPriceLow-Data.m_iPriceStart)*100/(float)Data.m_iPriceStart,
- Data.m_iPriceHigh, (Data.m_iPriceHigh-Data.m_iPriceStart)*100/(float)Data.m_iPriceStart,
- Data.m_NewsItem.m_strURL);
+ //Data.m_bLog = m_Excel.AddRow(Data.m_NewsItem.m_NewsTime.ToString("HH:mm:ss:fff"), Data.m_NewsItem.m_ResTime.ToString("HH:mm:ss:fff"), Data.m_NewsItem.m_strRef, Data.m_NewsItem.m_strTitle, Data.m_NewsItem.m_fElapseT,
+ // Data.m_iPriceStart,
+ // Data.m_iPriceLow, (Data.m_iPriceLow-Data.m_iPriceStart)*100/(float)Data.m_iPriceStart,
+ // Data.m_iPriceHigh, (Data.m_iPriceHigh-Data.m_iPriceStart)*100/(float)Data.m_iPriceStart,
+ // Data.m_NewsItem.m_strURL);
}
if(Data.m_bLog == false)
diff --git a/Util.cs b/Util.cs
index 759bf20..d74ca8b 100644
--- a/Util.cs
+++ b/Util.cs
@@ -113,7 +113,11 @@ namespace NewsCrawler
public static bool IsDebugging()
{
+#if DEBUG
return Debugger.IsAttached;
+#else
+ return false;
+#endif
}
public static string GetConfigPath()
diff --git a/configure/code-duplicated.txt b/configure/code-duplicated.txt
index 69bf4b1..5971c96 100644
--- a/configure/code-duplicated.txt
+++ b/configure/code-duplicated.txt
@@ -76,3 +76,5 @@ KODEX 단기채권
강스템바이오텍
금호타이어
아이진
+바른전자
+솔고바이오
diff --git a/packages.config b/packages.config
index 9d64bf3..cd75489 100644
--- a/packages.config
+++ b/packages.config
@@ -1,4 +1,5 @@
+
\ No newline at end of file
diff --git a/packages/Microsoft.Office.Interop.Excel.15.0.4795.1000/Microsoft.Office.Interop.Excel.15.0.4795.1000.nupkg b/packages/Microsoft.Office.Interop.Excel.15.0.4795.1000/Microsoft.Office.Interop.Excel.15.0.4795.1000.nupkg
new file mode 100644
index 0000000..856a9ab
Binary files /dev/null and b/packages/Microsoft.Office.Interop.Excel.15.0.4795.1000/Microsoft.Office.Interop.Excel.15.0.4795.1000.nupkg differ
diff --git a/packages/Microsoft.Office.Interop.Excel.15.0.4795.1000/lib/net20/Microsoft.Office.Interop.Excel.dll b/packages/Microsoft.Office.Interop.Excel.15.0.4795.1000/lib/net20/Microsoft.Office.Interop.Excel.dll
new file mode 100644
index 0000000..9d6d158
Binary files /dev/null and b/packages/Microsoft.Office.Interop.Excel.15.0.4795.1000/lib/net20/Microsoft.Office.Interop.Excel.dll differ
diff --git a/packages/Newtonsoft.Json.9.0.1/lib/net20/Newtonsoft.Json.dll b/packages/Newtonsoft.Json.9.0.1/lib/net20/Newtonsoft.Json.dll
new file mode 100644
index 0000000..2d82d01
Binary files /dev/null and b/packages/Newtonsoft.Json.9.0.1/lib/net20/Newtonsoft.Json.dll differ
diff --git a/packages/Newtonsoft.Json.9.0.1/lib/net35/Newtonsoft.Json.dll b/packages/Newtonsoft.Json.9.0.1/lib/net35/Newtonsoft.Json.dll
new file mode 100644
index 0000000..1ed20a0
Binary files /dev/null and b/packages/Newtonsoft.Json.9.0.1/lib/net35/Newtonsoft.Json.dll differ
diff --git a/packages/Newtonsoft.Json.9.0.1/lib/net40/Newtonsoft.Json.dll b/packages/Newtonsoft.Json.9.0.1/lib/net40/Newtonsoft.Json.dll
new file mode 100644
index 0000000..20dae62
Binary files /dev/null and b/packages/Newtonsoft.Json.9.0.1/lib/net40/Newtonsoft.Json.dll differ
diff --git a/packages/Newtonsoft.Json.9.0.1/lib/net45/Newtonsoft.Json.dll b/packages/Newtonsoft.Json.9.0.1/lib/net45/Newtonsoft.Json.dll
new file mode 100644
index 0000000..be6558d
Binary files /dev/null and b/packages/Newtonsoft.Json.9.0.1/lib/net45/Newtonsoft.Json.dll differ
diff --git a/packages/Newtonsoft.Json.9.0.1/lib/netstandard1.0/Newtonsoft.Json.dll b/packages/Newtonsoft.Json.9.0.1/lib/netstandard1.0/Newtonsoft.Json.dll
new file mode 100644
index 0000000..5f2336e
Binary files /dev/null and b/packages/Newtonsoft.Json.9.0.1/lib/netstandard1.0/Newtonsoft.Json.dll differ
diff --git a/packages/Newtonsoft.Json.9.0.1/lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll b/packages/Newtonsoft.Json.9.0.1/lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll
new file mode 100644
index 0000000..13edc4a
Binary files /dev/null and b/packages/Newtonsoft.Json.9.0.1/lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll differ
diff --git a/packages/Newtonsoft.Json.9.0.1/lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll b/packages/Newtonsoft.Json.9.0.1/lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll
new file mode 100644
index 0000000..8289274
Binary files /dev/null and b/packages/Newtonsoft.Json.9.0.1/lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll differ