+
+
+
+
+ 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;
+ }