OSDN Git Service

コテハン表示機能
authorunknown <qwerty2501@users.sourceforge.jp>
Fri, 10 Feb 2012 05:14:35 +0000 (14:14 +0900)
committerunknown <qwerty2501@users.sourceforge.jp>
Fri, 10 Feb 2012 05:14:35 +0000 (14:14 +0900)
nlite.suo
nlite/nlite_chatData.cpp
nlite/nlite_chatData.h
nlite/nlite_commentview.cpp
nlite/nlite_mainframe.cpp
nlite/nlite_property.cpp
nlite/nlite_property.h
nlite_stub/nlite_stub.cpp

index a4ef26b..7f388d8 100644 (file)
Binary files a/nlite.suo and b/nlite.suo differ
index 2d59a08..6516e9c 100644 (file)
@@ -34,12 +34,13 @@ user_id(TEXT("")),
 name(TEXT("")),
 community(TEXT("")),
 bgcolor(INIT_COLOR),
-//originBkFlag(FALSE),
+writePropertyFlag(FALSE),
 time(0)
 {}
 
 VOID ListenerData::SetBkColor(COLORREF bkColor_in){
        bgcolor = bkColor_in;
+       writePropertyFlag = TRUE;
        return;
 }
 
@@ -297,19 +298,20 @@ CListenerList::reference CListenerList::Register(ListenerData &listener,BOOL bUp
 
        iterator rslt = std::find_if(begin,end,listenerPre);
 
-       
+
 
        if(rslt == end){
 
                
+               
                m_listenerList.push_back(listener);
-
                return m_listenerList.back();
 
        } else if(bUpdate == TRUE){
 
                *rslt = listener;
 
+               
        }
        
        return *rslt;
@@ -337,6 +339,53 @@ BOOL CListenerList::ReadProperty(LPCTSTR fileName){
 
        return rslt;
 }
+#define NLITE_ATTRIBUTE_WRITE_STR(s,n) s->WriteAttributeString(NULL, _tcsstr(TEXT(#n),TEXT("."))  != NULL ? _tcsstr(TEXT(#n),TEXT(".")) + 1 : TEXT(#n), NULL, n)
+
+#define NLITE_ATTRIBUTE_WRITE_INT(s,n) \
+       {\
+       TCHAR buffer[sizeof(n) * 8];\
+       _stprintf(buffer,TEXT("%d"),static_cast<INT>(n));\
+       s->WriteAttributeString(NULL, _tcsstr(TEXT(#n),TEXT(".")) + 1, NULL,buffer );\
+}
+BOOL CListenerList::WriteProperty(LPCTSTR fileName){
+       BOOL rslt = FALSE;
+
+
+       CComPtr<IXmlWriter> pWriter;
+       CreateXmlWriter(__uuidof(IXmlWriter), reinterpret_cast<void**>(&pWriter), 0);
+       // \83t\83@\83C\83\8b\83X\83g\83\8a\81[\83\80\8dì\90¬
+       CComPtr<IStream> pStream;
+       SHCreateStreamOnFile(fileName, STGM_CREATE | STGM_WRITE, &pStream);
+
+       pWriter->SetOutput(pStream);
+
+       // \83C\83\93\83f\83\93\83g\97L\8cø\89»
+       pWriter->SetProperty(XmlWriterProperty_Indent, TRUE);
+
+       // <?xml version="1.0" encoding="UTF-8"?>
+       pWriter->WriteStartDocument(XmlStandalone_Omit);
+
+       pWriter->WriteStartElement(NULL,TEXT("listenerData"),NULL);
+
+
+       auto begin = m_listenerList.begin();
+       auto end = m_listenerList.end();
+
+       for(;begin != end;++begin){
+               if(begin->writePropertyFlag == TRUE){
+                       pWriter->WriteStartElement(NULL,TEXT("user"),NULL);
+                       if(begin->name.Length() > 0) NLITE_ATTRIBUTE_WRITE_STR(pWriter,(*begin).name);
+                       if(begin->community.Length()> 0) NLITE_ATTRIBUTE_WRITE_STR(pWriter,(*begin).community);
+                       NLITE_ATTRIBUTE_WRITE_INT(pWriter,(*begin).time);
+                       if(begin->bgcolor != ListenerData::INIT_COLOR)NLITE_ATTRIBUTE_WRITE_INT(pWriter,(*begin).bgcolor);
+                       pWriter->WriteString(begin->user_id);
+                       pWriter->WriteEndElement();
+               }
+       }
+       pWriter->WriteEndDocument();
+       rslt = TRUE;
+       return rslt;
+}
 
 
 ReadUserSettingXML::ReadUserSettingXML(CListenerList &in_listenerList):m_listenerList(in_listenerList),userNodeFlag(FALSE){}
@@ -383,9 +432,11 @@ ReadUserSettingXML::ReadUserSettingXML(CListenerList &in_listenerList):m_listene
 
                if(this->userNodeFlag == TRUE){
 
-
-                       listenerBuff.user_id.Append(pszData,nLength);
-
+                       
+                       if(_tcstol(listenerBuff.user_id,NULL,10) != 0 || ((difftime(time(NULL),604800)) <listenerBuff.time)){
+                               listenerBuff.writePropertyFlag = TRUE;
+                               listenerBuff.user_id.Append(pszData,nLength);
+                       }
 
 
 
index cc9efa1..3e1cc7e 100644 (file)
@@ -27,6 +27,7 @@ namespace nlite{
                CNLiteString community;                                 //\93o\98^\82µ\82½\83R\83~\83\85\83j\83e\83B
                COLORREF bgcolor;                                               //\94w\8ci\90F
                time_t time;                                                    //\93o\98^\8e\9e\8aÔ
+               BOOL writePropertyFlag;                                         //\83v\83\8d\83p\83e\83B\8f\91\82«\8d\9e\82Ý\83t\83\89\83O
 //             BOOL originBkFlag;                                              //\94w\8ci\90F\90Ý\92è\83t\83\89\83O
        public:
 
@@ -110,8 +111,9 @@ namespace nlite{
                BOOL ReadProperty(LPCTSTR fileName);
 
                ///
+               ///\83\8a\83X\83i\81[\83f\81[\83^\8f\91\82«\8d\9e\82Ý
                ///
-               ///
+               BOOL WriteProperty(LPCTSTR fileName);
 
                
                ///
index 120fa6a..c57892c 100644 (file)
@@ -1244,13 +1244,12 @@ overclientrect:
 
                
                
-               
+               CComBSTR &viewUserName = chatData.listenerData->name.Length() == 0 ? chatData.listenerData->user_id : chatData.listenerData->name;
                dc.SelectFont(linkFont);
                dc.SetTextColor(self.viewproperty.linkStringColor);
                //\83e\83L\83X\83g\95`\89æ
                dc.DrawTextW(noString,_tcslen(noString),&noViewRect,DT_WORD_ELLIPSIS);
-               dc.DrawTextW(chatData.listenerData->user_id,chatData.listenerData->user_id.Length(),&userNameViewRect,DT_WORD_ELLIPSIS);
-
+               dc.DrawTextW(viewUserName,viewUserName.Length(),&userNameViewRect,DT_WORD_ELLIPSIS);
                dc.SelectFont(::AtlGetDefaultGuiFont());
                dc.SetTextColor(chatData.viewData.stringColor == CChatData::ViewData::INIT_COLOR ? chatData.viewData.stringColor :self.viewproperty.baseStringColor);
                dc.DrawTextW(dateString,_tcslen(dateString),&timeViewRect,DT_WORD_ELLIPSIS);
@@ -1546,7 +1545,7 @@ end:
                GetCursorPos(&mousePoint);
                ::ScreenToClient(*this,&mousePoint);
                
-               if(/*static_cast<INT>(loLparam) == 1 &&*/( IsOnNoOrUserName(CCommentView::NO,mousePoint) || IsOnNoOrUserName(CCommentView::USERNAME,mousePoint))){
+               if(( IsOnNoOrUserName(CCommentView::NO,mousePoint) || IsOnNoOrUserName(CCommentView::USERNAME,mousePoint))){
                        
                        
                        ::SetCursor(::LoadCursorW(NULL,IDC_HAND));
index 90e9079..7a9f213 100644 (file)
@@ -199,7 +199,7 @@ VOID CNliteMainFrame::Initialize(LPCTSTR localAppDataPath){
                        
                }
 
-               listenerList.ReadProperty(nliteProperty.userSettingPath);
+               listenerList.ReadProperty(nliteProperty.listenerDataPath);
 
                commentView.SetProperty(nliteProperty.cvp,nliteProperty.gp);
                if(nliteProperty.gp.browserType == BT_NOSETTING){
@@ -259,6 +259,7 @@ VOID CNliteMainFrame::Finalaize(){
 
        nliteProperty.cvp = commentView.GetProperty();
        nliteProperty.WriteProperty();
+       listenerList.WriteProperty(nliteProperty.listenerDataPath);
 }
 
 VOID CNliteMainFrame::OnViewPreference(UINT uNotifyCode,int nID,HWND hWndCtl){
index c3a1fc6..12fb3b4 100644 (file)
@@ -11,10 +11,10 @@ namespace nlite{
 #define NLITE_GET_TYPENAME(n)                  (_tcsstr(CComBSTR(typeid(n).name()),TEXT("::")) + 2)
 #define NLITE_XMLELLMENT_WRITE(s,p)            s->WriteStartElement(NULL, NLITE_GET_TYPENAME(p), NULL)
 
-#define NLITE_ATTRIBUTE_WRITE_STR(s,n) s->WriteElementString(NULL, _tcsstr(TEXT(#n),TEXT("."))  != NULL ? _tcsstr(TEXT(#n),TEXT(".")) + 1 : TEXT(#n), NULL, n)
+#define NLITE_ELLEMENT_WRITE_STR(s,n)  s->WriteElementString(NULL, _tcsstr(TEXT(#n),TEXT("."))  != NULL ? _tcsstr(TEXT(#n),TEXT(".")) + 1 : TEXT(#n), NULL, n)
 
 
-#define NLITE_ATTRIBUTE_WRITE_INT(s,n) \
+#define NLITE_ELLEMENT_WRITE_INT(s,n)  \
        {\
        TCHAR buffer[sizeof(n) * 8];\
        _stprintf(buffer,TEXT("%d"),static_cast<INT>(n));\
@@ -208,11 +208,11 @@ namespace nlite{
                propertySaveFolderPath += TEXT("nlite\\");
                propertyPath = propertySaveFolderPath;
                propertyPath += TEXT("property.xml");
-               userSettingPath = propertySaveFolderPath;
-               userSettingPath += TEXT("listenerData.xml");
+               listenerDataPath = propertySaveFolderPath;
+               listenerDataPath += TEXT("listenerData.xml");
                SurelyCreate(propertySaveFolderPath,FALSE);
                SurelyCreate(propertyPath,TRUE);
-               SurelyCreate(userSettingPath,TRUE);
+               SurelyCreate(listenerDataPath,TRUE);
                
                return;
        }
@@ -245,59 +245,59 @@ namespace nlite{
                pWriter->WriteStartElement(NULL,TEXT("nliteconfig"),NULL);
                //\83R\83\81\83\93\83g\93Ç\82Ý\8fã\82°\90Ý\92è\8f\91\82«\8d\9e\82Ý
                NLITE_XMLELLMENT_WRITE(pWriter,crp);
-               NLITE_ATTRIBUTE_WRITE_STR(pWriter,crp.outString);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,crp.administratorCommentReadFlag);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,crp.besideLengthFlag);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,crp.bspReadFlag);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,crp.commentReadFlag);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,crp.maxCommentLength);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,crp.newLineReadFlag);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,crp.ngUserReadFlag);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,crp.ngWordReadFlag);
-               NLITE_ATTRIBUTE_WRITE_STR(pWriter,crp.shortComment);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,crp.teropReadFlag);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,crp.userCommentReadFlag);
+               NLITE_ELLEMENT_WRITE_STR(pWriter,crp.outString);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,crp.administratorCommentReadFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,crp.besideLengthFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,crp.bspReadFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,crp.commentReadFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,crp.maxCommentLength);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,crp.newLineReadFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,crp.ngUserReadFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,crp.ngWordReadFlag);
+               NLITE_ELLEMENT_WRITE_STR(pWriter,crp.shortComment);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,crp.teropReadFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,crp.userCommentReadFlag);
                pWriter->WriteEndElement();
                //commentview\90Ý\92è\92l\8f\91\82«\8d\9e\82Ý
                NLITE_XMLELLMENT_WRITE(pWriter,cvp);
                NLITE_XML_WRITE_FOR_INT(pWriter,cvp.headerholSize);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,cvp.anonymousIDLinkColor);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,cvp.backColor);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,cvp.baseStringColor);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,cvp.commentFoldingFlag);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,cvp.commentTimeType);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,cvp.anonymousIDLinkColor);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,cvp.backColor);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,cvp.baseStringColor);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,cvp.commentFoldingFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,cvp.commentTimeType);
                NLITE_XML_WRITE_FOR_INT(pWriter,cvp.headerOrderArray);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,cvp.linkStringColor);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,cvp.selectBackColor);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,cvp.selectSellLineColor);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,cvp.colLineColor);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,cvp.normalSellLineColor);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,cvp.ownerStringColor);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,cvp.linkStringColor);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,cvp.selectBackColor);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,cvp.selectSellLineColor);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,cvp.colLineColor);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,cvp.normalSellLineColor);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,cvp.ownerStringColor);
                
                pWriter->WriteEndElement();
 
 
                NLITE_XMLELLMENT_WRITE(pWriter,mfp);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,mfp.windowSize.cx);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,mfp.windowSize.cy);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,mfp.windowFrontFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,mfp.windowSize.cx);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,mfp.windowSize.cy);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,mfp.windowFrontFlag);
                pWriter->WriteEndElement();
 
 
                //\8b¤\92Ê\90Ý\92è\8f\91\82«\8d\9e\82Ý
                NLITE_XMLELLMENT_WRITE(pWriter,gp);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,gp.activeCountTimeFlag);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,gp.autoColorRegisterFlag);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,gp.autoNameUpdateFlag);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,gp.autoNameRegisterFlag);
-               NLITE_ATTRIBUTE_WRITE_STR(pWriter,gp.browserPath);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,gp.browserType);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,gp.commentLogAutoSaveFlag);
-               NLITE_ATTRIBUTE_WRITE_STR(pWriter,gp.commentPath);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,gp.defaultBrowserFlag);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,gp.numberNameFlag);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,gp.userCountUpdateFlag);
-               NLITE_ATTRIBUTE_WRITE_INT(pWriter,gp.ncvUserSettingReadedFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,gp.activeCountTimeFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,gp.autoColorRegisterFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,gp.autoNameUpdateFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,gp.autoNameRegisterFlag);
+               NLITE_ELLEMENT_WRITE_STR(pWriter,gp.browserPath);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,gp.browserType);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,gp.commentLogAutoSaveFlag);
+               NLITE_ELLEMENT_WRITE_STR(pWriter,gp.commentPath);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,gp.defaultBrowserFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,gp.numberNameFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,gp.userCountUpdateFlag);
+               NLITE_ELLEMENT_WRITE_INT(pWriter,gp.ncvUserSettingReadedFlag);
                
                pWriter->WriteEndElement();
                pWriter->WriteEndDocument();
index ff09d9e..a41ad3e 100644 (file)
@@ -130,7 +130,7 @@ namespace nlite{
                CNLiteString propertyFolderPath;                        //\83v\83\8d\83p\83e\83B\94z\92u\83t\83H\83\8b\83_
                CNLiteString propertySaveFolderPath;            //\83v\83\8d\83p\83e\83B\83t\83H\83\8b\83_
                CNLiteString propertyPath;                                      //\83v\83\8d\83p\83e\83B\83t\83@\83C\83\8b\83p\83X
-               CNLiteString userSettingPath;                           //\83\8a\83X\83i\81[\8fî\95ñ\90Ý\92è\83t\83@\83C\83\8b\83p\83X
+               CNLiteString listenerDataPath;                          //\83\8a\83X\83i\81[\8fî\95ñ\90Ý\92è\83t\83@\83C\83\8b\83p\83X
                Property();
 
                ~Property();
index 5b33d91..5e7090d 100644 (file)
@@ -125,7 +125,7 @@ StreamStatus_P NicoLiveStream_getStreamStatus(NicoLiveStream_P self){
        self->stream.start_time = 1324710000;
        
        _tcscpy(self->stream.id,TEXT("lv75313550"));
-       _tcscpy(self->stream.default_community,TEXT("co1187609"));
+       _tcscpy(self->stream.default_community,TEXT("co1345577"));
 
        self->stream.is_owner = FALSE;
        self->stream.provider_type = COMMUNITY_PROVIDER_TYPE;
@@ -212,7 +212,7 @@ unsigned int WINAPI commentthread(VOID *usadata){
                for(index2 = 0;index2 < ONERECEVECHATCOUNT;index2++){
 
                        liveChat.chatBuf = commentcount % 2 == 0 ? TEXT("http://live.nicovideo.jp/watch/lv79715214?alert=1 254 http://live.nicovideo.jp/") : TEXT("<font color=FF0000>sm552447 sm1543514 lv25447 </font >");
-                       _stprintf((LPTSTR)liveChat.user_id,user_id_format,rand() % 15);
+                       _stprintf((LPTSTR)liveChat.user_id,TEXT("%s"),TEXT("0NsZs9X9GFLJaE9Ru3QuV2StCIM"));
                        commentcount++;
                        _stprintf((LPTSTR)liveChat.no,TEXT("%u"),commentcount);
                        
@@ -439,7 +439,7 @@ LPCTSTR NicoLiveStream_getId(NicoLiveStream_P self){
 ///\83X\83g\83\8a\81[\83\80\83X\83e\81[\83^\83X\82Ì\83R\83~\83\85\83j\83e\83B\94Ô\8d\86\82ð\8eæ\93¾
 ///
 LPCTSTR NicoLiveStream_getDefaultCommunity(NicoLiveStream_P self){
-       static const LPCTSTR rslt = TEXT("co222222");
+       static const LPCTSTR rslt = TEXT("co1345577");
        return rslt;
 }