--- /dev/null
+// nlib_driver.cpp : \83R\83\93\83\\81[\83\8b \83A\83v\83\8a\83P\81[\83V\83\87\83\93\82Ì\83G\83\93\83g\83\8a \83|\83C\83\93\83g\82ð\92è\8b`\82µ\82Ü\82·\81B
+//
+
+#include "stdafx.h"
+#include <iostream>
+#include <qwerty\windebuger.h>
+#include <conio.h>
+#include <shareCookie\shareCookie.h>
+#include <shareCookie\browserType.h>
+#include <nlib\nlib.h>
+#include <nlib\nlib_define.h>
+
+
+
+//\83\89\83C\83u\83\89\83\8a\83\8a\83\93\83N
+#pragma comment(lib,"Wininet.lib")
+#pragma comment(lib,"WinHttp.lib")
+#pragma comment(lib,"Iepmapi.lib")
+#pragma comment(lib,"ws2_32.lib")
+#pragma comment(lib, "shell32.lib" )
+#pragma comment(lib,"expat.lib")
+#pragma comment(lib,"sqlite3.lib")
+#pragma comment(lib,"sqliteManager.lib")
+#pragma comment(lib,"shareCookie.lib")
+#pragma comment(lib,"nlib.lib")
+#pragma comment(lib,"winmm.lib")
+#pragma comment(lib,"JSONParser.lib")
+
+
+NicoLiveStream_P nl;
+NicoVideoAuth_P nva;
+//NlibProperty_P np;
+WSAData wsaData;
+HINTERNET hInternet = WinHttpOpen(L"nicoliveTest",WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,(LPCWSTR)WINHTTP_NO_PROXY_NAME,(LPCWSTR)WINHTTP_NO_PROXY_BYPASS,0);
+
+int nicoLive_setup(void) {
+
+ INT_PTR err;
+ INT_PTR count = 0;
+
+
+ //WSAData\82ð\8f\89\8aú\89»
+ while((err = WSAStartup(MAKEWORD(2,0),&wsaData)) == WSASYSNOTREADY){
+
+ count++;
+ if(count >= 5)break;
+ Sleep(500);
+
+
+
+ }
+
+ if(err != ERROR_SUCCESS){
+
+ return NLIB_INITALIZE_FAILED_NETWORK;
+ }
+ InitializeNLIB(hInternet);
+ nl = NicoLiveStream_new();
+ nva = NicoVideoAuth_new();
+ //np = NlibProperty_ref();
+
+ NicoVideoAuth_getNicoVideoAuth(nva,BT_GOOGLE_CHROME);
+ return nl != NULL ? 0 : 1;
+}
+
+int nicoLive_teardown(void) {
+ NicoLiveStream_delete(&nl);
+ NicoVideoAuth_delete(&nva);
+ FinalizeNLIB();
+ WinHttpCloseHandle(hInternet);
+ WSACleanup();
+ return 0;
+}
+
+
+int FreeList_setup(void){
+
+
+ return 0;
+}
+
+
+
+NLIB_RESULT callback(NICOLIVE_EVENT eventType,NicoLiveStream_P pNicoLiveStream,LPVOID option,NICOLIVE_PARAM param1,NICOLIVE_PARAM param2){
+
+
+ switch(eventType){
+
+ case NICOLIVE_EVENT_ERR_CONNECT:
+
+ errprint(TEXT("\92Ê\90M\83G\83\89\81[\94\90¶"));
+
+ break;
+
+
+ case NICOLIVE_EVENT_RECEVE_CONNECTRESULT:
+
+ println(TEXT("receveStart::last_res[%s],thread[%s],ticket[%s],server_time[%s]"),((NicoLiveThreadComment_P)param1)->last_res,((NicoLiveThreadComment_P)param1)->thread,((NicoLiveThreadComment_P)param1)->ticket,((NicoLiveThreadComment_P)param1)->server_time);
+
+ break;
+
+ case NICOLIVE_EVENT_RECEVE_CHAT:
+
+ {
+ int i = 0;
+ NicoLiveChat_P chatP = (NicoLiveChat_P)param1;
+ int index = chatP->mailCount;
+ println(TEXT("recevechat::no[%s],locale[%s],vpos[%s],date[%s],premium[%s],anonymity[%s],thread[%s],user_id[%s],name[%s]"),chatP->no,chatP->locale,chatP->vpos,chatP->date,chatP->premium,chatP->anonymity,chatP->thread,chatP->user_id,chatP->name);
+
+
+
+ for(;i < index;i++){
+
+ println(TEXT("mail(%d)[%s]"),i,chatP->mail[i]);
+
+ }
+
+ println(TEXT("chatBody::%s"),chatP->chatBuf);
+
+ }
+ break;
+
+ case NICOLIVE_EVENT_RECEVE_CHATSETTLE:
+
+
+
+ println(TEXT("recevechatCount::no[%d],count[%d]"),param1,param2);
+ param1;
+
+ break;
+
+ case NICOLIVE_EVENT_RECEVE_CHATSENDRESULT:
+
+ {
+ NicoLiveSendResultComment_P nls = (NicoLiveSendResultComment_P)param1;
+
+ println(TEXT("sendresult::no[%s],status[%s],thread[%s]"),nls->no,nls->status,nls->thread);
+
+ }
+
+ break;
+
+ case NICOLIVE_EVENT_SEND_HEARTBEAT:
+
+ {
+
+ NicoLiveHeartBeat_P hbp = (NicoLiveHeartBeat_P)param1;
+
+ println(TEXT("heartbeat::time[%llu],watchCount[%d],commentCount[%d],is_restrict[%s],ticket[%s]"),hbp->time,hbp->watchCount,hbp->commentCount,hbp->is_restrict,hbp->ticket);
+ //println(TEXT("heartbeat::watchCount[%d],commentCount[%d],is_restrict[%s],ticket[%s]"),hbp->watchCount,hbp->commentCount,hbp->is_restrict,hbp->ticket);
+
+
+ }
+
+
+ break;
+
+
+ }
+
+ return 0;
+}
+
+NLIB_RESULT myListCallBack(LPVOID option,NicoMyListItem_P pVideo){
+
+ dumpln(TEXT("video_id:%s"),pVideo->itemData.video_id);
+
+
+
+ return NLIB_ERR_OK;
+}
+
+static NLIB_RESULT myListGroupCallBack(LPVOID option,NicoMyList_P pMyList){
+ WCHAR buf[256];
+ NLIB_RESULT rslt;
+ wcscpy(buf,pMyList->id);
+ dumpln(TEXT("id:%s"),buf);
+ rslt = NicoMyList_getMyList(nva,buf,myListCallBack,NULL);
+
+
+
+ return NLIB_ERR_OK;
+}
+
+void nicoLive_connect(void) {
+
+ dumpline();
+ //NlibProperty_setBrowserType(np,BT_INTERNET_EXPLORER);
+ //CU_ASSERT_EQUAL(NicoLiveStream_connect(nl,BT_INTERNET_EXPLORER,L"lv12345",callback,NULL), NLIB_ERR_GETPLAYERSTATUS_INVALID_LV);
+
+
+
+ NicoLiveStrream_setResFrom(nl,1000);
+ NicoLiveStream_setHeartBeatMsec(nl,5000);
+ NicoLiveStream_setKeapALiveMsec(nl,5000);
+ //NicoLiveStream_setKeapALiveFlag(nl,FALSE);
+
+ //CU_ASSERT_EQUAL(NicoLiveStream_connect(nl,nva,L"lv66406941",callback,NULL), NLIB_ERR_OK);
+ WCHAR housoubuf[LENGTH_1024];
+ std::wcin.getline(housoubuf,sizeof(housoubuf) / sizeof(housoubuf[0]));
+
+ WCHAR buf[1024];
+
+
+
+ for(int index = 0;index < 5;index++){
+ CU_ASSERT_EQUAL(NicoLiveStream_connect(nl,nva,housoubuf,callback,NULL), NLIB_ERR_OK);
+ std::wcin.getline(buf,sizeof(buf) / sizeof(buf[0]));
+
+ LPWSTR mail = L"184";
+ LPWSTR exname = L"name";
+ LPWSTR exvalue = L"qwerty";
+
+ LPCWSTR mails[2] = {mail,NULL};
+ LPCWSTR extends[3] = {exname,exvalue,NULL};
+
+
+ while(wcslen(buf) > 0){
+
+ NicoLiveStream_sendChat(nl,buf,mails,NULL);
+ std::wcin.getline(buf,sizeof(buf) / sizeof(buf[0]));
+ }
+ NicoLiveStream_disConnect(nl);
+ }
+
+ CU_ASSERT_EQUAL(_heapchk(),_HEAPOK);
+
+ //Sleep(3000);
+
+
+ /*
+ //NlibProperty_setBrowserType(np,BT_FIRE_FOX);
+ CU_ASSERT_EQUAL(NicoLiveStream_connect(nl,BT_FIRE_FOX,L"lv12345",callback,NULL), 0);
+ //NlibProperty_setBrowserType(np,BT_GOOGLE_CHROME);
+ CU_ASSERT_EQUAL(NicoLiveStream_connect(nl,BT_GOOGLE_CHROME,L"lv12345",callback,NULL), 0);
+ //NlibProperty_setBrowserType(np,BT_IE_COMPONENT);
+ CU_ASSERT_EQUAL(NicoLiveStream_connect(nl,BT_IE_COMPONENT,L"lv12345",callback,NULL), 0);
+ */
+
+ return;
+}
+
+
+void nicoLive_mylist(void) {
+
+
+
+ //CU_ASSERT_EQUAL(NicoMyList_getDefList(nva,myListCallBack,NULL), NLIB_ERR_OK);
+ //CU_ASSERT_EQUAL(NicoMyList_getMyListGroup(nva,myListGroupCallBack,NULL),NLIB_ERR_OK);
+ CU_ASSERT_EQUAL(NicoMyList_addItem(L"sm16046365"),NLIB_ERR_OK);
+ check(_heapchk() == _HEAPOK,TEXT("heap\83G\83\89\81[\82Å\82·"));
+ dumpln(TEXT("heapchk:%d"),_heapchk());
+
+
+}
+
+
+static CU_TestInfo nlive_test[] = {
+ { "\90Ú\91±", nicoLive_connect },
+ //{"\83}\83C\83\8a\83X\83g",nicoLive_mylist},
+ CU_TEST_INFO_NULL,
+};
+
+
+
+static CU_SuiteInfo suites[] = {
+ { "nicoLiveStream\82Ì\83e\83X\83g", nicoLive_setup, nicoLive_teardown, nlive_test },
+ CU_SUITE_INFO_NULL, /* \96\96\94ö\82ÍCU_SUITE_INFO_NULL\82Å\8fI\92[ */
+
+};
+
+
+int _tmain(int argc, _TCHAR* argv[])
+{
+
+
+
+
+
+ CU_initialize_registry();
+ CU_register_suites(suites);
+ CU_basic_set_mode(CU_BRM_VERBOSE);
+ CU_basic_run_tests();
+ CU_cleanup_registry();
+
+
+
+ getch();
+ return 0;
+}
\ No newline at end of file
--- /dev/null
+// stdafx.cpp : \95W\8f\80\83C\83\93\83N\83\8b\81[\83h nlib_driver.pch \82Ì\82Ý\82ð
+// \8aÜ\82Þ\83\\81[\83X \83t\83@\83C\83\8b\82Í\81A\83v\83\8a\83R\83\93\83p\83C\83\8b\8dÏ\82Ý\83w\83b\83_\81[\82É\82È\82è\82Ü\82·\81B
+// stdafx.obj \82É\82Í\83v\83\8a\83R\83\93\83p\83C\83\8b\8dÏ\82Ý\8c^\8fî\95ñ\82ª\8aÜ\82Ü\82ê\82Ü\82·\81B
+
+#include "stdafx.h"
+
+// TODO: \82±\82Ì\83t\83@\83C\83\8b\82Å\82Í\82È\82\81ASTDAFX.H \82Å\95K\97v\82È
+// \92Ç\89Á\83w\83b\83_\81[\82ð\8eQ\8fÆ\82µ\82Ä\82\82¾\82³\82¢\81B
--- /dev/null
+// nlite.cpp : \83A\83v\83\8a\83P\81[\83V\83\87\83\93\82Ì\83G\83\93\83g\83\8a \83|\83C\83\93\83g\82ð\92è\8b`\82µ\82Ü\82·\81B
+//
+
+#include "stdafx.h"
+#include "nlite_include.h"
+
+
+CAppModule _Module;
+
+const CApplicationInfo* nlite::appInfo = NULL;
+static TCHAR localAppDataPath[_MAX_PATH];
+
+static WSAData wsaData; //winsockdata
+static HINTERNET hInternet = NULL;
+
+static BOOL InitializeNlite(); //\83A\83v\83\8a\83P\81[\83V\83\87\83\93\8f\89\8aú\89»
+static VOID FinalizeNlite(); //\83A\83v\83\8a\83P\81[\83V\83\87\83\93\8fI\97¹\8f\88\97\9d
+static CNliteMainFrame wnd; //\83\81\83C\83\93\83t\83\8c\81[\83\80\83E\83B\83\93\83h\83E
+int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE,
+ LPTSTR lpCmdLine, int nCmdShow)
+{
+
+ int nRet = -1;
+ try{
+ if(_Module.Init(NULL, hInstance) != S_OK){
+ throw AppInitException(__LINE__,TEXT(__FILE__));
+ }
+
+ if(InitializeNlite() != TRUE){
+ throw AppInitException(__LINE__,TEXT(__FILE__));
+ }
+
+
+
+
+ CMessageLoop theLoop;
+ _Module.AddMessageLoop(&theLoop);
+
+
+
+ wnd.CreateEx(0,0,WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN);
+ wnd.ShowWindow(nCmdShow);
+ wnd.UpdateWindow();
+ wnd.Initialize(localAppDataPath);
+ _heapmin();
+
+
+
+ nRet = theLoop.Run();
+
+ vcassert(_heapchk() == _HEAPOK,TEXT("\83q\81[\83v\83G\83\89\81[\82Å\82·"));
+
+ goto nliteend;
+
+ } catch(nlite::Exception &e){
+ tstring errMessage(TEXT("\83G\83\89\81[\83\81\83b\83Z\81[\83W:"));
+ errMessage += e.what();
+ errMessage += TEXT("\r\n\8ds\94Ô\8d\86:");
+ std::wostringstream num;
+ num << e.getLineNo();
+ errMessage += num.str();
+ errMessage += TEXT("\r\n\83t\83@\83C\83\8b\96¼:");
+ errMessage += e.getFileName();
+
+ MessageBox(NULL,errMessage.c_str(),TEXT("\83n\83\93\83h\83\8b\82³\82ê\82Ä\82È\82¢\83G\83\89\81["),MB_ICONERROR | MB_OK);
+
+ goto nlitefinally;
+ }catch(std::exception &e){
+
+ MessageBoxA(NULL,e.what(),"\83n\83\93\83h\83\8b\82³\82ê\82Ä\82È\82¢\95s\96¾\82Ì\83G\83\89\81[",MB_ICONERROR | MB_OK);
+
+ goto nlitefinally;
+ }
+
+nlitefinally:
+ wnd.OnException();
+ wnd.DestroyWindow();
+
+
+nliteend:
+
+ _Module.RemoveMessageLoop();
+ FinalizeNlite();
+ _Module.Term();
+
+
+ return nRet;
+}
+
+static BOOL InitializeNlite(){
+
+ BOOL rslt = FALSE;
+
+ try{
+
+ nlite::appInfo = &CApplicationInfo::getInstance();
+ INT_PTR err;
+ INT_PTR count = 0;
+
+ //WSAData\82ð\8f\89\8aú\89»
+ while((err = WSAStartup(MAKEWORD(2,0),&wsaData)) == WSASYSNOTREADY){
+
+ count++;
+ if(count >= 5)break;
+ Sleep(500);
+
+
+
+ }
+
+ if(err != ERROR_SUCCESS){
+
+ throw AppInitException(__LINE__,TEXT(__FILE__));
+ }
+
+ const CApplicationInfo &appInfo = CApplicationInfo::getInstance();
+ tstring userAgent;
+ userAgent.reserve(256);
+ userAgent = appInfo.getProcuctName();
+ userAgent += TEXT("/");
+ userAgent += appInfo.getProductVersion();
+
+
+ hInternet = WinHttpOpen(userAgent.c_str(),WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,(LPCWSTR)WINHTTP_NO_PROXY_NAME,(LPCWSTR)WINHTTP_NO_PROXY_BYPASS,0);
+
+ if(hInternet == NULL){
+
+ throw AppInitException(__LINE__,TEXT(__FILE__));
+
+ }
+
+ InitializeNLIB(hInternet);
+
+ if(SHGetFolderPathW(0,CSIDL_LOCAL_APPDATA,0,SHGFP_TYPE_CURRENT,localAppDataPath) != S_OK){
+
+ throw AppInitException(__LINE__,TEXT(__FILE__));
+ }
+
+
+ SystemParametersInfo (SPI_SETLISTBOXSMOOTHSCROLLING,FALSE,FALSE,0);
+
+
+ }catch (AppInitException e){
+
+ return rslt;
+
+ }
+
+
+
+ rslt = TRUE;
+
+
+ return rslt;
+}
+
+
+ VOID FinalizeNlite(){
+
+ wnd.Finalaize();
+ FinalizeNLIB();
+ WinHttpCloseHandle(hInternet);
+ WSACleanup();
+
+ return;
+ }
\ No newline at end of file
--- /dev/null
+#include "stdafx.h"
+#include "nlite_include.h"
+
+
+CApplicationInfo::CApplicationInfo(){
+
+ struct LANGANDCODEPAGE {
+
+ WORD wLanguage;
+ WORD wCodePage;
+ } *lpTranslate;
+ TCHAR szModuleName[_MAX_PATH + 1] = {0}; //\83A\83v\83\8a\83P\81[\83V\83\87\83\93\83t\83@\83C\83\8b\96¼
+ try{
+
+ DWORD dwReserved;
+ LPTSTR errMessage = NULL;
+ int nRet = GetModuleFileName(NULL,szModuleName,ARRAYSIZE(szModuleName));
+ assert(nRet > 0);
+
+ if(nRet <= 0){
+
+
+ throw AppInitException(__LINE__,TEXT(__FILE__));
+ }
+
+
+ DWORD dwSize = GetFileVersionInfoSize(szModuleName,&dwReserved);
+
+ assert(dwSize > 0);
+
+ if(dwSize <= 0){
+
+ throw AppInitException(__LINE__,TEXT(__FILE__));
+ }
+
+ pBlock = malloc(dwSize);
+ assert(pBlock != NULL);
+
+ BOOL bRet = GetFileVersionInfo(szModuleName,0,dwSize,pBlock);
+
+ assert(bRet);
+
+ if(bRet != TRUE){
+ throw AppInitException(__LINE__,TEXT(__FILE__));
+ }
+
+ UINT ulen;
+ if(VerQueryValue(pBlock,TEXT("\\VarFileInfo\\Translation"),(LPVOID*)&lpTranslate,&ulen) == FALSE){
+ throw AppInitException(__LINE__,TEXT(__FILE__));
+ }
+
+ TCHAR subBlock[_MAX_PATH];
+ _stprintf(subBlock,TEXT("\\StringFileInfo\\%04x%04x\\ProductVersion"),lpTranslate->wLanguage,lpTranslate->wCodePage);
+
+ if(VerQueryValue(pBlock,subBlock,(LPVOID *)&pProductVersion,&ulen) == FALSE){
+
+ throw AppInitException(__LINE__,TEXT(__FILE__));
+
+ }
+
+ _stprintf(subBlock,TEXT("\\StringFileInfo\\%04x%04x\\OriginalFilename"),lpTranslate->wLanguage,lpTranslate->wCodePage);
+
+ if(VerQueryValue(pBlock,subBlock,(LPVOID *)&pOriginalFileName,&ulen) == FALSE){
+
+ throw AppInitException(__LINE__,TEXT(__FILE__));
+
+ }
+
+ _stprintf(subBlock,TEXT("\\StringFileInfo\\%04x%04x\\LegalCopyright"),lpTranslate->wLanguage,lpTranslate->wCodePage);
+
+ if(VerQueryValue(pBlock,subBlock,(LPVOID *)&pLegalCopyright,&ulen) == FALSE){
+
+ throw AppInitException(__LINE__,TEXT(__FILE__));
+
+ }
+
+ _stprintf(subBlock,TEXT("\\StringFileInfo\\%04x%04x\\ProductName"),lpTranslate->wLanguage,lpTranslate->wCodePage);
+
+ if(VerQueryValue(pBlock,subBlock,(LPVOID *)&pProductName,&ulen) == FALSE){
+
+ throw AppInitException(__LINE__,TEXT(__FILE__));
+
+ }
+
+
+ } catch (const AppInitException& e){
+
+
+ safeFree(pBlock);
+
+ throw e;
+ }
+
+ return;
+
+
+
+}
+
+
+CApplicationInfo::~CApplicationInfo(){
+
+
+ safeFree(pBlock);
+}
\ No newline at end of file
--- /dev/null
+#include "stdafx.h"
+#include "nlite_include.h"
+
+
+
+
+VOID CCommentView::CommentLineSet(LPCTSTR chat,UINT_PTR count){
+
+
+
+ CDC cdc = listBox.GetDC();
+
+ RECT drowSize = {0};
+ header.GetItemRect(COMMENT,&drowSize);
+ drowSize.left += 2;
+ drowSize.top += 2;
+ drowSize.right -= 2;
+ drowSize.bottom = 0;
+
+ SelectObject(cdc,AtlGetDefaultGuiFont());
+ cdc.DrawTextW(chat,-1,&drowSize, DT_CALCRECT | DT_WORDBREAK);
+ drowSize.top -= 2;
+ drowSize.left -= 2;
+ drowSize.right += 2;
+ drowSize.bottom += 2;
+
+ listBox.SetItemHeight(listBox.GetCount() -1,drowSize.bottom - drowSize.top);
+
+ return;
+}
+
+
+VOID CCommentView::OnHeaderTrack(){
+
+ Lock();
+
+ UINT_PTR commentCount = commentlist.Size();
+ listBox.ResetContent();
+ for(UINT_PTR index =0;index < commentCount;index++){
+ listBox.AddString(NULL);
+ CommentLineSet(commentlist.GetChatAt(index).chatBuf.c_str(),index);
+
+ }
+
+ Unlock();
+
+ listBox.InvalidateRect(NULL,TRUE);
+
+
+
+}
+
+VOID CCommentView::OnChatReceve(NicoLiveChat_P chat,UINT_PTR count){
+
+
+
+ Lock();
+ commentlist.OnChatReceve(chat,count);
+ listBox.AddString(NULL);
+ Unlock();
+
+ CommentLineSet(chat->chatBuf,count);
+
+
+}
+
+VOID CCommentView::OnChatReceveSettle(UINT_PTR commentCount,UINT_PTR commentCountSum){
+
+ return;
+}
+
+
+VOID CCommentView::OnDrawList(LPDRAWITEMSTRUCT lpDrawItemStruct){
+
+
+
+ Lock();
+
+ RECT noViewRect;
+ RECT userNameViewRect;
+ RECT timeViewRect;
+ RECT chatViewRect;
+ RECT infoViewRect;
+
+ header.GetItemRect(NO,&noViewRect);
+ header.GetItemRect(USERNAME,&userNameViewRect);
+ header.GetItemRect(TIME,&timeViewRect);
+ header.GetItemRect(COMMENT,&chatViewRect);
+ header.GetItemRect(INFO,&infoViewRect);
+
+ noViewRect.left += 2;
+ userNameViewRect.left += 2;
+ timeViewRect.left += 2;
+ chatViewRect.left += 2;
+ infoViewRect.left += 2;
+
+ noViewRect.right += 2;
+ userNameViewRect.right += 2;
+ timeViewRect.right += 2;
+ chatViewRect.right += 2;
+ infoViewRect.right += 2;
+
+ noViewRect.top = lpDrawItemStruct->rcItem.top + 2;
+ userNameViewRect.top = lpDrawItemStruct->rcItem.top + 2;
+ timeViewRect.top = lpDrawItemStruct->rcItem.top + 2;
+ chatViewRect.top = lpDrawItemStruct->rcItem.top + 2;
+ infoViewRect.top = lpDrawItemStruct->rcItem.top + 2;
+
+ noViewRect.bottom = lpDrawItemStruct->rcItem.bottom - 2;
+ userNameViewRect.bottom = lpDrawItemStruct->rcItem.bottom - 2;
+ timeViewRect.bottom = lpDrawItemStruct->rcItem.bottom - 2;
+ chatViewRect.bottom = lpDrawItemStruct->rcItem.bottom - 2;
+ infoViewRect.bottom = lpDrawItemStruct->rcItem.bottom - 2;
+
+ CChatData &chatData = commentlist.GetChatAt(lpDrawItemStruct->itemID);
+
+ time_t chatTime = (time_t)difftime(chatData.date,streamStatus.start_time);
+ tm ct = *gmtime(&chatTime);
+
+
+ TCHAR noString[sizeof(chatData.no) * 8];
+ TCHAR dateString[LENGTH_16];
+ _stprintf(noString,TEXT("%u"),chatData.no);
+
+ _tcsftime(dateString,ARRAY_LENGTH(dateString),ct.tm_hour != 0 ? TEXT("%H:%M:%S") : TEXT("%M:%S"),&ct);
+
+ CBrush bkBurush;
+ CPen outLinePen;
+ CPen colLinePen;
+ //\91I\91ð\8fó\91Ô\82©\83`\83F\83b\83N
+ if ((lpDrawItemStruct->itemState) & (ODS_SELECTED))
+ {
+
+ //\83u\83\89\83V\8dì\90¬
+ bkBurush=CreateSolidBrush(RGB(255,240,240));
+// outLinePen = CreatePen(PS_SOLID,3,RGB(255,0,0));
+ //\83e\83L\83X\83g\82Ì\94w\8ci\90F\82ð\8ew\92è
+ SetBkColor(lpDrawItemStruct->hDC,RGB(255,240,240)) ;
+ }
+ else
+ {
+ //\83u\83\89\83V\8dì\90¬
+ bkBurush=CreateSolidBrush(viewproperty.backColor);
+
+
+ //\83e\83L\83X\83g\82Ì\94w\8ci\90F\82ð\8ew\92è
+ SetBkColor(lpDrawItemStruct->hDC,viewproperty.backColor) ;
+ }
+
+ outLinePen = CreatePen(PS_SOLID,1,RGB(127,127,127));
+ //\83e\83L\83X\83g\82Ì\83J\83\89\81[\82ð\90Ý\92è
+ SetTextColor(lpDrawItemStruct->hDC,viewproperty.baseStringColor);
+
+ SelectObject(lpDrawItemStruct->hDC,bkBurush);
+ SelectObject(lpDrawItemStruct->hDC,outLinePen);
+ Rectangle(lpDrawItemStruct->hDC,lpDrawItemStruct->rcItem.left,lpDrawItemStruct->rcItem.top,lpDrawItemStruct->rcItem.right,lpDrawItemStruct->rcItem.bottom);
+ DeleteObject(outLinePen);
+ DeleteObject(colLinePen);
+ DeleteObject(bkBurush);
+
+ ::DrawText(lpDrawItemStruct->hDC,noString,_tcslen(noString),&noViewRect,DT_WORD_ELLIPSIS);
+
+ ::DrawText(lpDrawItemStruct->hDC,chatData.user_id.c_str(),chatData.user_id.length(),&userNameViewRect,DT_WORD_ELLIPSIS);
+
+ ::DrawText(lpDrawItemStruct->hDC,chatData.chatBuf.c_str(),chatData.chatBuf.length(),&chatViewRect,DT_WORDBREAK);
+
+ ::DrawText(lpDrawItemStruct->hDC,dateString,_tcslen(dateString),&timeViewRect,DT_WORD_ELLIPSIS);
+
+
+ Unlock();
+
+
+
+
+ return;
+}
+
+
+
+VOID CCommentList::OnChatReceve(NicoLiveChat_P chatData_in, UINT_PTR count){
+
+
+ CChatData chatData;
+ chatData.SetChat(*chatData_in);
+
+
+
+ chatList.push_back(chatData);
+ return;
+}
+
+
+
+VOID CChatData::SetChat(NicoLiveChat &chat_in){
+
+
+ this->anonymity = _ttol(chat_in.anonymity);
+ this->premium = _ttol(chat_in.premium);
+ this->chatBuf = chat_in.chatBuf;
+ this->no = _ttol(chat_in.no);
+
+ if(_tcscmp(chat_in.locale,TEXT("jp")) == 0){
+ this->locale = cuntry::jp;
+ } else {
+ this->locale = cuntry::unknown;
+ }
+ this->mail.reserve(chat_in.mailCount);
+ for(UINT_PTR index = 0;index < chat_in.mailCount ;index++){
+
+ this->mail.push_back(chat_in.mail[index]);
+ }
+
+ this->name = chat_in.name;
+
+ this->user_id = chat_in.user_id;
+
+
+
+ this->vpos = _ttol(chat_in.vpos);
+ this->thread = _ttol(chat_in.thread);
+ this->date = _ttol(chat_in.date);
+
+
+
+ return;
+}
+
+
+
--- /dev/null
+#include "stdafx.h"
+#include "nlite_include.h"
+
+
+
+
+static const RECT commentViewSize = {5,0,5,0};
+
+
+
+
+//\83T\83C\83Y\95Ï\8dX\8f\88\97\9d
+VOID CNliteMainFrame::ChangeSize(const SIZE& client){
+
+
+
+
+
+ tabctrl.MoveWindow(0,toolBarHeight,client.cx,client.cy - (toolBarHeight + statusBarHeight + commentWriteWindowSize.cy));
+
+
+ RECT tabClientRect;
+ tabctrl.GetClientRect(&tabClientRect);
+ tabctrl.AdjustRect(FALSE,&tabClientRect);
+
+
+
+
+ commentView.MoveWindow(tabClientRect.left, tabClientRect.top,tabClientRect.right - tabClientRect.left, tabClientRect.bottom - tabClientRect.top);
+
+ commentWriteWindow.MoveWindow(0,client.cy - (commentWriteWindowSize.cy + statusBarHeight),client.cx,client.cy);
+
+
+
+ return;
+}
+
+LRESULT CNliteMainFrame::OnCreate(LPCREATESTRUCT lpcs){
+
+
+ // \83X\83e\81[\83^\83X\83o\81[\82ð\8dì\90¬
+ vcverify(CreateSimpleStatusBar(),TEXT("\83X\83e\81[\83^\83X\83o\81[\8dì\90¬\82É\8e¸\94s\82µ\82Ü\82µ\82½"));
+ tabctrl.Create(m_hWnd,0,NULL,WS_CHILD | WS_CLIPCHILDREN | WS_DLGFRAME);
+ commentView.Create(tabctrl.m_hWnd);
+
+ commentWriteWindow.Create(m_hWnd,0,NULL,WS_CHILD | WS_VISIBLE);
+
+ CreateSimpleReBar();
+ HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd,IDC_NLITE, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE);
+ lvNoCombo.Create(m_hWnd, CRect(0, 0, 100, 100), NULL,WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWN , 0, IDC_COMBO_REBAR);
+
+
+ subLiveNoComboBox.SubclassWindow(lvNoCombo.GetEditCtrl());
+ lvNoCombo.SetFont(AtlGetDefaultGuiFont());
+
+
+
+ AddSimpleReBarBand(hWndToolBar);
+ AddSimpleReBarBand(lvNoCombo,TEXT("\95ú\91\97URL"));
+ SizeSimpleReBarBands();
+
+
+
+ tabctrl.SetFont(hTabFont);
+ tabctrl.SetWindowPos(HWND_BOTTOM,0,0,0,0,SWP_SHOWWINDOW);
+ tabctrl.AddItem(TCIF_TEXT | TCIF_PARAM, _T("\83R\83\81\83\93\83g\88ê\97\97"), 0, (DWORD)commentView.m_hWnd);
+
+
+
+ // \83\81\83b\83Z\81[\83W\83\8b\81[\83v\82É\83\81\83b\83Z\81[\83W\83t\83B\83\8b\83^\82Æ\83A\83C\83h\83\8b\83n\83\93\83h\83\89\82ð\92Ç\89Á
+ CMessageLoop* pLoop = _Module.GetMessageLoop();
+ pLoop->AddMessageFilter(this);
+ pLoop->AddIdleHandler(this);
+
+ RECT wndRect;
+ this->GetWindowRect(&wndRect);
+
+ LONG cyMaxImized = GetSystemMetrics (SM_CYMAXIMIZED);
+ wndRect.bottom = nliteProperty.mfp.windowSize.cy != 0 ? nliteProperty.mfp.windowSize.cy : (LONG)cyMaxImized / 2;
+ wndRect.right = nliteProperty.mfp.windowSize.cx != 0 ? nliteProperty.mfp.windowSize.cx : commentViewSize.left + commentViewSize.right + 20 + commentView.GetColumnHolSizeSum();
+
+
+
+ RECT statusbarRect;
+ ::GetClientRect(m_hWndStatusBar,&statusbarRect);
+
+ statusBarHeight = statusbarRect.bottom - statusbarRect.top;
+
+
+
+ this->MoveWindow(wndRect.left,wndRect.top,wndRect.right,wndRect.bottom);
+
+
+
+
+ return 0;
+}
+
+NLIB_RESULT CNliteMainFrame::LiveCallBack(NICOLIVE_EVENT eventType,NicoLiveStream_P pNicoLiveStream,LPVOID option,NICOLIVE_PARAM param1,NICOLIVE_PARAM param2){
+
+ CLiveUserData &userData = (*(CLiveUserData*)option);
+
+ try{
+ switch(eventType){
+
+ case NICOLIVE_EVENT_RECEVE_CONNECTRESULT:
+
+ userData.OnChatReceveStart(*NicoLiveStream_getStreamStatus(pNicoLiveStream));
+
+ break;
+
+ case NICOLIVE_EVENT_RECEVE_CHAT:
+
+ userData.OnChatReceve((NicoLiveChat_P) param1,param2);
+
+ break;
+
+ case NICOLIVE_EVENT_RECEVE_CHATSETTLE:
+
+ userData.OnChatReceveSettle(param1,param2);
+
+ break;
+
+ case NICOLIVE_EVENT_RECEVE_CHATSENDRESULT:
+
+ break;
+
+ case NICOLIVE_EVENT_SEND_HEARTBEAT:
+
+ break;
+
+ case NICOLIVE_EVENT_ERR_CONNECT:
+
+ throw NLiveException(TEXT("\90Ú\91±\83G\83\89\81[\82Å\82·"),__LINE__,TEXT(__FILE__));
+
+ break;
+
+ default:
+
+ throw NLiveException(TEXT("\97\\8aú\82µ\82È\82¢\83\81\83b\83Z\81[\83W\82ª\91\97\90M\82³\82ê\82Ü\82µ\82½"),__LINE__,TEXT(__FILE__));
+
+ break;
+ }
+
+ } catch(Exception e){
+
+ ::MessageBox(NULL,e.what(),TEXT("\83n\83\93\83h\83\8b\82³\82ê\82Ä\82¢\82È\82¢\83G\83\89\81["),MB_OK | MB_ICONSTOP | MB_TASKMODAL);
+
+ } catch(std::exception e){
+
+ ::MessageBoxA(NULL,e.what(),"\83n\83\93\83h\83\8b\82³\82ê\82Ä\82¢\82È\82¢\83G\83\89\81[",MB_OK | MB_ICONSTOP | MB_TASKMODAL);
+ }
+
+
+
+
+ return NLIB_ERR_OK;
+}
\ No newline at end of file
--- /dev/null
+#include "stdafx.h"
+#include "nlite_include.h"
+
+
+
+#define NLITE_READ_INI_INT(cs,mm,path) cs.mm = GetPrivateProfileInt(cs.GetSectionName(),TEXT(#mm),cs.mm,path)
+
+#define NLITE_READ_INI_STR(cs,mm,bv,path) \
+ GetPrivateProfileString(cs.GetSectionName(),TEXT(#mm),cs.mm.c_str(),&bv[0],bv.size(),path);\
+ cs.mm = &bv[0]\
+ /*\83}\83N\83\8d\81@\8fI\97¹*/
+
+#define NLITE_WRITE_INI_INT(cs,mm,path) WritePrivateProfileInt(cs.GetSectionName(),TEXT(#mm),cs.mm,path)
+
+#define NLITE_WRITE_INI_STR(cs,mm,path) WritePrivateProfileString(cs.GetSectionName(),TEXT(#mm),cs.mm.c_str(),path)
+
+
+#define NLITE_HOLIZONE_SIZE TEXT("headerholSize%u")
+
+
+static const LPCTSTR bt_none = TEXT("none");
+static const LPCTSTR bt_ie = TEXT("ie");
+static const LPCTSTR bt_chrome = TEXT("chrome");
+static const LPCTSTR bt_firefox = TEXT("firefox");
+static const LPCTSTR bt_iecm = TEXT("iecm");
+
+static
+BOOL
+WINAPI
+WritePrivateProfileInt(
+ LPCTSTR lpAppName,
+ LPCTSTR lpKeyName,
+ LONG lData,
+ LPCTSTR lpFileName
+)
+{
+ TCHAR value[LENGTH_256];
+
+ _stprintf(value, TEXT("%d"), lData);
+ return WritePrivateProfileString(
+ lpAppName,
+ lpKeyName,
+ value,
+ lpFileName);
+}
+
+
+VOID Property::ReadIniFile(){
+
+ CreatePropertyFile();
+
+ std::vector<TCHAR> buffer(LENGTH_2048);
+
+ //crp\82Ì\90Ý\92è\92l\93Ç\82Ý\8d\9e\82Ý
+
+ NLITE_READ_INI_INT(crp,besideLengthFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(crp,bspReadFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(crp,commentReadFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(crp,managementReadFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(crp,maxCommentLength,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(crp,newLineReadFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(crp,ngUserReadFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(crp,ngWordReadFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(crp,teropReadFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(crp,userCommentReadFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_STR(crp,outString,buffer,propertyPath.c_str());
+
+ NLITE_READ_INI_STR(crp,shortComment,buffer,propertyPath.c_str());
+
+
+ //commentview\90Ý\92è\92l\93Ç\82Ý\8d\9e\82Ý
+
+ NLITE_READ_INI_INT(cvp,anonymousIDLinkColor,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(cvp,backColor,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(cvp,baseStringColor,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(cvp,commentFoldingFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(cvp,commentTimeType,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(cvp,IDLinkColor,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(cvp,lineColor,propertyPath.c_str());
+
+ LPCTSTR headerFormat = NLITE_HOLIZONE_SIZE;
+ TCHAR headerKey[_MAX_PATH];
+
+ for(UINT_PTR index = 0;index < ARRAY_LENGTH(cvp.headerholSize);index++){
+ _stprintf(headerKey,headerFormat,index);
+ cvp.headerholSize[index] = GetPrivateProfileInt(cvp.GetSectionName(),headerKey,cvp.headerholSize[index],propertyPath.c_str());
+ }
+
+ //mainframe\90Ý\92è\92l\93Ç\8eæ
+
+ NLITE_READ_INI_INT(mfp,windowFrontFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(mfp,windowSize.cx,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(mfp,windowSize.cy,propertyPath.c_str());
+
+ //general\90Ý\92è\92l\93Ç\8eæ
+
+ NLITE_READ_INI_INT(gp,activeCountTimeFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(gp,autoColorRegisterFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(gp,autoNameRegisterFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(gp,autoNameUpdateFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_STR(gp,browserPath,buffer,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(gp,commentLogAutoSaveFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_STR(gp,commentPath,buffer,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(gp,defaultBroserFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(gp,numberNameFlag,propertyPath.c_str());
+
+ NLITE_READ_INI_INT(gp,userCountUpdateFlag,propertyPath.c_str());
+
+
+
+ typedef std::map<tstring, BROWSERTYPE> funcs_type;
+
+ funcs_type funcs;
+ funcs.insert(std::make_pair(bt_none, BT_NOSETTING));
+ funcs.insert(std::make_pair(bt_ie, BT_INTERNET_EXPLORER));
+ funcs.insert(std::make_pair(bt_firefox, BT_FIRE_FOX));
+ funcs.insert(std::make_pair(bt_chrome, BT_GOOGLE_CHROME));
+ funcs.insert(std::make_pair(bt_iecm,BT_IE_COMPONENT));
+
+ tstring browserTypeName;
+
+ GetPrivateProfileString(gp.GetSectionName(),TEXT(TOSTR(browserType)),bt_none,&buffer[0],buffer.size(),propertyPath.c_str());
+ browserTypeName = &buffer[0];
+
+ funcs_type::iterator it = funcs.find(browserTypeName);
+ if (it != funcs.end()){
+
+ gp.browserType = it->second;
+ }else{
+ throw AppInitException(__LINE__,TEXT(__FILE__));
+ }
+
+ return;
+}
+
+
+VOID Property::CreatePropertyFile(){
+
+ propertyPath = appLocalPath;
+
+ propertyPath += TEXT("\\qwerty_nico");
+
+ if(PathIsDirectory(propertyPath.c_str()) == FALSE){
+
+ if(CreateDirectory(propertyPath.c_str(),NULL) == 0){
+ throw Exception(TEXT("\90Ý\92è\83t\83@\83C\83\8b\8dì\90¬\82É\8e¸\94s\82µ\82Ü\82µ\82½"),__LINE__,TEXT(__FILE__));
+ }
+
+ }
+
+ propertyPath += TEXT("\\nlite");
+
+ if(PathIsDirectory(propertyPath.c_str()) == FALSE){
+
+ if(CreateDirectory(propertyPath.c_str(),NULL) == 0){
+ throw Exception(TEXT("\90Ý\92è\83t\83@\83C\83\8b\8dì\90¬\82É\8e¸\94s\82µ\82Ü\82µ\82½"),__LINE__,TEXT(__FILE__));
+ }
+
+ }
+
+ propertyPath += TEXT("\\property.ini");
+
+
+ if(PathFileExists(propertyPath.c_str())== FALSE || PathIsDirectory(propertyPath.c_str()) == TRUE){
+ HANDLE hPropertyini = CreateFile(propertyPath.c_str(),GENERIC_READ | GENERIC_WRITE,FILE_SHARE_READ | FILE_SHARE_WRITE,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
+
+ if(hPropertyini == INVALID_HANDLE_VALUE ){
+
+ throw Exception(TEXT("\90Ý\92è\83t\83@\83C\83\8b\8dì\90¬\82É\8e¸\94s\82µ\82Ü\82µ\82½"),__LINE__,TEXT(__FILE__));
+
+ }
+
+
+ CloseHandle(hPropertyini);
+ }
+
+ return;
+}
+
+
+VOID Property::WriteIniFile(){
+
+ CreatePropertyFile();
+
+ //\83R\83\81\83\93\83g\93Ç\82Ý\8fã\82°\90Ý\92è\8f\91\82«\8d\9e\82Ý
+
+ NLITE_WRITE_INI_INT(crp,besideLengthFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(crp,bspReadFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(crp,commentReadFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(crp,managementReadFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(crp,maxCommentLength,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(crp,newLineReadFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(crp,ngUserReadFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(crp,ngWordReadFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(crp,teropReadFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(crp,userCommentReadFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_STR(crp,outString,propertyPath.c_str());
+
+ NLITE_WRITE_INI_STR(crp,shortComment,propertyPath.c_str());
+
+
+ //commentview\90Ý\92è\92l\8f\91\82«\8d\9e\82Ý
+
+ NLITE_WRITE_INI_INT(cvp,anonymousIDLinkColor,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(cvp,backColor,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(cvp,baseStringColor,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(cvp,commentFoldingFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(cvp,commentTimeType,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(cvp,IDLinkColor,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(cvp,lineColor,propertyPath.c_str());
+
+ LPCTSTR headerFormat = NLITE_HOLIZONE_SIZE;
+ TCHAR headerKey[_MAX_PATH];
+
+ for(UINT_PTR index = 0;index < ARRAY_LENGTH(cvp.headerholSize);index++){
+ _stprintf(headerKey,headerFormat,index);
+ cvp.headerholSize[index] = WritePrivateProfileInt(cvp.GetSectionName(),headerKey,cvp.headerholSize[index],propertyPath.c_str());
+ }
+
+ //mainframe\90Ý\92è\92l\8f\91\82«\8d\9e\82Ý
+
+ NLITE_WRITE_INI_INT(mfp,windowFrontFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(mfp,windowSize.cx,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(mfp,windowSize.cy,propertyPath.c_str());
+
+ //general\90Ý\92è\92l\8f\91\82«\8d\9e\82Ý
+
+ NLITE_WRITE_INI_INT(gp,activeCountTimeFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(gp,autoColorRegisterFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(gp,autoNameRegisterFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(gp,autoNameUpdateFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_STR(gp,browserPath,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(gp,commentLogAutoSaveFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_STR(gp,commentPath,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(gp,defaultBroserFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(gp,numberNameFlag,propertyPath.c_str());
+
+ NLITE_WRITE_INI_INT(gp,userCountUpdateFlag,propertyPath.c_str());
+
+ tstring browserTypeName;
+
+
+ switch (gp.browserType){
+
+ case BT_NOSETTING:
+
+ browserTypeName = bt_none;
+
+ break;
+
+ case BT_INTERNET_EXPLORER:
+
+ browserTypeName = bt_ie;
+
+ break;
+
+ case BT_GOOGLE_CHROME:
+
+ browserTypeName = bt_chrome;
+
+ break;
+
+ case BT_FIRE_FOX:
+
+ browserTypeName = bt_firefox;
+
+ break;
+
+ case BT_IE_COMPONENT:
+ browserTypeName = bt_iecm;
+ break;
+
+ default:
+ browserTypeName = bt_none;
+ break;
+
+ }
+
+ WritePrivateProfileString(gp.GetSectionName(),TEXT(TOSTR(browserType)),browserTypeName.c_str(),propertyPath.c_str());
+
+ return;
+}
\ No newline at end of file
--- /dev/null
+// stdafx.cpp : \95W\8f\80\83C\83\93\83N\83\8b\81[\83h nlite.pch \82Ì\82Ý\82ð
+// \8aÜ\82Þ\83\\81[\83X \83t\83@\83C\83\8b\82Í\81A\83v\83\8a\83R\83\93\83p\83C\83\8b\8dÏ\82Ý\83w\83b\83_\81[\82É\82È\82è\82Ü\82·\81B
+// stdafx.obj \82É\82Í\83v\83\8a\83R\83\93\83p\83C\83\8b\8dÏ\82Ý\8c^\8fî\95ñ\82ª\8aÜ\82Ü\82ê\82Ü\82·\81B
+
+#include "stdafx.h"
+
+// TODO: \82±\82Ì\83t\83@\83C\83\8b\82Å\82Í\82È\82\81ASTDAFX.H \82Å\95K\97v\82È
+// \92Ç\89Á\83w\83b\83_\81[\82ð\8eQ\8fÆ\82µ\82Ä\82\82¾\82³\82¢\81B
--- /dev/null
+#define _CRT_SECURE_NO_WARNINGS 1 //vc++\82Ì\82¨\82¹\82Á\82©\82¢\82È\8cx\8d\90\82ð\8fÁ\82·\83}\83N\83\8d
+#define _CRT_NON_CONFORMING_SWPRINTFS 1 //vc++\82Ì\82¨\82¹\82Á\82©\82¢\82È\8cx\8d\90\82ð\8fÁ\82·\83}\83N\83\8d
+
+#include <nlib\nlib.h>
+#include <nlib\nlib_define.h>
+#include "nlib_stub.h"
+#include <stdio.h>
+#include <memory.h>
+#include <stdlib.h>
+#include <process.h>
+#include <qwerty\windebuger.h>
+
+
+
+static void *nlibmemory;
+static BROWSERTYPE browserType;
+static unsigned int WINAPI commentthread(VOID *usadata);
+NicoLiveStream_P NicoLiveStream_new(){
+
+ NicoLiveStream_P rslt = (NicoLiveStream_P)malloc(sizeof(NicoLiveStream));
+ ZeroMemory(rslt,sizeof(*rslt));
+ rslt->endEvent = CreateEvent(NULL,TRUE,FALSE,NULL);
+ return rslt;
+}
+
+VOID NicoLiveStream_delete(NicoLiveStream_P* self){
+
+ NicoLiveStream_disConnect(*self);
+ CloseHandle((*self)->endEvent);
+ free(*self);
+ *self = NULL;
+ return;
+}
+
+NicoVideoAuth_P NicoVideoAuth_new(){
+
+ return (NicoVideoAuth_P)malloc(65536);
+}
+
+VOID NicoVideoAuth_delete(NicoVideoAuth_P *self){
+
+ free(*self);
+ *self= NULL;
+}
+
+
+NLIB_RESULT InitializeNLIB(HINTERNET hInternet){
+
+ nlibmemory = malloc(65536);
+
+ return NLIB_ERR_OK;
+}
+
+
+VOID FinalizeNLIB(){
+
+ free(nlibmemory);
+}
+
+NLIB_RESULT NicoVideoAuth_getNicoVideoAuth(NicoVideoAuth_P self,BROWSERTYPE browserType){
+
+ ::browserType = browserType;
+
+ return NLIB_ERR_OK;
+}
+
+NLIB_RESULT NicoLiveStream_connect(NicoLiveStream_P self,NicoVideoAuth_P nicoVideoAuth,LPCWSTR url,NicoRecvCallBack callback,LPVOID option){
+
+ NLIB_RESULT rslt = NLIB_ERR_OK;
+
+ NicoLiveStream_disConnect(self);
+
+ self->callback = callback;
+ self->option = option;
+ self->threadHandle = (HANDLE)_beginthreadex(NULL,0,commentthread,self,0,NULL);
+
+
+
+ return rslt;
+}
+
+VOID NicoLiveStream_disConnect(NicoLiveStream_P self){
+
+ SetEvent(self->endEvent);
+ if(self->threadHandle != INVALID_HANDLE_VALUE){
+ WaitForSingleObject(self->threadHandle,INFINITE);
+ CloseHandle(self->threadHandle);
+ }
+
+
+
+ self->threadHandle = NULL;
+
+ ResetEvent(self->endEvent);
+ return;
+}
+
+StreamStatus_P NicoLiveStream_getStreamStatus(NicoLiveStream_P self){
+
+ self->stream.base_time = 1324709820;
+ self->stream.open_time = 1324709820;
+ self->stream.end_time = 1324713599;
+ self->stream.start_time = 1324710000;
+
+ _tcscpy(self->stream.id,TEXT("lv75313550"));
+ _tcscpy(self->stream.default_community,TEXT("co1187609"));
+
+ self->stream.is_owner = FALSE;
+ self->stream.provider_type = COMMUNITY_PROVIDER_TYPE;
+
+
+ return &self->stream;
+}
+
+
+unsigned int WINAPI commentthread(VOID *usadata){
+
+ NicoLiveStream_P self = (NicoLiveStream_P)usadata;
+
+ NicoLiveThreadComment threadcomment;
+ threadcomment.last_res = TEXT("256");
+ threadcomment.server_time = TEXT("12345467");
+ threadcomment.thread = TEXT("1234567");
+ threadcomment.ticket = TEXT("0x12334445");
+ self->callback(NICOLIVE_EVENT_RECEVE_CONNECTRESULT,self,self->option,(NICOLIVE_PARAM)&threadcomment,0);
+
+ NicoLiveChat liveChat;
+ TCHAR noBuf[sizeof(UINT_PTR) * 8];
+ liveChat.anonymity = TEXT("");
+
+ liveChat.date = TEXT("1324713598");
+ liveChat.locale = TEXT("jp");
+ LPCTSTR mails[] = {TEXT("184"),NULL};
+ liveChat.mail = &mails[0];
+ liveChat.mailCount = ARRAY_LENGTH(mails) - 1;
+ liveChat.name = TEXT("");
+ liveChat.no = noBuf;
+ liveChat.premium = TEXT("1");
+ liveChat.thread = TEXT("1000254");
+ liveChat.user_id = TEXT("testuser");
+ liveChat.vpos = TEXT("8852");
+ int commentcount = 0;
+
+ DWORD rslt;
+ for(int indexfirst = 0; indexfirst < 1000;indexfirst++){
+ liveChat.chatBuf = commentcount % 2 == 0 ? TEXT("testcomment\82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 ") : TEXT("test");
+ _stprintf((LPTSTR)liveChat.no,TEXT("%u"),commentcount);
+ self->callback(NICOLIVE_EVENT_RECEVE_CHAT,self,self->option,(NICOLIVE_PARAM)&liveChat,indexfirst);
+ commentcount++;
+ }
+
+
+ for(int index = 0,index2; index < 100;index++){
+
+
+ for(index2 = 0;index2 < 3;index2++){
+
+ liveChat.chatBuf = commentcount % 2 == 0 ? TEXT("testcomment\82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 \82 ") : TEXT("test");
+ _stprintf((LPTSTR)liveChat.no,TEXT("%u"),commentcount);
+ self->callback(NICOLIVE_EVENT_RECEVE_CHAT,self,self->option,(NICOLIVE_PARAM)&liveChat,index + index2);
+ commentcount++;
+ }
+
+ self->callback(NICOLIVE_EVENT_RECEVE_CHATSETTLE,self,self->option,100,commentcount);
+ if(( rslt = WaitForSingleObject(self->endEvent,0)) != WAIT_TIMEOUT){
+
+ goto end;
+ }
+
+
+
+ }
+end:
+
+ _endthreadex(0);
+ return 0;
+}
\ No newline at end of file