-static WSAData wsaData; //winsockdata
-static HINTERNET hInternet = NULL;
-static BOOL InitializeNlite(); //\83A\83v\83\8a\83P\81[\83V\83\87\83\93\8f\89\8aú\89»
-static VOID FinalizeNlite(); //\83A\83v\83\8a\83P\81[\83V\83\87\83\93\8fI\97¹\8f\88\97\9d
-static CNliteMainFrame wnd; //\83\81\83C\83\93\83t\83\8c\81[\83\80\83E\83B\83\93\83h\83E
+
+#ifndef NLITE_TEST
//\83\81\83C\83\93\8aÖ\90\94
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE,
UnexpectedErrorMessageShow(TEXT("\83n\83\93\83h\83\8b\82³\82ê\82Ä\82¢\82È\82¢\83G\83\89\81["),e.what(),e.getLineNo(),e.getFileName(),e.getFunctionName());
- goto nlitefinally;
+ goto nliteexception;
} catch(nlib::Exception &e){
UnexpectedErrorMessageShow(TEXT("nlib\82Å\83n\83\93\83h\83\8b\82³\82ê\82Ä\82¢\82È\82¢\83G\83\89\81["),e.what(),e.getLineNo(),e.getFileName(),e.getFunctionName());
- goto nlitefinally;
+ goto nliteexception;
}catch(std::exception &e){
UnexpectedErrorMessageShow(TEXT("\83n\83\93\83h\83\8b\82³\82ê\82Ä\82¢\82È\82¢\83G\83\89\81["),CComBSTR(e.what()),-1,TEXT("\94\90¶\83t\83@\83C\83\8b\82ª\93Á\92è\8fo\97\88\82Ü\82¹\82ñ"),TEXT("\94\90¶\8aÖ\90\94\82ª\93Á\92è\82Å\82«\82Ü\82¹\82ñ"));
- goto nlitefinally;
+ goto nliteexception;
}
-nlitefinally:
- wnd.OnException();
- wnd.DestroyWindow();
- FreeLibrary(hRich);
-nliteend:
+
+nliteend:
+ FreeLibrary(hRich);
_Module.RemoveMessageLoop();
FinalizeNlite();
_Module.Term();
::CoUninitialize();
return nRet;
-}
-
-static BOOL InitializeNlite(){
-
- BOOL rslt = FALSE;
-
- try{
-
- nlite::appInfo = &CApplicationInfo::getInstance();
- INT_PTR err;
- INT_PTR count = 0;
-
- //WSAData\82ð\8f\89\8aú\89»
- while((err = WSAStartup(MAKEWORD(2,0),&wsaData)) == WSASYSNOTREADY){
-
- count++;
- if(count >= 5)break;
- Sleep(500);
+nliteexception:
+ wnd.OnException();
+ wnd.DestroyWindow();
+ goto nliteend;
+}
- }
+#else
+#ifdef NLITE_TEST
- if(err != ERROR_SUCCESS){
- throw AppInitException(__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
- }
+//\83\81\83C\83\93\8aÖ\90\94
+int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE,
+ LPTSTR lpCmdLine, int nCmdShow)
+{
+ HINSTANCE hRich = LoadLibrary(CRichEditCtrl::GetLibraryName());
+ int nRet = -1;
- //\83A\83v\83\8a\83P\81[\83V\83\87\83\93\8fî\95ñ\83C\83\93\83X\83^\83\93\83X\90¶\90¬
- const CApplicationInfo &appInfo = CApplicationInfo::getInstance();
- CNLiteString userAgent;
- userAgent = appInfo.getProcuctName();
- userAgent += TEXT("/");
- userAgent += appInfo.getProductVersion();
+ //
+ //\83A\83v\83\8a\83P\83P\81[\83V\83\87\83\93\8f\89\8aú\89»\8f\88\97\9d
+ //
+ HRESULT hRes = ::CoInitialize(NULL);
+ ATLASSERT(SUCCEEDED(hRes));
+ AtlInitCommonControls(ICC_COOL_CLASSES | ICC_WIN95_CLASSES);
+ GUID guid;
+ _Module.Init(NULL, hInstance,&guid);
+ AtlAxWinInit();
+ InitializeNlite();
- //HTTP\83I\83u\83W\83F\83N\83g\90¶\90¬
- hInternet = WinHttpOpen(userAgent,WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,(LPCWSTR)WINHTTP_NO_PROXY_NAME,(LPCWSTR)WINHTTP_NO_PROXY_BYPASS,0);
+
- if(hInternet == NULL){
- throw AppInitException(__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
- }
- //nlib\82Ì\8f\89\8aú\89»
- InitializeNLIB(hInternet);
- //\83\8d\81[\83J\83\8b\83A\83v\83\8a\83P\81[\83V\83\87\83\93\83t\83H\83\8b\83_\8c\9f\8dõ
- if(SHGetFolderPathW(0,CSIDL_LOCAL_APPDATA,0,SHGFP_TYPE_CURRENT,localAppDataPath) != S_OK){
- throw AppInitException(__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
- }
+ //\8fI\97¹\8cã\83\81\83\82\83\8a\83`\83F\83b\83N
+ vcassert(_heapchk() == _HEAPOK,TEXT("\83q\81[\83v\83G\83\89\81[\82Å\82·"));
- SystemParametersInfo (SPI_SETLISTBOXSMOOTHSCROLLING,FALSE,FALSE,0);
+ nRet = 0;
+ FreeLibrary(hRich);
- if(SHGetFolderPathW(0,CSIDL_APPDATA,0,SHGFP_TYPE_CURRENT,appFolderPath) != S_OK){
- throw AppInitException(__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
- }
- ncvAppSettingPath = appFolderPath;
- ncvAppSettingPath += TEXT("\\posite-c\\NiconamaCommentViewer\\AppSetting.xml");
- rslt = TRUE;
- }catch (AppInitException e){
- rslt = FALSE;
- }
-
+ FinalizeNlite();
+ ::CoUninitialize();
- return rslt;
+ return nRet;
}
+#endif
-VOID FinalizeNlite(){
-
- //\83\81\83C\83\93\83t\83\8c\81[\83\80\83E\83B\83\93\83h\83E\8cã\8f\88\97\9d
- wnd.Finalaize();
-
- //nlib\8cã\8f\88\97\9d
- FinalizeNLIB();
-
- //HTTP\83I\83u\83W\83F\83N\83g\8aJ\95ú
- WinHttpCloseHandle(hInternet);
-
- //winsock\8aJ\95ú
- WSACleanup();
-
- return;
-}
-
+#endif
class CProperty;
class CGeneralProperty;
class CListenerData;
-
+ class CNliteMainFrame;
</Command>
</PreBuildEvent>
<PostBuildEvent>
- <Command>mkdir "$(targetdir)nlite\libs" /y
+ <Command>mkdir "$(targetdir)nlite\libs"
xcopy "$(ProjectDir)libs" "$(targetdir)nlite\libs" /e /y
copy "$(targetdir)nlite.exe" "$(targetdir)nlite\" /y</Command>
</PostBuildEvent>
</Command>
</PreBuildEvent>
<PostBuildEvent>
- <Command>mkdir "$(targetdir)nlite_preview\libs" /y
+ <Command>mkdir "$(targetdir)nlite_preview\libs"
xcopy "$(ProjectDir)libs" "$(targetdir)nlite_preview\libs" /e /y
copy "$(targetdir)nlite.exe" "$(targetdir)nlite_preview\" /y
</ItemGroup>
<ItemGroup>
<ClInclude Include="nlite.h" />
+ <ClInclude Include="nlite_bugreport.h" />
<ClInclude Include="nlite_chatData.h" />
<ClInclude Include="nlite_commentview.h" />
<ClInclude Include="nlite_commentWrite.h" />
<ItemGroup>
<ClCompile Include="nlite.cpp" />
<ClCompile Include="nlite_appInfo.cpp" />
+ <ClCompile Include="nlite_bugreport.cpp" />
<ClCompile Include="nlite_chatData.cpp" />
<ClCompile Include="nlite_commentview.cpp" />
<ClCompile Include="nlite_commentWrite.cpp" />
<ClInclude Include="nlite_viewerPropertyWindow.h">
<Filter>ヘッダー ファイル</Filter>
</ClInclude>
+ <ClInclude Include="nlite_bugreport.h">
+ <Filter>ヘッダー ファイル</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<ClCompile Include="nlite_common.cpp">
<Filter>ソース ファイル</Filter>
</ClCompile>
+ <ClCompile Include="nlite_bugreport.cpp">
+ <Filter>ソース ファイル</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="nlite.rc">
--- /dev/null
+#include "stdafx.h"
+#include "nlite_include.h"
+
+namespace nlite{
+
+
+ BugTrail::BugTrail():
+ headMessage(),
+ summary(),
+ line(),
+ fileName(),
+ function()
+ {}
+
+
+ HINTERNET CBugReport::hInternet = NULL;
+ CString CBugReport::outputDir;
+ const CString CBugReport::szHostName(TEXT("http://localhost"));
+ const CString CBugReport::szUrlPath(TEXT("bugreport.rb"));
+ const UINT_PTR CBugReport::portNo(8080);
+ VOID CBugReport::OutBugFile(){
+
+
+
+ return;
+ }
+
+ BOOL CBugReport::SendBugReport(const BugTrail& bugtrail){
+
+ BOOL result = FALSE;
+
+ HINTERNET hConnect = NULL;
+ HINTERNET hRequest = NULL;
+ TCHAR szHeader[] = TEXT("Content-Type: application/x-www-form-urlencoded\r\n");
+ DWORD dwHeaderLength = _tcslen(szHeader);
+ DWORD dwTotalLength;
+ DWORD dwStatusCode;
+ DWORD dwDataLength;
+ hConnect = WinHttpConnect(CBugReport::hInternet, CBugReport::szHostName, CBugReport::portNo, 0);
+ if (hConnect == NULL) {
+ goto networderr;
+ }
+
+ hRequest = WinHttpOpenRequest(hConnect, TEXT("POST"), CBugReport::szUrlPath, NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, 0);
+ if (hRequest == NULL) {
+ goto networderr;
+ }
+
+ CString postData;
+ postData = TEXT("sourcefile=");
+ postData += bugtrail.fileName;
+ postData += TEXT("\r\n");
+
+
+
+
+ std::vector<char> body;
+ body.reserve(GetLenToMB(CP_UTF8,postData));
+ WideToMB(CP_UTF8,postData,&body[0],body.capacity());
+ dwDataLength = body.size();
+ dwTotalLength = dwDataLength;
+ WinHttpSendRequest(hRequest, szHeader, dwHeaderLength, WINHTTP_NO_REQUEST_DATA, 0, dwTotalLength, 0);
+ WinHttpWriteData(hRequest,&body[0],dwTotalLength ,&dwDataLength);
+ WinHttpReceiveResponse(hRequest, NULL);
+
+ DWORD dwSize = sizeof(DWORD);
+ WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, WINHTTP_HEADER_NAME_BY_INDEX, &dwStatusCode, &dwSize, WINHTTP_NO_HEADER_INDEX);
+
+
+end:
+
+
+ WinHttpCloseHandle(hRequest);
+ WinHttpCloseHandle(hConnect);
+
+
+
+ return result;
+
+networderr:
+ result = FALSE;
+
+ goto end;
+ }
+
+ VOID CBugReport::TakeBugFiles(){
+
+ return;
+ }
+
+ VOID CBugReport::Initalize(HINTERNET hInternet,const CString &outputDir){
+
+ CBugReport::hInternet = hInternet;
+ CBugReport::outputDir = outputDir;
+ return;
+ }
+
+}
\ No newline at end of file
--- /dev/null
+#pragma once
+
+
+namespace nlite{
+
+
+ struct BugTrail{
+
+ CString headMessage;
+ CString summary;
+ CString line;
+ CString fileName;
+ CString function;
+
+
+ BugTrail();
+ };
+
+ class CBugReport{
+
+ private:
+ //\83C\83\93\83^\81[\83l\83b\83g\83n\83\93\83h\83\8b
+ static HINTERNET hInternet;
+ static CString outputDir;
+ const static CString szHostName;
+ const static CString szUrlPath;
+ const static UINT_PTR portNo;
+ private:
+ ///
+ ///\83o\83O\8fî\95ñ\82ð\83t\83@\83C\83\8b\82É\8fo\97Í
+ ///
+ VOID OutBugFile();
+
+ public:
+ BOOL SendBugReport(const BugTrail& bugtrail);
+
+ VOID TakeBugFiles();
+
+
+ static VOID Initalize(HINTERNET hInternet,const CString &outputDir);
+
+ };
+
+}
\ No newline at end of file
namespace nlite{
-
+
namespace nliteregex{
namespace text{
const CString URL_TEXT = TEXT("(https?|ftp)(://[-_.!~*\'()a-zA-Z0-9;/?:@&=+$,%#]+)");
CString ncvAppSettingPath;
TCHAR localAppDataPath[_MAX_PATH];
speaker::ISpeaker &g_speaker = speaker::ISpeaker::GetMeiNormal(TEXT("libs\\Voice\\mei_normal\\"),TEXT("libs\\open_jtalk_dic\\"));
+ WSAData wsaData; //winsockdata
+ HINTERNET hInternet = NULL;
+ CNliteMainFrame wnd; //\83\81\83C\83\93\83t\83\8c\81[\83\80\83E\83B\83\93\83h\83E
+
VOID nlite::UnexpectedErrorMessageShow(LPCTSTR headMessage,LPCTSTR summary,UINT line,LPCTSTR fileName,LPCTSTR function){
CString errLogFilePath(nliteProperty.GetPropertySaveFolderPath());
const CApplicationInfo * appInfo = NULL;
+
+
+
+
+ BOOL InitializeNlite(){
+
+ BOOL rslt = FALSE;
+
+ try{
+
+ nlite::appInfo = &CApplicationInfo::getInstance();
+ INT_PTR err;
+ INT_PTR count = 0;
+
+ //WSAData\82ð\8f\89\8aú\89»
+ while((err = WSAStartup(MAKEWORD(2,0),&wsaData)) == WSASYSNOTREADY){
+
+ count++;
+ if(count >= 5)break;
+ Sleep(500);
+
+
+
+ }
+
+ if(err != ERROR_SUCCESS){
+
+ throw AppInitException(__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
+ }
+
+ //\83A\83v\83\8a\83P\81[\83V\83\87\83\93\8fî\95ñ\83C\83\93\83X\83^\83\93\83X\90¶\90¬
+ const CApplicationInfo &appInfo = CApplicationInfo::getInstance();
+ CNLiteString userAgent;
+ userAgent = appInfo.getProcuctName();
+ userAgent += TEXT("/");
+ userAgent += appInfo.getProductVersion();
+
+
+
+ //HTTP\83I\83u\83W\83F\83N\83g\90¶\90¬
+ hInternet = WinHttpOpen(userAgent,WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,(LPCWSTR)WINHTTP_NO_PROXY_NAME,(LPCWSTR)WINHTTP_NO_PROXY_BYPASS,0);
+
+ if(hInternet == NULL){
+
+ throw AppInitException(__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
+
+ }
+
+ //nlib\82Ì\8f\89\8aú\89»
+ InitializeNLIB(hInternet);
+
+ //\83\8d\81[\83J\83\8b\83A\83v\83\8a\83P\81[\83V\83\87\83\93\83t\83H\83\8b\83_\8c\9f\8dõ
+ if(SHGetFolderPathW(0,CSIDL_LOCAL_APPDATA,0,SHGFP_TYPE_CURRENT,localAppDataPath) != S_OK){
+
+ throw AppInitException(__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
+ }
+
+
+
+
+
+
+ if(SHGetFolderPathW(0,CSIDL_APPDATA,0,SHGFP_TYPE_CURRENT,appFolderPath) != S_OK){
+
+ throw AppInitException(__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
+ }
+ ncvAppSettingPath = appFolderPath;
+ ncvAppSettingPath += TEXT("\\posite-c\\NiconamaCommentViewer\\AppSetting.xml");
+
+ nliteProperty.ReadProperty();
+
+ if((nliteProperty.GetGeneralProperty().IsNCVUserSettingReaded() == FALSE)){
+
+ ReadNCVListenerData();
+ }
+
+ listenerList.ReadProperty(nliteProperty.GetListenerDataPath());
+
+ CBugReport::Initalize(hInternet,CString(nliteProperty.GetPropertySaveFolderPath()) + TEXT("bugReport\\"));
+ rslt = TRUE;
+ }catch (AppInitException e){
+
+ rslt = FALSE;
+
+ }
+
+
+ return rslt;
+ }
+
+
+ VOID FinalizeNlite(){
+
+ //\83\81\83C\83\93\83t\83\8c\81[\83\80\83E\83B\83\93\83h\83E\8cã\8f\88\97\9d
+ wnd.Finalaize();
+
+ //nlib\8cã\8f\88\97\9d
+ FinalizeNLIB();
+
+ //HTTP\83I\83u\83W\83F\83N\83g\8aJ\95ú
+ WinHttpCloseHandle(hInternet);
+
+ //winsock\8aJ\95ú
+ WSACleanup();
+
+ return;
+ }
+
+
+ BOOL ReadNCVListenerData(){
+
+ BOOL rslt = FALSE;
+
+ if((PathFileExists(ncvAppSettingPath) && (!::PathIsDirectory( ncvAppSettingPath )))){
+
+ if((::MessageBox(NULL,TEXT("NCV\82Ì\83\8a\83X\83i\81[\8fî\95ñ\82Æ\93¯\8aú\82µ\82Ü\82·\82©\81H"),TEXT("\83\8a\83X\83i\81[\8fî\95ñ\93Ç\82Ý\8d\9e\82Ý"),MB_OK | MB_OKCANCEL) == IDOK)){
+ listenerList.ReadProperty(GetNCVListenerInfoFilePath());
+ }
+ nliteProperty.GetGeneralProperty().SetNCVUSerSettingReaded(TRUE);
+ rslt = TRUE;
+ }
+
+ return rslt;
+ }
}
extern TCHAR localAppDataPath[];
extern TCHAR appFolderPath[];
extern CString ncvAppSettingPath;
-
+ extern WSAData wsaData; //winsockdata
+ extern HINTERNET hInternet;
+ extern BOOL InitializeNlite(); //\83A\83v\83\8a\83P\81[\83V\83\87\83\93\8f\89\8aú\89»
+ extern VOID FinalizeNlite(); //\83A\83v\83\8a\83P\81[\83V\83\87\83\93\8fI\97¹\8f\88\97\9d
+ extern CNliteMainFrame wnd; //\83\81\83C\83\93\83t\83\8c\81[\83\80\83E\83B\83\93\83h\83E
//\83O\83\8d\81[\83o\83\8b\8aÖ\90\94
extern VOID UnexpectedErrorMessageShow(LPCTSTR headMessage,LPCTSTR summary,UINT line,LPCTSTR fileName,LPCTSTR function);
///
+ ///NCV\82Ì\83\8a\83X\83i\81[\83f\81[\83^\82ð\93Ç\82Ý\8eæ\82è
+ ///
+ extern BOOL ReadNCVListenerData();
+
+ ///
///ncv\82Ì\83\8a\83X\83i\81[\8fî\95ñ\83t\83@\83C\83\8b\83p\83X\82ð\8eæ\93¾
///
extern CString GetNCVListenerInfoFilePath();
#include "nlite_appinfo.h"
#include "nlite_propertyWindow.h"
#include "nlite_mainframe.h"
+#include "nlite_bugreport.h"
VOID CNliteMainFrame::Initialize(LPCTSTR localAppDataPath){
try{
- nliteProperty.ReadProperty();
+
- if((nliteProperty.GetGeneralProperty().IsNCVUserSettingReaded() == FALSE) &&
- ((PathFileExists(ncvAppSettingPath) && (!::PathIsDirectory( ncvAppSettingPath ))))){
-
- if((::MessageBox(NULL,TEXT("NCV\82Ì\83\8a\83X\83i\81[\8fî\95ñ\82Æ\93¯\8aú\82µ\82Ü\82·\82©\81H"),TEXT("\83\8a\83X\83i\81[\8fî\95ñ\93Ç\82Ý\8d\9e\82Ý"),MB_OK | MB_OKCANCEL) == IDOK)){
- listenerList.ReadProperty(GetNCVListenerInfoFilePath());
- }
- nliteProperty.GetGeneralProperty().SetNCVUSerSettingReaded(TRUE);
-
-
- }
-
- listenerList.ReadProperty(nliteProperty.GetListenerDataPath());
-
commentView.SetProperty(nliteProperty.GetCommentViewProperty(),nliteProperty.GetGeneralProperty());
if(nliteProperty.GetGeneralProperty().GetBrowserType() == BT_NOSETTING){
nliteProperty.CookieSetting();
#define WINDEBUGER_NOPRINTING //\83f\83o\83b\83O\8fo\97Í\82ð\83R\83\93\83\\81[\83\8b\82É\95\\8e¦\82µ\82½\82\82È\82¢\8fê\8d\87\92è\8b`\82·\82é
#define _WTL_NO_CSTRING
+
+//#define NLITE_TEST
+
// Windows \83w\83b\83_\81[ \83t\83@\83C\83\8b:
#include <windows.h>
#include <WindowsX.h>