+BOOL filehelper::getfiles_bynames_findin_subfolder( IN LPCTSTR lpfolder, IN LPCTSTR lpfindext, IN STR_VEC &vtnames, IN STR_VEC *pvtfiles )
+{
+ // 路径不存在;
+ if (!PathFileExists(lpfolder))
+ return FALSE;
+
+ // 指针空;
+ if (pvtfiles == NULL) return FALSE;
+ m_pvtfiles = pvtfiles;
+
+#if USE_IMGEXT
+ // 判断扩展名有效性;
+ if (!iscorrectext(lpfindext)) return FALSE;
+#endif
+ findfiles_findin_subfolder(lpfolder);
+ if (lpfindext && _tcsstr(lpfindext, _T("*.*")) == NULL )
+ {// 需要保留指定后缀;
+ keepdownbyext(lpfindext, *pvtfiles);
+ }
+
+ // 再按名称过滤;
+ filterbyname(*pvtfiles, vtnames);
+
+ return TRUE;
+}
+
+BOOL filehelper::getfiles_bynames_findout_subfolder( IN LPCTSTR lpfolder, IN LPCTSTR lpfindext, IN STR_VEC &vtnames, IN OUT STR_VEC *pvtfiles )
+{
+ // 路径不存在;
+ if (!PathFileExists(lpfolder))
+ return FALSE;
+
+ // 指针空;
+ if (pvtfiles == NULL) return FALSE;
+ m_pvtfiles = pvtfiles;
+
+#if USE_IMGEXT
+ // 判断扩展名有效性;
+ if (!iscorrectext(lpfindext)) return FALSE;
+#endif
+
+ findfiles_findout_subfolder(lpfolder);
+ if (lpfindext && _tcsstr(lpfindext, _T("*.*")) == NULL )
+ {// 需要保留指定后缀;
+ keepdownbyext(lpfindext, *pvtfiles);
+ }
+
+ // 再按名称过滤;
+ filterbyname(*pvtfiles, vtnames);
+
+ return TRUE;
+}
+
+BOOL filehelper::getfiles_bynames_within_subfolder( IN LPCTSTR lpfolder, IN LPCTSTR lpfindext, IN STR_VEC &vtnames, IN STR_VEC *pvtfiles, IN STR_VEC *pvtfolders )
+{
+ // 路径不存在;
+ if (!PathFileExists(lpfolder))
+ return FALSE;
+
+ // 指针空;
+ if (pvtfiles == NULL) return FALSE;
+ m_pvtfiles = pvtfiles;
+ m_pvtfolders = pvtfolders;
+#if USE_IMGEXT
+ // 判断扩展名有效性;
+ if (!iscorrectext(lpfindext)) return FALSE;
+#endif
+
+ findfiles_within_subfolder(lpfolder);
+ if (lpfindext && _tcsstr(lpfindext, _T("*.*")) == NULL )
+BOOL filehelper::getfilesnames_findin_subfolder(IN LPCTSTR lpfolder, IN LPCTSTR lpfindext, IN STR_VEC *pvtfiles, IN STR_VEC *pvtnames)
+{
+ // 路径不存在;
+ if (!PathFileExists(lpfolder))
+ return FALSE;
+
+ // 指针空;
+ if (pvtnames || !pvtnames) return FALSE;
+ m_pvtfiles = pvtfiles;
+ m_pvtnames = pvtnames;
+#if USE_IMGEXT
+ // 判断扩展名有效性;
+ if (!iscorrectext(lpfindext)) return FALSE;
+#endif
+ findfilesnames_findin_subfolder(lpfolder);
+ if (lpfindext && _tcsstr(lpfindext, _T("*.*")) == NULL )
+ {// 需要保留指定后缀;
+ keepdownbyext(lpfindext, *pvtnames);
+ keepdownbyext(lpfindext, *pvtfiles);
+ }
+
+ return TRUE;
+}
+
+BOOL filehelper::getfilesnames_findout_subfolder(IN LPCTSTR lpfolder, IN LPCTSTR lpfindext, IN STR_VEC *pvtfiles, IN STR_VEC *pvtnames)
+{
+ // 路径不存在;
+ if (!PathFileExists(lpfolder))
+ return FALSE;
+
+ // 指针空;
+ if (pvtnames || !pvtnames) return FALSE;
+ m_pvtfiles = pvtfiles;
+ m_pvtnames = pvtnames;
+#if USE_IMGEXT
+ // 判断扩展名有效性;
+ if (!iscorrectext(lpfindext)) return FALSE;
+#endif
+ findfilesnames_findout_subfolder(lpfolder);
+ if (lpfindext && _tcsstr(lpfindext, _T("*.*")) == NULL )
+ {// 需要保留指定后缀;
+ keepdownbyext(lpfindext, *pvtnames);
+ keepdownbyext(lpfindext, *pvtfiles);
+ }
+
+ return TRUE;
+}
+
+BOOL filehelper::getfilesnames_within_subfolder(IN LPCTSTR lpfolder, IN LPCTSTR lpfindext, IN STR_VEC *pvtfiles, IN STR_VEC *pvtnames, IN STR_VEC *pvtfolders)
+{
+ // 路径不存在;
+ if (!PathFileExists(lpfolder))
+ return FALSE;
+
+ // 指针空;
+ if (pvtnames || !pvtnames) return FALSE;
+ m_pvtfiles = pvtfiles;
+ m_pvtnames = pvtnames;
+ m_pvtfolders = pvtfolders;
+#if USE_IMGEXT
+ // 判断扩展名有效性;
+ if (!iscorrectext(lpfindext)) return FALSE;
+#endif
+ findfilesnames_within_subfolder(lpfolder);
+ if (lpfindext && _tcsstr(lpfindext, _T("*.*")) == NULL )
+ for (STR_VEC::iterator it = vtnames.begin(); it != vtnames.end(); it++)
+ {
+ if (comparename_findin_files(it->c_str(), vtfiles))
+ {
+ if (pvtIsonym)
+ pvtIsonym->push_back(*it);
+ nCount++;
+ }
+ }
+
+ return nCount;
+}
+
+INT filehelper::comparenames_findin_folder(IN STR_VEC vtnames, IN LPCTSTR folder, IN BOOL bsubfolder, IN LPCTSTR findext, OUT STR_VEC *pvtIsonym /* = NULL */)
+{
+ if (vtnames.size() == 0 || !PathFileExists(folder)) return 0;
+ for (STR_VEC::iterator it = vtfiles1.begin(); it != vtfiles1.end(); it++)
+ {
+ name = getfilename(*it);
+ if (comparename_findin_files(name.c_str(), vtfiles2))
+ {
+ if (pvtIsonym)
+ pvtIsonym->push_back(name);
+ nCount++;
+ }
+ }
+
+ return nCount;
+}
+
+INT filehelper::comparefiles_findin_folder(IN STR_VEC &vtfiles, IN LPCTSTR folder, IN BOOL bsubfolder, IN LPCTSTR findext, OUT STR_VEC *pvtIsonym /* = NULL */)
+ for (STR_VEC::iterator it = pvtfiles[i].begin(); it != pvtfiles[i].end(); it++)
+ {
+ name = getfilename(*it);
+ if (comparename_findin_names(name.c_str(), vtnames))
+ {
+ // 打印日志,提示客户重名的相片;
+ OutputDebugString(it->c_str());
+ OutputDebugString(_T("\n"));
+ pvtIsonym->push_back(it->c_str());
+ }
+ else
+ {
+ vtnames.push_back(name);
+ }
+ }
+ }
+
+ if (pvtfiles)
+ delete []pvtfiles;
+ pvtfiles = NULL;
+
+ return 0;
+}
+
+INT filehelper::comparefolder_findin_folder(IN LPCTSTR folder1, IN LPCTSTR folder2, IN BOOL bsubfolder, IN LPCTSTR findext, OUT STR_VEC *pvtIsonym /* = NULL */)
+{
+ return 0;
+}
+
+INT filehelper::copyfolder(IN LPCTSTR from, IN LPCTSTR to)
+{
+ if (to == NULL || from == NULL)
+ return -1;
+
+ // 创建目录;
+ int nleft = 0;
+ int nIndex = -1;
+ TString strTo = to;
+ if (strTo.at(strTo.size()-1) != _T('\\'))
+ strTo.append(_T("\\"));
+ // 共享路径和硬盘盘符;
+ if (_tcscmp(strTo.substr(0, 2).c_str(), _T("\\\\")) == 0)