- 8092S 객체 사용
- 중복종목 버그 수정
This commit is contained in:
@@ -19,6 +19,8 @@ namespace NewsCrawler
|
||||
System.Timers.Timer m_timer = new System.Timers.Timer();
|
||||
ushort m_uiLastReqT = 0;
|
||||
|
||||
DSCBO1Lib.CpSvr8092S m_Cp8092S = new DSCBO1Lib.CpSvr8092S();
|
||||
|
||||
NewsForm m_Listener = null;
|
||||
|
||||
public CybosHelper(NewsForm Listener)
|
||||
@@ -52,9 +54,33 @@ namespace NewsCrawler
|
||||
|
||||
m_timer.Interval = 1000;
|
||||
m_timer.Elapsed += M_timer_Elapsed;
|
||||
m_timer.Start();
|
||||
//m_timer.Start();
|
||||
|
||||
m_Cp8092S.SetInputValue(0, "*");
|
||||
m_Cp8092S.Received += Cp8092S_Received;
|
||||
m_Cp8092S.Subscribe();
|
||||
}
|
||||
|
||||
|
||||
private void Cp8092S_Received()
|
||||
{
|
||||
byte cType = m_Cp8092S.GetHeaderValue(0);
|
||||
string strCode = m_Cp8092S.GetHeaderValue(1);
|
||||
short iTime = m_Cp8092S.GetHeaderValue(2);
|
||||
string strName = m_Cp8092S.GetHeaderValue(3);
|
||||
short iType = m_Cp8092S.GetHeaderValue(4);
|
||||
string strContents = m_Cp8092S.GetHeaderValue(5);
|
||||
|
||||
if(iType == 1 || iType == 2)
|
||||
{
|
||||
m_Listener.InsertItem(strContents, "", strCode,
|
||||
DateTime.ParseExact(iTime.ToString("0000"), "HHmm", CultureInfo.CurrentCulture),
|
||||
DateTime.Now,
|
||||
"", "CYBOS", 0, false);
|
||||
}
|
||||
|
||||
//Console.WriteLine(string.Format("[8092S] {0} ({1}:{2})", strContents, strName, strCode));
|
||||
}
|
||||
|
||||
private void M_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
m_timer.Enabled = false;
|
||||
|
||||
30
NewsForm.cs
30
NewsForm.cs
@@ -63,6 +63,9 @@ namespace NewsCrawler
|
||||
if(lvList.SelectedItems.Count > 0)
|
||||
lvList.SelectedItems[0].EnsureVisible();
|
||||
}
|
||||
lvList.Columns[chTime.Index].TextAlign = HorizontalAlignment.Right;
|
||||
lvList.Columns[chResponseT.Index].TextAlign = HorizontalAlignment.Right;
|
||||
lvList.Columns[chResT.Index].TextAlign = HorizontalAlignment.Right;
|
||||
|
||||
Console.WriteLine(string.Format("{0} ddd", m_CrawlTimer.SynchronizingObject));
|
||||
Console.WriteLine(string.Format("init thread {0}", System.Threading.Thread.CurrentThread.ManagedThreadId.ToString()));
|
||||
@@ -92,11 +95,20 @@ namespace NewsCrawler
|
||||
if(m_bBuy == false)
|
||||
return;
|
||||
|
||||
if(m_CodeList.IsBuyableCode(Code) == true)
|
||||
if((Code.m_enType & CodeList.CODE_TYPE.DENIAL) == CodeList.CODE_TYPE.DENIAL)
|
||||
{
|
||||
m_CybosHelper.Buy(Code, Config.GetBuyPrice());
|
||||
m_CodeList.AddDuplicatedList(Code.m_strCode, Code.m_strName);
|
||||
Util.Log(Util.LOG_TYPE.DENIAL, string.Format("거부종목 ({0})", Code));
|
||||
return;
|
||||
}
|
||||
|
||||
if((Code.m_enType & CodeList.CODE_TYPE.DUPLICATED) == CodeList.CODE_TYPE.DUPLICATED)
|
||||
{
|
||||
Util.Log(Util.LOG_TYPE.DUPLICATED, string.Format("중복종목 ({0})", Code));
|
||||
return;
|
||||
}
|
||||
|
||||
m_CybosHelper.Buy(Code, Config.GetBuyPrice());
|
||||
m_CodeList.AddDuplicatedList(Code.m_strCode, Code.m_strName);
|
||||
}
|
||||
|
||||
public void OnManualItemBuy(CodeList.CODE_VALUE Code)
|
||||
@@ -122,8 +134,6 @@ namespace NewsCrawler
|
||||
break;
|
||||
|
||||
case TextCondition.TYPE.POSITIVE:
|
||||
m_CodeList.AddDuplicatedList(Code.m_strCode, Code.m_strName);
|
||||
|
||||
if((Code.m_enType&CodeList.CODE_TYPE.DENIAL) == CodeList.CODE_TYPE.DENIAL)
|
||||
Util.Log(Util.LOG_TYPE.DENIAL, string.Format("[{0}] {1} (keyword:{2}, code:{3})", strRef, strTitle, MatchResult.m_strKeyword, Code.ToString()));
|
||||
else if((Code.m_enType&CodeList.CODE_TYPE.DENIAL) == CodeList.CODE_TYPE.DUPLICATED)
|
||||
@@ -135,11 +145,11 @@ namespace NewsCrawler
|
||||
Util.Log(Util.LOG_TYPE.POSITIVE, string.Format("[{0}] {1} (keyword:{2}, code:{3})", strRef, strTitle, MatchResult.m_strKeyword, Code.ToString()));
|
||||
BuyItem(Code);
|
||||
}
|
||||
|
||||
m_CodeList.AddDuplicatedList(Code.m_strCode, Code.m_strName);
|
||||
break;
|
||||
|
||||
case TextCondition.TYPE.MANUAL:
|
||||
m_CodeList.AddDuplicatedList(Code.m_strCode, Code.m_strName);
|
||||
|
||||
Util.Log(Util.LOG_TYPE.MANUAL_KEYWORD, string.Format("[{0}] {1} (keyword:{2}, code:{3})", strRef, strTitle, MatchResult.m_strKeyword, Code.ToString()));
|
||||
|
||||
if(m_bBuy == true)
|
||||
@@ -151,6 +161,8 @@ namespace NewsCrawler
|
||||
ManualPopup.TopMost = true;
|
||||
ManualPopup.Show();
|
||||
}
|
||||
|
||||
m_CodeList.AddDuplicatedList(Code.m_strCode, Code.m_strName);
|
||||
break;
|
||||
|
||||
case TextCondition.TYPE.NOT_MATCHED:
|
||||
@@ -171,10 +183,10 @@ namespace NewsCrawler
|
||||
}
|
||||
else
|
||||
{
|
||||
if(lvList.Items.Cast<ListViewItem>().Any(s => s.SubItems[chLink.Index].Text == strURL))
|
||||
if(strURL != "" && lvList.Items.Cast<ListViewItem>().Any(s => s.SubItems[chLink.Index].Text == strURL))
|
||||
return;
|
||||
|
||||
lvList.Items.Add(new ListViewItem(new string[] { time.ToString("HH:mm:ss"), ResTime.ToString("HH:mm:ss"), strRef, strTitle, string.Format("{0} ms", responseT), strURL }));
|
||||
lvList.Items.Add(new ListViewItem(new string[] { time.ToString("HH:mm:ss"), ResTime.ToString("HH:mm:ss:fff"), strRef, strTitle, string.Format("{0:0.0000} ms", responseT), strURL }));
|
||||
|
||||
if(bInitial == false && chAutoSelect.Checked == true)
|
||||
{
|
||||
|
||||
2
Util.cs
2
Util.cs
@@ -103,7 +103,7 @@ namespace NewsCrawler
|
||||
}
|
||||
|
||||
string strLogLevel = "["+enType+"] ";
|
||||
string strTime = DateTime.Now.ToString("[hh:mm:ss] ");
|
||||
string strTime = DateTime.Now.ToString("[HH:mm:ss:fff] ");
|
||||
string strMessage = strTime+strLogLevel+strLog;
|
||||
|
||||
File.AppendAllText(m_strLogFile, strMessage+Environment.NewLine, new UTF8Encoding(true));
|
||||
|
||||
Reference in New Issue
Block a user