From eb796e8df24093a4e6edb3fd58d41d4fe2298132 Mon Sep 17 00:00:00 2001 From: mjjo Date: Tue, 27 Dec 2016 11:16:13 +0900 Subject: [PATCH] =?UTF-8?q?-=20=EB=A7=A4=EC=88=98=ED=95=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EC=95=84=EB=8F=84=20=EC=A4=91=EB=B3=B5=20=EC=A2=85?= =?UTF-8?q?=EB=AA=A9=EC=97=90=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CodeList.cs | 9 +++++++-- NewsForm.cs | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CodeList.cs b/CodeList.cs index e10a733..a4658b9 100644 --- a/CodeList.cs +++ b/CodeList.cs @@ -126,8 +126,13 @@ namespace NewsCrawler public void AddDuplicatedList(string strCode, string strName) { CODE_VALUE Result = m_CodeList.Find(s => s.m_strCode == strCode); - if(Result != null) - Result.m_enType |= CODE_TYPE.DUPLICATED; + if(Result == null) + return; + + if((Result.m_enType & CODE_TYPE.DUPLICATED) == CODE_TYPE.DUPLICATED) + return; + + Result.m_enType |= CODE_TYPE.DUPLICATED; string strPath = Util.GetConfigPath()+"/code-duplicated.txt"; File.AppendAllText(strPath, strName+Environment.NewLine); diff --git a/NewsForm.cs b/NewsForm.cs index e068333..80f2b4e 100644 --- a/NewsForm.cs +++ b/NewsForm.cs @@ -122,6 +122,8 @@ 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) @@ -132,10 +134,12 @@ 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); - } + } 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)