From: unknown Date: Mon, 23 Jan 2012 08:17:27 +0000 (+0900) Subject: 2012/01/23 17:17:27 X-Git-Tag: v0.001~30 X-Git-Url: http://git.sourceforge.jp/view?p=nlite%2Fnlite.git;a=commitdiff_plain;h=7f862e66de46f47c9705ae8bf804588ec8979f95 2012/01/23 17:17:27 --- diff --git a/include/qwerty/windebuger.h b/include/qwerty/windebuger.h index d042387..2ade2f1 100644 --- a/include/qwerty/windebuger.h +++ b/include/qwerty/windebuger.h @@ -511,9 +511,10 @@ static VOID DebugOutMB(UINT codePage,LPSTR fileName,LPSTR functionName,UINT line static VOID DebugOutputCommon(LPCWSTR szBuf,UINT mode,const struct tm* now){ - WCHAR logFileName[24]; + + LPWSTR logFileNameFormat = L"debug_%d-%d-%d.log"; - DWORD number; + #ifndef WINDEBUGER_NOTRACEING @@ -524,6 +525,7 @@ static VOID DebugOutputCommon(LPCWSTR szBuf,UINT mode,const struct tm* now){ #ifndef WINDEBUGER_NOPRINTING if(mode & PRINTING__DEBUGER__){ + DWORD number; AllocConsole(); WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE),szBuf,wcslen(szBuf),&number,NULL); @@ -540,7 +542,7 @@ static VOID DebugOutputCommon(LPCWSTR szBuf,UINT mode,const struct tm* now){ #ifndef WINDEBUGER_NOLOGGING if(mode & LOGGING__DEBUGER__){ - + WCHAR logFileName[24]; wsprintfW(logFileName,logFileNameFormat,now->tm_year + 1900,now->tm_mon + 1,now->tm_mday); diff --git a/nlib/StdAfx.h b/nlib/StdAfx.h index 028b795..b4ccb1d 100644 --- a/nlib/StdAfx.h +++ b/nlib/StdAfx.h @@ -1,9 +1,10 @@ #pragma once #include "targetver.h" -#define _CRT_NON_CONFORMING_SWPRINTFS = 1 +#define _CRT_NON_CONFORMING_SWPRINTFS 1 +#define _CRT_SECURE_NO_WARNINGS 1 #define WIN32_LEAN_AND_MEAN // Windows ƒwƒbƒ_[‚©‚çŽg—p‚³‚ê‚Ä‚¢‚È‚¢•”•ª‚ðœŠO‚µ‚Ü‚·B - +#define WINDEBUGER_NOPRINTING //ƒfƒoƒbƒOo—Í‚ðƒRƒ“ƒ\[ƒ‹‚É•\Ž¦‚µ‚½‚­‚È‚¢ê‡’è‹`‚·‚é //windowsAPIŠÖ˜Aƒwƒbƒ_ diff --git a/nlib/nlib.h b/nlib/nlib.h index 2c47163..edde352 100644 --- a/nlib/nlib.h +++ b/nlib/nlib.h @@ -33,6 +33,9 @@ //Œ^’è‹` ////////////////////////////////////////////////////////////////////////////////////////////////////// + + + /// ///nlib‚Ì–ß‚è’l‚ÌŒ^ /// @@ -77,74 +80,27 @@ typedef struct nicovideoauth_t *NicoVideoAuth_P; /// -///¶•ú‘—ƒXƒe[ƒ^ƒX +///ƒjƒRƒjƒR¶•ú‘—ƒXƒe[ƒ^ƒX /// -typedef struct streamstatus_t{ +typedef struct streamstatus_t *StreamStatus_P; + - WCHAR id[LENGTH_128]; - WCHAR default_community[LENGTH_128]; - PROVIDERTYPE provider_type; - BOOL is_owner; - time_t start_time; - time_t end_time; - time_t open_time; - time_t base_time; -}StreamStatus,*StreamStatus_P; /// -///ƒ}ƒCƒŠƒXƒg“®‰æƒf[ƒ^ +///ƒjƒRƒjƒR“®‰æƒ}ƒCƒŠƒXƒgƒAƒCƒeƒ€ƒIƒuƒWƒFƒNƒg /// -typedef struct { - WCHAR deleted[LENGTH_2048]; - time_t first_retrieve; - WCHAR group_type[LENGTH_2048]; - WCHAR last_res_body[LENGTH_2048]; - WCHAR length_seconds[LENGTH_2048]; - WCHAR mylist_counter[LENGTH_2048]; - WCHAR num_res[LENGTH_2048]; - WCHAR thumbnail_url[LENGTH_2048]; - WCHAR title[LENGTH_2048]; - time_t update_time; - WCHAR video_id[LENGTH_2048]; - WCHAR view_counter[LENGTH_2048]; - WCHAR watch_id[LENGTH_2048]; -}NicoItemData,*NicoItemData_P; +typedef struct nicomylistitem_t *NicoMyListItem_P; /// -///ƒjƒRƒjƒR“®‰æ‚¨‹C‚É“ü‚è“®‰æ +///ƒjƒRƒjƒR“®‰æƒ}ƒCƒŠƒXƒgƒAƒCƒeƒ€ƒf[ƒ^ƒIƒuƒWƒFƒNƒg /// -typedef struct { - time_t create_time; - WCHAR description[LENGTH_2048]; - NicoItemData itemData; - WCHAR item_id[LENGTH_2048]; - WCHAR item_type[LENGTH_2048]; - time_t update_time; - UINT_PTR watch; - - -}NicoMyListItem,*NicoMyListItem_P; - +typedef struct nicoitemdata_t *NicoItemData_P; /// -///ƒjƒRƒjƒR“®‰æƒ}ƒCƒŠƒXƒg +///ƒjƒRƒjƒR“®‰æ‚̃}ƒCƒŠƒXƒgƒIƒuƒWƒFƒNƒg /// -typedef struct { - time_t create_time; - WCHAR default_sort[LENGTH_256]; - WCHAR description[LENGTH_2048]; - WCHAR icon_id[LENGTH_256]; - WCHAR id[LENGTH_256]; - WCHAR name[LENGTH_2048]; - WCHAR publicType[LENGTH_256]; - WCHAR sort_order[LENGTH_256]; - time_t update_time; - WCHAR user_id[LENGTH_256]; - -}NicoMyList,*NicoMyList_P; - - +typedef struct nicomylist_t *NicoMyList_P; /// ///ƒjƒRƒjƒR¶•ú‘—ƒCƒxƒ“ƒgƒnƒ“ƒhƒ‰ @@ -162,27 +118,21 @@ typedef NLIB_RESULT (*NicoMyListCallBack)(LPVOID option,NicoMyListItem_P pVideo) typedef NLIB_RESULT (*NicoMyListGroupCallBack)(LPVOID option,NicoMyList_P pMyList); - - -typedef UCHAR NICOLIVE_PREMIUM; -typedef UCHAR NICOLIVE_ANONYMITY; - - /// ///ƒjƒRƒjƒR¶•ú‘—ƒ`ƒƒƒbƒgƒRƒƒ“ƒg\‘¢‘Ì /// typedef struct{ - LPCWSTR premium; - LPCWSTR anonymity; - LPCWSTR thread; - LPCWSTR no; - LPCWSTR vpos; - LPCWSTR date; - LPCWSTR locale; - LPCWSTR user_id; - LPCWSTR name; - LPCWSTR chatBuf; - LPCWSTR* mail; + LPCTSTR premium; + LPCTSTR anonymity; + LPCTSTR thread; + LPCTSTR no; + LPCTSTR vpos; + LPCTSTR date; + LPCTSTR locale; + LPCTSTR user_id; + LPCTSTR name; + LPCTSTR chatBuf; + LPCTSTR* mail; UINT_PTR mailCount; }NicoLiveChat,*NicoLiveChat_P; @@ -193,10 +143,10 @@ typedef struct{ ///ƒjƒRƒjƒR¶•ú‘—ƒXƒŒƒbƒhƒRƒƒ“ƒg\‘¢‘Ì /// typedef struct{ - LPCWSTR thread; - LPCWSTR ticket; - LPCWSTR last_res; - LPCWSTR server_time; + LPCTSTR thread; + LPCTSTR ticket; + LPCTSTR last_res; + LPCTSTR server_time; }NicoLiveThreadComment,*NicoLiveThreadComment_P; @@ -204,9 +154,9 @@ typedef struct{ ///ƒjƒRƒjƒR¶•ú‘—‘—MŒ‹‰ÊƒRƒƒ“ƒg\‘¢‘Ì /// typedef struct{ - LPCWSTR status; - LPCWSTR no; - LPCWSTR thread; + LPCTSTR status; + LPCTSTR no; + LPCTSTR thread; }NicoLiveSendResultComment,*NicoLiveSendResultComment_P; @@ -223,9 +173,9 @@ typedef struct{ UINT_PTR commentCount; - LPCWSTR is_restrict; + LPCTSTR is_restrict; - LPCWSTR ticket; + LPCTSTR ticket; }NicoLiveHeartBeat,*NicoLiveHeartBeat_P; @@ -249,6 +199,12 @@ extern "C" { /// NLIB_DECLSPEC VOID FinalizeNLIB(); + + /// + ///ƒGƒ‰[ƒƒbƒZ[ƒWŽæ“¾ + /// + NLIB_DECLSPEC LPCTSTR NLIB_GetErrorMessage(NLIB_RESULT rsltCode); + // //ƒjƒRƒjƒR¶•ú‘—ŠÖ˜AŠÖ” ///////////////////////////////////////////////////////////////////////////////////////////////////// @@ -266,7 +222,7 @@ extern "C" { /// ///Žw’肵‚½URL‚Ì•ú‘—‚ɐڑ± /// - NLIB_DECLSPEC NLIB_RESULT NicoLiveStream_connect(NicoLiveStream_P self,NicoVideoAuth_P nicoVideoAuth,LPCWSTR url,NicoRecvCallBack callback,LPVOID option); + NLIB_DECLSPEC NLIB_RESULT NicoLiveStream_connect(NicoLiveStream_P self,NicoVideoAuth_P nicoVideoAuth,LPCTSTR url,NicoRecvCallBack callback,LPVOID option); /// @@ -338,13 +294,55 @@ extern "C" { /// ///ƒRƒƒ“ƒg‘—M /// - NLIB_DECLSPEC NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCWSTR chatbuf,LPCWSTR *mail,LPCWSTR *extends); + NLIB_DECLSPEC NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCTSTR chatbuf,LPCTSTR *mail,LPCTSTR *extends); /// ///ƒn[ƒgƒr[ƒg‘—M /// NLIB_DECLSPEC NLIB_RESULT NicoLiveStream_sendHeartBeat(NicoLiveStream_P self); + /// + ///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚ÌID‚ðŽæ“¾ + /// + NLIB_DECLSPEC LPCTSTR StreamStatus_getId(StreamStatus_P self); + + + /// + ///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚̃Rƒ~ƒ…ƒjƒeƒB”ԍ†‚ðŽæ“¾ + /// + NLIB_DECLSPEC LPCTSTR StreamStatus_getDefaultCommunity(StreamStatus_P self); + + + /// + ///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚̃vƒƒoƒCƒ_ƒ^ƒCƒv‚ðŽæ“¾ + /// + NLIB_DECLSPEC PROVIDERTYPE StreamStatus_getProviderType(StreamStatus_P self); + + + /// + ///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚̃I[ƒi[ƒtƒ‰ƒO‚ðŽæ“¾ + /// + NLIB_DECLSPEC BOOL StreamStatus_isOwner(StreamStatus_P self); + + /// + ///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚ÌŠJŽnŽž‚ðŽæ“¾ + /// + NLIB_DECLSPEC time_t StreamStatus_getStartTime(StreamStatus_P self); + + /// + ///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚̏I—¹Žž‚ðŽæ“¾ + /// + NLIB_DECLSPEC time_t StreamStatus_getEndTime(StreamStatus_P self); + + /// + ///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚ÌŠJêŽž‚ðŽæ“¾ + /// + NLIB_DECLSPEC time_t StreamStatus_getOpenTime(StreamStatus_P self); + + /// + ///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚̃x[ƒXŽž‚ðŽæ“¾ + /// + NLIB_DECLSPEC time_t StreamStatus_getBaseTime(StreamStatus_P self); // //ƒjƒRƒjƒR“®‰æ”FØŠÖ˜AŠÖ” @@ -379,7 +377,7 @@ extern "C" { /// ///ƒ}ƒCƒŠƒXƒgŽæ“¾ /// - NLIB_DECLSPEC NLIB_RESULT NicoMyList_getMyList(NicoVideoAuth_P pAuth,LPCWSTR id,NicoMyListCallBack callback,LPVOID option); + NLIB_DECLSPEC NLIB_RESULT NicoMyList_getMyList(NicoVideoAuth_P pAuth,LPCTSTR id,NicoMyListCallBack callback,LPVOID option); /// ///ƒ}ƒCƒŠƒXƒgƒOƒ‹[ƒvŽæ“¾ @@ -390,7 +388,7 @@ extern "C" { /// ///ƒ}ƒCƒŠƒXƒg“o˜^ŒÄ‚яo‚µ /// - NLIB_DECLSPEC NLIB_RESULT NicoMyList_addItem(LPCWSTR video_id); + NLIB_DECLSPEC NLIB_RESULT NicoMyList_addItem(LPCTSTR video_id); diff --git a/nlib/nlib.vcxproj b/nlib/nlib.vcxproj index 9078a41..961f62b 100644 --- a/nlib/nlib.vcxproj +++ b/nlib/nlib.vcxproj @@ -106,6 +106,7 @@ + diff --git a/nlib/nlib.vcxproj.filters b/nlib/nlib.vcxproj.filters index 7b5b6fa..99aef3c 100644 --- a/nlib/nlib.vcxproj.filters +++ b/nlib/nlib.vcxproj.filters @@ -36,6 +36,9 @@ ソース ファイル + + ソース ファイル + diff --git a/nlib/nlib_common.c b/nlib/nlib_common.c index 531506d..385bff6 100644 --- a/nlib/nlib_common.c +++ b/nlib/nlib_common.c @@ -7,8 +7,8 @@ HINTERNET hHttpSession; //HINTERNET HINTERNET hWatchLiveNicoConnect; HINTERNET hNicoVideoConnect; -WCHAR appDataPath[_MAX_PATH]; -WCHAR localAppDataPath[_MAX_PATH]; +TCHAR appDataPath[_MAX_PATH]; +TCHAR localAppDataPath[_MAX_PATH]; XML_Parser xmlParser; static CRITICAL_SECTION playerStatusParserCs; @@ -26,18 +26,20 @@ static INLINE VOID Parser_Finalize(); NLIB_RESULT InitializeNLIB(HINTERNET hInternet){ + NLIB_RESULT rslt = NLIB_ERR_CODE_NOTSET; hHttpSession = hInternet; if(hHttpSession == NULL){ - return NLIB_INITALIZE_FAILED_NETWORK; + rslt = NLIB_INITALIZE_FAILED_NETWORK; + goto end; } hWatchLiveNicoConnect = WinHttpConnect(hHttpSession,WTEXT(WATCH_LIVE_NICO_VIDEO_DOMEINNAME),INTERNET_DEFAULT_HTTP_PORT,0); if(hHttpSession == NULL){ - - return NLIB_INITALIZE_FAILED_NETWORK; + rslt = NLIB_INITALIZE_FAILED_NETWORK; + goto end; } hNicoVideoConnect = WinHttpConnect(hHttpSession,WWW_NICO_VIDEO_DOMEINNAME,INTERNET_DEFAULT_HTTP_PORT,0); @@ -61,7 +63,12 @@ NLIB_RESULT InitializeNLIB(HINTERNET hInternet){ //ƒp[ƒT‚ð‰Šú‰» Parser_Initialize(); - return NLIB_ERR_OK; + rslt = NLIB_ERR_OK; + +end: + + + return rslt; } VOID FinalizeNLIB(){ diff --git a/nlib/nlib_common.h b/nlib/nlib_common.h index 08efdd8..7563d96 100644 --- a/nlib/nlib_common.h +++ b/nlib/nlib_common.h @@ -11,7 +11,7 @@ typedef struct nicovideoauth_t{ - WCHAR userSession[LENGTH_256]; + TCHAR userSession[LENGTH_256]; }NicoVideoAuth; @@ -35,13 +35,13 @@ extern HINTERNET hNicoVideoConnect; /// ///appDataƒtƒHƒ‹ƒ_ /// -extern WCHAR appDataPath[]; +extern TCHAR appDataPath[]; /// ///localAppDAtaƒtƒHƒ‹ƒ_ /// -extern WCHAR localAppDataPath[]; +extern TCHAR localAppDataPath[]; /// diff --git a/nlib/nlib_define.h b/nlib/nlib_define.h index 3060631..173227a 100644 --- a/nlib/nlib_define.h +++ b/nlib/nlib_define.h @@ -66,11 +66,11 @@ ///ƒNƒbƒL[Žæ“¾Ž¸”s #define NLIB_ERR_COOKIE_FAILED ((NLIB_RESULT)1) -///NLIB‰Šú‰»ƒGƒ‰[Fƒlƒbƒgƒ[ƒN‰Šú‰»Ž¸”s +///ƒlƒbƒgƒ[ƒN‰Šú‰»Ž¸”s #define NLIB_INITALIZE_FAILED_NETWORK ((NLIB_RESULT)2) -///“ü—Í‚³‚ꂽ•ú‘—”ԍ†‚ª”FŽ¯‚Å‚«‚È‚¢ -#define NLIB_LIVENO_FAILED_INPUT ((NLIB_RESULT)3) +///“ü—Í‚³‚ꂽ•ú‘—”ԍ†‚ªNULL +#define NLIB_LIVENO_IS_NULL ((NLIB_RESULT)3) ///“ü—Í‚³‚ꂽ•ú‘—”ԍ†‚ª’·‚·‚¬‚é #define NLIB_LIVENO_FAILED_TOOBIG ((NLIB_RESULT)4) @@ -133,7 +133,7 @@ #define NLIB_ERR_GETPLAYERSTATUS_NOT_PERMITTED ((NLIB_RESULT)23) ///ƒvƒŒƒCƒ„[ƒXƒe[ƒ^ƒXŽæ“¾ƒGƒ‰[:require_accept_print_timeshift_ticket‚ª”­¶‚µ‚½ -#define NLIB_ERR_GETPLAYERSTATUS_NOT_REQUIRE_ACCEPT_PRINT_TIMESHIFT_TICKET ((NLIB_RESULT)24) +#define NLIB_ERR_GETPLAYERSTATUS_REQUIRE_ACCEPT_PRINT_TIMESHIFT_TICKET ((NLIB_RESULT)24) ///ƒvƒŒƒCƒ„[ƒXƒe[ƒ^ƒXŽæ“¾ƒGƒ‰[:tsarchive‚ª”­¶‚µ‚½ #define NLIB_ERR_GETPLAYERSTATUS_TSARCHIVE ((NLIB_RESULT)25) @@ -170,7 +170,13 @@ ///¶•ú‘—‚ɐڑ±‚µ‚Ä‚¢‚È‚¢ -#define NLIB_ERR_NOT_CONNECT ((NLIB_RESULT)35) +#define NLIB_ERR_NOT_LIVECONNECT ((NLIB_RESULT)35) + +///ƒRƒƒ“ƒg‘—M—p‚̃|ƒXƒgƒL[Žæ“¾Ž¸”s +#define NLIB_ERR_LIVE_GETPOSTKEY_FAILED ((NLIB_RESULT)36) + +///ƒGƒ‰[ƒR[ƒh‚ªÝ’肳‚ê‚Ä‚¢‚È‚¢ +#define NLIB_ERR_CODE_NOTSET ((NLIB_RESULT)0xFFFFFFFF) diff --git a/nlib/nlib_errorMessage.c b/nlib/nlib_errorMessage.c new file mode 100644 index 0000000..63b96cc --- /dev/null +++ b/nlib/nlib_errorMessage.c @@ -0,0 +1,218 @@ +#include "StdAfx.h" +#include "nlib_include.h" + + +//NLIB_ERR_OK +static const LPCTSTR NLIB_ERR_OK_STRING = + TEXT("ƒGƒ‰[‚Í”­¶‚µ‚Ä‚¢‚Ü‚¹‚ñ"); + +//NLIB_ERR_COOKIE_FAILED +static const LPCTSTR NLIB_ERR_COOKIE_FAILED_STRING = + TEXT("ƒNƒbƒL[Žæ“¾‚ÉŽ¸”s‚µ‚Ü‚µ‚½"); + +//NLIB_INITALIZE_FAILED_NETWORK +static const LPCTSTR NLIB_INITALIZE_FAILED_NETWORK_STRING= + TEXT("ƒlƒbƒgƒ[ƒN‚̏‰Šú‰»‚ÉŽ¸”s‚µ‚Ü‚µ‚½"); + +//NLIB_LIVENO_IS_NULL +static const LPCTSTR NLIB_LIVENO_IS_NULL_STRING= + TEXT("“ü—Í‚³‚ꂽ•ú‘—”ԍ†‚ªNULL’l‚Å‚·"); + +//NLIB_LIVENO_FAILED_TOOBIG +static const LPCTSTR NLIB_LIVENO_FAILED_TOOBIG_STRING= + TEXT("“ü—Í‚³‚ꂽ•ú‘—”ԍ†‚ª’·‚·‚¬‚Ü‚·"); + +//NLIB_LIVENO_FAILED_UNDEFEINE +static const LPCTSTR NLIB_LIVENO_FAILED_UNDEFEINE_STRING= + TEXT("“ü—Í‚³‚ꂽ•ú‘—”ԍ†‚ª³‚µ‚­‚ ‚è‚Ü‚¹‚ñ"); + +//NLIB_USERSESSION_FAILED_TOOBIG +static const LPCTSTR NLIB_USERSESSION_FAILED_TOOBIG_STRING= + TEXT("ƒ†[ƒU[ƒZƒbƒVƒ‡ƒ“‚Ì•¶Žš—ñ‚ª’·‚·‚¬‚Ü‚·"); + +//NLIB_GETPLAYERSTATUS_FAILED_CONNECT +static const LPCTSTR NLIB_GETPLAYERSTATUS_FAILED_CONNECT_STRING= + TEXT("ƒvƒŒƒCƒ„[ƒXƒe[ƒ^ƒX‚̐ڑ±‚ÉŽ¸”s‚µ‚Ü‚µ‚½"); + +//NLIB_ERR_GETPLAYERSTATUS_INVALID_LV +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_INVALID_LV_STRING= + TEXT("–³Œø‚È•ú‘—”ԍ†‚Å‚·"); + +//NLIB_ERR_GETPLAYERSTATUS_INVALID_THREAD +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_INVALID_THREAD_STRING= + TEXT("•ú‘—ƒXƒŒƒbƒh‚ªŒ©‚‚©‚è‚Ü‚¹‚ñ‚Å‚µ‚½"); + +//NLIB_ERR_GETPLAYERSTATUS_CLOSED +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_CLOSED_STRING= + TEXT("•ú‘—‚ªI—¹‚µ‚Ä‚¢‚Ü‚·"); + +//NLIB_ERR_GETPLAYERSTATUS_UNKNOWN_ERROR +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_UNKNOWN_ERROR_STRING= + TEXT("•ú‘—Ú‘±’†‚É•s–¾‚ȃGƒ‰[‚ª”­¶‚µ‚Ü‚µ‚½:unknown_error"); + +//NLIB_ERR_GETPLAYERSTATUS_SERVER_ERROR +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_SERVER_ERROR_STRING= + TEXT("•ú‘—ƒT[ƒo[Ú‘±‚ÉŽ¸”s‚µ‚Ü‚µ‚½"); + +//NLIB_ERR_GETPLAYERSTATUS_DELETED +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_DELETED_STRING= + TEXT("•ú‘—‚ªíœ‚³‚ê‚Ä‚¢‚Ü‚·"); + +//NLIB_ERR_GETPLAYERSTATUS_FULL +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_FULL_STRING= + TEXT("–žˆõ‚Ì‚½‚ߐڑ±‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½"); + +//NLIB_ERR_GETPLAYERSTATUS_PERMISSION_DENIED +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_PERMISSION_DENIED_STRING = + TEXT("•ú‘—‚ɐڑ±‚·‚錠ŒÀ‚ª‚ ‚è‚Ü‚¹‚ñ"); + +//NLIB_ERR_GETPLAYERSTATUS_ACCESS_LOCKED +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_ACCESS_LOCKED_STRING= + TEXT("•ú‘—‚ªƒƒbƒN‚³‚ê‚Ä‚¢‚Đڑ±‚Å‚«‚Ü‚¹‚ñ"); + +//NLIB_ERR_GETPLAYERSTATUS_REQUIRE_COMMUNITY_MEMBER +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_REQUIRE_COMMUNITY_MEMBER_STRING= + TEXT("ƒRƒ~ƒ…ƒjƒeƒBŒÀ’è•ú‘—‚Ì‚½‚ߐڑ±‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½"); + +//NLIB_ERR_GETPLAYERSTATUS_COMINGSOON +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_COMINGSOON_STRING= + TEXT("•ú‘—‚ªŠJê‚³‚ê‚Ä‚¢‚È‚¢‚½‚ߐڑ±‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½"); + +//NLIB_ERR_GETPLAYERSTATUS_NOTFOUND +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_NOTFOUND_STRING= + TEXT("•ú‘—‚ªŒ©‚‚©‚è‚Ü‚¹‚ñ‚Å‚µ‚½"); + +//NLIB_ERR_GETPLAYERSTATUS_NOTLOGIN +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_NOTLOGIN_STRING= + TEXT("ƒƒOƒCƒ“‚µ‚Ä‚¢‚È‚¢‚½‚ß•ú‘—‚ɐڑ±‚Å‚«‚Ü‚¹‚ñ"); + +//NLIB_ERR_GETPLAYERSTATUS_UNKNOWN +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_UNKNOWN_STRING= + TEXT("•ú‘—Ú‘±’†‚É•s–¾‚ȃGƒ‰[‚ª”­¶‚µ‚Ü‚µ‚½:unknown"); + +//NLIB_ERR_GETPLAYERSTATUS_MAINTENANCE +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_MAINTENANCE_STRING= + TEXT("ƒƒ“ƒeƒiƒ“ƒX’†‚Å‚·"); + +//NLIB_ERR_GETPLAYERSTATUS_NOT_PERMITTED +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_NOT_PERMITTED_STRING= + TEXT("I—¹‚µ‚½•ú‘—‚©AŒÃ‚¢•ú‘—A‚ ‚é‚¢‚ÍBAN‚³‚ê‚Ä‚¢‚Ü‚·"); + +//NLIB_ERR_GETPLAYERSTATUS_REQUIRE_ACCEPT_PRINT_TIMESHIFT_TICKET +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_REQUIRE_ACCEPT_PRINT_TIMESHIFT_TICKET_STRING= + TEXT("ƒ^ƒCƒ€ƒVƒtƒg‚ÌŽ‹’®Œ —˜‚ª‚ ‚è‚Ü‚¹‚ñ"); + +//NLIB_ERR_GETPLAYERSTATUS_TSARCHIVE +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_TSARCHIVE_STRING= + TEXT("—L—¿•ú‘—‚̃A[ƒJƒCƒuŽ‹’®Œ —˜‚ª‚È‚¢‚½‚ߐڑ±‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½"); + +//NLIB_ERR_GETPLAYERSTATUS_USERTIMESHIFT +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_USERTIMESHIFT_STRING= + TEXT("ƒRƒ~ƒ…ƒjƒeƒB‚ÉŽQ‰Á‚µ‚Ä‚¢‚È‚¢‚½‚߃^ƒCƒ€ƒVƒtƒg‚ðŽ‹’®‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚¹‚ñ"); + +//NLIB_ERR_GETPLAYERSTATUS_UNDEFINED +static const LPCTSTR NLIB_ERR_GETPLAYERSTATUS_UNDEFINED_STRING= + TEXT("ƒAƒvƒŠƒP[ƒVƒ‡ƒ““à‚Å’è‹`‚³‚ê‚Ä‚È‚¢ƒGƒ‰[‚ª”­¶‚µ‚Ü‚µ‚½"); + +//NLIB_ERR_WATCHLIVENICOVIDEO_FAILED_CONNECT +static const LPCTSTR NLIB_ERR_WATCHLIVENICOVIDEO_FAILED_CONNECT_STRING= + TEXT("ƒjƒR¶‚̃T[ƒo[Ú‘±‚ÉŽ¸”s‚µ‚Ü‚µ‚½"); + +//NLIB_ERR_BUFFER_TOOLITTLE +static const LPCTSTR NLIB_ERR_BUFFER_TOOLITTLE_STRING= + TEXT("“à•”‚ÅŠm•Û‚³‚ꂽƒoƒbƒtƒ@‚ª‘«‚è‚Ü‚¹‚ñ"); + +//NLIB_ERR_FAILED_NETWORK +static const LPCTSTR NLIB_ERR_FAILED_NETWORK_STRING= + TEXT("ƒlƒbƒgƒ[ƒN‚ɉ½‚ç‚©‚ُ̈킪”­¶‚µ‚Ü‚µ‚½"); + +//NLIB_ERR_PLAYERSTATUS_ERROR +static const LPCTSTR NLIB_ERR_PLAYERSTATUS_ERROR_STRING= + TEXT("Žæ“¾‚µ‚½ƒvƒŒƒCƒ„[ƒXƒe[ƒ^ƒX‚ªƒGƒ‰[‚Å‚·"); + +//NLIB_ERR_HEARTBEAT_ERROR +static const LPCTSTR NLIB_ERR_HEARTBEAT_ERROR_STRING= + TEXT("Žæ“¾‚µ‚½ƒn[ƒgƒr[ƒg‚ªƒGƒ‰[‚Å‚·"); + +//NLIB_ERR_JSON_PARSE +static const LPCTSTR NLIB_ERR_JSON_PARSE_STRING= + TEXT("json‰ðÍ’†‚ɃGƒ‰[‚ª”­¶‚µ‚Ü‚µ‚½"); + +//NLIB_ERR_SHELL_FAILED +static const LPCTSTR NLIB_ERR_SHELL_FAILED_STRING= + TEXT("shellƒRƒ}ƒ“ƒhŽÀs‚ÉŽ¸”s‚µ‚Ü‚µ‚½"); + +//NLIB_ERR_NOT_LIVECONNECT +static const LPCTSTR NLIB_ERR_NOT_LIVECONNECT_STRING= + TEXT("¶•ú‘—‚ɐڑ±‚µ‚Ä‚¢‚Ü‚¹‚ñ"); + +//NLIB_ERR_LIVE_GETPOSTKEY_FAILED +static const LPCTSTR NLIB_ERR_LIVE_GETPOSTKEY_FAILED_STRING= + TEXT("ƒRƒƒ“ƒg‘—M—p‚̃|ƒXƒgƒL[Žæ“¾‚ÉŽ¸”s‚µ‚Ü‚µ‚½"); + + +//NLIB_ERR_CODE_NOTSET +static const LPCTSTR NLIB_ERR_CODE_NOTSET_STRING= + TEXT("ƒGƒ‰[ƒR[ƒh‚ªÝ’肳‚ê‚Ä‚¢‚Ü‚¹‚ñBƒ‰ƒCƒuƒ‰ƒŠ‚ÌŽÀ‘•‚ɉ½‚ç‚©‚Ì–â‘肪‚ ‚é‚Ì‚ÅŠJ”­ŽÒ‚É•ñ‚µ‚Ä‚­‚¾‚³‚¢"); + +#define NLIB_ERRMESSAGE_TABLE_START(c) switch(c){ + + +#define NLIB_ERRMESSAGE_CASE(m,c)\ +case c:{\ + m = c##_STRING;\ + break;\ +} + +#define NLIB_ERRMESSAGE_TABLE_END() } + +LPCTSTR NLIB_GetErrorMessage(NLIB_RESULT rsltCode){ + + static const LPCTSTR INI_ERRMES = TEXT(""); + LPCTSTR errmes = INI_ERRMES; + + NLIB_ERRMESSAGE_TABLE_START(rsltCode) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_OK) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_COOKIE_FAILED) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_INITALIZE_FAILED_NETWORK) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_LIVENO_IS_NULL) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_LIVENO_FAILED_TOOBIG) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_LIVENO_FAILED_UNDEFEINE) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_USERSESSION_FAILED_TOOBIG) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_GETPLAYERSTATUS_FAILED_CONNECT) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_INVALID_LV) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_INVALID_THREAD) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_CLOSED) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_UNKNOWN_ERROR) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_SERVER_ERROR) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_DELETED) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_FULL) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_PERMISSION_DENIED) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_ACCESS_LOCKED) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_REQUIRE_COMMUNITY_MEMBER) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_COMINGSOON) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_NOTFOUND) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_NOTLOGIN) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_UNKNOWN) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_MAINTENANCE) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_NOT_PERMITTED) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_REQUIRE_ACCEPT_PRINT_TIMESHIFT_TICKET) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_TSARCHIVE) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_USERTIMESHIFT) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_GETPLAYERSTATUS_UNDEFINED) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_WATCHLIVENICOVIDEO_FAILED_CONNECT) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_BUFFER_TOOLITTLE) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_FAILED_NETWORK) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_PLAYERSTATUS_ERROR) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_HEARTBEAT_ERROR) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_JSON_PARSE) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_SHELL_FAILED) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_NOT_LIVECONNECT) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_LIVE_GETPOSTKEY_FAILED) + NLIB_ERRMESSAGE_CASE(errmes,NLIB_ERR_CODE_NOTSET) + NLIB_ERRMESSAGE_TABLE_END() + + + + return errmes; +} \ No newline at end of file diff --git a/nlib/nlib_myList.c b/nlib/nlib_myList.c index 0e55b41..7e4ebea 100644 --- a/nlib/nlib_myList.c +++ b/nlib/nlib_myList.c @@ -48,9 +48,9 @@ typedef struct { /// ///ƒ}ƒCƒŠƒXƒgˆê——Žæ“¾‹¤’ʏˆ— /// -static NLIB_RESULT NicoMyList_getMyListInternal(NicoVideoAuth_P pAuth,LPCWSTR objectName,NicoMyListCallBack callback,LPVOID option); +static NLIB_RESULT NicoMyList_getMyListInternal(NicoVideoAuth_P pAuth,LPCTSTR objectName,NicoMyListCallBack callback,LPVOID option); -static NLIB_RESULT NicoMyList_common(NicoVideoAuth_P pAuth,LPCWSTR objectName,JSONStructEventHandler structHandler,JSONDataEventHandler dataHandler,JSONStructEndEventHandler endHandler,LPVOID item); +static NLIB_RESULT NicoMyList_common(NicoVideoAuth_P pAuth,LPCTSTR objectName,JSONStructEventHandler structHandler,JSONDataEventHandler dataHandler,JSONStructEndEventHandler endHandler,LPVOID item); static NicoMyListItem_P NicoMyListItem_new(); @@ -74,7 +74,7 @@ static JSONVoid myListItemDataEndEventHandler(JSONVoid *option,JSONUInt thisHier -static NLIB_RESULT jsonStrCpy(LPWSTR buf,LPCWSTR in,SIZE_T size); +static NLIB_RESULT jsonStrCpy(LPTSTR buf,LPCTSTR in,SIZE_T size); @@ -84,8 +84,8 @@ static NLIB_RESULT jsonStrCpy(LPWSTR buf,LPCWSTR in,SIZE_T size); // #define jsonToArray(arr,in) jsonStrCpy((arr),(in),sizeof(arr) / sizeof(arr[0])) -#define jsonDataDecimal(nmc,dt) if((valueType) == JSONTypeDecimal && wcscmp((name),(nmc)) == 0){(dt) = wcstoul((LPCWSTR)param,NULL,10);goto jsondataend;} -#define jsonDataString(nmc,dt,err) if((valueType) == JSONTypeString && wcscmp((name),(nmc)) == 0){(err) = jsonToArray((dt),(LPCWSTR)param);goto jsondataend;} +#define jsonDataDecimal(nmc,dt) if((valueType) == JSONTypeDecimal && wcscmp((name),(nmc)) == 0){(dt) = wcstoul((LPCTSTR)param,NULL,10);goto jsondataend;} +#define jsonDataString(nmc,dt,err) if((valueType) == JSONTypeString && wcscmp((name),(nmc)) == 0){(err) = jsonToArray((dt),(LPCTSTR)param);goto jsondataend;} /// @@ -94,19 +94,19 @@ static NLIB_RESULT jsonStrCpy(LPWSTR buf,LPCWSTR in,SIZE_T size); NLIB_RESULT NicoMyList_getDefList(NicoVideoAuth_P pAuth,NicoMyListCallBack callback,LPVOID option){ + NLIB_RESULT rslt = NLIB_ERR_CODE_NOTSET; - - NLIB_RESULT rslt = NicoMyList_getMyListInternal(pAuth,L"api/deflist/list",callback,option); + rslt = NicoMyList_getMyListInternal(pAuth,L"api/deflist/list",callback,option); return rslt; } -NLIB_DECLSPEC NLIB_RESULT NicoMyList_getMyList(NicoVideoAuth_P pAuth,LPCWSTR id,NicoMyListCallBack callback,LPVOID option){ +NLIB_DECLSPEC NLIB_RESULT NicoMyList_getMyList(NicoVideoAuth_P pAuth,LPCTSTR id,NicoMyListCallBack callback,LPVOID option){ - WCHAR objectName[LENGTH_512]; - NLIB_RESULT rslt = NLIB_ERR_OK; + TCHAR objectName[LENGTH_512]; + NLIB_RESULT rslt = NLIB_ERR_CODE_NOTSET; if(wcslen(id) > ARRAY_LENGTH(objectName) / 2){ return NLIB_ERR_BUFFER_TOOLITTLE; } @@ -118,8 +118,8 @@ NLIB_DECLSPEC NLIB_RESULT NicoMyList_getMyList(NicoVideoAuth_P pAuth,LPCWSTR id, } -static NLIB_RESULT NicoMyList_getMyListInternal(NicoVideoAuth_P pAuth,LPCWSTR objectName,NicoMyListCallBack callback,LPVOID option){ - NLIB_RESULT rslt = NLIB_ERR_OK; +static NLIB_RESULT NicoMyList_getMyListInternal(NicoVideoAuth_P pAuth,LPCTSTR objectName,NicoMyListCallBack callback,LPVOID option){ + NLIB_RESULT rslt = NLIB_ERR_CODE_NOTSET; NicoMyListItemContainer itemContainer; ZeroMemory(&itemContainer,sizeof(itemContainer)); itemContainer.callBack = callback; @@ -133,7 +133,7 @@ static NLIB_RESULT NicoMyList_getMyListInternal(NicoVideoAuth_P pAuth,LPCWSTR ob NLIB_DECLSPEC NLIB_RESULT NicoMyList_getMyListGroup(NicoVideoAuth_P pAuth,NicoMyListGroupCallBack callback,LPVOID option){ - NLIB_RESULT rslt = NLIB_ERR_OK; + NLIB_RESULT rslt = NLIB_ERR_CODE_NOTSET; NicoMyListContainer listContainer; ZeroMemory(&listContainer,sizeof(listContainer)); listContainer.callBack = callback; @@ -144,11 +144,11 @@ NLIB_DECLSPEC NLIB_RESULT NicoMyList_getMyListGroup(NicoVideoAuth_P pAuth,NicoMy NicoMyList_delete(&listContainer.pMyList); return rslt; } -NLIB_DECLSPEC NLIB_RESULT NicoMyList_addItem(LPCWSTR video_id){ +NLIB_DECLSPEC NLIB_RESULT NicoMyList_addItem(LPCTSTR video_id){ - NLIB_RESULT rslt = NLIB_ERR_OK; + NLIB_RESULT rslt = NLIB_ERR_CODE_NOTSET; - WCHAR addApi[LENGTH_512] = {L"http://www.nicovideo.jp/mylist_add/video/"}; + TCHAR addApi[LENGTH_512] = {L"http://www.nicovideo.jp/mylist_add/video/"}; if(wcslen(video_id) > ARRAY_LENGTH(addApi) /2){ goto buffererr; @@ -159,6 +159,7 @@ NLIB_DECLSPEC NLIB_RESULT NicoMyList_addItem(LPCWSTR video_id){ goto shellerr; } + rslt = NLIB_ERR_OK; end: @@ -178,13 +179,13 @@ buffererr: //ƒvƒ‰ƒCƒx[ƒgŠÖ” // -static NLIB_RESULT NicoMyList_common(NicoVideoAuth_P pAuth,LPCWSTR objectName,JSONStructEventHandler structHandler,JSONDataEventHandler dataHandler,JSONStructEndEventHandler endHandler,LPVOID item){ +static NLIB_RESULT NicoMyList_common(NicoVideoAuth_P pAuth,LPCTSTR objectName,JSONStructEventHandler structHandler,JSONDataEventHandler dataHandler,JSONStructEndEventHandler endHandler,LPVOID item){ //•Ï”éŒ¾A‰Šú‰» - NLIB_RESULT rslt = NLIB_ERR_OK; + NLIB_RESULT rslt = NLIB_ERR_CODE_NOTSET; //HINTERNET hNicoVideoSession = NULL; HINTERNET hrequest = NULL; - WCHAR sendBuffer[LENGTH_512] = {L"Cookie: "}; + TCHAR sendBuffer[LENGTH_512] = {L"Cookie: "}; JSONParser_P jsonParser = JSONParser_new(); @@ -207,7 +208,7 @@ static NLIB_RESULT NicoMyList_common(NicoVideoAuth_P pAuth,LPCWSTR objectName,JS wcscat(sendBuffer,pAuth->userSession); //hNicoVideoSession = WinHttpConnect(hHttpSession,WWW_NICO_VIDEO_DOMEINNAME,INTERNET_DEFAULT_HTTP_PORT,0); - hrequest = WinHttpOpenRequest(hNicoVideoConnect,L"GET",objectName,L"1.1",(LPCWSTR)WINHTTP_NO_REFERER,(LPCWSTR*)WINHTTP_DEFAULT_ACCEPT_TYPES,0); + hrequest = WinHttpOpenRequest(hNicoVideoConnect,L"GET",objectName,L"1.1",(LPCTSTR)WINHTTP_NO_REFERER,(LPCTSTR*)WINHTTP_DEFAULT_ACCEPT_TYPES,0); if(hrequest == NULL){ goto networkerr; @@ -267,6 +268,8 @@ static NLIB_RESULT NicoMyList_common(NicoVideoAuth_P pAuth,LPCWSTR objectName,JS } } + rslt = NLIB_ERR_OK; + end: free(readBuffer); JSONParser_delete(&jsonParser); @@ -383,27 +386,27 @@ static JSONVoid myListItemDataEventHandler(JSONVoid *option,JSONUInt thisHierarc if(valueType == JSONTypeDecimal && wcscmp(name,L"create_time") == 0){ - self->pitem->create_time = wcstoul((LPCWSTR)param,NULL,10); + self->pitem->create_time = wcstoul((LPCTSTR)param,NULL,10); } else if(valueType == JSONTypeString && wcscmp(name,L"description") == 0){ - self->container.errcode = jsonToArray(self->pitem->description,(LPCWSTR)param); + self->container.errcode = jsonToArray(self->pitem->description,(LPCTSTR)param); } else if(valueType == JSONTypeString && wcscmp(name,L"item_id") == 0){ - self->container.errcode = jsonToArray(self->pitem->item_id,(LPCWSTR)param); + self->container.errcode = jsonToArray(self->pitem->item_id,(LPCTSTR)param); } else if(valueType == JSONTypeString && wcscmp(name,L"item_type") == 0){ - self->container.errcode = jsonToArray(self->pitem->item_type,(LPCWSTR)param); + self->container.errcode = jsonToArray(self->pitem->item_type,(LPCTSTR)param); } else if(valueType == JSONTypeDecimal && wcscmp(name,L"update_time") == 0){ - self->pitem->update_time = wcstoul((LPCWSTR)param,NULL,10); + self->pitem->update_time = wcstoul((LPCTSTR)param,NULL,10); } else if(valueType == JSONTypeDecimal && wcscmp(name,L"watch") == 0){ - self->pitem->watch = wcstoul((LPCWSTR)param,NULL,10); + self->pitem->watch = wcstoul((LPCTSTR)param,NULL,10); } break; @@ -412,55 +415,55 @@ static JSONVoid myListItemDataEventHandler(JSONVoid *option,JSONUInt thisHierarc if(valueType == JSONTypeString && wcscmp(name,L"deleted") == 0){ - self->container.errcode = jsonToArray(self->pitem->itemData.deleted,(LPCWSTR)param); + self->container.errcode = jsonToArray(self->pitem->itemData.deleted,(LPCTSTR)param); } else if(valueType == JSONTypeDecimal && wcscmp(name,L"first_retrieve") == 0){ - self->pitem->itemData.first_retrieve = wcstoul((LPCWSTR)param,NULL,10); + self->pitem->itemData.first_retrieve = wcstoul((LPCTSTR)param,NULL,10); } else if(valueType == JSONTypeString && wcscmp(name,L"group_type") == 0){ - self->container.errcode = jsonToArray(self->pitem->itemData.group_type,(LPCWSTR)param); + self->container.errcode = jsonToArray(self->pitem->itemData.group_type,(LPCTSTR)param); } else if(valueType == JSONTypeString && wcscmp(name,L"last_res_body") == 0){ - self->container.errcode = jsonToArray(self->pitem->itemData.last_res_body,(LPCWSTR)param); + self->container.errcode = jsonToArray(self->pitem->itemData.last_res_body,(LPCTSTR)param); } else if(valueType == JSONTypeString && wcscmp(name,L"length_seconds") == 0){ - self->container.errcode = jsonToArray(self->pitem->itemData.length_seconds,(LPCWSTR)param); + self->container.errcode = jsonToArray(self->pitem->itemData.length_seconds,(LPCTSTR)param); } else if(valueType == JSONTypeString && wcscmp(name,L"mylist_counter") == 0){ - self->container.errcode = jsonToArray(self->pitem->itemData.mylist_counter,(LPCWSTR)param); + self->container.errcode = jsonToArray(self->pitem->itemData.mylist_counter,(LPCTSTR)param); } else if(valueType == JSONTypeString && wcscmp(name,L"num_res") == 0){ - self->container.errcode = jsonToArray(self->pitem->itemData.num_res,(LPCWSTR)param); + self->container.errcode = jsonToArray(self->pitem->itemData.num_res,(LPCTSTR)param); } else if(valueType == JSONTypeString && wcscmp(name,L"thumbnail_url") == 0){ - self->container.errcode = jsonToArray(self->pitem->itemData.thumbnail_url,(LPCWSTR)param); + self->container.errcode = jsonToArray(self->pitem->itemData.thumbnail_url,(LPCTSTR)param); } else if(valueType == JSONTypeString && wcscmp(name,L"title") == 0){ - self->container.errcode = jsonToArray(self->pitem->itemData.title,(LPCWSTR)param); + self->container.errcode = jsonToArray(self->pitem->itemData.title,(LPCTSTR)param); } else if(valueType == JSONTypeDecimal && wcscmp(name,L"update_time") == 0){ - self->pitem->itemData.update_time = wcstoul((LPCWSTR)param,NULL,10); + self->pitem->itemData.update_time = wcstoul((LPCTSTR)param,NULL,10); } else if(valueType == JSONTypeString && wcscmp(name,L"video_id") == 0){ - self->container.errcode = jsonToArray(self->pitem->itemData.video_id,(LPCWSTR)param); + self->container.errcode = jsonToArray(self->pitem->itemData.video_id,(LPCTSTR)param); } else if(valueType == JSONTypeString && wcscmp(name,L"view_counter") == 0){ - self->container.errcode = jsonToArray(self->pitem->itemData.view_counter,(LPCWSTR)param); + self->container.errcode = jsonToArray(self->pitem->itemData.view_counter,(LPCTSTR)param); } else if(valueType == JSONTypeString && wcscmp(name,L"watch_id") == 0){ - self->container.errcode = jsonToArray(self->pitem->itemData.watch_id,(LPCWSTR)param); + self->container.errcode = jsonToArray(self->pitem->itemData.watch_id,(LPCTSTR)param); } @@ -570,7 +573,7 @@ static JSONVoid myListStructEndEventHandler(JSONVoid *option,JSONUInt thisHierar return; } -static NLIB_RESULT jsonStrCpy(LPWSTR buf,LPCWSTR in,SIZE_T size){ +static NLIB_RESULT jsonStrCpy(LPTSTR buf,LPCTSTR in,SIZE_T size){ NLIB_RESULT rslt = NLIB_ERR_OK; @@ -585,4 +588,9 @@ static NLIB_RESULT jsonStrCpy(LPWSTR buf,LPCWSTR in,SIZE_T size){ } return rslt; -} \ No newline at end of file +} + + + + + diff --git a/nlib/nlib_mylist.h b/nlib/nlib_mylist.h index 6f70f09..6e84d42 100644 --- a/nlib/nlib_mylist.h +++ b/nlib/nlib_mylist.h @@ -1 +1,52 @@ #pragma once + + +/// +///ƒ}ƒCƒŠƒXƒg“®‰æƒf[ƒ^ +/// +typedef struct nicoitemdata_t{ + TCHAR deleted[LENGTH_2048]; + time_t first_retrieve; + TCHAR group_type[LENGTH_2048]; + TCHAR last_res_body[LENGTH_2048]; + TCHAR length_seconds[LENGTH_2048]; + TCHAR mylist_counter[LENGTH_2048]; + TCHAR num_res[LENGTH_2048]; + TCHAR thumbnail_url[LENGTH_2048]; + TCHAR title[LENGTH_2048]; + time_t update_time; + TCHAR video_id[LENGTH_2048]; + TCHAR view_counter[LENGTH_2048]; + TCHAR watch_id[LENGTH_2048]; +}NicoItemData,*NicoItemData_P; + +/// +///ƒjƒRƒjƒR“®‰æ‚¨‹C‚É“ü‚è“®‰æ +/// +typedef struct nicomylistitem_t{ + time_t create_time; + TCHAR description[LENGTH_2048]; + NicoItemData itemData; + TCHAR item_id[LENGTH_2048]; + TCHAR item_type[LENGTH_2048]; + time_t update_time; + UINT_PTR watch; +}NicoMyListItem,*NicoMyListItem_P; + + +/// +///ƒjƒRƒjƒR“®‰æƒ}ƒCƒŠƒXƒg +/// +typedef struct nicomylist_t{ + time_t create_time; + TCHAR default_sort[LENGTH_256]; + TCHAR description[LENGTH_2048]; + TCHAR icon_id[LENGTH_256]; + TCHAR id[LENGTH_256]; + TCHAR name[LENGTH_2048]; + TCHAR publicType[LENGTH_256]; + TCHAR sort_order[LENGTH_256]; + time_t update_time; + TCHAR user_id[LENGTH_256]; + +}NicoMyList,*NicoMyList_P; \ No newline at end of file diff --git a/nlib/nlib_nicoLive.c b/nlib/nlib_nicoLive.c index f01d112..7456c42 100644 --- a/nlib/nlib_nicoLive.c +++ b/nlib/nlib_nicoLive.c @@ -76,7 +76,7 @@ static CRITICAL_SECTION heartBeatCs; /// ///ƒvƒŒƒCƒ„[ƒXƒe[ƒ^ƒXŽæ“¾ /// -static INLINE NLIB_RESULT GetPlayerStatus(NicoLivePlayerStatus_P pPlayerStatus,LPCWSTR userSession,HINTERNET hConnect,LPVOID buffer); +static INLINE NLIB_RESULT GetPlayerStatus(NicoLivePlayerStatus_P pPlayerStatus,LPCTSTR userSession,HINTERNET hConnect,LPVOID buffer); /// ///nicoLiveHistoryŽæ“¾ @@ -126,7 +126,7 @@ static unsigned int loopCommon(NicoLiveStream_P self,WSAEVENT sendEvent,WSAEVENT /// ///ƒRƒƒ“ƒg‰ðÍŠÖ” /// -static VOID NicoLiveParseComment(NicoLiveStream_P self,LPWSTR commentBuf,UINT_PTR endSize,LPWSTR* mailCountBuf,SIZE_T* mailCountBufSize,SIZE_T* commentBufSize); +static VOID NicoLiveParseComment(NicoLiveStream_P self,LPTSTR commentBuf,UINT_PTR endSize,LPTSTR* mailCountBuf,SIZE_T* mailCountBufSize,SIZE_T* commentBufSize); static void NicoLiveError(void *buf); @@ -138,7 +138,7 @@ static VOID OnSendKeepAllive(NicoLiveStream_P self); /// ///ƒ\ƒPƒbƒgŽæ“¾ŠÖ” /// -static INLINE SOCKET GetConectedSocket(LPCWSTR nordName,LPCWSTR port,int socktype,int addr_famiry,int protocol); +static INLINE SOCKET GetConectedSocket(LPCTSTR nordName,LPCTSTR port,int socktype,int addr_famiry,int protocol); StreamStatus_P NicoLiveStream_getStreamStatus(NicoLiveStream_P self){ @@ -154,12 +154,12 @@ BOOL Initialize_NicoLive(){ //ƒn[ƒgƒr[ƒgƒRƒ“ƒeƒi‰Šú‰» ZeroMemory(&heartBeatContainer,sizeof(heartBeatContainer)); - heartBeatContainer.is_restrictSize = sizeof(WCHAR) * LENGTH_1024; - heartBeatContainer.is_restrictBuff = (LPWSTR)calloc(1,heartBeatContainer.is_restrictSize); + heartBeatContainer.is_restrictSize = sizeof(TCHAR) * LENGTH_1024; + heartBeatContainer.is_restrictBuff = (LPTSTR)calloc(1,heartBeatContainer.is_restrictSize); heartBeatContainer.heartBeat.is_restrict = heartBeatContainer.is_restrictBuff; - heartBeatContainer.ticketSize = sizeof(WCHAR) * LENGTH_1024; - heartBeatContainer.ticketBuff = (LPWSTR)calloc(1,heartBeatContainer.ticketSize); + heartBeatContainer.ticketSize = sizeof(TCHAR) * LENGTH_1024; + heartBeatContainer.ticketBuff = (LPTSTR)calloc(1,heartBeatContainer.ticketSize); heartBeatContainer.heartBeat.ticket = heartBeatContainer.ticketBuff; InitializeCriticalSection(&heartBeatCs); @@ -407,12 +407,12 @@ INT_PTR NicoLiveStream_getResFrom(NicoLiveStream_P self){ return (-1) * self->res_from; } -NLIB_RESULT NicoLiveStream_connect(NicoLiveStream_P self,NicoVideoAuth_P nicoVideoAuth,LPCWSTR url,NicoRecvCallBack callback,LPVOID option){ +NLIB_RESULT NicoLiveStream_connect(NicoLiveStream_P self,NicoVideoAuth_P nicoVideoAuth,LPCTSTR url,NicoRecvCallBack callback,LPVOID option){ #define NICOLIVE_CONNECTIONSTREAM_COOKIE_COUNT 1 #define LIVENO_LENGTH LENGTH_NICOLIVEID - NLIB_RESULT rslt = NLIB_ERR_OK; + NLIB_RESULT rslt = NLIB_ERR_CODE_NOTSET; @@ -421,10 +421,10 @@ NLIB_RESULT NicoLiveStream_connect(NicoLiveStream_P self,NicoVideoAuth_P nicoVid //url‚©‚çÚ‘±”ԍ†‚𒊏o - LPCWSTR pInputLiveNo = url; - LPCWSTR psrech = wcsstr(url,L"http://"); - LPCWSTR pInputLiveNoEnd; - WCHAR liveNo[LIVENO_LENGTH] = {0}; + LPCTSTR pInputLiveNo = url; + LPCTSTR psrech = wcsstr(url,L"http://"); + LPCTSTR pInputLiveNoEnd; + TCHAR liveNo[LIVENO_LENGTH] = {0}; if(self == NULL)goto end; @@ -454,7 +454,7 @@ NLIB_RESULT NicoLiveStream_connect(NicoLiveStream_P self,NicoVideoAuth_P nicoVid if(pInputLiveNo == NULL){ - rslt = NLIB_LIVENO_FAILED_INPUT; + rslt = NLIB_LIVENO_IS_NULL; goto end; }else if(pInputLiveNoEnd - pInputLiveNo + 2 >= LIVENO_LENGTH - 1){ @@ -492,14 +492,14 @@ NLIB_RESULT NicoLiveStream_connect(NicoLiveStream_P self,NicoVideoAuth_P nicoVid { - WCHAR objectName[LENGTH_256] = {L"api/getplayerstatus?v="}; + TCHAR objectName[LENGTH_256] = {L"api/getplayerstatus?v="}; wcsncat(objectName,liveNo,sizeof(objectName) / sizeof(objectName[0])); - self->sessionManager.getPlayerStatusSession = WinHttpOpenRequest(hWatchLiveNicoConnect,L"GET",objectName,L"1.1",(LPCWSTR)WINHTTP_NO_REFERER,(LPCWSTR*)WINHTTP_DEFAULT_ACCEPT_TYPES,0); + self->sessionManager.getPlayerStatusSession = WinHttpOpenRequest(hWatchLiveNicoConnect,L"GET",objectName,L"1.1",(LPCTSTR)WINHTTP_NO_REFERER,(LPCTSTR*)WINHTTP_DEFAULT_ACCEPT_TYPES,0); } //ƒvƒŒƒCƒ„[ƒXƒe[ƒ^ƒXŽæ“¾ @@ -524,6 +524,8 @@ NLIB_RESULT NicoLiveStream_connect(NicoLiveStream_P self,NicoVideoAuth_P nicoVid self->isConnecting = TRUE; + + rslt = NLIB_ERR_OK; //nicoLiveHistory‚ðŽæ“¾(•K—v‚È‚µH) //GetNicoLiveHistory(self,hWatchLiveNicVideo); @@ -537,10 +539,10 @@ end: NLIB_RESULT NicoLiveStream_sendHeartBeat(NicoLiveStream_P self){ - NLIB_RESULT rslt = NLIB_ERR_OK; + NLIB_RESULT rslt = NLIB_ERR_CODE_NOTSET; if(self->isConnecting == FALSE){ - rslt = NLIB_ERR_NOT_CONNECT; + rslt = NLIB_ERR_NOT_LIVECONNECT; goto end; } if(self == NULL || self->playerStatus.error != NLIB_ERR_OK){ @@ -558,9 +560,9 @@ NLIB_RESULT NicoLiveStream_sendHeartBeat(NicoLiveStream_P self){ const UINT_PTR buflen = LENGTH_65536; LPVOID buffer = self->sessionManager.buffer; - LPWSTR objectName = (LPWSTR)buffer; - LPWSTR indexPtr; - //LPWSTR sendBuffer = (LPWSTR)&objectName[LENGTH_4096]; + LPTSTR objectName = (LPTSTR)buffer; + LPTSTR indexPtr; + //LPTSTR sendBuffer = (LPTSTR)&objectName[LENGTH_4096]; LPSTR recvBuffer = (LPSTR)&objectName[LENGTH_4096]; DWORD readSize; DWORD statusCode; @@ -579,7 +581,7 @@ NLIB_RESULT NicoLiveStream_sendHeartBeat(NicoLiveStream_P self){ if(self->sessionManager.heartBeatSession == NULL){ - self->sessionManager.heartBeatSession = WinHttpOpenRequest(hWatchLiveNicoConnect,L"GET",objectName,L"1.1",(LPCWSTR)WINHTTP_NO_REFERER,(LPCWSTR*)WINHTTP_DEFAULT_ACCEPT_TYPES,0); + self->sessionManager.heartBeatSession = WinHttpOpenRequest(hWatchLiveNicoConnect,L"GET",objectName,L"1.1",(LPCTSTR)WINHTTP_NO_REFERER,(LPCTSTR*)WINHTTP_DEFAULT_ACCEPT_TYPES,0); } if(WinHttpSendRequest(self->sessionManager.heartBeatSession,self->userSession,-1,WINHTTP_NO_REQUEST_DATA,0,0,0) == FALSE){ @@ -645,6 +647,8 @@ NLIB_RESULT NicoLiveStream_sendHeartBeat(NicoLiveStream_P self){ } + + rslt = NLIB_ERR_OK; connectend: ZeroMemory(self->sessionManager.buffer,sizeof(self->sessionManager.buffer)); LeaveCriticalSection(&self->sessionManager.cs); @@ -700,9 +704,9 @@ end: #define NICOLIVE_SENDCHATBUFLEN LENGTH_4096 #define NICOLIVE_SENDFORMAT "%S" -NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCWSTR chatbuf,LPCWSTR *mail,LPCWSTR *extends){ +NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCTSTR chatbuf,LPCTSTR *mail,LPCTSTR *extends){ - NLIB_RESULT rslt = NLIB_ERR_OK; + NLIB_RESULT rslt = NLIB_ERR_CODE_NOTSET; EnterCriticalSection(&self->sessionManager.cs); { @@ -711,8 +715,8 @@ NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCWSTR chatbuf,LPCWST LPSTR postKey; LPSTR postKeyBuf = (LPSTR)chunk; - LPWSTR postKeyReqBuf = (LPWSTR)&postKeyBuf[NICOLIVE_SENDCHATBUFLEN]; - LPWSTR cookieBuf = &postKeyReqBuf[NICOLIVE_SENDCHATBUFLEN]; + LPTSTR postKeyReqBuf = (LPTSTR)&postKeyBuf[NICOLIVE_SENDCHATBUFLEN]; + LPTSTR cookieBuf = &postKeyReqBuf[NICOLIVE_SENDCHATBUFLEN]; DWORD statusCode; DWORD statusCodeSize = sizeof(statusCode); DWORD readSize; @@ -722,13 +726,13 @@ NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCWSTR chatbuf,LPCWST if(self->isConnecting == FALSE){ - rslt = NLIB_ERR_NOT_CONNECT; - goto end; + rslt = NLIB_ERR_NOT_LIVECONNECT; + goto errorend; } if(chatbuf == NULL || wcslen(chatbuf) >= LENGTH_1024){ rslt = NLIB_ERR_BUFFER_TOOLITTLE; - goto end; + goto errorend; } @@ -737,7 +741,7 @@ NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCWSTR chatbuf,LPCWST _swprintf(postKeyReqBuf,L"api/getpostkey?thread=%u&block_no=%u",self->playerStatus.ms.thread,self->chatManager.chatNo / 100); //hWatchLiveNicoVideo = WinHttpConnect(hHttpSession,WTEXT(WATCH_LIVE_NICO_VIDEO_DOMEINNAME),INTERNET_DEFAULT_HTTP_PORT,0); - hGetPostKeySession = WinHttpOpenRequest(hWatchLiveNicoConnect,L"GET",postKeyReqBuf,L"1.1",(LPCWSTR)WINHTTP_NO_REFERER,(LPCWSTR*)WINHTTP_DEFAULT_ACCEPT_TYPES,0); + hGetPostKeySession = WinHttpOpenRequest(hWatchLiveNicoConnect,L"GET",postKeyReqBuf,L"1.1",(LPCTSTR)WINHTTP_NO_REFERER,(LPCTSTR*)WINHTTP_DEFAULT_ACCEPT_TYPES,0); //_swprintf(cookieBuf,L"Cookie: %s; %s",self->userSession,self->nicoLiveHistory); @@ -745,29 +749,29 @@ NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCWSTR chatbuf,LPCWST if(WinHttpSendRequest(hGetPostKeySession,self->userSession,-1,WINHTTP_NO_REQUEST_DATA,0,0,0) == FALSE){ - rslt = NLIB_GETPLAYERSTATUS_FAILED_CONNECT; - goto end; + rslt = NLIB_ERR_LIVE_GETPOSTKEY_FAILED; + goto errorend; } if(WinHttpReceiveResponse(hGetPostKeySession,NULL) == FALSE){ - rslt = NLIB_GETPLAYERSTATUS_FAILED_CONNECT; - goto end; + rslt = NLIB_ERR_LIVE_GETPOSTKEY_FAILED; + goto errorend; } if (WinHttpQueryHeaders(hGetPostKeySession,WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER,WINHTTP_HEADER_NAME_BY_INDEX,&statusCode,&statusCodeSize,WINHTTP_NO_HEADER_INDEX) == FALSE){ - rslt = NLIB_GETPLAYERSTATUS_FAILED_CONNECT; - goto end; + rslt = NLIB_ERR_LIVE_GETPOSTKEY_FAILED; + goto errorend; } if (HTTP_STATUS_OK != statusCode){ - rslt = NLIB_GETPLAYERSTATUS_FAILED_CONNECT; - goto end; + rslt = NLIB_ERR_LIVE_GETPOSTKEY_FAILED; + goto errorend; } @@ -776,8 +780,8 @@ NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCWSTR chatbuf,LPCWST if(ReadHttpBody(hGetPostKeySession,(LPBYTE)postKeyBuf,buflen,&readSize) == FALSE){ - rslt = NLIB_GETPLAYERSTATUS_FAILED_CONNECT; - goto end; + rslt = NLIB_ERR_LIVE_GETPOSTKEY_FAILED; + goto errorend; } postKeyBuf[readSize] = '\0'; @@ -805,7 +809,7 @@ NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCWSTR chatbuf,LPCWST len = NICOLIVE_SENDCHATBUFLEN - (indexPtr - mailBuf) - 1; if(GetLenToMB(CP_UTF8,mail[0]) >= len){ rslt = NLIB_ERR_BUFFER_TOOLITTLE; - goto end; + goto errorend; } @@ -823,7 +827,7 @@ NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCWSTR chatbuf,LPCWST if(GetLenToMB(CP_UTF8,mail[0]) >= len){ rslt = NLIB_ERR_BUFFER_TOOLITTLE; - goto end; + goto errorend; } @@ -854,7 +858,7 @@ NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCWSTR chatbuf,LPCWST if(GetLenToMB(CP_UTF8,extends[0]) >= len){ rslt = NLIB_ERR_BUFFER_TOOLITTLE; - goto end; + goto errorend; } WideToMB(CP_UTF8,extends[0],indexPtr,len); @@ -869,7 +873,7 @@ NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCWSTR chatbuf,LPCWST if(GetLenToMB(CP_UTF8,extends[1]) >= len){ rslt = NLIB_ERR_BUFFER_TOOLITTLE; - goto end; + goto errorend; } WideToMB(CP_UTF8,extends[1],indexPtr,len); @@ -884,7 +888,7 @@ NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCWSTR chatbuf,LPCWST if(GetLenToMB(CP_UTF8,extends[0]) >= len){ rslt = NLIB_ERR_BUFFER_TOOLITTLE; - goto end; + goto errorend; } WideToMB(CP_UTF8,extends[0],indexPtr,len); @@ -899,7 +903,7 @@ NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCWSTR chatbuf,LPCWST if(GetLenToMB(CP_UTF8,extends[1]) >= len){ rslt = NLIB_ERR_BUFFER_TOOLITTLE; - goto end; + goto errorend; } WideToMB(CP_UTF8,extends[1],indexPtr,len); @@ -983,9 +987,9 @@ NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCWSTR chatbuf,LPCWST strcpy(indexPtr,">"); indexPtr += strlen(indexPtr); { - LPWSTR sendBuf = (LPWSTR)&buffer[NICOLIVE_SENDCHATBUFLEN * 4]; - LPWSTR sendPtr = sendBuf; - LPCWSTR endPtr= chatbuf + wcslen(chatbuf); + LPTSTR sendBuf = (LPTSTR)&buffer[NICOLIVE_SENDCHATBUFLEN * 4]; + LPTSTR sendPtr = sendBuf; + LPCTSTR endPtr= chatbuf + wcslen(chatbuf); //convertTEXT(indexPtr,chatbuf,indexPtr,endPtr); @@ -1043,14 +1047,15 @@ NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCWSTR chatbuf,LPCWST } } + rslt = NLIB_ERR_OK; -end: +errorend: - WinHttpCloseHandle(hGetPostKeySession); + WinHttpCloseHandle(hGetPostKeySession); - ZeroMemory(self->sessionManager.buffer,sizeof(self->sessionManager.buffer)); - LeaveCriticalSection(&self->sessionManager.cs); - } + ZeroMemory(self->sessionManager.buffer,sizeof(self->sessionManager.buffer)); + LeaveCriticalSection(&self->sessionManager.cs); + } @@ -1070,7 +1075,7 @@ end: -NLIB_RESULT GetPlayerStatus(NicoLivePlayerStatus_P self,LPCWSTR userSession,HINTERNET hConnect,LPVOID buffer){ +NLIB_RESULT GetPlayerStatus(NicoLivePlayerStatus_P self,LPCTSTR userSession,HINTERNET hConnect,LPVOID buffer){ NLIB_RESULT rslt = NLIB_ERR_OK; @@ -1080,7 +1085,7 @@ NLIB_RESULT GetPlayerStatus(NicoLivePlayerStatus_P self,LPCWSTR userSession,HINT //HINTERNET hGetPlayerStatusRequest = NULL; const UINT_PTR buflen = LENGTH_65536; //LPVOID buffer = ; - //LPWSTR sendBuffer; + //LPTSTR sendBuffer; LPSTR recvBuffer = (LPSTR)buffer; DWORD readSize; DWORD statusCode; @@ -1165,8 +1170,8 @@ static INLINE NLIB_RESULT GetNicoLiveHistory(NicoLiveStream_P self,HINTERNET hCo HINTERNET hStreamBrowse = NULL; - WCHAR objectName[GETNICOLIVEHIS_OBJNAMELENGTH] = {L"/watch/"}; - WCHAR cookie[GETNICOLIVEHIS_COOKIELENGTH] = {L"Cookie: "}; + TCHAR objectName[GETNICOLIVEHIS_OBJNAMELENGTH] = {L"/watch/"}; + TCHAR cookie[GETNICOLIVEHIS_COOKIELENGTH] = {L"Cookie: "}; DWORD statusCode; DWORD statusCodeSize = sizeof(statusCode); DWORD chunkSize = LENGTH_65536; @@ -1174,7 +1179,7 @@ static INLINE NLIB_RESULT GetNicoLiveHistory(NicoLiveStream_P self,HINTERNET hCo - LPWSTR buffer = (LPWSTR)chunkSize; + LPTSTR buffer = (LPTSTR)chunkSize; @@ -1193,7 +1198,7 @@ static INLINE NLIB_RESULT GetNicoLiveHistory(NicoLiveStream_P self,HINTERNET hCo - hStreamBrowse = WinHttpOpenRequest(hNicoVideoConnect,L"GET",objectName,L"1.1",(LPCWSTR)WINHTTP_NO_REFERER,(LPCWSTR*)WINHTTP_DEFAULT_ACCEPT_TYPES,0); + hStreamBrowse = WinHttpOpenRequest(hNicoVideoConnect,L"GET",objectName,L"1.1",(LPCTSTR)WINHTTP_NO_REFERER,(LPCTSTR*)WINHTTP_DEFAULT_ACCEPT_TYPES,0); @@ -1231,9 +1236,9 @@ static INLINE NLIB_RESULT GetNicoLiveHistory(NicoLiveStream_P self,HINTERNET hCo } { - LPWSTR start =wcsstr(buffer,L"nicolivehistory="); + LPTSTR start =wcsstr(buffer,L"nicolivehistory="); - LPWSTR end = wcsstr(start,L";"); + LPTSTR end = wcsstr(start,L";"); UINT_PTR length = end - start; @@ -1389,7 +1394,7 @@ static VOID OnSendHeartBeat(NicoLiveStream_P self){ static VOID OnSendKeepAllive(NicoLiveStream_P self){ if(self->chatManager.keapALiveFlag){ - LPCWSTR mail[2] = {L"184",NULL}; + LPCTSTR mail[2] = {L"184",NULL}; NicoLiveStream_sendChat(self,L"/keapalive",mail,NULL); } @@ -1402,9 +1407,9 @@ static unsigned int WINAPI NicoLiveRecvChat(void* lpBuffer){ unsigned int rslt = 0; - //LPWSTR user_id = NULL; - //LPWSTR name = NULL; - //LPWSTR chatBuf = NULL; + //LPTSTR user_id = NULL; + //LPTSTR name = NULL; + //LPTSTR chatBuf = NULL; @@ -1543,8 +1548,8 @@ static BOOL NicoLiveRecvChatLoop(NicoLiveStream_P self){ //ƒRƒƒ“ƒgŽóMˆ— // BOOL rslt = TRUE; //Œ‹‰Ê - LPWSTR commentBuf = NULL; //ƒRƒƒ“ƒgƒoƒbƒtƒ@ - LPWSTR* mailCountBuf = NULL; //ƒ[ƒ‹ƒ|ƒCƒ“ƒ^ƒoƒbƒtƒ@ + LPTSTR commentBuf = NULL; //ƒRƒƒ“ƒgƒoƒbƒtƒ@ + LPTSTR* mailCountBuf = NULL; //ƒ[ƒ‹ƒ|ƒCƒ“ƒ^ƒoƒbƒtƒ@ INT_PTR recevedLen; //ŽóM•¶Žš—ñ’· INT_PTR messageBufLen; //ƒoƒbƒtƒ@’· @@ -1555,8 +1560,8 @@ static BOOL NicoLiveRecvChatLoop(NicoLiveStream_P self){ DWORD dwResult; //ƒCƒxƒ“ƒg‚ªƒEƒFƒCƒgŠÖ”‚ÌŒ‹‰Ê‚ðŠi”[‚·‚é•Ï” - SIZE_T commentBufSize = sizeof(WCHAR) * LENGTH_2048; //ƒRƒƒ“ƒgƒoƒbƒtƒ@’· - SIZE_T mailCountBufSize = sizeof(LPWSTR) * LENGTH_256; //ƒ[ƒ‹‚̃|ƒCƒ“ƒ^—pƒoƒbƒtƒ@’· + SIZE_T commentBufSize = sizeof(TCHAR) * LENGTH_2048; //ƒRƒƒ“ƒgƒoƒbƒtƒ@’· + SIZE_T mailCountBufSize = sizeof(LPTSTR) * LENGTH_256; //ƒ[ƒ‹‚̃|ƒCƒ“ƒ^—pƒoƒbƒtƒ@’· WSAEVENT hRecvEvent = NULL; @@ -1569,8 +1574,8 @@ static BOOL NicoLiveRecvChatLoop(NicoLiveStream_P self){ hEventArray[0] = hRecvEvent; hEventArray[1] = self->chatManager.endEvent; - commentBuf = (LPWSTR)malloc(commentBufSize); - mailCountBuf = (LPWSTR*)malloc(mailCountBufSize); + commentBuf = (LPTSTR)malloc(commentBufSize); + mailCountBuf = (LPTSTR*)malloc(mailCountBufSize); //Ø’f‚³‚ê‚é‚܂Ń‹[ƒv while(1){ @@ -1651,24 +1656,24 @@ end: -static VOID NicoLiveParseComment(NicoLiveStream_P self,LPWSTR commentBuf,UINT_PTR endSize,LPWSTR* mailCountBuf,SIZE_T* mailCountBufSize,SIZE_T* commentBufSize){ +static VOID NicoLiveParseComment(NicoLiveStream_P self,LPTSTR commentBuf,UINT_PTR endSize,LPTSTR* mailCountBuf,SIZE_T* mailCountBufSize,SIZE_T* commentBufSize){ - LPWSTR indexPtr; //‰ðÍŽž‚ÌŽw•Wƒ|ƒCƒ“ƒ^ + LPTSTR indexPtr; //‰ðÍŽž‚ÌŽw•Wƒ|ƒCƒ“ƒ^ NicoLiveChat nicoLiveChat; //ƒ`ƒƒƒbƒgƒRƒƒ“ƒgŠi”[—p\‘¢‘Ì NicoLiveThreadComment nicoLiveThreadComment; //Ú‘±‰ž“šƒRƒƒ“ƒgŠi”[—p\‘¢‘Ì NicoLiveSendResultComment nicoLiveSendResultComment; //‘—M‰ž“šƒRƒƒ“ƒgŠi”[—p\‘¢‘Ì NicoLiveChat nicoLiveChatBase; //ƒ`ƒƒƒbƒgƒRƒƒ“ƒgŠî’ê\‘¢‘Ì NicoLiveThreadComment nicoLiveThreadCommentBase; //Ú‘±‰ž“šƒRƒƒ“ƒgŠî’ê\‘¢‘Ì NicoLiveSendResultComment nicoLiveSendResultCommentBase;//‘—M‰ž“šƒRƒƒ“ƒgŠî’ê\‘¢‘Ì - LPWSTR attrNameStart; //‘®«–¼ŠJŽnƒ|ƒCƒ“ƒ^ - LPWSTR attrNameEnd; //‘®«–¼I—¹ƒ|ƒCƒ“ƒ^ - LPWSTR attrValueStart; //‘®«’lŠJŽnƒ|ƒCƒ“ƒ^ - LPWSTR attrValueEnd; //‘®«’lI—¹ƒ|ƒCƒ“ƒ^ + LPTSTR attrNameStart; //‘®«–¼ŠJŽnƒ|ƒCƒ“ƒ^ + LPTSTR attrNameEnd; //‘®«–¼I—¹ƒ|ƒCƒ“ƒ^ + LPTSTR attrValueStart; //‘®«’lŠJŽnƒ|ƒCƒ“ƒ^ + LPTSTR attrValueEnd; //‘®«’lI—¹ƒ|ƒCƒ“ƒ^ INT_PTR nameLen; //‘®«‚Ì–¼‘O‚Ì’·‚³ - LPWSTR mailIndexPtr; //ƒ[ƒ‹‘®«’l‰ðÍ—pŽw•Wƒ|ƒCƒ“ƒ^ - LPWSTR xmlTextPtr; //xmlƒeƒLƒXƒgŒ`Ž®‚̃f[ƒ^‰ðÍŽž‚ÉŽg—p‚·‚éƒ|ƒCƒ“ƒ^ - LPWSTR xmlTextEnd; //xmlƒeƒLƒXƒgI—¹ƒ|ƒCƒ“ƒ^ - LPWSTR* mailIndex; //ƒ[ƒ‹ƒRƒ}ƒ“ƒhƒŠƒXƒgƒ|ƒCƒ“ƒ^ + LPTSTR mailIndexPtr; //ƒ[ƒ‹‘®«’l‰ðÍ—pŽw•Wƒ|ƒCƒ“ƒ^ + LPTSTR xmlTextPtr; //xmlƒeƒLƒXƒgŒ`Ž®‚̃f[ƒ^‰ðÍŽž‚ÉŽg—p‚·‚éƒ|ƒCƒ“ƒ^ + LPTSTR xmlTextEnd; //xmlƒeƒLƒXƒgI—¹ƒ|ƒCƒ“ƒ^ + LPTSTR* mailIndex; //ƒ[ƒ‹ƒRƒ}ƒ“ƒhƒŠƒXƒgƒ|ƒCƒ“ƒ^ BOOL isReceveChat = FALSE; //ƒ`ƒƒƒbƒgŽóMƒtƒ‰ƒO SIZE_T commentSizeCh; //ŽóM‚µ‚½ƒRƒƒ“ƒg‚ðƒ†ƒjƒR[ƒh‚É•ÏŠ·‚·‚é‚Æ‚«‚Ì’·‚³ LPSTR recvBufTmp; //ŽóM•¶Žš—ñ‘€ì—pƒ|ƒCƒ“ƒ^ @@ -1710,8 +1715,8 @@ static VOID NicoLiveParseComment(NicoLiveStream_P self,LPWSTR commentBuf,UINT_P for (;recvBufTmp + strlen(recvBufTmp) < recvEndPoint;recvBufTmp += strlen(recvBufTmp) + 1){ - commentSizeCh = sizeof(WCHAR) * GetLenToWide(CP_UTF8,recvBufTmp); - extendMalloc(commentBuf,LPWSTR,*commentBufSize,commentSizeCh); + commentSizeCh = sizeof(TCHAR) * GetLenToWide(CP_UTF8,recvBufTmp); + extendMalloc(commentBuf,LPTSTR,*commentBufSize,commentSizeCh); MBToWide(CP_UTF8,recvBufTmp,commentBuf,*commentBufSize); traceln(TEXT("comment:\r\n%s"),commentBuf); @@ -1831,7 +1836,7 @@ static VOID NicoLiveParseComment(NicoLiveStream_P self,LPWSTR commentBuf,UINT_P } - extendMalloc(mailCountBuf,LPWSTR*,*mailCountBufSize,nicoLiveChat.mailCount); + extendMalloc(mailCountBuf,LPTSTR*,*mailCountBufSize,nicoLiveChat.mailCount); nicoLiveChat.mail = mailCountBuf; mailCountBuf[0] = NULL; @@ -1973,7 +1978,7 @@ static void NicoLiveSelfDisconnect(void *buf){ } -static INLINE SOCKET GetConectedSocket(LPCWSTR nordName,LPCWSTR port,int socktype,int addr_famiry,int protocol){ +static INLINE SOCKET GetConectedSocket(LPCTSTR nordName,LPCTSTR port,int socktype,int addr_famiry,int protocol){ SOCKET rslt = INVALID_SOCKET; @@ -2032,4 +2037,77 @@ static INLINE SOCKET GetConectedSocket(LPCWSTR nordName,LPCWSTR port,int socktyp return rslt; +} + + +// +//ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒXŠÖ˜A +// + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚ÌID‚ðŽæ“¾ +/// +NLIB_DECLSPEC LPCTSTR StreamStatus_getId(StreamStatus_P self){ + + return self->id; +} + + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚̃Rƒ~ƒ…ƒjƒeƒB”ԍ†‚ðŽæ“¾ +/// +NLIB_DECLSPEC LPCTSTR StreamStatus_getDefaultCommunity(StreamStatus_P self){ + + return self->default_community; +} + + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚̃vƒƒoƒCƒ_ƒ^ƒCƒv‚ðŽæ“¾ +/// +PROVIDERTYPE StreamStatus_getProviderType(StreamStatus_P self){ + + return self->provider_type; +} + + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚̃I[ƒi[ƒtƒ‰ƒO‚ðŽæ“¾ +/// +BOOL StreamStatus_isOwner(StreamStatus_P self){ + + return self->is_owner; +} + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚ÌŠJŽnŽž‚ðŽæ“¾ +/// +time_t StreamStatus_getStartTime(StreamStatus_P self){ + + return self->start_time; +} + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚̏I—¹Žž‚ðŽæ“¾ +/// +time_t StreamStatus_getEndTime(StreamStatus_P self){ + + return self->end_time; +} + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚ÌŠJêŽž‚ðŽæ“¾ +/// +time_t StreamStatus_getOpenTime(StreamStatus_P self){ + + return self->open_time; + +} + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚̃x[ƒXŽž‚ðŽæ“¾ +/// +time_t StreamStatus_getBaseTime(StreamStatus_P self){ + + return self->base_time; } \ No newline at end of file diff --git a/nlib/nlib_nicoLive.h b/nlib/nlib_nicoLive.h index 2f7f871..cbf9cb1 100644 --- a/nlib/nlib_nicoLive.h +++ b/nlib/nlib_nicoLive.h @@ -17,9 +17,9 @@ typedef VOID(*NicoLiveOnSend)(NicoLiveStream_P self); typedef struct { NicoLiveHeartBeat heartBeat; - LPWSTR is_restrictBuff; + LPTSTR is_restrictBuff; INT_PTR is_restrictSize; - LPWSTR ticketBuff; + LPTSTR ticketBuff; INT_PTR ticketSize; NLIB_RESULT error; @@ -60,13 +60,26 @@ typedef struct { time_t baseVpos; }ChatManager,*ChatManager_P; - +/// +///¶•ú‘—ƒXƒe[ƒ^ƒX +/// +typedef struct streamstatus_t{ + + TCHAR id[LENGTH_128]; + TCHAR default_community[LENGTH_128]; + PROVIDERTYPE provider_type; + BOOL is_owner; + time_t start_time; + time_t end_time; + time_t open_time; + time_t base_time; +}StreamStatus,*StreamStatus_P; ///ƒƒbƒZ[ƒWƒT[ƒo[ƒXƒe[ƒ^ƒX typedef struct messageserver_t{ - WCHAR addr[LENGTH_IP]; - WCHAR port[LENGTH_32]; + TCHAR addr[LENGTH_IP]; + TCHAR port[LENGTH_32]; UINT_PTR thread; @@ -77,8 +90,8 @@ typedef struct messageserver_t{ typedef struct{ UINT_PTR is_premium; - WCHAR user_id[LENGTH_128]; - WCHAR userDomain[LENGTH_128]; + TCHAR user_id[LENGTH_128]; + TCHAR userDomain[LENGTH_128]; }NicoLivePSOwn,*NicoLivePSOwn_P; @@ -103,9 +116,9 @@ typedef struct { #define NICOLIVEHISTORY_LENGTH LENGTH_256 typedef struct nicolivestream_t{ - WCHAR userSession[USERSESSION_LENGTH]; - WCHAR nicoLiveHistory[NICOLIVEHISTORY_LENGTH]; - WCHAR ticket[LENGTH_256]; + TCHAR userSession[USERSESSION_LENGTH]; + TCHAR nicoLiveHistory[NICOLIVEHISTORY_LENGTH]; + TCHAR ticket[LENGTH_256]; LPVOID option; NicoLivePlayerStatus playerStatus; ChatManager chatManager; diff --git a/nlib/nlib_nicoVideoAuth.c b/nlib/nlib_nicoVideoAuth.c index f5abaa3..8dd4ba2 100644 --- a/nlib/nlib_nicoVideoAuth.c +++ b/nlib/nlib_nicoVideoAuth.c @@ -22,13 +22,15 @@ VOID NicoVideoAuth_delete(NicoVideoAuth_P* self){ NLIB_RESULT NicoVideoAuth_getNicoVideoAuth(NicoVideoAuth_P self,BROWSERTYPE browserType){ - + NLIB_RESULT rslt = NLIB_ERR_CODE_NOTSET; //ƒNƒbƒL[‚̎擾 if( GetCookie(browserType,self->userSession,sizeof(self->userSession),L"user_session",WTEXT(NICO_VIDEO_DOMEINNAME)) != COOKIE_ERR_OK){ - - return NLIB_ERR_COOKIE_FAILED; + rslt = NLIB_ERR_COOKIE_FAILED; + goto end; } + rslt = NLIB_ERR_OK; +end: - return NLIB_ERR_OK; + return rslt; } \ No newline at end of file diff --git a/nlib/nlib_xmlHandler.c b/nlib/nlib_xmlHandler.c index f2c5984..4f26e4a 100644 --- a/nlib/nlib_xmlHandler.c +++ b/nlib/nlib_xmlHandler.c @@ -41,12 +41,12 @@ enum NicoLiveHeartBeat_NORD{ #define StrCpyArray(buf,pszData,nLength) StrCpy(buf,sizeof(buf) / sizeof(buf[0]),pszData,nLength) -static INLINE NLIB_RESULT StrCpy(LPWSTR buf,UINT_PTR buflen,LPCWSTR pszData,UINT_PTR nLength); +static INLINE NLIB_RESULT StrCpy(LPTSTR buf,UINT_PTR buflen,LPCTSTR pszData,UINT_PTR nLength); /// ///UTF8•ÏŠ·“à•”ŠÖ” /// -static INLINE VOID ToUTF8(LPSTR buf,LPCWSTR input,INT_PTR nLength,INT_PTR maxLength); +static INLINE VOID ToUTF8(LPSTR buf,LPCTSTR input,INT_PTR nLength,INT_PTR maxLength); @@ -445,7 +445,7 @@ void NPlayerStatus_CharacterDataHandler(void *userData,const XML_Char *pszData,i }else if(_tcsncmp(pszData,TEXT("require_accept_print_timeshift_ticket"),nLength) == 0) { - ps->error = NLIB_ERR_GETPLAYERSTATUS_NOT_REQUIRE_ACCEPT_PRINT_TIMESHIFT_TICKET; + ps->error = NLIB_ERR_GETPLAYERSTATUS_REQUIRE_ACCEPT_PRINT_TIMESHIFT_TICKET; }else if(_tcsncmp(pszData,TEXT("access_locked"),nLength) == 0) { @@ -499,7 +499,7 @@ extern void NPlayerStatus_ElementEndHandler(void *userData,const XML_Char *pszNa } -static INLINE NLIB_RESULT StrCpy(LPWSTR buf,UINT_PTR buflen,LPCWSTR pszData,UINT_PTR nLength){ +static INLINE NLIB_RESULT StrCpy(LPTSTR buf,UINT_PTR buflen,LPCTSTR pszData,UINT_PTR nLength){ if(nLength >= buflen){ return NLIB_ERR_BUFFER_TOOLITTLE; @@ -627,7 +627,7 @@ void NicoLiveHeartBeat_CharacterDataHandler(void *userData,const XML_Char *pszDa //heartbeat/is_restrict case MAKENORD1(NicoLiveHeartBeat_HEARTBEAT,NicoLiveHeartBeat_IS_RESTRICT): - extendMalloc(hbc->is_restrictBuff,LPWSTR,hbc->is_restrictSize,(INT_PTR)sizeof(WCHAR) * nLength); + extendMalloc(hbc->is_restrictBuff,LPTSTR,hbc->is_restrictSize,(INT_PTR)sizeof(TCHAR) * nLength); wcsncpy(hbc->is_restrictBuff,pszData,nLength); @@ -638,7 +638,7 @@ void NicoLiveHeartBeat_CharacterDataHandler(void *userData,const XML_Char *pszDa //heartbeat/ticket case MAKENORD1(NicoLiveHeartBeat_HEARTBEAT,NicoLiveHeartBeat_TICKET): - extendMalloc(hbc->ticketBuff,LPWSTR,hbc->ticketSize,(INT_PTR)sizeof(WCHAR) * nLength); + extendMalloc(hbc->ticketBuff,LPTSTR,hbc->ticketSize,(INT_PTR)sizeof(TCHAR) * nLength); wcsncpy(hbc->ticketBuff,pszData,nLength); @@ -660,7 +660,7 @@ void NicoLiveHeartBeat_ElementEndHandler(void *userData,const XML_Char *pszName) } -static INLINE VOID ToUTF8(LPSTR buf,LPCWSTR input,INT_PTR nLength,INT_PTR maxLength){ +static INLINE VOID ToUTF8(LPSTR buf,LPCTSTR input,INT_PTR nLength,INT_PTR maxLength){ if(WideCharToMultiByte(CP_UTF8,0,input,nLength,(LPSTR)NULL,0,(LPCSTR)NULL,(LPBOOL)NULL) > maxLength){ diff --git a/nlib_driver/nlib_driver.cpp b/nlib_driver/nlib_driver.cpp index 991c8fc..660f54a 100644 --- a/nlib_driver/nlib_driver.cpp +++ b/nlib_driver/nlib_driver.cpp @@ -154,7 +154,7 @@ NLIB_RESULT callback(NICOLIVE_EVENT eventType,NicoLiveStream_P pNicoLiveStream,L NLIB_RESULT myListCallBack(LPVOID option,NicoMyListItem_P pVideo){ - dumpln(TEXT("video_id:%s"),pVideo->itemData.video_id); +// dumpln(TEXT("video_id:%s"),pVideo->itemData.video_id); @@ -164,7 +164,7 @@ NLIB_RESULT myListCallBack(LPVOID option,NicoMyListItem_P pVideo){ static NLIB_RESULT myListGroupCallBack(LPVOID option,NicoMyList_P pMyList){ WCHAR buf[256]; NLIB_RESULT rslt; - wcscpy(buf,pMyList->id); +// wcscpy(buf,pMyList->id); dumpln(TEXT("id:%s"),buf); rslt = NicoMyList_getMyList(nva,buf,myListCallBack,NULL); @@ -214,6 +214,8 @@ void nicoLive_connect(void) { //Sleep(3000); + + return; } @@ -241,12 +243,17 @@ int _tmain(int argc, _TCHAR* argv[]) nicoLive_setup(); - nicoLive_connect(); - nicoLive_mylist(); + for(int index = 0; index <= NLIB_ERR_NOT_LIVECONNECT;index++){ + + idumpln(TEXT("errmessage:%s"),NLIB_GetErrorMessage(index)); + } + + //nicoLive_connect(); + //nicoLive_mylist(); nicoLive_teardown(); - getch(); + _getch(); return 0; } \ No newline at end of file diff --git a/nlib_driver/stdafx.h b/nlib_driver/stdafx.h index 756d442..8655d45 100644 --- a/nlib_driver/stdafx.h +++ b/nlib_driver/stdafx.h @@ -4,7 +4,7 @@ // #pragma once - +#define _CRT_NON_CONFORMING_SWPRINTFS 1 #include #include diff --git a/nlite.suo b/nlite.suo index e1b0d8a..0f6a60e 100644 Binary files a/nlite.suo and b/nlite.suo differ diff --git a/nlite/nlite.cpp b/nlite/nlite.cpp index 0b92f70..af5edc8 100644 --- a/nlite/nlite.cpp +++ b/nlite/nlite.cpp @@ -12,7 +12,7 @@ CAppModule _Module; -const CApplicationInfo* nlite::appInfo = NULL; +const CApplicationInfo * nlite::appInfo = NULL; static TCHAR localAppDataPath[_MAX_PATH]; static WSAData wsaData; //winsockdata @@ -168,3 +168,14 @@ static BOOL InitializeNlite(){ return; } + VOID nlite::UnexpectedErrorMessageShow(LPCTSTR headMessage,LPCTSTR summary){ + CNLiteString errMessage; + errMessage = headMessage; + errMessage += TEXT("‘z’肳‚ê‚Ä‚¢‚È‚¢ƒGƒ‰[‚ª”­¶‚µ‚Ü‚µ‚½BƒAƒvƒŠƒP[ƒVƒ‡ƒ“”z’uƒtƒHƒ‹ƒ_‚ɍ쐬‚³‚ꂽƒƒOƒtƒ@ƒCƒ‹‚ð“n‚µ‚Ä‚à‚炦‚é‚ÆŠJ”­ŽÒ‚ª”ñí‚ÉŠì‚Ñ‚Ü‚·"); + errMessage += TEXT("\r\nƒGƒ‰[ƒƒbƒZ[ƒW:"); + errMessage += summary; + ::MessageBox(NULL,errMessage,TEXT("‘z’肳‚ê‚Ä‚¢‚È‚¢ƒGƒ‰["),MB_ICONERROR | MB_OK); + + + return; + } \ No newline at end of file diff --git a/nlite/nlite.h b/nlite/nlite.h index 8f3de9b..d062803 100644 --- a/nlite/nlite.h +++ b/nlite/nlite.h @@ -4,11 +4,16 @@ namespace nlite{ + //ƒNƒ‰ƒXæséŒ¾ class CApplicationInfo; class CListenerList; - extern const CApplicationInfo* appInfo; + //ƒAƒvƒŠƒP[ƒVƒ‡ƒ“î•ñƒNƒ‰ƒX + extern const CApplicationInfo * appInfo; extern CListenerList listenerList; + extern VOID UnexpectedErrorMessageShow(LPCTSTR headMessage,LPCTSTR summary); + + #define NLITE_ERR_MESSAGE_FORMAT "ƒnƒ“ƒhƒ‹‚³‚ê‚Ä‚¢‚È‚¢ƒGƒ‰[:\r\n%s\r\ns”ԍ†:%d\r\nƒ\[ƒXƒtƒ@ƒCƒ‹:%s" diff --git a/nlite/nlite.vcxproj b/nlite/nlite.vcxproj index b21e8df..49ca203 100644 --- a/nlite/nlite.vcxproj +++ b/nlite/nlite.vcxproj @@ -129,9 +129,11 @@ + + Create Create diff --git a/nlite/nlite.vcxproj.filters b/nlite/nlite.vcxproj.filters index f535fab..ebb25a2 100644 --- a/nlite/nlite.vcxproj.filters +++ b/nlite/nlite.vcxproj.filters @@ -98,6 +98,12 @@ ソース ファイル + + ソース ファイル + + + ソース ファイル + diff --git a/nlite/nlite_appInfo.cpp b/nlite/nlite_appInfo.cpp index 2367e3f..c79d786 100644 --- a/nlite/nlite_appInfo.cpp +++ b/nlite/nlite_appInfo.cpp @@ -3,6 +3,9 @@ namespace nlite { + + + CApplicationInfo::CApplicationInfo(){ struct LANGANDCODEPAGE { @@ -105,4 +108,56 @@ CApplicationInfo::~CApplicationInfo(){ safeFree(pBlock); } +/// +///ƒVƒ“ƒOƒ‹ƒgƒ“ +/// +CApplicationInfo& CApplicationInfo::getInstance(){ + static CApplicationInfo appInfo; + return appInfo; + +} + + + +LPCTSTR CApplicationInfo::getProductVersion()const{ + + return pProductVersion; + +} + +LPCTSTR CApplicationInfo::getOriginalFileName()const{ + + return pOriginalFileName; + +} + +LPCTSTR CApplicationInfo::getLegalCopyright()const{ + + return pLegalCopyright; + +} + +LPCTSTR CApplicationInfo::getProcuctName() const{ + + return pProductName; +} + + +VOID CApplicationInfo::show() const { + + CNLiteString szApp; + CNLiteString szOtherStuff; + + + szApp = pOriginalFileName; + szApp += TEXT("‚̃AƒvƒŠƒP[ƒVƒ‡ƒ“î•ñ"); + + szOtherStuff = TEXT("ƒo[ƒWƒ‡ƒ“î•ñ: "); + szOtherStuff += pProductVersion; + szOtherStuff += TEXT("\r\n’˜ìŒ : "); + szOtherStuff += pLegalCopyright; + + ShellAbout(NULL,szApp,szOtherStuff,NULL); +} + } \ No newline at end of file diff --git a/nlite/nlite_appinfo.h b/nlite/nlite_appinfo.h index ce18bd5..8744989 100644 --- a/nlite/nlite_appinfo.h +++ b/nlite/nlite_appinfo.h @@ -21,23 +21,22 @@ namespace nlite{ LPTSTR pProductName; //»•i–¼ private: /// - ///ƒRƒ“ƒcƒgƒ‰ƒNƒ^ + ///ƒRƒ“ƒXƒgƒ‰ƒNƒ^ /// CApplicationInfo(); public: + + /// + ///ƒfƒXƒgƒ‰ƒNƒ^ + /// ~CApplicationInfo(); public: - /// ///ƒVƒ“ƒOƒ‹ƒgƒ“ /// - static CApplicationInfo& getInstance(){ - static CApplicationInfo appInfo; - return appInfo; - - } - + static CApplicationInfo& getInstance(); + @@ -45,45 +44,20 @@ namespace nlite{ //ƒQƒbƒ^[ // - LPCTSTR getProductVersion()const{ - - return pProductVersion; - - } - - LPCTSTR getOriginalFileName()const{ - - return pOriginalFileName; + LPCTSTR getProductVersion()const; - } + LPCTSTR getOriginalFileName()const; - LPCTSTR getLegalCopyright()const{ + LPCTSTR getLegalCopyright()const; - return pLegalCopyright; + LPCTSTR getProcuctName() const; - } - - LPCTSTR getProcuctName() const{ - - return pProductName; - } - - VOID show() const { - - CNLiteString szApp; - CNLiteString szOtherStuff; - - - szApp = pOriginalFileName; - szApp += TEXT("‚̃AƒvƒŠƒP[ƒVƒ‡ƒ“î•ñ"); - - szOtherStuff = TEXT("ƒo[ƒWƒ‡ƒ“î•ñ: "); - szOtherStuff += pProductVersion; - szOtherStuff += TEXT("\r\n’˜ìŒ : "); - szOtherStuff += pLegalCopyright; + /// + ///ƒEƒBƒ“ƒhƒE‚É•\Ž¦ + /// + VOID show() const; - ShellAbout(NULL,szApp,szOtherStuff,NULL); - } + }; } \ No newline at end of file diff --git a/nlite/nlite_chatData.cpp b/nlite/nlite_chatData.cpp index ae1f7a3..d36febd 100644 --- a/nlite/nlite_chatData.cpp +++ b/nlite/nlite_chatData.cpp @@ -21,6 +21,13 @@ struct ListenerPre{ }; +ListenerData::ListenerData(LPCTSTR user_id_in): +user_id(user_id_in), +userName(TEXT("")), +bkColor(RGB(0,0,0)), +originBkFlag(FALSE) +{} + VOID ListenerData::SetBkColor(COLORREF bkColor_in){ bkColor = bkColor_in; return; @@ -79,6 +86,7 @@ VOID CChatData::SetChat(NicoLiveChat &chat_in){ //ƒRƒƒ“ƒgƒŠƒXƒgƒNƒ‰ƒX ////////////////////////////////////////////////////////////////////////// +//‘I‘ðsŽæ“¾—pƒtƒ@ƒ“ƒNƒVƒ‡ƒiƒ‹ struct GetCurSelFunc_t{ INT_PTR count; diff --git a/nlite/nlite_chatData.h b/nlite/nlite_chatData.h index 7acd4cf..bd96ed3 100644 --- a/nlite/nlite_chatData.h +++ b/nlite/nlite_chatData.h @@ -22,14 +22,7 @@ namespace nlite{ COLORREF bkColor; BOOL originBkFlag; public: - ListenerData(LPCTSTR user_id_in): - user_id(user_id_in), - userName(TEXT("")), - bkColor(RGB(0,0,0)), - originBkFlag(FALSE) - { - - } + ListenerData(LPCTSTR user_id_in); VOID SetBkColor(COLORREF bkColor_in); diff --git a/nlite/nlite_commentWrite.cpp b/nlite/nlite_commentWrite.cpp index c80ed5e..b1021b1 100644 --- a/nlite/nlite_commentWrite.cpp +++ b/nlite/nlite_commentWrite.cpp @@ -19,50 +19,61 @@ const static UINT_PTR CHECKBUTTON_SUBSCRIPT_HEIGHT = 10; const static COLORREF MAX_COLOR = 0xFFFFFF; -const CommentColorInfo generalUser::COMMENT_COLORLIST[] = { - {TEXT("white"),RGB(0xFF,0xFF,0xFF)}, - {TEXT("red"),RGB(0xFF,0x00,0x00)}, - {TEXT("pink"),RGB(0xFF,0x80,0x80)}, - {TEXT("orange"),RGB(0xFF,0xC0,0x00)}, - {TEXT("yellow"),RGB(0xFF,0xFF,0x00)}, - {TEXT("green"),RGB(0x00,0xFF,0x00)}, - {TEXT("cyan"),RGB(0x00,0xFF,0xFF)}, - {TEXT("blue"),RGB(0x00,0x00,0xFF)}, - {TEXT("purple"),RGB(0xC0,0x00,0xFF)}, +namespace generalUser{ + const CommentColorInfo COMMENT_COLORLIST[] = { + {TEXT("white"),RGB(0xFF,0xFF,0xFF)}, //”’ + {TEXT("red"),RGB(0xFF,0x00,0x00)}, //Ô + {TEXT("pink"),RGB(0xFF,0x80,0x80)}, //ƒsƒ“ƒN + {TEXT("orange"),RGB(0xFF,0xC0,0x00)}, //ƒIƒŒƒ“ƒW + {TEXT("yellow"),RGB(0xFF,0xFF,0x00)}, //‰©F + {TEXT("green"),RGB(0x00,0xFF,0x00)}, //—Î + {TEXT("cyan"),RGB(0x00,0xFF,0xFF)}, //Š¦F + {TEXT("blue"),RGB(0x00,0x00,0xFF)}, //Â + {TEXT("purple"),RGB(0xC0,0x00,0xFF)}, //Ž‡ -}; - -const CommentColorInfo premiumUser::COMMENT_COLORLIST[] = { - {TEXT("black"),RGB(0x00,0x00,0x00)}, - {TEXT("white2"),RGB(0xCC,0xCC,0x99)}, - {TEXT("red2"),RGB(0xCC,0x00,0x33)}, - {TEXT("pink2"),RGB(0xFF,0x33,0xCC)}, - {TEXT("orange2"),RGB(0xFF,0x66,0x00)}, - {TEXT("yellow2"),RGB(0x99,0x99,0x00)}, - {TEXT("green2"),RGB(0x00,0xCC,0x66)}, - {TEXT("cyan2"),RGB(0x00,0xCC,0xCC)}, - {TEXT("blue2"),RGB(0x33,0x99,0xFF)}, - {TEXT("purple2"),RGB(0x66,0x33,0xCC)} -// {TEXT("black2"),RGB(0x66,0x66,0x66)} -}; - -const CommentSizeInfo generalUser::COMMENT_SIZELIST[] = { - {TEXT("•’ʁ@"),TEXT("medium")}, - {TEXT("¬@"),TEXT("small")} -}; - -const CommentSizeInfo premiumUser::COMMENT_SIZELIST[] = { - {TEXT("‘å@"),TEXT("big")} -}; - -const CommentPosInfo generalUser::COMMENT_POSLIST[] = { - {TEXT("’ʏí@"),TEXT("naka")} -}; - -const CommentPosInfo premiumUser::COMMENT_POSLIST[] = { - {TEXT("‰º@"),TEXT("shita")}, - {TEXT("ã@"),TEXT("ue")} -}; + }; + + const CommentSizeInfo COMMENT_SIZELIST[] = { + {TEXT("•’ʁ@"),TEXT("medium")}, //•’ʃTƒCƒY + {TEXT("¬@"),TEXT("small")} //¬ƒTƒCƒY + }; + + + const CommentPosInfo COMMENT_POSLIST[] = { + {TEXT("’ʏí@"),TEXT("naka")} //’ʏí•\Ž¦ + }; +} + +namespace premiumUser{ + + const CommentColorInfo COMMENT_COLORLIST[] = { + {TEXT("black"),RGB(0x00,0x00,0x00)}, //• + {TEXT("white2"),RGB(0xCC,0xCC,0x99)}, //”’‚»‚Ì‚Q + {TEXT("red2"),RGB(0xCC,0x00,0x33)}, //Ô‚»‚Ì‚Q + {TEXT("pink2"),RGB(0xFF,0x33,0xCC)}, //ƒsƒ“ƒN‚»‚Ì‚Q + {TEXT("orange2"),RGB(0xFF,0x66,0x00)}, //ƒIƒŒƒ“ƒW‚»‚Ì‚Q + {TEXT("yellow2"),RGB(0x99,0x99,0x00)}, //‰©F‚»‚Ì‚Q + {TEXT("green2"),RGB(0x00,0xCC,0x66)}, //—΂»‚Ì‚Q + {TEXT("cyan2"),RGB(0x00,0xCC,0xCC)}, //Š¦F‚»‚Ì‚Q + {TEXT("blue2"),RGB(0x33,0x99,0xFF)}, //Â‚»‚Ì‚Q + {TEXT("purple2"),RGB(0x66,0x33,0xCC)} //Ž‡‚»‚Ì‚Q + // {TEXT("black2"),RGB(0x66,0x66,0x66)} //•‚»‚Ì‚Q‚Í‚È‚¢H + }; + + const CommentSizeInfo COMMENT_SIZELIST[] = { + {TEXT("‘å@"),TEXT("big")} //‘åƒTƒCƒY + }; + + + + const CommentPosInfo COMMENT_POSLIST[] = { + {TEXT("‰º@"),TEXT("shita")}, //‰º‚É•\Ž¦ + {TEXT("ã@"),TEXT("ue")} //ã‚É•\Ž¦ + }; +} + + + template @@ -104,9 +115,7 @@ commentWriteInternalHeight(0), commentWriteMaxLength(INIT_COMMENTWRITE_MAXLENGTH), nicoLiveStream(in_nicoLiveStream), commentSubEdit(*this) -{ - -} +{} @@ -217,7 +226,7 @@ static VOID agreeEnterKeyThread(LPVOID userData){ return; } -VOID CCommentWriteWindow::SendChat(){ +BOOL CCommentWriteWindow::SendChat(){ CCommentMaker commentMaker; std::vector chat(commentEdit.GetWindowTextLengthW() + 1); commentEdit.GetWindowTextW(&chat[0],chat.size()); @@ -226,18 +235,36 @@ VOID CCommentWriteWindow::SendChat(){ commentMaker.AddMail(ANONYMOUS_MAILCOMMAND); } + BOOL rslt = FALSE; + NLIB_RESULT code = nicoLiveStream.SendChat(commentMaker); - if(nicoLiveStream.SendChat(commentMaker) != NLIB_ERR_OK){ + switch(code){ - commentSubEdit.AgreeEnter(); - } else { + case NLIB_ERR_OK: - _beginthread(agreeEnterKeyThread,0,&commentSubEdit); + rslt = TRUE; + + break; + + case NLIB_ERR_NOT_LIVECONNECT: + + ::MessageBox(NULL,NLIB_GetErrorMessage(code),TEXT("ƒRƒƒ“ƒg‘‚«ž‚݃Gƒ‰["),MB_ICONERROR | MB_OK); + + rslt = FALSE; + break; + + default: + errprint(TEXT("ƒRƒƒ“ƒg‘‚«ž‚Ý’†‚ɃGƒ‰[:%s"),NLIB_GetErrorMessage(code)); + UnexpectedErrorMessageShow(TEXT("ƒRƒƒ“ƒg‘‚«ž‚Ý’†‚É"),NLIB_GetErrorMessage(code)); + rslt = FALSE; + break; } + + - return; + return rslt; } @@ -443,7 +470,17 @@ void CSubChatEdit::OnKeyDown(TCHAR wParam, UINT upLParam,UINT loLParam){ if(untilConnectingFlag == FALSE){ untilConnectingFlag = TRUE; - self.SendChat(); + ; + + if(self.SendChat() != TRUE){ + + _beginthread(agreeEnterKeyThread,0,this); + + } + + + + } cs.Unlock(); diff --git a/nlite/nlite_commentWrite.h b/nlite/nlite_commentWrite.h index 9c6ec89..a7b1467 100644 --- a/nlite/nlite_commentWrite.h +++ b/nlite/nlite_commentWrite.h @@ -141,7 +141,7 @@ namespace nlite{ public: - VOID SendChat(); + BOOL SendChat(); VOID OnSendChatResult(); diff --git a/nlite/nlite_commentview.cpp b/nlite/nlite_commentview.cpp index e042c01..4da7ab5 100644 --- a/nlite/nlite_commentview.cpp +++ b/nlite/nlite_commentview.cpp @@ -4,6 +4,16 @@ namespace nlite{ +//F’萔 +namespace ColorList{ + enum type{ + selectBack = RGB(255,240,240), + outLineSelect = RGB(255,0,0), + outLineNomal = RGB(0,0,0), + colLine = RGB(224,224,224) + }; +}; + // //ƒRƒƒ“ƒgƒrƒ…[ƒNƒ‰ƒXƒƒ\ƒbƒh /////////////////////////////////////////////////////// @@ -194,7 +204,7 @@ VOID CCommentView::OnChatReceve(NicoLiveChat_P chat,UINT_PTR commnetCountSum){ } -VOID CCommentView::SetStreamStatus(StreamStatus &st){ +VOID CCommentView::SetStreamStatus(StreamStatus_P st){ streamStatus.SetStreamStatus(st); } @@ -483,7 +493,7 @@ VOID CCommentView::OnVScroll(INT_PTR loWParam,SHORT hiWParam,HWND lParam){ LRESULT CCommentView::OnCreate(LPCREATESTRUCT lpcs){ m_header.Create(m_hWnd,0,WC_HEADER,WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | HDS_BUTTONS | HDS_HOTTRACK |HDS_DRAGDROP | HDS_FULLDRAG ,0,commentViewConstant::HEADER_ID); - m_commentListWindow.Create(m_hWnd,0,commentViewConstant::NLITE_COMMENTLISTWINDOW,WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN , 0,commentViewConstant::LISTBOX_ID); + m_commentListWindow.Create(m_hWnd,0,commentViewConstant::NLITE_COMMENTLISTWINDOW,WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN , 0,commentViewConstant::LISTWINDOW); @@ -558,7 +568,7 @@ VOID CCommentListWindow::OnPaint(HDC in_hdc){ RECT windowRect; - + RECT listRect = {0}; RECT clientRect; self.GetClientRect(&clientRect); @@ -569,14 +579,14 @@ VOID CCommentListWindow::OnPaint(HDC in_hdc){ windowRect.bottom -= windowRect.top; windowRect.left = 0; windowRect.top = 0; - RECT listRect = windowRect; - listRect.right = self.GetColumnHolSizeSum(); + + CPaintDC pdc(*this); { CMemoryDC mdc(pdc,windowRect); mdc.SelectFont(AtlGetDefaultGuiFont()); - mdc.FillRect(&clientRect,(HBRUSH)::GetStockObject(GRAY_BRUSH)); + CCommentList &commentList = self.commentlist; @@ -588,7 +598,8 @@ VOID CCommentListWindow::OnPaint(HDC in_hdc){ if(commentList.Size() > (UINT_PTR)viewStartHeight){ - + listRect = windowRect; + listRect.right = self.GetColumnHolSizeSum(); CCommentList::iterator chatData = commentList.begin(); std::advance(chatData,viewStartHeight); @@ -635,6 +646,8 @@ VOID CCommentListWindow::OnPaint(HDC in_hdc){ } } + windowRect.left = listRect.right; + mdc.FillRect(&windowRect,(HBRUSH)::GetStockObject(GRAY_BRUSH)); diff --git a/nlite/nlite_commentview.h b/nlite/nlite_commentview.h index 1a6171c..4751474 100644 --- a/nlite/nlite_commentview.h +++ b/nlite/nlite_commentview.h @@ -2,18 +2,22 @@ namespace nlite{ + //’萔—p‚Ì–¼‘O‹óŠÔ namespace commentViewConstant{ - const static LPCTSTR NLITE_COMMENTVIEW = TEXT("NLITE_COMMENTVIEW"); - const static LPCTSTR NLITE_COMMENTLISTBASE = TEXT("NLITE_COMMENTLISTBASE"); + //ƒRƒƒ“ƒgƒrƒ…[ƒEƒBƒ“ƒhƒE–¼ + const static LPCTSTR NLITE_COMMENTVIEW = TEXT("NLITE_COMMENTVIEW"); + //ƒRƒƒ“ƒgƒŠƒXƒgƒEƒBƒ“ƒhƒE–¼ const static LPCTSTR NLITE_COMMENTLISTWINDOW = TEXT("NLITE_COMMENTLISTWINDOW"); + //ƒwƒbƒ_[‚̍‚‚³ const static UINT_PTR HEADER_HAIGHT = 20; + //ƒwƒbƒ_[ƒRƒ“ƒgƒ[ƒ‹ID const static UINT_PTR HEADER_ID = 257; - const static UINT_PTR LISTBOX_ID = 258; + const static UINT_PTR LISTWINDOW = 258; const static UINT_PTR MENU_OR_ID = 256; } @@ -27,14 +31,7 @@ namespace nlite{ private: CCommentView &self; - struct ColorList{ - enum type{ - selectBack = RGB(255,240,240), - outLineSelect = RGB(255,0,0), - outLineNomal = RGB(0,0,0), - colLine = RGB(224,224,224) - }; - }; + public: @@ -245,7 +242,7 @@ namespace nlite{ /// ///ƒjƒR¶‚̃Xƒe[ƒ^ƒXÝ’è /// - VOID SetStreamStatus(StreamStatus &st); + VOID SetStreamStatus(StreamStatus_P st); /// ///ƒ`ƒƒƒbƒgƒRƒƒ“ƒgŽóMŽž‚̏ˆ— diff --git a/nlite/nlite_exception.cpp b/nlite/nlite_exception.cpp new file mode 100644 index 0000000..837753b --- /dev/null +++ b/nlite/nlite_exception.cpp @@ -0,0 +1,48 @@ +#include "stdafx.h" +#include "nlite_include.h" + +namespace nlite{ + +Exception::Exception(){} + +Exception::Exception(const char* const& errMessage):exception(errMessage){} + +Exception::Exception(const wchar_t * const & errMessage,UINT_PTR in_line,LPCTSTR in_fileName): + wErrMessage(errMessage), + line(in_line) +{ + WCHAR file[_MAX_FNAME]; + WCHAR ext[_MAX_EXT]; + _wsplitpath(in_fileName,(wchar_t*)NULL,(wchar_t*)NULL,file,ext); + fileName = file; + fileName += ext; + +} + +LPCWSTR Exception::what(){ + + return wErrMessage; + +} + +UINT_PTR Exception::getLineNo(){ + + return line; +} + +LPCWSTR Exception::getFileName(){ + + return fileName; + +} + + +AppInitException::AppInitException(UINT_PTR in_line,LPCTSTR in_fileName):Exception(TEXT("ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‰Šú‰»‚ÉŽ¸”s‚µ‚Ü‚µ‚½"),in_line,in_fileName){} + + + +NLIBException::NLIBException(LPCTSTR errmessage,NLIB_RESULT rslt,UINT_PTR in_line,LPCTSTR in_fileName):errcode(rslt),Exception(errmessage,in_line,in_fileName){} + +NLiveException::NLiveException(LPCTSTR errmessage,UINT_PTR in_line,LPCTSTR in_fileName):Exception(errmessage,in_line,in_fileName){} + +} \ No newline at end of file diff --git a/nlite/nlite_exception.h b/nlite/nlite_exception.h index 0204c14..a3af619 100644 --- a/nlite/nlite_exception.h +++ b/nlite/nlite_exception.h @@ -11,52 +11,50 @@ namespace nlite{ UINT_PTR line; CNLiteString fileName; - //ƒRƒ“ƒXƒgƒ‰ƒNƒ^ + public: - Exception(){} - Exception(const char* const& errMessage):exception(errMessage){} - Exception(const wchar_t * const & errMessage,UINT_PTR in_line,LPCTSTR in_fileName): - wErrMessage(errMessage), - line(in_line) - { - WCHAR file[_MAX_FNAME]; - WCHAR ext[_MAX_EXT]; - _wsplitpath(in_fileName,(wchar_t*)NULL,(wchar_t*)NULL,file,ext); - fileName = file; - fileName += ext; - - } - - LPCWSTR what(){ - - return wErrMessage; - - } + /// + ///ƒRƒ“ƒXƒgƒ‰ƒNƒ^ + /// + Exception(); + Exception(const char* const& errMessage); + Exception(const wchar_t * const & errMessage,UINT_PTR in_line,LPCTSTR in_fileName); + + + /// + ///ƒGƒ‰[•¶Œ¾Žæ“¾ + /// + LPCWSTR what(); - UINT_PTR getLineNo(){ - return line; - } + /// + ///ƒGƒ‰[”­¶sŽæ“¾ + /// + UINT_PTR getLineNo(); - LPCWSTR getFileName(){ - - return fileName; - - } + /// + ///ƒGƒ‰[”­¶ƒtƒ@ƒCƒ‹–¼Žæ“¾ + /// + LPCWSTR getFileName(); }; - + /// + ///ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‰Šú‰»—áŠOƒNƒ‰ƒX + /// class AppInitException : public Exception{ public: - - AppInitException(UINT_PTR in_line,LPCTSTR in_fileName):Exception(TEXT("ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‰Šú‰»‚ÉŽ¸”s‚µ‚Ü‚µ‚½"),in_line,in_fileName){} - - - + /// + ///ƒRƒ“ƒXƒgƒ‰ƒNƒ^ + /// + AppInitException(UINT_PTR in_line,LPCTSTR in_fileName); }; + + /// + ///nlib—áŠOƒNƒ‰ƒX + /// class NLIBException : public Exception{ private: @@ -64,17 +62,21 @@ namespace nlite{ NLIB_RESULT errcode; public: - NLIBException(LPCTSTR errmessage,NLIB_RESULT rslt,UINT_PTR in_line,LPCTSTR in_fileName):errcode(rslt),Exception(errmessage,in_line,in_fileName) - {} + NLIBException(LPCTSTR errmessage,NLIB_RESULT rslt,UINT_PTR in_line,LPCTSTR in_fileName); + }; + + /// + ///ƒjƒR¶—áŠOƒNƒ‰ƒX + /// class NLiveException :public Exception{ public: - - NLiveException(LPCTSTR errmessage,UINT_PTR in_line,LPCTSTR in_fileName):Exception(errmessage,in_line,in_fileName){} + NLiveException(LPCTSTR errmessage,UINT_PTR in_line,LPCTSTR in_fileName); + }; diff --git a/nlite/nlite_mailframe.h b/nlite/nlite_mailframe.h index f973c2d..ee7edba 100644 --- a/nlite/nlite_mailframe.h +++ b/nlite/nlite_mailframe.h @@ -8,25 +8,16 @@ namespace nlite{ /// const static LPCTSTR NLITE_MAINWINDOW = TEXT("nlite"); - /// - ///ƒEƒBƒ“ƒhƒEÅ’áƒTƒCƒY - /// - const static SIZE lowestFrameSize = {300,300}; + /// ///ƒƒCƒ“ƒtƒŒ[ƒ€ƒNƒ‰ƒX /// - class CNliteMainFrame : public CFrameWindowImpl, - public CUpdateUI,public CMessageFilter, public CIdleHandler + class CNliteMainFrame : public CFrameWindowImpl + ,public CUpdateUI,public CMessageFilter, public CIdleHandler { - /// - ///’萔 - /// - enum{ - IDC_COMBO_REBAR = 301, - IDC_COMBO_TITLE = 302 - }; + public: @@ -98,7 +89,7 @@ namespace nlite{ /// ///ƒRƒƒ“ƒgŽóMŠJŽnŽž‚̃R[ƒ‹ƒoƒbƒNˆ— /// - VOID OnChatReceveStart(StreamStatus &streamStatus); + VOID OnChatReceveStart(StreamStatus_P streamStatus); /// @@ -136,7 +127,6 @@ namespace nlite{ CSubLiveNoComboBox subLiveNoComboBox; //¶•ú‘—”ԍ†“ü—Í—pƒRƒ“ƒ{ƒ{ƒbƒNƒX(ƒTƒuƒNƒ‰ƒX) CCommentWriteWindow commentWriteWindow; //ƒRƒƒ“ƒg‘‚«ž‚Ý—pƒNƒ‰ƒX CTabCtrl tabctrl; //ƒ^ƒuƒRƒ“ƒgƒ[ƒ‹ - HFONT hTabFont; //ƒ^ƒuƒEƒBƒ“ƒhƒE—p‚̃tƒHƒ“ƒg CComboBoxEx lvNoCombo; //¶•ú‘—”ԍ†“ü—Í—pƒRƒ“ƒ{ƒ{ƒbƒNƒX INT_PTR statusBarHeight; //ƒXƒe[ƒ^ƒXƒo[‚̍‚‚³ @@ -145,18 +135,14 @@ namespace nlite{ Property nliteProperty; //ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ƒvƒƒpƒeƒB CNicoLiveStream nicoLiveStream; //ƒjƒRƒjƒR¶•ú‘—ƒIƒuƒWƒFƒNƒg private: - // ƒƒbƒZ[ƒWƒtƒBƒ‹ƒ^ˆ— - virtual BOOL PreTranslateMessage(MSG* pMsg){ - // Šî’êƒNƒ‰ƒX‚ÌPreTranslateMessage‚ðŒÄ‚яo‚· - return CFrameWindowImpl::PreTranslateMessage(pMsg); - } + virtual BOOL PreTranslateMessage(MSG* pMsg); // ƒAƒCƒhƒ‹ˆ— - virtual BOOL OnIdle(){ - return FALSE; - } + virtual BOOL OnIdle(); + + public: @@ -180,6 +166,7 @@ namespace nlite{ // ƒƒbƒZ[ƒWƒ}ƒbƒv BEGIN_MSG_MAP_EX(CNliteMainFrame) MSG_WM_CREATE(OnCreate) + MSG_WM_CLOSE(OnClose) MSG_WM_DESTROY(OnDestroy) MESSAGE_HANDLER(WM_SIZE,OnSize) MSG_WM_SIZING(OnSizing) @@ -202,13 +189,25 @@ namespace nlite{ /// VOID Finalaize(); - VOID OnDestroy(); - + + /// + ///—áŠO”­¶Žž‚̏ˆ— + /// VOID OnException(); private: /// + ///ƒEƒBƒ“ƒhƒE‚ð•Â‚¶‚é‚Æ‚«‚̏ˆ— + /// + VOID OnClose(); + + /// + ///ƒEƒBƒ“ƒhƒE”jŠüŽž‚̏ˆ— + /// + VOID OnDestroy(); + + /// ///ƒc[ƒ‹ƒo[‚‚³•ÏX /// LRESULT OnRbnHeightChange(INT_PTR wParam,LPNMHDR lParam,BOOL &bHandled); @@ -236,7 +235,11 @@ namespace nlite{ /// LRESULT OnCreate(LPCREATESTRUCT lpcs); - VOID ConnectNicoLive(LPCTSTR liveNo); + + /// + ///ƒjƒR¶•ú‘—‚ɐڑ± + /// + BOOL ConnectNicoLive(LPCTSTR liveNo); @@ -250,7 +253,9 @@ namespace nlite{ //ƒNƒbƒL[‚̐ݒè VOID OnCookie(UINT uNotifyCode,int nID,HWND hWndCtl); - + /// + ///CNicoLiveStream‚̃R[ƒ‹ƒoƒbƒN—pŠÖ” + /// static NLIB_RESULT LiveCallBack(NICOLIVE_EVENT eventType,NicoLiveStream_P pNicoLiveStream,LPVOID option,NICOLIVE_PARAM param1,NICOLIVE_PARAM param2); diff --git a/nlite/nlite_mainframe.cpp b/nlite/nlite_mainframe.cpp index 0388410..83ad01e 100644 --- a/nlite/nlite_mainframe.cpp +++ b/nlite/nlite_mainframe.cpp @@ -6,6 +6,20 @@ namespace nlite{ static const RECT commentViewSize = {5,0,5,0}; +/// +///’萔 +/// +enum{ + IDC_COMBO_REBAR = 301, + IDC_COMBO_TITLE = 302 +}; + + +/// +///ƒEƒBƒ“ƒhƒEÅ’áƒTƒCƒY +/// +const static SIZE lowestFrameSize = {300,300}; + CNliteMainFrame::~CNliteMainFrame(){ @@ -25,6 +39,18 @@ CNliteMainFrame::CNliteMainFrame() hTabFont = CreateFontIndirect(&lf); } + +// ƒƒbƒZ[ƒWƒtƒBƒ‹ƒ^ˆ— +BOOL CNliteMainFrame::PreTranslateMessage(MSG* pMsg){ + // Šî’êƒNƒ‰ƒX‚ÌPreTranslateMessage‚ðŒÄ‚яo‚· + return CFrameWindowImpl::PreTranslateMessage(pMsg); +} + +// ƒAƒCƒhƒ‹ˆ— +BOOL CNliteMainFrame::OnIdle(){ + return FALSE; +} + //ƒTƒCƒY•ÏXˆ— VOID CNliteMainFrame::ChangeSize(const SIZE& client){ @@ -150,8 +176,16 @@ VOID CNliteMainFrame::Initialize(LPCTSTR localAppDataPath){ } -VOID CNliteMainFrame::OnDestroy(){ +VOID CNliteMainFrame::OnClose(){ + this->ShowWindow(SW_HIDE); nicoLiveStream.DisConnect(); + this->DestroyWindow(); + + return; +} + +VOID CNliteMainFrame::OnDestroy(){ + commentView.DestroyWindow(); PostQuitMessage(0); @@ -196,11 +230,63 @@ VOID CNliteMainFrame::OnCookie(UINT uNotifyCode,int nID,HWND hWndCtl){ } -VOID CNliteMainFrame::ConnectNicoLive(LPCTSTR liveNo){ +BOOL CNliteMainFrame::ConnectNicoLive(LPCTSTR liveNo){ nicoLiveStream.DisConnect(); commentView.OnConnect(); - nicoLiveStream.Connect(nicoVideoAuth,liveNo,LiveCallBack,&userData); + BOOL rslt = FALSE; + NLIB_RESULT code = nicoLiveStream.Connect(nicoVideoAuth,liveNo,LiveCallBack,&userData); + + //ƒGƒ‰[ƒR[ƒhˆ— + switch(code){ + + //³íI—¹ + case NLIB_ERR_OK: + + rslt = TRUE; + break; + + //‘z’肳‚ꂽƒGƒ‰[ƒR[ƒh + case NLIB_ERR_COOKIE_FAILED: + case NLIB_LIVENO_FAILED_UNDEFEINE: + case NLIB_GETPLAYERSTATUS_FAILED_CONNECT: + case NLIB_ERR_GETPLAYERSTATUS_INVALID_LV: + case NLIB_ERR_GETPLAYERSTATUS_INVALID_THREAD: + case NLIB_ERR_GETPLAYERSTATUS_CLOSED: + case NLIB_ERR_GETPLAYERSTATUS_UNKNOWN_ERROR: + case NLIB_ERR_GETPLAYERSTATUS_SERVER_ERROR: + case NLIB_ERR_GETPLAYERSTATUS_DELETED: + case NLIB_ERR_GETPLAYERSTATUS_FULL: + case NLIB_ERR_GETPLAYERSTATUS_PERMISSION_DENIED: + case NLIB_ERR_GETPLAYERSTATUS_ACCESS_LOCKED: + case NLIB_ERR_GETPLAYERSTATUS_REQUIRE_COMMUNITY_MEMBER: + case NLIB_ERR_GETPLAYERSTATUS_COMINGSOON: + case NLIB_ERR_GETPLAYERSTATUS_NOTFOUND: + case NLIB_ERR_GETPLAYERSTATUS_NOTLOGIN: + case NLIB_ERR_GETPLAYERSTATUS_UNKNOWN: + case NLIB_ERR_GETPLAYERSTATUS_MAINTENANCE: + case NLIB_ERR_GETPLAYERSTATUS_NOT_PERMITTED: + case NLIB_ERR_GETPLAYERSTATUS_REQUIRE_ACCEPT_PRINT_TIMESHIFT_TICKET: + case NLIB_ERR_GETPLAYERSTATUS_TSARCHIVE: + case NLIB_ERR_GETPLAYERSTATUS_USERTIMESHIFT: + case NLIB_ERR_GETPLAYERSTATUS_UNDEFINED: + + ::MessageBox(NULL,NLIB_GetErrorMessage(code),TEXT("•ú‘—Ú‘±ƒGƒ‰["),MB_ICONERROR | MB_OK); + rslt = FALSE; + break; + + + //‘z’肳‚ê‚Ä‚¢‚È‚¢ƒGƒ‰[ƒR[ƒh + default: + { + UnexpectedErrorMessageShow( TEXT("•ú‘—Ú‘±’†‚É"),NLIB_GetErrorMessage(code)); + errprint(TEXT("•ú‘—Ú‘±ƒGƒ‰[:%s"),NLIB_GetErrorMessage(code)); + rslt = FALSE; + } + break; + + } + return rslt; } @@ -267,7 +353,7 @@ NLIB_RESULT CNliteMainFrame::LiveCallBack(NICOLIVE_EVENT eventType,NicoLiveStrea case NICOLIVE_EVENT_RECEVE_CONNECTRESULT: - userData.OnChatReceveStart(*NicoLiveStream_getStreamStatus(pNicoLiveStream)); + userData.OnChatReceveStart(NicoLiveStream_getStreamStatus(pNicoLiveStream)); break; @@ -345,8 +431,9 @@ VOID CNliteMainFrame::CSubLiveNoComboBox::OnKeyDown(TCHAR wParam, UINT upLParam, untilConnectingFlag = TRUE; std::vector buffer(this->GetWindowTextLengthW() + 1); ::GetWindowTextW(this->m_hWnd,&buffer[0],buffer.size()); - self.ConnectNicoLive(&buffer[0]); - _beginthread(AgreeEnterKeyThread,0,this); + if(self.ConnectNicoLive(&buffer[0]) != TRUE){ + _beginthread(AgreeEnterKeyThread,0,this); + } } cs.Unlock(); @@ -383,7 +470,7 @@ VOID CNliteMainFrame::CLiveUserData::OnConnect(){ } -VOID CNliteMainFrame::CLiveUserData::OnChatReceveStart(StreamStatus &streamStatus){ +VOID CNliteMainFrame::CLiveUserData::OnChatReceveStart(StreamStatus_P streamStatus){ commentView.SetStreamStatus(streamStatus); diff --git a/nlite/nlite_nlib.cpp b/nlite/nlite_nlib.cpp index 0c5159e..e2d9c1a 100644 --- a/nlite/nlite_nlib.cpp +++ b/nlite/nlite_nlib.cpp @@ -26,15 +26,15 @@ VOID CStreamStatus::Initalize(){ -VOID CStreamStatus::SetStreamStatus(StreamStatus &streamStatus){ - - id = streamStatus.id; - default_community = streamStatus.default_community; - provider_type = streamStatus.provider_type; - start_time = streamStatus.start_time; - end_time = streamStatus.end_time; - open_time = streamStatus.open_time; - base_time = streamStatus.base_time; +VOID CStreamStatus::SetStreamStatus(StreamStatus_P streamStatus){ + + id = StreamStatus_getId(streamStatus); + default_community = StreamStatus_getDefaultCommunity(streamStatus); + provider_type = StreamStatus_getProviderType(streamStatus); + start_time = StreamStatus_getStartTime(streamStatus); + end_time = StreamStatus_getEndTime(streamStatus); + open_time = StreamStatus_getOpenTime(streamStatus); + base_time = StreamStatus_getBaseTime(streamStatus); } diff --git a/nlite/nlite_nlib.h b/nlite/nlite_nlib.h index f9fd2d6..72b0385 100644 --- a/nlite/nlite_nlib.h +++ b/nlite/nlite_nlib.h @@ -21,7 +21,7 @@ namespace nlite{ VOID Initalize(); - VOID SetStreamStatus(StreamStatus &streamStatus); + VOID SetStreamStatus(StreamStatus_P streamStatus); }; diff --git a/nlite/nlite_property.cpp b/nlite/nlite_property.cpp index e7f0002..4510bc5 100644 --- a/nlite/nlite_property.cpp +++ b/nlite/nlite_property.cpp @@ -43,6 +43,209 @@ WritePrivateProfileInt( } +PropertyBase::PropertyBase(LPCTSTR in_sectionName):sectionName(in_sectionName){} + +BOOL CCookieSettingWindow::OnInitDialog(CWindow wndFocus, LPARAM lInitParam){ + // ƒXƒNƒŠ[ƒ“‚Ì’†‰›‚É”z’u + CenterWindow(); + + + CButton radio; + + switch(this->browserType){ + + case BT_INTERNET_EXPLORER: + + radio = GetDlgItem(IDC_RADIO_IE); + + break; + + case BT_FIRE_FOX: + + radio = GetDlgItem(IDC_RADIO_FIREFOX); + + break; + + + case BT_GOOGLE_CHROME: + + radio = GetDlgItem(IDC_RADIO_CHROME); + + break; + + case BT_IE_COMPONENT: + + radio = GetDlgItem(IDC_RADIO_IECM); + + break; + + default: + goto skip; + } + radio.SetCheck(BST_CHECKED); + +skip: + + return TRUE; +} + +VOID CCookieSettingWindow::OnOK(UINT uNotifyCode, int nID, CWindow wndCtl){ + CButton ieRadio = GetDlgItem(IDC_RADIO_IE); + CButton firefoxRadio = GetDlgItem(IDC_RADIO_FIREFOX); + CButton chromeRadio = GetDlgItem(IDC_RADIO_CHROME); + CButton iecmRadio = GetDlgItem(IDC_RADIO_IECM); + + if(ieRadio.GetCheck() == BST_CHECKED){ + + this->browserType = BT_INTERNET_EXPLORER; + + } + + if(firefoxRadio.GetCheck() == BST_CHECKED){ + + this->browserType = BT_FIRE_FOX; + + } + + if(chromeRadio.GetCheck() == BST_CHECKED){ + + this->browserType = BT_GOOGLE_CHROME; + + } + + if(iecmRadio.GetCheck() == BST_CHECKED){ + + this->browserType = BT_IE_COMPONENT; + + } + + + EndDialog(nID); +} + +VOID CCookieSettingWindow::OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl){ + EndDialog(nID); +} + +VOID CCookieSettingWindow::SetBrowserType(BROWSERTYPE browserType){ + + this->browserType = browserType; + + + return; +} + +BROWSERTYPE CCookieSettingWindow::GetBrowserType(){ + return this->browserType; +} + + + +CommentViewProperty::CommentViewProperty(): + commentFoldingFlag(TRUE), + commentTimeType(StreamingTimeType), + PropertyBase(TEXT("COMMENTVIEW")), + baseStringColor(RGB(0,0,0)), + backColor(RGB(255,255,255)) + +{ + + memset(headerholSize,-1,sizeof(headerholSize)); +} + +LPCTSTR CommentViewProperty::GetSectionName(){ + + return sectionName; + +} + + +CommentReadProperty::CommentReadProperty(): + commentReadFlag(FALSE), + ngWordReadFlag(TRUE), + ngUserReadFlag(TRUE), + managementReadFlag(TRUE), + bspReadFlag(TRUE), + userCommentReadFlag(TRUE), + teropReadFlag(TRUE), + PropertyBase(TEXT("COMMENTREAD")) +{} + +LPCTSTR CommentReadProperty::GetSectionName(){ + + return sectionName; + +} + + +GeneralProperty::GeneralProperty(): + userCountUpdateFlag(TRUE), + commentLogAutoSaveFlag(FALSE), + defaultBroserFlag(TRUE), + autoNameRegisterFlag(FALSE), + autoNameUpdateFlag(FALSE), + numberNameFlag(FALSE), + autoColorRegisterFlag(FALSE), + activeCountTimeFlag(TRUE), + PropertyBase(TEXT("GENERAL")), + browserType(BT_NOSETTING) +{} + +LPCTSTR GeneralProperty::GetSectionName(){ + + return sectionName; + +} + +MainFrameProperty::MainFrameProperty(): +windowFrontFlag(TRUE), +PropertyBase(TEXT("MAINFRAME")) +{ + + ZeroMemory(&windowSize,sizeof(windowSize)); + +} + +LPCTSTR MainFrameProperty::GetSectionName(){ + + return sectionName; +} + + +Property::Property() +{ + TCHAR localAppPath[_MAX_PATH]; + SHGetFolderPathW(0,CSIDL_LOCAL_APPDATA,0,SHGFP_TYPE_CURRENT,localAppPath); + + this->appLocalPath = localAppPath; +} + +Property::~Property() +{ + + +} + +VOID Property::Initialize(){ + this->~Property(); + new(this) Property; + +} + +BROWSERTYPE Property::CookieSetting(){ + + CCookieSettingWindow cookieSettingwindow; + + cookieSettingwindow.SetBrowserType(gp.browserType); + + cookieSettingwindow.DoModal(); + + this->gp.browserType = cookieSettingwindow.GetBrowserType(); + + return this->gp.browserType; + +} + VOID Property::ReadIniFile(){ CreatePropertyFile(); diff --git a/nlite/nlite_property.h b/nlite/nlite_property.h index c781401..bc6278c 100644 --- a/nlite/nlite_property.h +++ b/nlite/nlite_property.h @@ -2,7 +2,17 @@ namespace nlite{ - + /// + ///ƒvƒƒpƒeƒBƒx[ƒXƒNƒ‰ƒX + /// + struct PropertyBase{ + + protected: + CNLiteString sectionName; + + public: + PropertyBase(LPCTSTR in_sectionName); + }; class CCookieSettingWindow:public CDialogImpl{ @@ -18,104 +28,23 @@ namespace nlite{ COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel) END_MSG_MAP() - BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam){ - // ƒXƒNƒŠ[ƒ“‚Ì’†‰›‚É”z’u - CenterWindow(); - - - CButton radio; - - switch(this->browserType){ - - case BT_INTERNET_EXPLORER: - - radio = GetDlgItem(IDC_RADIO_IE); - - break; - - case BT_FIRE_FOX: - - radio = GetDlgItem(IDC_RADIO_FIREFOX); - - break; - - - case BT_GOOGLE_CHROME: - - radio = GetDlgItem(IDC_RADIO_CHROME); - - break; - - case BT_IE_COMPONENT: - - radio = GetDlgItem(IDC_RADIO_IECM); - - break; - - default: - goto skip; - } - radio.SetCheck(BST_CHECKED); - -skip: - - return TRUE; - } - - void OnOK(UINT uNotifyCode, int nID, CWindow wndCtl){ - CButton ieRadio = GetDlgItem(IDC_RADIO_IE); - CButton firefoxRadio = GetDlgItem(IDC_RADIO_FIREFOX); - CButton chromeRadio = GetDlgItem(IDC_RADIO_CHROME); - CButton iecmRadio = GetDlgItem(IDC_RADIO_IECM); - - if(ieRadio.GetCheck() == BST_CHECKED){ - - this->browserType = BT_INTERNET_EXPLORER; - - } - - if(firefoxRadio.GetCheck() == BST_CHECKED){ - - this->browserType = BT_FIRE_FOX; - - } - - if(chromeRadio.GetCheck() == BST_CHECKED){ - - this->browserType = BT_GOOGLE_CHROME; - - } - - if(iecmRadio.GetCheck() == BST_CHECKED){ - - this->browserType = BT_IE_COMPONENT; - - } - - - EndDialog(nID); - } - void OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl){ - EndDialog(nID); - } + BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam); - void SetBrowserType(BROWSERTYPE browserType){ + VOID OnOK(UINT uNotifyCode, int nID, CWindow wndCtl); - this->browserType = browserType; + VOID OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl); + VOID SetBrowserType(BROWSERTYPE browserType); - return; - } + BROWSERTYPE GetBrowserType(); - BROWSERTYPE GetBrowserType(){ - return this->browserType; - } + }; - struct CommentViewProperty{ + struct CommentViewProperty:public PropertyBase{ enum CommentTimeType{ @@ -124,8 +53,7 @@ skip: }; - private: - CNLiteString sectionName; + #define COMMENTVIEW_HEADERITEMSIZE 5 public: @@ -141,33 +69,19 @@ skip: COLORREF lineColor; - CommentViewProperty(): - commentFoldingFlag(TRUE), - commentTimeType(StreamingTimeType), - sectionName(TEXT("COMMENTVIEW")), - baseStringColor(RGB(0,0,0)), - backColor(RGB(255,255,255)) - - { + CommentViewProperty(); - memset(headerholSize,-1,sizeof(headerholSize)); - } + LPCTSTR GetSectionName(); - LPCTSTR GetSectionName(){ - - return sectionName; - - } + }; /// ///ƒRƒƒ“ƒg“ǂݏグÝ’è /// - struct CommentReadProperty{ + struct CommentReadProperty:public PropertyBase{ - private: - CNLiteString sectionName; public: BOOL commentReadFlag; //ƒRƒƒ“ƒg“ǂݏグƒtƒ‰ƒO @@ -183,32 +97,17 @@ skip: CNLiteString shortComment; //È—ªŽž‚ɓǂݏグ‚镶Žš—ñ CNLiteString outString; //“ǂݏグœŠO•¶Žš—ñ + CommentReadProperty(); - CommentReadProperty(): - commentReadFlag(FALSE), - ngWordReadFlag(TRUE), - ngUserReadFlag(TRUE), - managementReadFlag(TRUE), - bspReadFlag(TRUE), - userCommentReadFlag(TRUE), - teropReadFlag(TRUE), - sectionName(TEXT("COMMENTREAD")) - {} - - LPCTSTR GetSectionName(){ - - return sectionName; - - } + LPCTSTR GetSectionName(); + }; /// ///ˆê”ʐݒè /// - struct GeneralProperty{ - private: - CNLiteString sectionName; + struct GeneralProperty:public PropertyBase{ public: CNLiteString browserPath; //ƒuƒ‰ƒEƒU‚̃pƒX @@ -223,56 +122,34 @@ skip: BOOL activeCountTimeFlag; //ƒAƒNƒeƒBƒul”‚ðŽ©“®XV‚·‚é‚©‚̃tƒ‰ƒO BROWSERTYPE browserType; //ƒuƒ‰ƒEƒUƒ^ƒCƒv - GeneralProperty(): - userCountUpdateFlag(TRUE), - commentLogAutoSaveFlag(FALSE), - defaultBroserFlag(TRUE), - autoNameRegisterFlag(FALSE), - autoNameUpdateFlag(FALSE), - numberNameFlag(FALSE), - autoColorRegisterFlag(FALSE), - activeCountTimeFlag(TRUE), - sectionName(TEXT("GENERAL")), - browserType(BT_NOSETTING) - {} - - LPCTSTR GetSectionName(){ - - return sectionName; + GeneralProperty(); - } + LPCTSTR GetSectionName(); + }; /// ///ƒƒCƒ“Ý’è /// - struct MainFrameProperty{ + struct MainFrameProperty:public PropertyBase{ - private: - CNLiteString sectionName; public: SIZE windowSize; //ƒEƒBƒ“ƒhƒEƒTƒCƒY BOOL windowFrontFlag; //ƒEƒBƒ“ƒhƒEÅ‘O–Ê•\Ž¦ƒtƒ‰ƒO + /// ///ƒRƒ“ƒXƒgƒ‰ƒNƒ^ /// - MainFrameProperty(): - windowFrontFlag(TRUE), - sectionName(TEXT("MAINFRAME")) - { - - ZeroMemory(&windowSize,sizeof(windowSize)); + MainFrameProperty(); - } - LPCTSTR GetSectionName(){ - - return sectionName; - } + LPCTSTR GetSectionName(); + + }; @@ -289,54 +166,26 @@ skip: CNLiteString appLocalPath; CNLiteString propertyPath; + Property(); - Property() - { - TCHAR localAppPath[_MAX_PATH]; - SHGetFolderPathW(0,CSIDL_LOCAL_APPDATA,0,SHGFP_TYPE_CURRENT,localAppPath); - - this->appLocalPath = localAppPath; - } + ~Property(); - ~Property() - { - - } private: VOID CreatePropertyFile(); public: - - VOID Initialize(){ - this->~Property(); - new(this) Property; - - } - - - - + VOID Initialize(); VOID ReadIniFile(); VOID WriteIniFile(); - BROWSERTYPE CookieSetting(){ - - CCookieSettingWindow cookieSettingwindow; - - cookieSettingwindow.SetBrowserType(gp.browserType); + BROWSERTYPE CookieSetting(); - cookieSettingwindow.DoModal(); - - this->gp.browserType = cookieSettingwindow.GetBrowserType(); - - return this->gp.browserType; - - } + }; diff --git a/nlite/nlite_string.cpp b/nlite/nlite_string.cpp new file mode 100644 index 0000000..b1bfcdf --- /dev/null +++ b/nlite/nlite_string.cpp @@ -0,0 +1,17 @@ +#include "stdafx.h" +#include "nlite_include.h" + +namespace nlite{ + +/// +///ƒRƒ“ƒXƒgƒ‰ƒNƒ^ +/// +CNLITESTRING_THISTYPE::CNLITESTRING_THISTYPE():CNLITESTRING_INTERNALSTRINGTYPE(){} + +CNLITESTRING_THISTYPE::CNLITESTRING_THISTYPE(LPCTSTR in_str):CNLITESTRING_INTERNALSTRINGTYPE(in_str){} + +CNLITESTRING_THISTYPE::CNLITESTRING_THISTYPE(const CNLITESTRING_INTERNALSTRINGTYPE_REFERENCE in_str):CNLITESTRING_INTERNALSTRINGTYPE(in_str){} + +CNLITESTRING_THISTYPE::CNLITESTRING_THISTYPE(const CNLITESTRING_THISTYPE_REFERENCE in_str):CNLITESTRING_INTERNALSTRINGTYPE(in_str){} + +} \ No newline at end of file diff --git a/nlite/nlite_string.h b/nlite/nlite_string.h index 2e101b2..fe14401 100644 --- a/nlite/nlite_string.h +++ b/nlite/nlite_string.h @@ -23,19 +23,16 @@ namespace nlite{ public: - - - /// ///ƒRƒ“ƒXƒgƒ‰ƒNƒ^ /// - CNLITESTRING_THISTYPE():CNLITESTRING_INTERNALSTRINGTYPE(){} + CNLITESTRING_THISTYPE(); - CNLITESTRING_THISTYPE(LPCTSTR in_str):CNLITESTRING_INTERNALSTRINGTYPE(in_str){} - - CNLITESTRING_THISTYPE(const CNLITESTRING_INTERNALSTRINGTYPE_REFERENCE in_str):CNLITESTRING_INTERNALSTRINGTYPE(in_str){} + CNLITESTRING_THISTYPE(LPCTSTR in_str); + + CNLITESTRING_THISTYPE(const CNLITESTRING_INTERNALSTRINGTYPE_REFERENCE in_str); - CNLITESTRING_THISTYPE(const CNLITESTRING_THISTYPE_REFERENCE in_str):CNLITESTRING_INTERNALSTRINGTYPE(in_str){} + CNLITESTRING_THISTYPE(const CNLITESTRING_THISTYPE_REFERENCE in_str); diff --git a/nlite/stdafx.h b/nlite/stdafx.h index 274ec43..ede309d 100644 --- a/nlite/stdafx.h +++ b/nlite/stdafx.h @@ -8,10 +8,12 @@ #include "targetver.h" #define WIN32_LEAN_AND_MEAN // Windows ƒwƒbƒ_[‚©‚çŽg—p‚³‚ê‚Ä‚¢‚È‚¢•”•ª‚ðœŠO‚µ‚Ü‚·B -#define _CRT_SECURE_NO_WARNINGS 1 //vc++‚Ì‚¨‚¹‚Á‚©‚¢‚ÈŒx‚ðÁ‚·ƒ}ƒNƒ -#define _CRT_NON_CONFORMING_SWPRINTFS 1 //vc++‚Ì‚¨‚¹‚Á‚©‚¢‚ÈŒx‚ðÁ‚·ƒ}ƒNƒ -//#define USE_STUB +#define _CRT_SECURE_NO_WARNINGS 1 //vc++‚Ì‚¨‚¹‚Á‚©‚¢‚ÈŒx‚ðÁ‚· +#define _CRT_NON_CONFORMING_SWPRINTFS 1 //vc++‚Ì‚¨‚¹‚Á‚©‚¢‚ÈŒx‚ðÁ‚· +#define USE_STUB //ƒXƒ^ƒu‚ðŽg—p‚·‚éê‡‚̓Rƒƒ“ƒgƒAƒEƒg‚ð‰ðœ‚·‚é +#define WINDEBUGER_NOPRINTING //ƒfƒoƒbƒOo—Í‚ðƒRƒ“ƒ\[ƒ‹‚É•\Ž¦‚µ‚½‚­‚È‚¢ê‡’è‹`‚·‚é #define _WTL_NO_CSTRING + // Windows ƒwƒbƒ_[ ƒtƒ@ƒCƒ‹: #include #include diff --git a/nlite_stub/nlib_stub.h b/nlite_stub/nlib_stub.h index ec27d4c..1eaa7ad 100644 --- a/nlite_stub/nlib_stub.h +++ b/nlite_stub/nlib_stub.h @@ -1,4 +1,22 @@ #pragma once +#define _CRT_SECURE_NO_WARNINGS 1 //vc++‚Ì‚¨‚¹‚Á‚©‚¢‚ÈŒx‚ðÁ‚· +#define _CRT_NON_CONFORMING_SWPRINTFS 1 //vc++‚Ì‚¨‚¹‚Á‚©‚¢‚ÈŒx‚ðÁ‚· +#define TEST_CONNECT_RESULT_CHECK + +/// +///¶•ú‘—ƒXƒe[ƒ^ƒX +/// +typedef struct streamstatus_t{ + + TCHAR id[LENGTH_128]; + TCHAR default_community[LENGTH_128]; + PROVIDERTYPE provider_type; + BOOL is_owner; + time_t start_time; + time_t end_time; + time_t open_time; + time_t base_time; +}StreamStatus,*StreamStatus_P; typedef struct nicolivestream_t{ NicoRecvCallBack callback; diff --git a/nlite_stub/nlite_stub.cpp b/nlite_stub/nlite_stub.cpp index ba697d5..4900689 100644 --- a/nlite_stub/nlite_stub.cpp +++ b/nlite_stub/nlite_stub.cpp @@ -66,6 +66,8 @@ NLIB_RESULT NicoVideoAuth_getNicoVideoAuth(NicoVideoAuth_P self,BROWSERTYPE brow return NLIB_ERR_OK; } +#ifndef TEST_CONNECT_RESULT_CHECK + NLIB_RESULT NicoLiveStream_connect(NicoLiveStream_P self,NicoVideoAuth_P nicoVideoAuth,LPCWSTR url,NicoRecvCallBack callback,LPVOID option){ NLIB_RESULT rslt = NLIB_ERR_OK; @@ -80,6 +82,22 @@ NLIB_RESULT NicoLiveStream_connect(NicoLiveStream_P self,NicoVideoAuth_P nicoVid return rslt; } +#endif + +#ifdef TEST_CONNECT_RESULT_CHECK +NLIB_RESULT NicoLiveStream_connect(NicoLiveStream_P self,NicoVideoAuth_P nicoVideoAuth,LPCWSTR url,NicoRecvCallBack callback,LPVOID option){ + + static NLIB_RESULT rslt = NLIB_ERR_OK; + + rslt++; + + + + return rslt; +} + + +#endif VOID NicoLiveStream_disConnect(NicoLiveStream_P self){ @@ -220,3 +238,76 @@ end: } +// +//ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒXŠÖ˜A +// + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚ÌID‚ðŽæ“¾ +/// +NLIB_DECLSPEC LPCTSTR StreamStatus_getId(StreamStatus_P self){ + + return self->id; +} + + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚̃Rƒ~ƒ…ƒjƒeƒB”ԍ†‚ðŽæ“¾ +/// +NLIB_DECLSPEC LPCTSTR StreamStatus_getDefaultCommunity(StreamStatus_P self){ + + return self->default_community; +} + + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚̃vƒƒoƒCƒ_ƒ^ƒCƒv‚ðŽæ“¾ +/// +PROVIDERTYPE StreamStatus_getProviderType(StreamStatus_P self){ + + return self->provider_type; +} + + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚̃I[ƒi[ƒtƒ‰ƒO‚ðŽæ“¾ +/// +BOOL StreamStatus_isOwner(StreamStatus_P self){ + + return self->is_owner; +} + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚ÌŠJŽnŽž‚ðŽæ“¾ +/// +time_t StreamStatus_getStartTime(StreamStatus_P self){ + + return self->start_time; +} + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚̏I—¹Žž‚ðŽæ“¾ +/// +time_t StreamStatus_getEndTime(StreamStatus_P self){ + + return self->end_time; +} + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚ÌŠJêŽž‚ðŽæ“¾ +/// +time_t StreamStatus_getOpenTime(StreamStatus_P self){ + + return self->open_time; + +} + +/// +///ƒXƒgƒŠ[ƒ€ƒXƒe[ƒ^ƒX‚̃x[ƒXŽž‚ðŽæ“¾ +/// +time_t StreamStatus_getBaseTime(StreamStatus_P self){ + + return self->base_time; +} + + diff --git a/nlite_stub/nlite_stub.vcxproj b/nlite_stub/nlite_stub.vcxproj index 05b1e7d..1928d89 100644 --- a/nlite_stub/nlite_stub.vcxproj +++ b/nlite_stub/nlite_stub.vcxproj @@ -92,6 +92,7 @@ + diff --git a/nlite_stub/nlite_stub.vcxproj.filters b/nlite_stub/nlite_stub.vcxproj.filters index f6092e9..8c1e56e 100644 --- a/nlite_stub/nlite_stub.vcxproj.filters +++ b/nlite_stub/nlite_stub.vcxproj.filters @@ -21,6 +21,9 @@ ソース ファイル + + ソース ファイル +