123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682 |
- #include "stdafx.h"
- #include "test.h"
- #include "testDlg.h"
- #include "MediaExtXml.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #endif
- BEGIN_MESSAGE_MAP(CtestApp, CWinAppEx)
- ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
- END_MESSAGE_MAP()
- CtestApp::CtestApp()
- {
-
-
- }
- CtestApp theApp;
- ImgEnvInterface* InitializeEnvironment(IN IMGSHARE_VEC& imginfo)
- {
- double dTotalNum,dFreeNum;
- ImgShareInfo tagImg;
- tagImg.bEnable = TRUE;
- tagImg.byImgType = 1;
- tagImg.byMaxCapacity = 35;
- tagImg.byMinCapacity = 5;
- tagImg.byPriority = 255;
- _stprintf_s(tagImg.szBranchId, _T("%s"), _T("20150814105018373497.ly.com"));
- _stprintf_s(tagImg.szShareDirectory, _T("%s"),_T("\\\\lyfz-server\\客户原片(管理软件)$"));
- imginfo.push_back(new ImgShareInfo(tagImg));
-
- underlyingapi::GetDiskSpaceInfo(_T("\\\\lyfz-server\\客户原片(管理软件)$"), dTotalNum, dFreeNum);
- ImgShareInfo tagImg1;
- tagImg1.bEnable = TRUE;
- tagImg1.byImgType = 1;
- tagImg1.byMaxCapacity = 35;
- tagImg1.byMinCapacity = 5;
- tagImg1.byPriority = 254;
- _stprintf_s(tagImg1.szBranchId, _T("%s"), _T("20150814105018373497.ly.com"));
- _stprintf_s(tagImg1.szShareDirectory, _T("%s"),_T("\\\\lyfz-server\\客户原片(管理软件)1$"));
- imginfo.push_back(new ImgShareInfo(tagImg1));
-
- underlyingapi::GetDiskSpaceInfo(_T("\\\\lyfz-server\\客户原片(管理软件)1$"), dTotalNum, dFreeNum);
- ImgShareInfo tagImg2;
- tagImg2.bEnable = TRUE;
- tagImg2.byImgType = 1;
- tagImg2.byMaxCapacity = 35;
- tagImg2.byMinCapacity = 5;
- tagImg2.byPriority = 253;
- _stprintf_s(tagImg2.szBranchId, _T("%s"), _T("20150814105018373497.ly.com"));
- _stprintf_s(tagImg2.szShareDirectory, _T("%s"),_T("\\\\lyfz-server\\客户原片(管理软件)2$"));
- imginfo.push_back(new ImgShareInfo(tagImg2));
-
- underlyingapi::GetDiskSpaceInfo(_T("\\\\lyfz-server\\客户原片(管理软件)2$"), dTotalNum, dFreeNum);
-
- ImgShareInfo tagImg3;
- tagImg3.bEnable = TRUE;
- tagImg3.byImgType = 1;
- tagImg3.byMaxCapacity = 35;
- tagImg3.byMinCapacity = 5;
- tagImg3.byPriority = 252;
- _stprintf_s(tagImg3.szBranchId, _T("%s"), _T("20150814105018373497.ly.com"));
- _stprintf_s(tagImg3.szShareDirectory, _T("%s"),_T("E:\\lyfzbin\\Services\\客户原片(管理软件)$"));
- imginfo.push_back(new ImgShareInfo(tagImg3));
-
- underlyingapi::GetDiskSpaceInfo(_T("E:\\lyfzbin\\Services\\客户原片(管理软件)$"), dTotalNum, dFreeNum);
- ImgEnvInterface *pImg = new ImgOfOriginal();
- pImg->InitializeEnvironment(_T("20150814105018373497.ly.com"),&imginfo);
- return pImg;
- }
- VOID DestroyImgkernel(IN ImgEnvInterface *pImg, IN IMGSHARE_VEC* pvtImgShareInfo)
- {
- if ( pImg )
- delete pImg;
- pImg = NULL;
- for ( IMGSHARE_VEC::iterator it = pvtImgShareInfo->begin(); it != pvtImgShareInfo->end();)
- {
- delete (ImgShareInfo*)*it;
- it = pvtImgShareInfo->erase(it);
- }
- }
- VOID Test_001(ImgLoadInterface *pImg)
- {
- OutputDebugString(_T("\n"));
- if ( !pImg ) return;
- ImgEnvInterface *pImgEnv = (ImgOfOriginal *)pImg;
- pImgEnv->InitializeEnvironment(NULL,NULL);
- CStringArray Ary;
- pImg->LoadOrderImages(1, _T("20150814105018373497.ly.com"), _T("20141129-013"), _T("*.CR2|*.NEF"), Ary);
- if ( Ary.GetSize() == 0 )
- AfxMessageBox(_T("*.CR2|*.NEF 扩展名 相片张数 0"));
- else
- {
- for ( int i = 0; i < Ary.GetSize(); i++)
- {
- OutputDebugString(Ary.ElementAt(i) + _T("\n"));
- }
- }
- Ary.RemoveAll();
- OutputDebugString(_T("--------------\n"));
- pImg->LoadOrderImages(1, _T("20150814105018373497.ly.com"), _T("20141129-013"), _T("*.Jpg|*.NEF"), Ary);
- if ( Ary.GetSize() == 0 )
- AfxMessageBox(_T("*.Jpg|*.NEF 扩展名 相片张数 0"));
- else
- {
- for ( int i = 0; i < Ary.GetSize(); i++)
- {
- OutputDebugString(Ary.ElementAt(i) + _T("\n"));
- }
- }
- OutputDebugString(_T("--------------\n"));
- }
- VOID Test_002(ImgLoadInterface *pImg)
- {
- OutputDebugString(_T("--------------\n"));
- if ( !pImg ) return;
- OutputDebugString(_T("\n"));
- STR_VEC Ary;
- pImg->LoadOrderImages(1, _T("20150814105018373497.ly.com"), _T("20141129-013"), _T("*.CR2|*.NEF"), Ary);
- if ( Ary.size() == 0 )
- AfxMessageBox(_T("*.CR2|*.NEF 扩展名 相片张数 0"));
- else
- {
- for ( STR_VEC::iterator it = Ary.begin(); it != Ary.end(); it++)
- {
- OutputDebugString(it->c_str());
- OutputDebugString(_T("\n"));
- }
- }
- OutputDebugString(_T("\n"));
- Ary.clear();
- pImg->LoadOrderImages(1, _T("20150814105018373497.ly.com"), _T("20141129-013"), _T("*.Jpg|*.NEF|*.Cr2"), Ary);
- if ( Ary.size() == 0 )
- AfxMessageBox(_T("*.Jpg|*.NEF|*.Cr2 扩展名 相片张数 0"));
- else
- {
- for ( STR_VEC::iterator it = Ary.begin(); it != Ary.end(); it++)
- {
- OutputDebugString(it->c_str());
- OutputDebugString(_T("\n"));
- }
- }
- OutputDebugString(_T("--------------\n"));
- }
- VOID Test_003(ImgCopyInterface *pImg)
- {
- if ( !pImg ) return;
- pImg->CopyImg2Specifiedpath(
- _T("E:\\lyfzbin\\Services\\客户原片(管理软件)$"),
- _T("C:\\Users\\It\\Desktop\\Desktop\\"),
- _T("*.jpg|*.nef|*.jpeg|*.png"),
- SET_PIX(100,100),
- 0,
- 1
- );
- AfxMessageBox(_T("压缩像素:100x100;\n 原样复制目录:否;\n 存在文件时覆盖;\n 扩展名: *.jpg|*.nef|*.jpeg|*.png"));
- pImg->CopyImg2Specifiedpath(
- _T("E:\\lyfzbin\\Services\\客户原片(管理软件)$"),
- _T("C:\\Users\\It\\Desktop\\Desktop\\"),
- _T("*.jpg|*.nef|*.jpeg|*.png"),
- INVALID_COPY_PIX,
- 0,
- 0
- );
- AfxMessageBox(_T("压缩像素:无;\n 原样复制目录:否;\n 存在文件时覆盖;\n 扩展名: *.jpg|*.nef|*.jpeg|*.png"));
- pImg->CopyImg2Specifiedpath(
- _T("E:\\lyfzbin\\Services\\客户原片(管理软件)$"),
- _T("C:\\Users\\It\\Desktop\\Desktop1\\"),
- _T("*.jpg|*.nef|*.jpeg|*.png|*.cr2"),
- SET_PIX(600,800),
- 1,
- 1
- );
- AfxMessageBox(_T("压缩像素:600x800;\n 原样复制目录:是;\n 存在文件时不覆盖;\n 扩展名: *.jpg|*.nef|*.jpeg|*.png"));
- pImg->CopyImg2Specifiedpath(
- _T("E:\\lyfzbin\\Services\\客户原片(管理软件)$"),
- _T("C:\\Users\\It\\Desktop\\Desktop1\\"),
- _T("*.jpg|*.nef|*.jpeg|*.png|*.cr2"),
- INVALID_COPY_PIX,
- 1,
- 0
- );
- AfxMessageBox(_T("压缩像素:无;\n 原样复制目录:是;\n 存在文件时覆盖;\n 扩展名: *.jpg|*.nef|*.jpeg|*.png"));
- OutputDebugString(_T("--------------\n"));
- }
- VOID Test_004()
- {
- underlyingapi::OSVerInfo osvi;
- underlyingapi::GetSystemInfo(osvi);
- AfxMessageBox(osvi.szOSVerName);
- CString str;
- double dTotalNum,dFreeNum;
- underlyingapi::GetDiskSpaceInfo(_T("E:\\lyfzbin\\Services\\客户原片(管理软件)$"),dTotalNum,dFreeNum);
- str.Format(_T("t:%lf, f:%lf"), dTotalNum, dFreeNum);
- AfxMessageBox(str);
- OutputDebugString(_T("--------------\n"));
- }
- VOID Test_005()
- {
- filehelping::filehelpImpl fil;
-
- STR_VEC vtfiles;
- STR_VEC vtnames;
- STR_VEC vtnames_noext;
- STR_VEC vtfolders;
-
- TRACE("--------------\n");
- INT nCount = fil.comparefolderself(_T("E:\\lyfzbin\\Services\\客户原片(管理软件)$"), _T("*.cr2|*.nef"), &vtnames);
- TRACE("--------------\n");
- BOOL bret = fil.getsubfolder(_T("E:\\lyfzbin\\Services\\客户原片(管理软件)$"), &vtfolders);
- vtfolders.clear();
- vtnames.clear();
- fil.getallsubfolder(_T("E:\\lyfzbin\\Services\\客户原片(管理软件)$"), &vtfolders);
- TRACE("--------------\n");
- BOOL bRet = fil.getall(_T("E:\\lyfzbin\\Services\\客户原片(管理软件)$"),
-
- _T("*.jpEg|*.CR2"),
- &vtfiles,
- &vtnames,
- &vtnames_noext,
- &vtfolders);
- TRACE("--------------\n");
- if ( bRet == FALSE )
- {
- AfxMessageBox(_T("获取文件失败"));
- }
- else
- {
- AfxMessageBox(_T("获取文件成功"));
- }
- OutputDebugString(_T("--------------\n"));
- }
- VOID Test_006(ImgLoadInterface *pImg)
- {
- OutputDebugString(_T("\n"));
- if ( !pImg ) return;
- CStringArray Ary;
- pImg->LoadSceneryImages(1,
- _T("20150814105018373497.ly.com"),
- _T("20141129-013"),
- _T("内景大西街店C棚"),
- _T("*.Jpg|*.NEF|*.Cr2"),
- Ary,
- NULL);
- if ( Ary.GetSize() == 0 )
- AfxMessageBox(_T("*.Jpg|*.NEF 扩展名 相片张数 0"));
- else
- {
- for ( int i = 0; i < Ary.GetSize(); i++)
- {
- OutputDebugString(Ary.ElementAt(i) + _T("\n"));
- }
- }
- OutputDebugString(_T("++++++++++++++++++++++++++\n"));
- STR_VEC vt;
- pImg->LoadSceneryImages(1,
- _T("20150814105018373497.ly.com"),
- _T("20141129-013"),
- _T("内景大西街店C棚"),
- _T("*.Jpg|*.NEF|*.Cr2"),
- vt,
- NULL);
- if ( vt.size() == 0 )
- AfxMessageBox(_T("*.Jpg|*.NEF 扩展名 相片张数 0"));
- else
- {
- for ( STR_VEC::iterator it = vt.begin(); it != vt.end(); it++)
- {
- OutputDebugString(it->c_str());
- OutputDebugString(_T("\n"));
- }
- }
- OutputDebugString(_T("--------------\n"));
- }
- VOID Test_007(ImgLoadInterface *pImg)
- {
- OutputDebugString(_T("\n"));
- if ( !pImg ) return;
- CStringArray AryImg;
- for ( int i = 1; i < 20; i++ )
- {
- CString str;
- str.Format(_T("%03d"),i);
- AryImg.Add(str);
- }
- CStringArray Arypaths;
- CStringArray AryNoExist;
- pImg->LoadSelectedIamges(1,
- _T("20150814105018373497.ly.com"),
- _T("20141129-013"),
- _T("*.Jpg|*.NEF|*.Cr2"),
- AryImg,
- AryNoExist,
- Arypaths);
- if ( Arypaths.GetSize() == 0 )
- AfxMessageBox(_T("*.Jpg|*.NEF 扩展名 相片张数 0"));
- else
- {
- for ( int i = 0; i < Arypaths.GetSize(); i++)
- {
- OutputDebugString(Arypaths.ElementAt(i) + _T("\n"));
- }
- }
- OutputDebugString(_T("++++++++++++++++++++++++++\n"));
- }
- VOID Test_008(ImgLoadExInterface *pImg)
- {
- OutputDebugString(_T("\n"));
- if ( !pImg ) return;
- CStringArray Arypaths;
- CStringArray AryWithImg;
- CStringArray AryNull;
- CString strImg;
- CStringArray ArySelectedImg;
- for ( int i = 0; i < 20; i++ )
- {
- strImg.Format(_T("%03d"),i);
- ArySelectedImg.Add(strImg);
- }
- pImg->LoadSelectedIamgesFromSpecifiedpathEx(
- _T("E:\\lyfzbin\\Services\\客户原片(管理软件)$\\20141129-013\\内景大西街店C棚"),
- TRUE,
- ArySelectedImg,
- AryNull,
-
-
- _T(""),
- Arypaths,
-
-
- _T(""),
- AryWithImg);
- if ( Arypaths.GetSize() == 0 )
- OutputDebugString(_T("Null \n"));
- else
- {
- for ( int i = 0; i < Arypaths.GetSize(); i++)
- {
- OutputDebugString(Arypaths.ElementAt(i) + _T("\n"));
- }
- }
- OutputDebugString(_T("++++++++++++++++++++++++++\n"));
- if ( ArySelectedImg.GetSize() == 0 )
- OutputDebugString(_T("Null \n"));
- else
- {
- for ( int i = 0; i < ArySelectedImg.GetSize(); i++)
- {
- OutputDebugString(ArySelectedImg.ElementAt(i) + _T("\n"));
- }
- }
- OutputDebugString(_T("++++++++++++++++++++++++++\n"));
- if ( AryWithImg.GetSize() == 0 )
- OutputDebugString(_T("Null \n"));
- else
- {
- for ( int i = 0; i < AryWithImg.GetSize(); i++)
- {
- OutputDebugString(AryWithImg.ElementAt(i) + _T("\n"));
- }
- }
- OutputDebugString(_T("++++++++++++++++++++++++++\n"));
- pImg->LoadSpecifiedpathImagesEx(
- _T("E:\\lyfzbin\\Services\\客户原片(管理软件)$\\20141129-013\\内景大西街店C棚"),
- TRUE,
- _T("*.Jpg|*.NEF|"),
- Arypaths,
- _T("*.Jpeg|*.NEF|*.Cr2"),
- AryWithImg
- );
- if ( Arypaths.GetSize() == 0 )
- OutputDebugString(_T("Null \n"));
- else
- {
- for ( int i = 0; i < Arypaths.GetSize(); i++)
- {
- OutputDebugString(Arypaths.ElementAt(i) + _T("\n"));
- }
- }
- OutputDebugString(_T("++++++++++++++++++++++++++\n"));
- if ( AryWithImg.GetSize() == 0 )
- OutputDebugString(_T("Null \n"));
- else
- {
- for ( int i = 0; i < AryWithImg.GetSize(); i++)
- {
- OutputDebugString(AryWithImg.ElementAt(i) + _T("\n"));
- }
- }
- OutputDebugString(_T("++++++++++++++++++++++++++\n"));
-
- pImg->LoadOrderImagesEx(
- OImgtype,
- _T("20150814105018373497.ly.com"),
- _T("20141129-013"),
- TRUE,
- _T("*.Jpg|*.NEF|"),
- Arypaths,
- _T("*.Jpeg|*.NEF|*.Cr2"),
- AryWithImg
- );
- if ( Arypaths.GetSize() == 0 )
- OutputDebugString(_T("Null \n"));
- else
- {
- for ( int i = 0; i < Arypaths.GetSize(); i++)
- {
- OutputDebugString(Arypaths.ElementAt(i) + _T("\n"));
- }
- }
- OutputDebugString(_T("++++++++++++++++++++++++++\n"));
- if ( AryWithImg.GetSize() == 0 )
- OutputDebugString(_T("Null \n"));
- else
- {
- for ( int i = 0; i < AryWithImg.GetSize(); i++)
- {
- OutputDebugString(AryWithImg.ElementAt(i) + _T("\n"));
- }
- }
- OutputDebugString(_T("++++++++++++++++++++++++++\n"));
- }
- BOOL GetDebugPriv()
- {
-
- HANDLE hToken;
-
- LUID sedebugnameValue;
-
- TOKEN_PRIVILEGES tkp;
- DWORD dwCurProcId = GetCurrentProcessId();
-
- HANDLE hCurProc;
- hCurProc = ::OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwCurProcId);
- if (!::OpenProcessToken(hCurProc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
- {
-
- return FALSE;
- }
- if (!::LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &sedebugnameValue))
- {
-
- CloseHandle(hToken);
- return FALSE;
- }
- tkp.PrivilegeCount = 1;
- tkp.Privileges[0].Luid = sedebugnameValue;
- tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
- if (!::AdjustTokenPrivileges(hToken, FALSE, &tkp, sizeof tkp, NULL, NULL))
- {
-
- CloseHandle(hToken);
- return FALSE;
- }
- CloseHandle(hCurProc);
- CloseHandle(hToken);
- return TRUE;
- }
- BOOL IsInstalledVC2005()
- {
- vector<TString> DllList;
- DllList.push_back(_T("C:\\Windows\\System32\\msvcp90.dll"));
- DllList.push_back(_T("C:\\Windows\\System32\\msvcr90.dll"));
-
- for (vector<TString>::iterator it = DllList.begin(); it != DllList.end(); it++ )
- {
- CFile fp;
- BOOL b = fp.Open(it->c_str(),CFile::modeRead);
- if ( PathFileExists(_T("C:\\Windows\\System32\\msvcp100.dll")) )
- {
- OutputDebugString(_T("文件存在~~~"));
- }
- else
- {
- OutputDebugString(_T("文件不存在"));
- }
- DWORD dw = GetLastError();
- }
- return TRUE;
- }
- BOOL CtestApp::InitInstance()
- {
-
-
-
- INITCOMMONCONTROLSEX InitCtrls;
- InitCtrls.dwSize = sizeof(InitCtrls);
-
-
- InitCtrls.dwICC = ICC_WIN95_CLASSES;
- InitCommonControlsEx(&InitCtrls);
- CWinAppEx::InitInstance();
- AfxEnableControlContainer();
- #if 0
- IMGSHARE_VEC imginfo;
- ImgOfOriginal *pImg = (ImgOfOriginal*)InitializeEnvironment(imginfo);
-
- Test_008(pImg);
- DestroyImgkernel(pImg,&imginfo);;
- return FALSE;
- #endif
- GetDebugPriv();
- IsInstalledVC2005();
- CMediaExtXml ss;
- ss.Loadxml(_T("C:\\Users\\IT\\Desktop\\备份.2013.06.07.RunTimeDepot\\bin\\mediaext.xml"));
- return FALSE;
- GetIniInfo();
- GetSoftWareVersion();
-
- g_AdoImpl = new Ado2Impl();
- Catalogkernel::STDatabaseInfo tagAdoDatabaseInfo;
- _stprintf_s(tagAdoDatabaseInfo.szDataSource,_T("%s"),g_szDBSource);
- _stprintf_s(tagAdoDatabaseInfo.szDatabaseTCPPort,_T("%d"),g_dwDBServerPort);
- _stprintf_s(tagAdoDatabaseInfo.szDatabaseAccount,_T("%s"),g_szDBAccount);
- _stprintf_s(tagAdoDatabaseInfo.szDatabasePassword,_T("%s"),g_szDBPassWord);
- _stprintf_s(tagAdoDatabaseInfo.szDatabaseName,_T("%s"),g_szDBName);
-
- if ( !g_AdoImpl->OpenCatalog(tagAdoDatabaseInfo) )
- {
- OutputDebugString(_T("open catalog failed, Please Checking it~"));
- return FALSE;
- }
-
-
-
-
-
-
-
- SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
- CtestDlg dlg;
- m_pMainWnd = &dlg;
- INT_PTR nResponse = dlg.DoModal();
- if (nResponse == IDOK)
- {
-
-
- }
- else if (nResponse == IDCANCEL)
- {
-
-
- }
-
-
- return FALSE;
- }
|