Exemplo n.º 1
0
void CToxProto::OnGotFriendAvatarInfo(AvatarTransferParam *transfer)
{
	if (transfer->pfts.totalBytes == 0)
	{
		MCONTACT hConact = transfer->pfts.hContact;
		std::tstring path = GetAvatarFilePath(hConact);
		if (IsFileExists(path))
			DeleteFile(path.c_str());

		transfers.Remove(transfer);
		delSetting(hConact, TOX_SETTINGS_AVATAR_HASH);
		ProtoBroadcastAck(hConact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, 0, 0);
		return;
	}

	DBVARIANT dbv;
	if (!db_get(transfer->pfts.hContact, m_szModuleName, TOX_SETTINGS_AVATAR_HASH, &dbv))
	{
		if (memcmp(transfer->hash, dbv.pbVal, TOX_HASH_LENGTH) == 0)
		{
			db_free(&dbv);
			OnFileCancel(transfer->pfts.hContact, transfer);
			return;
		}
		db_free(&dbv);
	}

	TCHAR path[MAX_PATH];
	mir_sntprintf(path, _countof(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
	OnFileAllow(transfer->pfts.hContact, transfer, path);
}
Exemplo n.º 2
0
void CToxProto::BootstrapNodesFromIni(bool isIPv6)
{
	if (IsFileExists((TCHAR*)VARST(_T(TOX_INI_PATH))))
	{
		char fileName[MAX_PATH];
		mir_strcpy(fileName, VARS(TOX_INI_PATH));

		char *section, sections[MAX_PATH], value[MAX_PATH];
		GetPrivateProfileSectionNamesA(sections, _countof(sections), fileName);
		section = sections;
		while (*section != NULL)
		{
			if (strstr(section, TOX_SETTINGS_NODE_PREFIX) == section)
			{
				GetPrivateProfileStringA(section, "IPv4", NULL, value, _countof(value), fileName);
				ptrA address(mir_strdup(value));
				int port = GetPrivateProfileIntA(section, "Port", 33445, fileName);
				GetPrivateProfileStringA(section, "PubKey", NULL, value, _countof(value), fileName);
				ptrA pubKey(mir_strdup(value));
				BootstrapNode(address, port, pubKey);
				if (isIPv6)
				{
					GetPrivateProfileStringA(section, "IPv6", NULL, value, _countof(value), fileName);
					address = mir_strdup(value);
					BootstrapNode(address, port, pubKey);
				}
			}
			section += mir_strlen(section) + 1;
		}
	}
}
Exemplo n.º 3
0
/*! @brief フォルダ指定EditBoxのコールバック関数

	@date 2007.02.09 bosagami 新規作成
	@date 2007.09.02 genta ディレクトリチェックを強化
*/
LRESULT CALLBACK OnFolderProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
	if(msg == WM_DROPFILES) 
	do {
		//	From Here 2007.09.02 genta 
		SFilePath sPath;
		if( DragQueryFile((HDROP)wparam, 0, NULL, 0 ) > _countof2(sPath) - 1 ){
			// skip if the length of the path exceeds buffer capacity
			break;
		}
		DragQueryFile((HDROP)wparam, 0, sPath, _countof2(sPath) - 1);

		//ファイルパスの解決
		CSakuraEnvironment::ResolvePath(sPath);
		
		//	ファイルがドロップされた場合はフォルダを切り出す
		//	フォルダの場合は最後が失われるのでsplitしてはいけない.
		if( IsFileExists( sPath, true )){	//	第2引数がtrueだとディレクトリは対象外
			SFilePath szWork;
			SplitPath_FolderAndFile( sPath, szWork, NULL );
			_tcscpy( sPath, szWork );
		}

		SetGrepFolder(hwnd, sPath);
	}
	while(0);	//	1回しか通らない. breakでここまで飛ぶ

	return  CallWindowProc(g_pOnFolderProc,hwnd,msg,wparam,lparam);
}
Exemplo n.º 4
0
BOOL CReportCameraWorker::LogCaptureFile(CString FileExt)
{
	CString	strCaptureFileName = GetCaptureFileName(FileExt);
	// if there are capture file save it to log
	if (IsFileExists(strCaptureFileName))
	{
		// save data about file to log
		CString strClientCameraReportFilesDirectory = GetClientCameraReportsFilesDirectory();
		
		CString strDateTime = m_LastStartedCaptureTime.Format(_T("%a %b %d %H:%M:%S %Y"));
		
		CString strCameraLogFileName;
		strCameraLogFileName.Format(_T("%s\\%s.clog"), GetClientCameraReportsFilesDirectory(), m_CaptureFileName.Mid(0, 8));
		TRACE(_T("CAMERA LOG [%s]\n"), strCameraLogFileName);
		
		CStdioFile LogFile;
		
		if (LogFile.Open(strCameraLogFileName, CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite | CFile::typeText))
		{
			CString strOutLogLine;
			
			//Wed Sep 28 15:52:22 2011,20110928155222.ogg,1029380,da1381f68be6f165d11358847d68a5f0
			strOutLogLine.Format(_T("%s,%s,%I64u,%s\n"), strDateTime, GetFileName(strCaptureFileName), GetBinFileSizeEx(strCaptureFileName), GetMD5Signature(strCaptureFileName));
			
			LogFile.SeekToEnd();
			LogFile.WriteString(strOutLogLine);
			LogFile.Close();

			return TRUE;
		}
	}

	return FALSE;
}
Exemplo n.º 5
0
int _tmain(int argc, _TCHAR* argv[])
{
    LPCTSTR szUrl = _T("http://localhost:8033/uploadDmp");

    // parse command
    typedef std::basic_string<TCHAR> tstring;
    tstring strFilePath;
    for(int i=1; i<argc; ++ i)
    {
        if(_tcsnicmp(argv[i], _T("-f"), 2) == 0)
        {
            strFilePath = argv[i] + 2;
            if(strFilePath.length() > 2 && strFilePath[0] == _T('\"'))
                strFilePath = strFilePath.substr(1, strFilePath.length() - 2);
        }
    }
    if(strFilePath.empty() || !IsFileExists(strFilePath.c_str()))
        return 0;

    CCrashUploader uploader;
    uploader.setFile(strFilePath.c_str())
        .setUrl(szUrl)
        .asyncUpload(&UploadCallback)
        .wait();

	return 0;
}
Exemplo n.º 6
0
void CToxProto::OnGotFriendAvatarInfo(Tox *tox, int32_t number, uint8_t format, uint8_t *hash, void *arg)
{
	CToxProto *proto = (CToxProto*)arg;

	MCONTACT hContact = proto->FindContact(number);
	if (hContact)
	{
		std::tstring path = proto->GetAvatarFilePath(hContact);
		if (format == TOX_AVATAR_FORMAT_NONE)
		{
			proto->delSetting(hContact, TOX_SETTINGS_AVATAR_HASH);
			proto->ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, 0, 0);
			if (IsFileExists(path))
			{
				DeleteFile(path.c_str());
			}
		}
		else
		{
			DBVARIANT dbv;
			if (!db_get(hContact, proto->m_szModuleName, TOX_SETTINGS_AVATAR_HASH, &dbv))
			{
				if (memcmp(hash, dbv.pbVal, TOX_HASH_LENGTH) != 0)
				{
					tox_request_avatar_data(proto->tox, number);
				}
				db_free(&dbv);
			}
			else
			{
				tox_request_avatar_data(proto->tox, number);
			}
		}
	}
}
Exemplo n.º 7
0
INT_PTR CToxProto::SetMyAvatar(WPARAM wParam, LPARAM lParam)
{
	TCHAR *path = (TCHAR*)lParam;
	std::tstring avatarPath = GetAvatarFilePath();
	if (path != NULL)
	{
		if (!CopyFile(path, avatarPath.c_str(), FALSE))
		{
			debugLogA("CToxProto::SetMyAvatar: failed to copy new avatar to avatar cache");
			return -1;
		}

		SetToxAvatar(avatarPath, true);
	}
	else
	{
		if (tox_unset_avatar(tox) == TOX_ERROR)
		{
			debugLogA("CToxProto::SetMyAvatar: failed to unset avatar");
			return -1;
		}

		if (IsFileExists(avatarPath))
		{
			DeleteFile(avatarPath.c_str());
		}

		db_unset(NULL, m_szModuleName, TOX_SETTINGS_AVATAR_HASH);
	}

	return 0;
}
Exemplo n.º 8
0
	TString GetNewNameForFileDigit(const TPath &oldPath, const TString &nameWithoutDigit, __int64 & counter, size_t & leadingZeros, const TPath &pathForRename)
    {
		TString pathWithDigit;
		const int BUFFER_SIZE = 65;
		char buffer[BUFFER_SIZE];
		TString leadingZeroString;

		counter++;
		if (leadingZeros > 0)
		{
			if (LengthOfLong(counter) > LengthOfLong(counter - 1)) //если цифра удленилась
               leadingZeros--;
			for (size_t i = 0; i < leadingZeros; i++)
				leadingZeroString.push_back('0');
		}

		if (_i64toa_s(counter, buffer, BUFFER_SIZE, 10) == 0)
		{
			pathWithDigit = CreatePath(oldPath.GetDirectory(), nameWithoutDigit + leadingZeroString + TString(buffer) + oldPath.GetExtension());
			if(TPath::EqualByNameWithExtension(pathWithDigit, pathForRename))
				return pathForRename.Original();
			if (IsFileExists(pathWithDigit.c_str())) //если такой файл уже есть, то не увеличиваем номер, а добавляем _2
				return GetNewNameForFileAdd(oldPath);
		}
		else
			return GetNewNameForFileAdd(oldPath);
		return pathWithDigit;
    }
Exemplo n.º 9
0
int GetSSLPassPhrase(const char* fname, std::string& out)
{
	if(0 != IsFileExists(fname))
	{
		std::cout << fname << ": No Such file!" << "[" << __FUNCTION__ << ":" << __LINE__ << "]" << std::endl;
		return -1;
	}


	std::string ans;
	std::ostringstream cmd;
	
	std::string fname_cmd(fname);
	//fname_cmd += " readConf";
	cmd << fname_cmd << " 2>&1";
	//cmd << fname << " 2>&1";
	
	std::cout << cmd.str() << "    " << cmd.str().c_str() << "[" << __FUNCTION__ << ":" << __LINE__ << "]" << std::endl;
	
	int ret;
	ret = SystemPipedCommand(cmd.str().c_str(), ans);
	if (ret != 0)
		std::cout << "error! ret=" << ret << "[" << __FUNCTION__ << ":" << __LINE__ << "]" << std::endl;

	out = ans;
	std::cout << "shell script result: " << ans << "[" << __FUNCTION__ << ":" << __LINE__ << "]" << std::endl;
	
	return 0;
}
Exemplo n.º 10
0
	bool InitializeNavigationRoutes(void)
	{
		string file = NAV_PATH + "NAVDATA/wpNavRTE.txt";
		if(!IsFileExists(file.c_str()))
			return false;
		Internal::InitializeNavigationRoutes(file);
		return true;
	}
Exemplo n.º 11
0
INT_PTR CToxProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
{
	std::tstring path = GetAvatarFilePath();
	if (IsFileExists(path))
		mir_tstrncpy((TCHAR*)wParam, path.c_str(), (int)lParam);

	return 0;
}
Exemplo n.º 12
0
	bool InitializeAirports(void)
	{
		string file = NAV_PATH + "NAVDATA/airports.dat";
		if(!IsFileExists(file.c_str()))
			return false;
		Internal::InitializeAirports(file);
		return true;
	}
Exemplo n.º 13
0
	bool InitializeDAFixes(const char *ICAO)
	{
		char file[128];
		sprintf(file, "%sSIDSTARS/%s.txt", NAV_PATH.c_str(), ICAO);
		if(!IsFileExists(file))
			return false;
		Internal::InitializeDAFixes(file, (char*)ICAO);
		return true;
	}
Exemplo n.º 14
0
	bool SetNavDataPath(const char *path)
	{
		NAV_PATH = path;
		string checker = NAV_PATH;
		checker += "NAVDATA/cycle_info.txt";
		if(IsFileExists(checker.c_str()))
			return true;
		else
			return false;
	}
Exemplo n.º 15
0
bool Editor::SaveMap(std::string name)
{
	if (!IsFileExists(("maps/" + name + ".soc").c_str()))
	{
		map->SaveMap(name, floors, destinations, boxes, walls, player);
		return true;
	}

	return false;
}
Exemplo n.º 16
0
Arquivo: Menu.cpp Projeto: mrDIMAS/src
void Menu::OnContinueGameClick() {
	if(IsFileExists("quickSave.save")) {
		SetPage(Page::Main);
		if(!mGame->GetLevel()) {
			mModalWindow->Ask(mLocalization.GetString("continueLastGameQuestion"));
			mModalWindow->SetYesAction([this] { CameraStartFadeOut([this] { mGame->LoadState("quickSave.save"); Hide(); }); });
		} else {
			CameraStartFadeOut([this] {	Hide(); });
		}
	}
}
Exemplo n.º 17
0
void CExportData::ProduceDayWbKline(CString DestFileName,int BeginDate,int EndDate)
{
	if( IsFileExists( DestFileName ) )
		if( AfxMessageBox("存在同名文件,是否覆盖?",MB_ICONQUESTION|MB_YESNO )==IDNO )
			return;
    CString FloppyFileName;
	UpdateWindow();
	
	if (DestFileName[0]=='a'||DestFileName[0]=='b'||DestFileName[0]=='A'||DestFileName[0]=='B')
	{
		FloppyFileName=DestFileName;
		DestFileName="C:\\Source.day";
	}


}
Exemplo n.º 18
0
INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam)
{
	debugLogA("CToxProto::SetMyAvatar: setting avatar");
	TCHAR *path = (TCHAR*)lParam;
	std::tstring avatarPath = GetAvatarFilePath();
	if (path != NULL)
	{
		debugLogA("CToxProto::SetMyAvatar: copy new avatar");
		if (!CopyFile(path, avatarPath.c_str(), FALSE))
		{
			debugLogA("CToxProto::SetMyAvatar: failed to copy new avatar to avatar cache");
			return 0;
		}

		SetToxAvatar(avatarPath);

		return 0;
	}

	if (IsOnline())
	{
		for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
		{
			if (GetContactStatus(hContact) == ID_STATUS_OFFLINE)
				continue;

			int32_t friendNumber = GetToxFriendNumber(hContact);
			if (friendNumber == UINT32_MAX)
				continue;

			TOX_ERR_FILE_SEND error;
			tox_file_send(tox, friendNumber, TOX_FILE_KIND_AVATAR, 0, NULL, NULL, 0, &error);
			if (error != TOX_ERR_FILE_SEND_OK)
			{
				debugLogA(__FUNCTION__": failed to unset avatar (%d)", error);
				return 0;
			}
		}
	}

	if (IsFileExists(avatarPath))
		DeleteFile(avatarPath.c_str());

	delSetting(TOX_SETTINGS_AVATAR_HASH);

	return 0;
}
Exemplo n.º 19
0
INT_PTR CToxProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
{
	if (!wParam)
	{
		return -2;
	}

	std::tstring path(GetAvatarFilePath());
	if (IsFileExists(path))
	{
		_tcsncpy((TCHAR*)wParam, path.c_str(), (int)lParam);

		return 0;
	}

	return -1;
}
Exemplo n.º 20
0
	// Перименовываем, добавляя _2 к имени файла.
	TString GetNewNameForFileAdd(const TPath &oldPath)
    {
		TString uniquePath;
		const int SIMILAR_PREFIX_SIZE = 16;
		const TChar *SIMILAR_PREFIX_FORMAT = TEXT("_%u");
		TChar buffer[SIMILAR_PREFIX_SIZE];
		unsigned long counter = 2;

		do 
		{
			_stprintf_s(buffer, SIMILAR_PREFIX_FORMAT, counter++);
			uniquePath = CreatePath(oldPath.GetDirectory(), oldPath.GetName(false) + TString(buffer) + oldPath.GetExtension());
		} 
		while (IsFileExists(uniquePath.c_str()));

        return uniquePath;
    }
Exemplo n.º 21
0
    adError LoadBitmap(const TString& fileName, adBitmapPtr pBitmap)
    {
        if(pBitmap == NULL)
            return AD_ERROR_INVALID_POINTER;

        if(pBitmap->width == 0 || pBitmap->height == 0 || pBitmap->stride == 0 || 
            pBitmap->format <= AD_PIXEL_FORMAT_NONE || pBitmap->format >= AD_PIXEL_FORMAT_SIZE || 
            pBitmap->data == NULL)
            return AD_ERROR_INVALID_BITMAP;

        if(!IsFileExists(fileName.c_str()))
            return AD_ERROR_FILE_IS_NOT_EXIST;

        adError result = AD_ERROR_UNKNOWN;

        HGLOBAL hGlobal = LoadFileToMemory(fileName.c_str());
        if(hGlobal)
        {
            TImage *pImage = TImage::Load(hGlobal);
            if(pImage)
            {
                TView::Format format = TView::None;
                switch(pBitmap->format)
                {
                case AD_PIXEL_FORMAT_ARGB32:
                    format = TView::Bgra32;
                    break;
                }
                if(format)
                {
                    TView view(pBitmap->width, pBitmap->height, pBitmap->stride, format, pBitmap->data);
                    Simd::ResizeBilinear(*pImage->View(), view);
                    result = AD_OK;
                }
                delete pImage;
            }
            else
                result = AD_ERROR_CANT_LOAD_IMAGE;
            ::GlobalFree(hGlobal);
        }
        else
            result = AD_ERROR_CANT_OPEN_FILE;

        return result;
    }
Exemplo n.º 22
0
INT_PTR CToxProto::GetAvatarInfo(WPARAM, LPARAM lParam)
{
	PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION *)lParam;

	ptrA address(getStringA(pai->hContact, TOX_SETTINGS_ID));
	if (address != NULL)
	{
		std::tstring path = GetAvatarFilePath(pai->hContact);
		if (IsFileExists(path))
		{
			mir_tstrncpy(pai->filename, path.c_str(), _countof(pai->filename));
			pai->format = PA_FORMAT_PNG;

			return GAIR_SUCCESS;
		}
	}

	return GAIR_NOAVATAR;
}
Exemplo n.º 23
0
HBITMAP LoadTransparentImage(wchar_t *fileName)
{
	if (m_pImageFactory != NULL && IsFileExists(fileName) == TRUE)
	{
		IImage*			pImage = NULL;
		IBitmapImage*	pBitmapImage = NULL;
		ImageInfo		imageInfo; 
		BitmapData		bitmapData;

		m_pImageFactory->CreateImageFromFile(fileName, &pImage);
		m_pImageFactory->CreateBitmapFromImage(pImage, 0, 0, 
						PixelFormat32bppPARGB, InterpolationHintNearestNeighbor, 
						&pBitmapImage);
		pImage->GetImageInfo(&imageInfo);  
		RECT rect = {0, 0, imageInfo.Width, imageInfo.Height}; 

		pBitmapImage->LockBits(&rect, ImageLockModeRead, 
								PixelFormat32bppPARGB, &bitmapData);

		return CreateBitmap( imageInfo.Width, imageInfo.Height, 1, 
			GetPixelFormatSize(imageInfo.PixelFormat), bitmapData.Scan0);
	}
	return NULL;
};
Exemplo n.º 24
0
HINSTANCE InstallPcdDriverInternal()
{
	char tmp[MAX_PATH];
	bool install_driver = true;
	HINSTANCE h;
	char *dll_filename;

	// Confirm whether the see.sys is installed in system32\drivers folder
	Format(tmp, sizeof(tmp), "%s\\drivers\\see.sys", MsGetSystem32Dir());

	if (IsFileExists(tmp))
	{
		// If driver file is exist, try to get build number from registry
		if (LoadPcdDriverBuild() >= CEDAR_BUILD)
		{
			// Already latest driver is installed
			install_driver = false;
		}
	}

	if (install_driver)
	{
		char *src_filename = BRIDGE_WIN32_PCD_SYS;
		// If need to install the driver, confirm user is administrator
		if (MsIsAdmin() == false)
		{
			// Non administrator can't install driver
			return NULL;
		}

		if (MsIsX64())
		{
			src_filename = BRIDGE_WIN32_PCD_SYS_X64;
		}

		if (MsIsIA64())
		{
			src_filename = BRIDGE_WIN32_PCD_SYS_IA64;
		}

		// Copy see.sys
		if (FileCopy(src_filename, tmp) == false)
		{
			return NULL;
		}

		// Save build number
		SavePcdDriverBuild(CEDAR_BUILD);
	}

	dll_filename = BRIDGE_WIN32_PCD_DLL;

	if (Is64())
	{
		if (MsIsX64())
		{
			dll_filename = BRIDGE_WIN32_PCD_DLL_X64;
		}
		else if (MsIsIA64())
		{
			dll_filename = BRIDGE_WIN32_PCD_DLL_IA64;
		}
	}

	// Try to load see.dll and initialize
	h = MsLoadLibrary(dll_filename);
	if (h == NULL)
	{
		return NULL;
	}

	return h;
}
Exemplo n.º 25
0
/*!	WinHelp のかわりに HtmlHelp を呼び出す

	@author ryoji
	@date 2006.07.22 ryoji 新規
*/
BOOL MyWinHelp(HWND hwndCaller, UINT uCommand, DWORD_PTR dwData)
{
	UINT uCommandOrg = uCommand;	// WinHelp のコマンド
	bool bDesktop = false;	// デスクトップを親にしてヘルプ画面を出すかどうか
	HH_POPUP hp;	// ポップアップヘルプ用の構造体

	// Note: HH_TP_HELP_CONTEXTMENU や HELP_WM_HELP ではヘルプコンパイル時の
	// トピックファイルを Cshelp.txt 以外にしている場合、
	// そのファイル名を .chm パス名に追加指定する必要がある。
	//     例)sakura.chm::/xxx.txt

	switch( uCommandOrg )
	{
	case HELP_COMMAND:	// [ヘルプ]-[目次]
	case HELP_CONTENTS:
		uCommand = HH_DISPLAY_TOC;
		hwndCaller = ::GetDesktopWindow();
		bDesktop = true;
		break;
	case HELP_KEY:	// [ヘルプ]-[キーワード検索]
		uCommand = HH_DISPLAY_INDEX;
		hwndCaller = ::GetDesktopWindow();
		bDesktop = true;
		break;
	case HELP_CONTEXT:	// メニュー上での[F1]キー/ダイアログの[ヘルプ]ボタン
		uCommand = HH_HELP_CONTEXT;
		hwndCaller = ::GetDesktopWindow();
		bDesktop = true;
		break;
	case HELP_CONTEXTMENU:	// コントロール上での右クリック
	case HELP_WM_HELP:		// [?]ボタンを押してコントロールをクリック/コントロールにフォーカスを置いて[F1]キー
		uCommand = HH_DISPLAY_TEXT_POPUP;
		{
			// ポップアップヘルプ用の構造体に値をセットする
			HWND hwndCtrl;	// ヘルプ表示対象のコントロール
			int nCtrlID;	// 対象コントロールの ID
			DWORD* pHelpIDs;	// コントロール ID とヘルプ ID の対応表へのポインタ

			memset(&hp, 0, sizeof(hp));	// 構造体をゼロクリア
			hp.cbStruct = sizeof(hp);
			hp.pszFont = _T("MS Pゴシック, 9");
			hp.clrForeground = hp.clrBackground = -1;
			hp.rcMargins.left = hp.rcMargins.top = hp.rcMargins.right = hp.rcMargins.bottom = -1;
			if( uCommandOrg == HELP_CONTEXTMENU ){
				// マウスカーソル位置から対象コントロールと表示位置を求める
				if( !::GetCursorPos(&hp.pt) )
					return FALSE;
				hwndCtrl = ::WindowFromPoint(hp.pt);
			}
			else{
				// 対象コントロールは hwndCaller
				// [F1]キーの場合もあるので対象コントロールの位置から表示位置を決める
				RECT rc;
				hwndCtrl = hwndCaller;
				if( !::GetWindowRect( hwndCtrl, &rc ) )
					return FALSE;
				hp.pt.x = (rc.left + rc.right) / 2;
				hp.pt.y = rc.top;
			}
			// 対象コントロールに対応するヘルプ ID を探す
			nCtrlID = ::GetDlgCtrlID( hwndCtrl );
			if( nCtrlID <= 0 )
				return FALSE;
			pHelpIDs = (DWORD*)dwData;
			for (;;) {
				if( *pHelpIDs == 0 )
					return FALSE;	// 見つからなかった
				if( *pHelpIDs == (DWORD)nCtrlID )
					break;			// 見つかった
				pHelpIDs += 2;
			}
			hp.idString = *(pHelpIDs + 1);	// 見つけたヘルプ ID を設定する
			dwData = (DWORD_PTR)&hp;	// 引数をポップアップヘルプ用の構造体に差し替える
		}
		break;
	default:
		return FALSE;
	}

	LPCTSTR lpszHelp = GetHelpFilePath();
	if( IsFileExists( lpszHelp, true ) ){
		// HTML ヘルプを呼び出す
		HWND hWnd = OpenHtmlHelp( hwndCaller, lpszHelp, uCommand, dwData );
		if (bDesktop && hWnd != NULL){
			::SetForegroundWindow( hWnd );	// ヘルプ画面を手前に出す
		}
	}
	else {
		if( uCommandOrg == HELP_CONTEXTMENU)
			return FALSE;	// 右クリックでは何もしないでおく

		// オンラインヘルプを呼び出す
		if( uCommandOrg != HELP_CONTEXT )
			dwData = 1;	// 目次ページ

		TCHAR buf[256];
		_stprintf( buf, _T("https://sakura-editor.github.io/help/HLP%06Iu.html"), dwData );
		ShellExecute( ::GetActiveWindow(), NULL, buf, NULL, NULL, SW_SHOWNORMAL );
	}

	return TRUE;
}
Exemplo n.º 26
0
STDMETHODIMP CGitExtensionsShellEx::QueryContextMenu  (
    HMENU hMenu, UINT menuIndex, UINT uidFirstCmd,
    UINT uidLastCmd, UINT uFlags )
{
    // If the flags include CMF_DEFAULTONLY then we shouldn't do anything.
    if ( uFlags & CMF_DEFAULTONLY )
        return S_OK;

    CString szCascadeShellMenuItems = GetRegistryValue(HKEY_CURRENT_USER, L"SOFTWARE\\GitExtensions\\GitExtensions", L"CascadeShellMenuItems");
    if (szCascadeShellMenuItems.IsEmpty())
        szCascadeShellMenuItems = "110111000111111111";
    bool CascadeContextMenu = szCascadeShellMenuItems.Find('1') != -1;
    HMENU popupMenu = NULL;
    if (CascadeContextMenu)
        popupMenu = CreateMenu();

    bool isValidDir = IsValidGitDir(m_szFile);
    bool isFile = IsFileExists(m_szFile);

    // preset values, if not used
    commandsId.clear();

    UINT submenuIndex = 0;
    int id = 0;
    int cmdid;
    bool isSubMenu;

    if (isValidDir)
    {
        if (!isFile)
        {
            isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcBrowse);
            cmdid = AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"Browse", IDI_ICONBROWSEFILEEXPLORER, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
            commandsId[cmdid]=gcBrowse;

            isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcCommit);
            cmdid = AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"Commit", IDI_ICONCOMMIT, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
            commandsId[cmdid]=gcCommit;

            isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcPull);
            cmdid = AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"Pull", IDI_ICONPULL, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
            commandsId[cmdid]=gcPull;

            isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcPush);
            cmdid=AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"Push", IDI_ICONPUSH, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
            commandsId[cmdid]=gcPush;

            isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcStash);
            cmdid=AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"View stash", IDI_ICONSTASH, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
            commandsId[cmdid]=gcStash;

            isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcViewDiff);
            cmdid=AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"View changes", IDI_ICONVIEWCHANGES, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
            commandsId[cmdid]=gcViewDiff;

            isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcCheckoutBranch);
            if (isSubMenu && submenuIndex > 0) {
                InsertMenu(popupMenu, submenuIndex++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL); ++id;
            }
            cmdid=AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"Checkout branch", IDI_ICONBRANCHCHECKOUT, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
            commandsId[cmdid]=gcCheckoutBranch;

            isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcCheckoutRevision);
            cmdid=AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"Checkout revision", IDI_ICONREVISIONCHECKOUT, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
            commandsId[cmdid]=gcCheckoutRevision;

            isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcCreateBranch);
            cmdid=AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"Create branch", IDI_ICONBRANCHCREATE, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
            commandsId[cmdid]=gcCreateBranch;
        }

        isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcDiffTool);
        if (isSubMenu && submenuIndex > 0) {
            InsertMenu(popupMenu, submenuIndex++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL); ++id;
        }
        cmdid=AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"Open with difftool", IDI_ICONVIEWCHANGES, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
        commandsId[cmdid]=gcDiffTool;

        isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcFileHistory);
        cmdid=AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"File history", IDI_ICONFILEHISTORY, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
        commandsId[cmdid]=gcFileHistory;

        isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcResetFileChanges);
        cmdid=AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"Reset file changes", IDI_ICONTRESETFILETO, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
        commandsId[cmdid]=gcResetFileChanges;

        isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcAddFiles);
        cmdid=AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"Add files", IDI_ICONADDED, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
        commandsId[cmdid]=gcAddFiles;

        isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcApplyPatch);
        cmdid=AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"Apply patch", 0, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
        commandsId[cmdid]=gcApplyPatch;
    }
    else 
    {
        isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcClone);
        cmdid=AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"Clone", IDI_ICONCLONEREPOGIT, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
        commandsId[cmdid]=gcClone;

        isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcCreateRepository);
        cmdid=AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"Create new repository", IDI_ICONCREATEREPOSITORY, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
        commandsId[cmdid]=gcCreateRepository;
    }

    isSubMenu = DisplayInSubmenu(szCascadeShellMenuItems, gcSettings);
    if (isSubMenu && submenuIndex > 0) {
        InsertMenu(popupMenu, submenuIndex++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL); ++id;
    }
    cmdid=AddMenuItem(!isSubMenu ? hMenu : popupMenu, L"Settings", IDI_ICONSETTINGS, uidFirstCmd, ++id, !isSubMenu ? menuIndex++ : submenuIndex++, isSubMenu);
    commandsId[cmdid]=gcSettings;

    ++id;

    if (CascadeContextMenu)
    {
        MENUITEMINFO info;
        info.cbSize = sizeof( MENUITEMINFO );
        info.fMask = MIIM_STRING | MIIM_ID | MIIM_BITMAP | MIIM_SUBMENU;
        info.wID = uidFirstCmd + 1;
        info.hbmpItem = IsVistaOrLater() ? IconToBitmapPARGB32(IDI_GITEXTENSIONS) : HBMMENU_CALLBACK;
        myIDMap[1] = IDI_GITEXTENSIONS;
        myIDMap[uidFirstCmd + 1] = IDI_GITEXTENSIONS;
        info.dwTypeData = _T("Git Extensions");
        info.hSubMenu = popupMenu;
        InsertMenuItem(hMenu, menuIndex, true, &info);
    }

    return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL, id);
}
Exemplo n.º 27
0
LEditor* MainBook::OpenFile(const wxString& file_name,
    const wxString& projectName,
    int lineno,
    long position,
    OF_extra extra /*=OF_AddJump*/,
    bool preserveSelection /*=true*/)
{
    wxFileName fileName(file_name);
    fileName.MakeAbsolute();

#ifdef __WXMSW__
    // Handle cygwin paths
    wxString curpath = fileName.GetFullPath();
    static wxRegEx reCygdrive("/cygdrive/([A-Za-z])");
    if(reCygdrive.Matches(curpath)) {
        // Replace the /cygdrive/c with volume C:
        wxString volume = reCygdrive.GetMatch(curpath, 1);
        volume << ":";
        reCygdrive.Replace(&curpath, volume);
        fileName = curpath;
    }
#endif

    if(!IsFileExists(fileName)) {
        wxLogMessage(wxT("Failed to open: %s: No such file or directory"), fileName.GetFullPath().c_str());
        return NULL;
    }

    if(FileExtManager::GetType(fileName.GetFullName()) == FileExtManager::TypeBmp) {
        // a bitmap file, open it using an image viewer
        DoOpenImageViewer(fileName);
        return NULL;
    }

    wxString projName = projectName;
    if(projName.IsEmpty()) {
        // try to match a project name to the file. otherwise, CC may not work
        projName = ManagerST::Get()->GetProjectNameByFile(fileName.GetFullPath());
    }

    LEditor* editor = GetActiveEditor(true);
    BrowseRecord jumpfrom = editor ? editor->CreateBrowseRecord() : BrowseRecord();

    editor = FindEditor(fileName.GetFullPath());
    if(editor) {
        editor->SetProject(projName);
    } else if(fileName.IsOk() == false) {
        wxLogMessage(wxT("Invalid file name: ") + fileName.GetFullPath());
        return NULL;

    } else if(!fileName.FileExists()) {
        wxLogMessage(wxT("File: ") + fileName.GetFullPath() + wxT(" does not exist!"));
        return NULL;

    } else {

        // A Nice trick: hide the notebook, open the editor
        // and then show it
        bool hidden(false);
        if(m_book->GetPageCount() == 0) hidden = GetSizer()->Hide(m_book);

        editor = new LEditor(m_book);
        editor->Create(projName, fileName);

        int sel = m_book->GetSelection();
        if((extra & OF_PlaceNextToCurrent) && (sel != wxNOT_FOUND)) {
            AddPage(editor, fileName.GetFullName(), fileName.GetFullPath(), wxNullBitmap, false, sel + 1);
        } else {
            AddPage(editor, fileName.GetFullName(), fileName.GetFullPath());
        }
        editor->SetSyntaxHighlight();

        // mark the editor as read only if neede
        MarkEditorReadOnly(editor);

        // SHow the notebook
        if(hidden) GetSizer()->Show(m_book);

        if(position == wxNOT_FOUND && lineno == wxNOT_FOUND && editor->GetContext()->GetName() == wxT("C++")) {
            // try to find something interesting in the file to put the caret at
            // for now, just skip past initial blank lines and comments
            for(lineno = 0; lineno < editor->GetLineCount(); lineno++) {
                switch(editor->GetStyleAt(editor->PositionFromLine(lineno))) {
                case wxSTC_C_DEFAULT:
                case wxSTC_C_COMMENT:
                case wxSTC_C_COMMENTDOC:
                case wxSTC_C_COMMENTLINE:
                case wxSTC_C_COMMENTLINEDOC:
                    continue;
                }
                // if we got here, it's a line to stop on
                break;
            }
            if(lineno == editor->GetLineCount()) {
                lineno = 1; // makes sure a navigation record gets saved
            }
        }
    }

    if(position != wxNOT_FOUND) {
        editor->SetEnsureCaretIsVisible(position, preserveSelection);
        editor->SetLineVisible(editor->LineFromPosition(position));

    } else if(lineno != wxNOT_FOUND) {
        editor->CenterLine(lineno);
    }

    if(m_reloadingDoRaise) {
        if(GetActiveEditor() == editor) {
            editor->SetActive();
        } else {
            SelectPage(editor);
        }
    }

    // Add this file to the history. Don't check for uniqueness:
    // if it's already on the list, wxFileHistory will move it to the top
    // Also, sync between the history object and the configuration file
    m_recentFiles.AddFileToHistory(fileName.GetFullPath());
    clConfig::Get().AddRecentFile(fileName.GetFullPath());

    if(extra & OF_AddJump) {
        BrowseRecord jumpto = editor->CreateBrowseRecord();
        NavMgr::Get()->AddJump(jumpfrom, jumpto);
    }
#if !CL_USE_NATIVEBOOK
    if(m_book->GetPageCount() == 1) {
        m_book->GetSizer()->Layout();
    }
#endif
    return editor;
}
Exemplo n.º 28
0
bool CToxProto::LoadToxProfile(Tox_Options *options)
{
	debugLogA(__FUNCTION__": loading tox profile");

	mir_cslock locker(profileLock);
	
	ptrT profilePath(GetToxProfilePath());
	if (!IsFileExists(profilePath))
		return false;

	FILE *profile = _tfopen(profilePath, _T("rb"));
	if (profile == NULL)
	{
		ShowNotification(TranslateT("Unable to open Tox profile"), MB_ICONERROR);
		debugLogA(__FUNCTION__": failed to open tox profile");
		return false;
	}

	fseek(profile, 0, SEEK_END);
	long size = ftell(profile);
	rewind(profile);
	if (size < 0)
	{
		fclose(profile);
		return false;
	}
	
	if (size == 0)
	{
		fclose(profile);
		return true;
	}

	uint8_t *data = (uint8_t*)mir_calloc(size);
	if (fread((char*)data, sizeof(char), size, profile) != (size_t)size)
	{
		fclose(profile);
		ShowNotification(TranslateT("Unable to read Tox profile"), MB_ICONERROR);
		debugLogA(__FUNCTION__": failed to read tox profile");
		mir_free(data);
		return false;
	}
	fclose(profile);

	if (tox_is_data_encrypted(data))
	{
		pass_ptrA password(mir_utf8encodeW(pass_ptrT(getTStringA("Password"))));
		if (password == NULL || mir_strlen(password) == 0)
		{
			CToxPasswordEditor passwordEditor(this);
			if (!passwordEditor.DoModal())
			{
				mir_free(data);
				return false;
			}
		}
		uint8_t *encryptedData = (uint8_t*)mir_calloc(size - TOX_PASS_ENCRYPTION_EXTRA_LENGTH);
		TOX_ERR_DECRYPTION coreDecryptError;
		if (!tox_pass_decrypt(data, size, (uint8_t*)(char*)password, mir_strlen(password), encryptedData, &coreDecryptError))
		{
			ShowNotification(TranslateT("Unable to decrypt Tox profile"), MB_ICONERROR);
			debugLogA(__FUNCTION__": failed to decrypt tox profile (%d)", coreDecryptError);
			mir_free(data);
			return false;
		}
		mir_free(data);
		data = encryptedData;
		size -= TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
	}

	if (data)
	{
		options->savedata_data = data;
		options->savedata_length = size;
		options->savedata_type = TOX_SAVEDATA_TYPE_TOX_SAVE;
		return true;
	}

	return false;
}
Exemplo n.º 29
0
bool SuInstallDriverInner(bool force)
{
    wchar_t sys_fullpath[MAX_PATH];
    UINT current_sl_ver = 0;
    bool ret = false;
    wchar_t src_cat[MAX_PATH];
    wchar_t src_inf[MAX_PATH];
    wchar_t src_sys[MAX_PATH];
    wchar_t dst_cat[MAX_PATH];
    wchar_t dst_inf[MAX_PATH];
    wchar_t dst_sys[MAX_PATH];
    wchar_t tmp_dir[MAX_PATH];
    char *cpu_type = MsIsX64() ? "x64" : "x86";

    if (SuIsSupportedOs(true) == false)
    {
        // Unsupported OS
        return false;
    }

    CombinePathW(tmp_dir, sizeof(tmp_dir), MsGetWindowsDirW(), L"Temp");
    MakeDirExW(tmp_dir);

    UniStrCat(tmp_dir, sizeof(tmp_dir), L"\\selowtmp");
    MakeDirExW(tmp_dir);

    // Confirm whether the driver is currently installed
    CombinePathW(sys_fullpath, sizeof(sys_fullpath), MsGetSystem32DirW(), L"drivers\\SeLow_%S.sys");
    UniFormat(sys_fullpath, sizeof(sys_fullpath), sys_fullpath, cpu_type);

    if (IsFileExistsW(sys_fullpath))
    {
        char *path;

        // Read the current version from the registry
        current_sl_ver = MsRegReadIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME,
                                         (MsIsWindows10() ? SL_REG_VER_VALUE_WIN10 : SL_REG_VER_VALUE),
                                         false, true);

        path = MsRegReadStrEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, "ImagePath", false, true);

        if (IsEmptyStr(path) || IsFileExists(path) == false || MsIsServiceInstalled(SL_PROTOCOL_NAME) == false)
        {
            current_sl_ver = 0;
        }

        Free(path);
    }

    if (force == false && current_sl_ver >= SL_VER)
    {
        // Newer version has already been installed
        Debug("Newer SeLow is Installed. %u >= %u\n", current_sl_ver, SL_VER);
        return true;
    }

    // Copy necessary files to a temporary directory
    UniFormat(src_sys, sizeof(src_sys), L"|DriverPackages\\%S\\%S\\SeLow_%S.sys",
              (MsIsWindows10() ? "SeLow_Win10" : "SeLow_Win8"),
              cpu_type, cpu_type);
    if (MsIsWindows8() == false)
    {
        // Windows Vista and Windows 7 uses SHA-1 catalog files
        UniFormat(src_cat, sizeof(src_cat), L"|DriverPackages\\SeLow_Win8\\%S\\inf.cat", cpu_type);
    }
    else
    {
        // Windows 8 or above uses SHA-256 catalog files
        UniFormat(src_cat, sizeof(src_cat), L"|DriverPackages\\SeLow_Win8\\%S\\inf2.cat", cpu_type);

        if (MsIsWindows10())
        {
            // Windows 10 uses WHQL catalog files
            UniFormat(src_cat, sizeof(src_cat), L"|DriverPackages\\SeLow_Win10\\%S\\SeLow_Win10_%S.cat", cpu_type, cpu_type);
        }
    }
    UniFormat(src_inf, sizeof(src_inf), L"|DriverPackages\\%S\\%S\\SeLow_%S.inf",
              (MsIsWindows10() ? "SeLow_Win10" : "SeLow_Win8"),
              cpu_type, cpu_type);

    UniFormat(dst_sys, sizeof(dst_cat), L"%s\\SeLow_%S.sys", tmp_dir, cpu_type);
    UniFormat(dst_cat, sizeof(dst_cat), L"%s\\SeLow_%S_%S.cat", tmp_dir,
              (MsIsWindows10() ? "Win10" : "Win8"),
              cpu_type);

    UniFormat(dst_inf, sizeof(dst_inf), L"%s\\SeLow_%S.inf", tmp_dir, cpu_type);

    if (FileCopyW(src_sys, dst_sys) &&
            FileCopyW(src_cat, dst_cat) &&
            FileCopyW(src_inf, dst_inf))
    {
        NO_WARNING *nw;

        nw = MsInitNoWarningEx(SL_USER_AUTO_PUSH_TIMER);

        if (MsIsWindows10())
        {
            if (MsIsServiceInstalled(SL_PROTOCOL_NAME) == false && MsIsServiceRunning(SL_PROTOCOL_NAME) == false)
            {
                // On Windows 10, if there are no SwLow service installed, then uinstall the protocol driver first.
                // TODO: currently do nothing. On some versions of Windows 10 beta builds it is necessary to do something...
            }
        }

        if (MsIsWindows10())
        {
            // Delete garbage INFs
            SuDeleteGarbageInfs();
        }

        // Call the installer
        if (InstallNdisProtocolDriver(dst_inf, L"SeLow", SL_USER_INSTALL_LOCK_TIMEOUT) == false)
        {
            Debug("InstallNdisProtocolDriver Error.\n");
        }
        else
        {
            Debug("InstallNdisProtocolDriver Ok.\n");

            // Copy manually because there are cases where .sys file is not copied successfully for some reason
            FileCopyW(src_sys, sys_fullpath);

            ret = true;

            // Write the version number into the registry
            MsRegWriteIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME,
                             (MsIsWindows10() ? SL_REG_VER_VALUE_WIN10 : SL_REG_VER_VALUE),
                             SL_VER, false, true);

            // Set to automatic startup
            MsRegWriteIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, "Start", SERVICE_SYSTEM_START, false, true);
        }

        MsFreeNoWarning(nw);
    }
    else
    {
        Debug("Fail Copying Files.\n");
    }

    if (ret)
    {
        // If the service is installed this time, start and wait until the enumeration is completed
        SuFree(SuInitEx(180 * 1000));
    }

    return ret;
}
Exemplo n.º 30
0
/*!	差分表示
	@param	pszFile1	[in]	自ファイル名
	@param	pszFile2	[in]	相手ファイル名
    @param  nFlgOpt     [in]    0b000000000
                                    ||||||+--- -i ignore-case         大文字小文字同一視
                                    |||||+---- -w ignore-all-space    空白無視
                                    ||||+----- -b ignore-space-change 空白変更無視
                                    |||+------ -B ignore-blank-lines  空行無視
                                    ||+------- -t expand-tabs         TAB-SPACE変換
                                    |+--------    (編集中のファイルが旧ファイル)
                                    +---------    (DIFF差分がないときにメッセージ表示)
	@note	HandleCommandからの呼び出し対応(ダイアログなし版)
	@author	MIK
	@date	2002/05/25
	@date	2005/10/28	旧Command_Diffから関数名の変更。
						GetCommander().Command_Diff_Dialogだけでなく新Command_Diff
						からも呼ばれる関数。maru
	@date	2013/06/21	ExecCmdを利用するように
*/
void CEditView::ViewDiffInfo( 
	const TCHAR*	pszFile1,
	const TCHAR*	pszFile2,
	int				nFlgOpt,
	bool 			bUTF8
)
/*
	bool	bFlgCase,		//大文字小文字同一視
	bool	bFlgBlank,		//空白無視
	bool	bFlgWhite,		//空白変更無視
	bool	bFlgBLine,		//空行無視
	bool	bFlgTabSpc,		//TAB-SPACE変換
	bool	bFlgFile12,		//編集中のファイルが旧ファイル
*/
{
	CWaitCursor	cWaitCursor( this->GetHwnd() );
	int		nFlgFile12 = 1;

	/* exeのあるフォルダ */
	TCHAR	szExeFolder[_MAX_PATH + 1];

	TCHAR	cmdline[1024];
	GetExedir( cmdline, _T("diff.exe") );
	SplitPath_FolderAndFile( cmdline, szExeFolder, NULL );

	//	From Here Dec. 28, 2002 MIK
	//	diff.exeの存在チェック
	if( !IsFileExists( cmdline, true ) )
	{
		WarningMessage( GetHwnd(), LS(STR_ERR_DLGEDITVWDIFF2) );
		return;
	}
	cmdline[0] = _T('\0');

	//今あるDIFF差分を消去する。
	if( CDiffManager::getInstance()->IsDiffUse() )
		GetCommander().Command_Diff_Reset();
		//m_pcEditDoc->m_cDocLineMgr.ResetAllDiffMark();

	//オプションを作成する
	TCHAR	szOption[16];	// "-cwbBt"
	_tcscpy( szOption, _T("-") );
	if( nFlgOpt & 0x0001 ) _tcscat( szOption, _T("i") );	//-i ignore-case         大文字小文字同一視
	if( nFlgOpt & 0x0002 ) _tcscat( szOption, _T("w") );	//-w ignore-all-space    空白無視
	if( nFlgOpt & 0x0004 ) _tcscat( szOption, _T("b") );	//-b ignore-space-change 空白変更無視
	if( nFlgOpt & 0x0008 ) _tcscat( szOption, _T("B") );	//-B ignore-blank-lines  空行無視
	if( nFlgOpt & 0x0010 ) _tcscat( szOption, _T("t") );	//-t expand-tabs         TAB-SPACE変換
	if( _tcscmp( szOption, _T("-") ) == 0 ) szOption[0] = _T('\0');	//オプションなし
	if( nFlgOpt & 0x0020 ) nFlgFile12 = 0;
	else                   nFlgFile12 = 1;

	//	To Here Dec. 28, 2002 MIK

	{
		//コマンドライン文字列作成(MAX:1024)
		auto_sprintf(
			cmdline,
			_T("\"%ts\\%ts\" %ts \"%ts\" \"%ts\""),
			szExeFolder,	//sakura.exeパス
			_T("diff.exe"),		//diff.exe
			szOption,		//diffオプション
			( nFlgFile12 ? pszFile2 : pszFile1 ),
			( nFlgFile12 ? pszFile1 : pszFile2 )
		);
	}

	{
		int nFlgOpt = 0;
		nFlgOpt |= 0x01;  // GetStdOut
		if( bUTF8 ){
			nFlgOpt |= 0x80;  // UTF-8 out (SJISと違ってASCIIセーフなので)
			nFlgOpt |= 0x100; // UTF-8 in
		}
		nFlgOpt |= 0x40;  // 拡張情報出力無効
		COutputAdapterDiff oa(this, nFlgFile12);
		bool ret = ExecCmd( cmdline, nFlgOpt, NULL, &oa );

		if( ret ){
			if( oa.bDiffInfo == true && oa.nDiffLen > 0 )
			{
				oa.szDiffData[oa.nDiffLen] = '\0';
				AnalyzeDiffInfo( oa.szDiffData, nFlgFile12 );
			}
		}
	}

	//DIFF差分が見つからなかったときにメッセージ表示
	if( nFlgOpt & 0x0040 )
	{
		if( !CDiffManager::getInstance()->IsDiffUse() )
		{
			InfoMessage( this->GetHwnd(), LS(STR_ERR_DLGEDITVWDIFF5) );
		}
	}


	//分割したビューも更新
	m_pcEditWnd->Views_Redraw();

	return;
}