Explorar el Código

添加filefind.

Jeff hace 6 años
padre
commit
fa99f7a2e9

+ 6 - 6
ThresholdTools/ThresholdTools/ThresholdTools.vcxproj

@@ -99,7 +99,7 @@
       <Optimization>Disabled</Optimization>
       <SDLCheck>true</SDLCheck>
       <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\include;..\..\..\repos_main\common\STL-findfile</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -149,7 +149,7 @@
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <SDLCheck>true</SDLCheck>
       <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\include;..\..\..\repos_main\common\STL-findfile;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -197,9 +197,9 @@
     </ResourceCompile>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClInclude Include="..\..\..\repos_main\common\STL-findfile\filehelp.h" />
-    <ClInclude Include="..\..\..\repos_main\common\STL-findfile\findfile.h" />
     <ClInclude Include="CImgApply.h" />
+    <ClInclude Include="filehelp.h" />
+    <ClInclude Include="findfile.h" />
     <ClInclude Include="Resource.h" />
     <ClInclude Include="stdafx.h" />
     <ClInclude Include="targetver.h" />
@@ -207,9 +207,9 @@
     <ClInclude Include="ThresholdToolsDlg.h" />
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\..\repos_main\common\STL-findfile\filehelp.cpp" />
-    <ClCompile Include="..\..\..\repos_main\common\STL-findfile\findfile.cpp" />
     <ClCompile Include="CImgApply.cpp" />
+    <ClCompile Include="filehelp.cpp" />
+    <ClCompile Include="findfile.cpp" />
     <ClCompile Include="stdafx.cpp">
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>

+ 4 - 4
ThresholdTools/ThresholdTools/ThresholdTools.vcxproj.filters

@@ -33,10 +33,10 @@
     <ClInclude Include="CImgApply.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\..\repos_main\common\STL-findfile\filehelp.h">
+    <ClInclude Include="filehelp.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\..\repos_main\common\STL-findfile\findfile.h">
+    <ClInclude Include="findfile.h">
       <Filter>头文件</Filter>
     </ClInclude>
   </ItemGroup>
@@ -53,10 +53,10 @@
     <ClCompile Include="CImgApply.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\..\repos_main\common\STL-findfile\filehelp.cpp">
+    <ClCompile Include="filehelp.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\..\repos_main\common\STL-findfile\findfile.cpp">
+    <ClCompile Include="findfile.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
   </ItemGroup>

+ 1491 - 0
ThresholdTools/ThresholdTools/filehelp.cpp

@@ -0,0 +1,1491 @@
+#include "StdAfx.h"
+#include "filehelp.h"
+#include <shlwapi.h>
+
+// 排序和乱序使用stl;
+#include <cstdlib>
+#include <ctime>
+#include <algorithm>
+// _mkdir头文件;
+#include <direct.h>
+
+int myrandom(int i) { return std::rand() % i; }
+
+filehelpImpl::filehelpImpl(void)
+{
+	
+}
+
+filehelpImpl::~filehelpImpl(void)
+{
+
+}
+
+/************************************************************************/
+/*  函数:[2/21/2017 Jeff];
+/*  描述:;
+/*  参数:;
+/*  	[IN] :;
+/*  	[OUT] :;
+/*  	[IN/OUT] :;
+/*  返回:void;
+/*  注意:;
+/*  示例:;
+/*
+/*  修改:;
+/*  日期:;
+/*  内容:;
+/************************************************************************/
+void filehelpImpl::random(IN STR_VEC& vtContent, IN BOOL bSort /* = TRUE */)
+{
+	if (bSort)
+	{//排序;
+		std::sort(vtContent.begin(), vtContent.end());
+	}
+	else
+	{//乱序;
+		//设置随即数生成器的种子;
+		std::srand(unsigned(std::time(0)));
+		std::random_shuffle(vtContent.begin(), vtContent.end(), myrandom);
+	}
+}
+
+/************************************************************************/
+/*  函数:[2/21/2017 Jeff];
+/*  描述:;
+/*  参数:;
+/*  	[IN] :;
+/*  	[OUT] :;
+/*  	[IN/OUT] :;
+/*  返回:void;
+/*  注意:;
+/*  示例:;
+/*
+/*  修改:;
+/*  日期:;
+/*  内容:;
+/************************************************************************/
+void filehelpImpl::split(OUT vector<TString>& vtSplit, IN const TString str, IN const TString strSplit)
+{
+	if (str.size() == 0 || strSplit.size() == 0)
+		return;
+
+	INT nIndex = 0;
+	vtSplit.clear();
+	TString strtmp = str;
+	TString strtmp2;
+	do 
+	{
+		if (TString::npos != (nIndex = strtmp.find_first_of(strSplit)))
+		{
+			strtmp2 = strtmp.substr(0, nIndex);
+			if (strtmp2.size())vtSplit.push_back(strtmp2);
+			strtmp = strtmp.substr(nIndex + strSplit.size());
+		}
+	} while (strtmp.find_first_of(strSplit) != TString::npos);
+
+	if (strtmp.size())
+		vtSplit.push_back(strtmp);
+}
+
+/************************************************************************/
+/*  函数:[2/19/2017 Jeff];
+/*  描述:保留指定的扩展名文件;
+/*  参数:;
+/*  	[IN] keepExt:要保留的扩展名;
+/*  	[OUT] vtfiles:要提取保留扩展名的文件数组;
+/*  	[IN/OUT] :;
+/*  返回:void;
+/*  注意:;
+/*  示例:;
+/*
+/*  修改:;
+/*  日期:;
+/*  内容:;
+/************************************************************************/
+void filehelpImpl::keepdownbyext(IN const TString &keepExt, IN STR_VEC &vtfiles)
+{
+	if (keepExt.find(_T("*.*")) != TString::npos) return;
+	if (vtfiles.size() == 0) return;
+
+	// 获取复制扩展名;
+	int nIndex = 0;
+	TString strtmp;
+	TString strRemainExt(keepExt);
+	strRemainExt.append(_T("|"));
+	STR_VEC vtRemainExt;
+
+	// 将所有扩展名解析到数组里;
+	do
+	{
+		nIndex = strRemainExt.find(_T('|'));
+		if (nIndex != TString::npos)
+		{
+			strtmp = strRemainExt.substr(0, nIndex);
+			strRemainExt = strRemainExt.substr(nIndex + 1);
+
+			if (strtmp.compare(_T("*.*")))
+				vtRemainExt.push_back(strtmp);
+		}
+	} while (strRemainExt.find(_T('|')) != TString::npos);
+
+	STR_VEC vtresult;
+	// 过滤非复制扩展名的文件,同时去掉缩略图,保留指定复制扩展名的文件;
+	for (STR_VEC::iterator itExt = vtRemainExt.begin(); itExt != vtRemainExt.end(); itExt++)
+	{
+		for (STR_VEC::iterator it = vtfiles.begin(); it != vtfiles.end();)
+		{
+			if (match(itExt->substr(1), it->c_str())) 
+			{
+				vtresult.push_back(*it);
+				it = vtfiles.erase(it);
+			}
+			else
+				it++;
+		}
+	}
+
+	vtfiles.clear();
+	for ( STR_VEC::iterator it = vtresult.begin(); it != vtresult.end(); it++ )
+	{
+		vtfiles.push_back(*it);
+	}
+}
+
+void filehelpImpl::keepdownbyext(IN const TString &keepExt, IN const STR_VEC &vtfiles, OUT STR_VEC &vtresult)
+{
+	if (keepExt.find(_T("*.*")) != TString::npos) return;
+	if (vtfiles.size() == 0) return;
+
+	// 获取复制扩展名;
+	int nIndex = 0;
+	TString strtmp;
+	TString strRemainExt(keepExt);
+	strRemainExt.append(_T("|"));
+	STR_VEC vtRemainExt;
+
+	// 将所有扩展名解析到数组里;
+	do
+	{
+		nIndex = strRemainExt.find(_T('|'));
+		if (nIndex != TString::npos)
+		{
+			strtmp = strRemainExt.substr(0, nIndex);
+			strRemainExt = strRemainExt.substr(nIndex + 1);
+
+			if (strtmp.compare(_T("*.*")))
+				vtRemainExt.push_back(strtmp);
+		}
+	} while (strRemainExt.find(_T('|')) != TString::npos);
+
+#if 0
+	// 过滤非复制扩展名的文件,同时去掉缩略图,保留指定复制扩展名的文件;
+	for (STR_VEC::iterator itExt = vtRemainExt.begin(); itExt != vtRemainExt.end(); itExt++)
+	{
+		for (STR_VEC::const_iterator it = vtfiles.begin(); it != vtfiles.end(); it++)
+		{
+			if (match(itExt->substr(1), it->c_str())) 
+			{
+				vtresult.push_back(*it);
+			}
+		}
+	}
+#else
+	STR_VEC vt_files;
+	for (STR_VEC::const_iterator it = vtfiles.begin(); it != vtfiles.end(); it++ )
+	{// 不能直接用vtresult来复制,因为如果vtresult不为空的情况下,会有异常出现;
+		vt_files.push_back(*it);
+	}
+
+	for (STR_VEC::iterator itExt = vtRemainExt.begin(); itExt != vtRemainExt.end(); itExt++)
+	{
+		for (STR_VEC::iterator it = vt_files.begin(); it != vt_files.end(); )
+		{
+			if (match(itExt->substr(1), it->c_str()))
+			{
+				vtresult.push_back(*it);
+				it = vt_files.erase(it);
+			}
+			else
+				it++;
+		}
+	}
+#endif
+}
+
+/************************************************************************/
+/*  函数:keepoutext[2/19/2017 Jeff];
+/*  描述:移除指定扩展名的文件;
+/*  参数:;
+/*  	[IN] :;
+/*  	[OUT] :;
+/*  	[IN/OUT] :;
+/*  返回:void;
+/*  注意:;
+/*  示例:;
+/*
+/*  修改:;
+/*  日期:;
+/*  内容:;
+/************************************************************************/
+void filehelpImpl::keepoutbyext(IN const TString &removeext, IN STR_VEC &vtfiles)
+{
+	if (removeext.find(_T("*.*")) != TString::npos) return;
+	if (vtfiles.size() == 0) return;
+
+	// 获取复制扩展名;
+	int nIndex = 0;
+	TString strtmp;
+	TString strRemoveExt(removeext);
+	strRemoveExt.append(_T("|"));
+	STR_VEC vtRemoveExt;
+
+	// 将所有扩展名解析到数组里;
+	do
+	{
+		nIndex = strRemoveExt.find(_T('|'));
+		if (nIndex != TString::npos)
+		{
+			strtmp = strRemoveExt.substr(0, nIndex);
+			strRemoveExt = strRemoveExt.substr(nIndex + 1);
+
+			if (strtmp.compare(_T("*.*")))
+				vtRemoveExt.push_back(strtmp);
+		}
+	} while (strRemoveExt.find(_T('|')) != TString::npos);
+
+	// 过滤非复制扩展名的文件,同时去掉缩略图,保留指定复制扩展名的文件;
+	for (STR_VEC::iterator itExt = vtRemoveExt.begin(); itExt != vtRemoveExt.end(); itExt++)
+	{
+		for (STR_VEC::iterator it = vtfiles.begin(); it != vtfiles.end();)
+		{
+			if (match(itExt->substr(1), it->c_str())) 
+			{
+				it = vtfiles.erase(it);
+			}
+			else
+				it++;
+		}
+	}
+}
+
+void filehelpImpl::keepoutbyext(IN const TString &removeext, IN const STR_VEC &vtfiles, OUT STR_VEC &vtresult)
+{
+	if (removeext.find(_T("*.*")) != TString::npos) return;
+	if (vtfiles.size() == 0) return;
+
+	// 获取复制扩展名;
+	int nIndex = 0;
+	TString strtmp;
+	TString strRemoveExt(removeext);
+	strRemoveExt.append(_T("|"));
+	STR_VEC vtRemoveExt;
+
+	// 将所有扩展名解析到数组里;
+	do
+	{
+		nIndex = strRemoveExt.find(_T('|'));
+		if (nIndex != TString::npos)
+		{
+			strtmp = strRemoveExt.substr(0, nIndex);
+			strRemoveExt = strRemoveExt.substr(nIndex + 1);
+
+			if (strtmp.compare(_T("*.*")))
+				vtRemoveExt.push_back(strtmp);
+		}
+	} while (strRemoveExt.find(_T('|')) != TString::npos);
+
+	// 复制到新容器中;
+	STR_VEC vt_files;
+	for (STR_VEC::const_iterator it = vtfiles.begin(); it != vtfiles.end(); it++ )
+	{// 不能直接用vtresult来复制,因为如果vtresult不为空的情况下,会有异常出现;
+		vt_files.push_back(*it);
+	}
+
+	// 过滤非复制扩展名的文件,同时去掉缩略图,保留指定复制扩展名的文件;
+	for (STR_VEC::iterator itExt = vtRemoveExt.begin(); itExt != vtRemoveExt.end(); itExt++)
+	{
+		for (STR_VEC::iterator it = vt_files.begin(); it != vt_files.end();)
+		{
+			if (match(itExt->substr(1), it->c_str()))
+			{
+				vtresult.push_back(*it);
+				it = vt_files.erase(it);
+			}
+			else
+				it++;
+		}
+	}
+}
+
+void filehelpImpl::keepdowbyname(IN const STR_VEC &vtnames)
+{
+	if ( m_pvtfiles == NULL || m_pvtnames == &vtnames )
+		return;
+
+	INT nIndex = 0;
+	STR_VEC vt_result_files;
+	if ( m_pvtnames == NULL)
+	{
+		STR_VEC::const_iterator it_name = vtnames.begin();
+		for ( ; it_name != vtnames.end(); it_name++ )
+		{
+			STR_VEC::iterator it_file = m_pvtfiles->begin();
+			for ( ; it_file != m_pvtfiles->end(); )
+			{
+				nIndex = it_file->find_last_of(_T('\\'));
+				if (TString::npos != nIndex)
+				{
+					if (_tcsicmp(it_file->substr(nIndex + 1).c_str(), it_name->c_str()) == 0)
+					{
+						vt_result_files.push_back(*it_file);
+						it_file = m_pvtfiles->erase(it_file);
+						continue;
+					}
+				}
+				it_file++;
+			}
+		}
+
+		m_pvtfiles->clear();
+		for ( STR_VEC::iterator it = vt_result_files.begin(); it != vt_result_files.end(); it++ )
+		{
+			m_pvtfiles->push_back(*it);
+		}
+	}
+	else 
+	{
+		if ( m_pvtnames->size() != m_pvtfiles->size() )
+			return;
+
+		STR_VEC::iterator it_name;
+		STR_VEC::iterator it_file;
+		STR_VEC vt_result_names;
+		for ( STR_VEC::const_iterator it = vtnames.begin(); it != vtnames.end(); it++ )
+		{
+			it_name = m_pvtnames->begin();
+			it_file = m_pvtfiles->begin();
+			for ( ; it_file != m_pvtfiles->end(), it_name != m_pvtnames->end();)
+			{
+				if ( _tcsicmp(it_name->c_str(), it->c_str()) == 0 )
+				{
+					vt_result_files.push_back(*it_file);
+					vt_result_names.push_back(*it_name);
+					it_file = m_pvtfiles->erase(it_file);
+					it_name = m_pvtnames->erase(it_name);
+					continue;
+				}
+
+				it_file++;
+				it_name++;
+			}
+		}
+
+		m_pvtfiles->clear();
+		m_pvtnames->clear();
+		it_name = vt_result_names.begin();
+		it_file = vt_result_files.begin();
+		for ( ; it_file != vt_result_files.end(), it_name != vt_result_names.end(); it_file++, it_name++ )
+		{
+			m_pvtfiles->push_back(*it_file);
+			m_pvtnames->push_back(*it_name);
+		}
+	}
+}
+
+void filehelpImpl::keepdowbyname(IN const STR_VEC &vtnames, IN STR_VEC &vtfiles)
+{
+	if ( vtnames.size() == 0 )
+		return;
+
+	INT nIndex = 0;
+	STR_VEC vt_result_files;
+	STR_VEC::const_iterator it_name = vtnames.begin();
+	for ( ; it_name != vtnames.end(); it_name++ )
+	{
+		STR_VEC::iterator it_file = vtfiles.begin();
+		for ( ; it_file != vtfiles.end(); )
+		{
+			nIndex = it_file->find_last_of(_T('\\'));
+			if (TString::npos != nIndex)
+			{
+				if (_tcsicmp(it_file->substr(nIndex + 1).c_str(), it_name->c_str()) == 0)
+				{
+					vt_result_files.push_back(*it_file);
+					it_file = vtfiles.erase(it_file);
+					continue;
+				}
+			
+			}
+			it_file++;
+		}
+	}
+
+	vtfiles.clear();
+	for ( STR_VEC::iterator it = vt_result_files.begin(); it != vt_result_files.end(); it++ )
+	{
+		vtfiles.push_back(*it);
+	}
+}
+
+void filehelpImpl::keepdowbyname(IN const STR_VEC &vtnames, IN const STR_VEC &vtfiles, OUT STR_VEC &vt_result)
+{
+	if ( vtnames.size() == 0 )
+		return;
+
+	INT nIndex = 0;
+	STR_VEC::const_iterator it_name = vtnames.begin();
+	for ( ; it_name != vtnames.end(); it_name++ )
+	{
+		STR_VEC::const_iterator it_file = vtfiles.begin();
+		for ( ; it_file != vtfiles.end(); it_file++)
+		{
+			nIndex = it_file->find_last_of(_T('\\'));
+			if (TString::npos != nIndex)
+			{
+				if (_tcsicmp(it_file->substr(nIndex + 1).c_str(), it_name->c_str()) == 0)
+				{
+					vt_result.push_back(*it_file);
+				}
+			}
+		}
+	}
+}
+
+void filehelpImpl::keepdowbyname_noext(IN const STR_VEC &vtnames)
+{
+	if ( m_pvtfiles == NULL || m_pvtnames == &vtnames )
+		return;
+
+	INT nIndex = 0;
+	STR_VEC vt_result_files;
+	if ( m_pvtnames == NULL)
+	{
+		INT nIndex2 = 0;
+		STR_VEC::const_iterator it_name = vtnames.begin();
+		for ( ; it_name != vtnames.end(); it_name++ )
+		{
+			STR_VEC::iterator it_file = m_pvtfiles->begin();
+			for ( ; it_file != m_pvtfiles->end(); )
+			{
+				nIndex = it_file->find_last_of(_T('\\'));
+				nIndex2 = it_file->find_last_of(_T('.'));
+				if (TString::npos != nIndex && TString::npos != nIndex2 && nIndex > nIndex2 )
+				{
+					if ( _tcsicmp(it_file->substr(nIndex+1,nIndex2 - nIndex - 1).c_str(), it_name->c_str()) == 0)
+					{
+						vt_result_files.push_back(*it_file);
+						it_file = m_pvtfiles->erase(it_file);
+						continue;
+					}
+				}
+				it_file++;
+			}
+		}
+
+		m_pvtfiles->clear();
+		for ( STR_VEC::iterator it = vt_result_files.begin(); it != vt_result_files.end(); it++ )
+		{
+			m_pvtfiles->push_back(*it);
+		}
+	}
+	else 
+	{
+		if ( m_pvtnames->size() != m_pvtfiles->size() )
+			return;
+
+		STR_VEC::iterator it_name;
+		STR_VEC::iterator it_file;
+		STR_VEC vt_result_names;
+		for ( STR_VEC::const_iterator it = vtnames.begin(); it != vtnames.end(); it++ )
+		{
+			it_name = m_pvtnames->begin();
+			it_file = m_pvtfiles->begin();
+			for ( ; it_file != m_pvtfiles->end(), it_name != m_pvtnames->end();)
+			{
+				if ( TString::npos != ( nIndex = it_name->find_last_of(_T('.'))))
+				{
+					if ( _tcsicmp(it_name->substr(0, nIndex).c_str(), it->c_str()) == 0 )
+					{
+						vt_result_files.push_back(*it_file);
+						vt_result_names.push_back(*it_name);
+						it_file = m_pvtfiles->erase(it_file);
+						it_name = m_pvtnames->erase(it_name);
+						continue;
+					}
+				}
+				it_file++;
+				it_name++;
+			}
+		}
+
+		m_pvtfiles->clear();
+		m_pvtnames->clear();
+		it_name = vt_result_names.begin();
+		it_file = vt_result_files.begin();
+		for ( ; it_file != vt_result_files.end(), it_name != vt_result_names.end(); it_file++, it_name++ )
+		{
+			m_pvtfiles->push_back(*it_file);
+			m_pvtnames->push_back(*it_name);
+		}
+	}
+}
+
+void filehelpImpl::keepdowbyname_noext(IN const STR_VEC &vtnames, IN STR_VEC &vtfiles)
+{
+	if ( vtnames.size() == 0 )
+		return;
+
+	INT nIndex = 0;
+	TString strName;
+	STR_VEC vt_result_files;
+	STR_VEC::const_iterator it_name = vtnames.begin();
+	for ( ; it_name != vtnames.end(); it_name++ )
+	{
+		STR_VEC::iterator it_file = vtfiles.begin();
+		for ( ; it_file != vtfiles.end(); )
+		{
+			nIndex = it_file->find_last_of(_T('\\'));
+			if (TString::npos != nIndex)
+			{
+				strName = it_file->substr(nIndex+1);
+				if ( TString::npos != ( nIndex = strName.find_last_of(_T('.'))))
+				{
+					if ( _tcsicmp(strName.substr(0,nIndex).c_str(), it_name->c_str()) == 0)
+					{
+						vt_result_files.push_back(*it_file);
+						it_file = vtfiles.erase(it_file);
+						continue;
+					}
+				}
+			}
+			it_file++;
+		}
+	}
+
+	vtfiles.clear();
+	for ( STR_VEC::iterator it = vt_result_files.begin(); it != vt_result_files.end(); it++ )
+	{
+		vtfiles.push_back(*it);
+	}
+}
+
+void filehelpImpl::keepdowbyname_noext(IN const STR_VEC &vtnames, IN const STR_VEC &vtfiles, OUT STR_VEC &vt_result)
+{
+	if ( vtnames.size() == 0 )
+		return;
+
+	INT nIndex = 0;
+	TString strName;
+	STR_VEC::const_iterator it_name = vtnames.begin();
+	for ( ; it_name != vtnames.end(); it_name++ )
+	{
+		STR_VEC::const_iterator it_file = vtfiles.begin();
+		for ( ; it_file != vtfiles.end(); it_file++)
+		{
+			nIndex = it_file->find_last_of(_T('\\'));
+			if (TString::npos != nIndex)
+			{
+				strName = it_file->substr(nIndex+1);
+				if ( TString::npos != ( nIndex = strName.find_last_of(_T('.'))))
+				{
+					if ( _tcsicmp(strName.substr(0,nIndex).c_str(), it_name->c_str()) == 0)
+					{
+						vt_result.push_back(*it_file);
+					}
+				}
+			}
+		}
+	}
+}
+
+void filehelpImpl::subgroupExt(IN const TString &ext1, IN STR_VEC &vt1, IN const TString &ext2, IN STR_VEC &vt2)
+{
+	// 		if (ext1.find(_T("*.*")) != TString::npos ) return;
+	// 		if ( !iscorrectext(ext1) || vt1.size() == 0 ) return;
+	// 
+	// 		// 获取复制扩展名;
+	// 		int nIndex = 0;
+	// 		TString strtmp;
+	// 		TString strExt1(ext1);
+	// 		strExt1.append(_T("|"));
+	// 		STR_VEC vtExt1;
+	// 
+	// 		// 将所有扩展名解析到数组里;
+	// 		do 
+	// 		{
+	// 			nIndex = strExt1.find(_T('|'));
+	// 			if ( nIndex != TString::npos )
+	// 			{
+	// 				strtmp = strExt1.substr(0,nIndex);
+	// 				strExt1 = strExt1.substr(nIndex+1);
+	// 
+	// 				if(strtmp.compare(_T("*.*")))
+	// 					vtExt1.push_back(strtmp);
+	// 			}
+	// 		} while ( strExt1.find(_T('|')) != TString::npos );
+}
+
+/************************************************************************/
+/*  函数:filterbyname[2/21/2017 Jeff];
+/*  描述:根据有后缀的文件名(如:001.jpg)来过虑文件;;
+/*  参数:;
+/*  	[IN] vtfiles:要被过滤的文件路径数组;
+/*  	[IN] vtnames:要过滤的文件名,每个文件名都有后缀,如:001.jpg;
+/*  返回:void;
+/*  注意:;
+/*  示例:;
+/*
+/*  修改:;
+/*  日期:;
+/*  内容:;
+/************************************************************************/
+void filehelpImpl::filterbyname(IN STR_VEC &vtfiles, IN const STR_VEC &vtnames)
+{// 再按名称过滤;
+	INT nIndex = 0;
+	TString strName;
+	for ( STR_VEC::const_iterator it_name = vtnames.begin(); it_name != vtnames.end(); it_name++ )
+	{
+		for ( STR_VEC::iterator it_file = vtfiles.begin(); it_file != vtfiles.end(); )
+		{
+			nIndex = it_file->find_last_of(_T('\\'));
+			if (TString::npos != nIndex)
+			{
+				strName = it_file->substr(nIndex+1);
+				if ( _tcsicmp(strName.c_str(), it_name->c_str()) == 0 )
+				{
+					it_file = vtfiles.erase(it_file);
+					continue;
+				}				
+			}
+			it_file++;
+		}
+	}
+}
+
+void filehelpImpl::filterbyname(IN const STR_VEC &vtnames)
+{
+	if ( m_pvtfiles == NULL || m_pvtnames == &vtnames )
+		return;
+
+	INT nIndex = 0;
+	TString strName;
+	if ( m_pvtnames == NULL)
+	{
+		STR_VEC::const_iterator it_name = vtnames.begin();
+		for ( ; it_name != vtnames.end(); it_name++ )
+		{
+			STR_VEC::iterator it_file = m_pvtfiles->begin();
+			for ( ; it_file != m_pvtfiles->end(); )
+			{
+				nIndex = it_file->find_last_of(_T('\\'));
+				if (TString::npos != nIndex)
+				{
+					strName = it_file->substr(nIndex+1);
+					if ( _tcsicmp(strName.c_str(), it_name->c_str()) == 0)
+					{
+						it_file = m_pvtfiles->erase(it_file);
+						continue;
+					}
+				}
+				it_file++;
+			}
+		}
+	}
+	else 
+	{
+		if ( m_pvtnames->size() != m_pvtfiles->size() )
+			return;
+		for ( STR_VEC::const_iterator it = vtnames.begin(); it != vtnames.end(); it++ )
+		{
+			STR_VEC::iterator it_name = m_pvtnames->begin();
+			STR_VEC::iterator it_file = m_pvtfiles->begin();
+			for ( ; it_file != m_pvtfiles->end(), it_name != m_pvtnames->end();)
+			{
+				if ( _tcsicmp(it_name->c_str(), it->c_str()) == 0 )
+				{
+					it_file = m_pvtfiles->erase(it_file);
+					it_name = m_pvtnames->erase(it_name);
+					continue;
+				}
+
+				it_file++;
+				it_name++;
+			}
+		}
+	}
+}
+
+// 根据无后缀的文件名(如:001)来过虑文件;
+void filehelpImpl::filterbyname_noext(IN STR_VEC &vtfiles, IN const STR_VEC &vtnames)
+{// 再按名称过滤;
+	INT nIndex = 0;
+	INT nIndex2 = 0;
+	TString strName;
+	for ( STR_VEC::iterator it_file = vtfiles.begin(); it_file != vtfiles.end(); )
+	{
+		nIndex = it_file->find_last_of(_T('\\'));
+		nIndex2 = it_file->find_last_of(_T('.'));
+		for ( STR_VEC::const_iterator it_name = vtnames.begin(); it_name != vtnames.end(); it_name++ )
+		{
+			if (TString::npos != nIndex && TString::npos != nIndex2 && nIndex2 > nIndex)
+			{
+				if ( _tcsicmp(it_file->substr(nIndex+1,nIndex2-nIndex-1).c_str(), it_name->c_str()) == 0)
+				{
+					it_file = vtfiles.erase(it_file);
+					continue;
+				}
+			}
+			it_file++;
+		}
+	}
+}
+
+void filehelpImpl::filterbyname_noext(IN const STR_VEC &vtnames)
+{
+	if ( m_pvtfiles == NULL || m_pvtnames == &vtnames )
+		return;
+
+	INT nIndex = 0;
+	TString strName;
+	if ( m_pvtnames == NULL )
+	{
+		INT nIndex2 = 0;
+		STR_VEC::iterator it_file = m_pvtfiles->begin();
+		for ( ; it_file != m_pvtfiles->end(); )
+		{
+			nIndex = it_file->find_last_of(_T('\\'));
+			nIndex2 = it_file->find_last_of(_T('.'));
+			for ( STR_VEC::const_iterator it_name = vtnames.begin(); it_name != vtnames.end(); it_name++ )
+			{
+				if (TString::npos != nIndex && TString::npos != nIndex2 && nIndex2 > nIndex)
+				{
+					if ( _tcsicmp(it_file->substr(nIndex+1,nIndex2-nIndex-1).c_str(), it_name->c_str()) == 0 )
+					{
+						it_file = m_pvtfiles->erase(it_file);
+						continue;
+					}
+				}
+				it_file++;
+			}
+		}
+	}
+	else
+	{
+		if (m_pvtnames->size() != m_pvtfiles->size())
+			return;
+
+		for ( STR_VEC::const_iterator it = vtnames.begin(); it != vtnames.end(); it++ )
+		{
+			STR_VEC::iterator it_name = m_pvtnames->begin();
+			STR_VEC::iterator it_file = m_pvtfiles->begin();
+			for ( ; it_file != m_pvtfiles->end(), it_name != m_pvtnames->end();)
+			{
+				if ( TString::npos != (nIndex = it_name->find_last_of(_T('.'))) )
+				{
+					if ( _tcsicmp(it_name->substr(0, nIndex).c_str(), it->c_str()) == 0 )
+					{
+						it_file = m_pvtfiles->erase(it_file);
+						it_name = m_pvtnames->erase(it_name);
+						continue;
+					}
+
+					it_file++;
+					it_name++;
+				}
+			}
+		}
+	}
+
+}
+//////////////////////////////////////////////////////////////////////////
+BOOL filehelpImpl::getall(IN LPCTSTR lpfolder, IN LPCTSTR lpfindext, IN OUT STR_VEC *pvtfiles, IN OUT STR_VEC *pvtnames, IN OUT STR_VEC *pvtfolders)
+{
+	// 路径不存在;
+	if (!PathFileExists(lpfolder))
+		return FALSE;
+
+	// 指针空;
+	if (!pvtfiles || !pvtnames || !pvtfolders ) return FALSE;
+
+	m_pvtfiles = pvtfiles;
+	m_pvtnames = pvtnames;
+	m_pvtfolders = pvtfolders;
+
+#if	USE_IMGEXT
+	// 判断扩展名有效性;
+	if (!iscorrectext(lpfindext)) return FALSE;
+#endif
+
+	findall(lpfolder);
+	if ( _tcsstr(lpfindext, _T("*.*")) == NULL )
+	{// 需要保留指定后缀;
+		keepdownbyext(lpfindext, *pvtfiles);
+		keepdownbyext(lpfindext, *pvtnames);
+	}
+
+	return TRUE;
+}
+
+BOOL filehelpImpl::getsubfolder(IN LPCTSTR lpfolder, IN STR_VEC *pvtfolders)
+{
+	// 路径不存在;
+	if (!PathFileExists(lpfolder))
+		return FALSE;
+
+	// 指针空;
+	if (pvtfolders == NULL) return FALSE;
+	m_pvtfolders = pvtfolders;
+
+	findsubfolder(lpfolder);
+
+	return TRUE;
+}
+
+BOOL filehelpImpl::getallsubfolder(IN LPCTSTR lpfolder, IN STR_VEC *pvtfolders)
+{
+	// 路径不存在;
+	if (!PathFileExists(lpfolder))
+		return FALSE;
+
+	// 指针空;
+	if (pvtfolders == NULL) return FALSE;
+	m_pvtfolders = pvtfolders;
+
+	findallsubfolder(lpfolder);
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL filehelpImpl::getfiles_findin_subfolder(IN LPCTSTR lpfolder, IN LPCTSTR lpfindext, 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 ( _tcsstr(lpfindext, _T("*.*")) == NULL )
+	{// 需要保留指定后缀;
+		keepdownbyext(lpfindext, *pvtfiles);
+	}
+
+	return TRUE;
+}
+
+BOOL filehelpImpl::getfiles_findout_subfolder(IN LPCTSTR lpfolder, IN LPCTSTR lpfindext, 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_findout_subfolder(lpfolder);
+	if ( _tcsstr(lpfindext, _T("*.*")) == NULL )
+	{// 需要保留指定后缀;
+		keepdownbyext(lpfindext, *pvtfiles);
+	}
+
+	return TRUE;
+}
+
+BOOL filehelpImpl::getfiles_within_subfolder(IN LPCTSTR lpfolder, IN LPCTSTR lpfindext, 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 ( _tcsstr(lpfindext, _T("*.*")) == NULL )
+	{// 需要保留指定后缀;
+		keepdownbyext(lpfindext, *pvtfiles);
+	}
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL filehelpImpl::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 ( _tcsstr(lpfindext, _T("*.*")) == NULL )
+	{// 需要保留指定后缀;
+		keepdownbyext(lpfindext, *pvtfiles);
+	}
+
+	// 再按名称过滤;
+	filterbyname(*pvtfiles, vtnames);
+
+	return TRUE;
+}
+
+BOOL filehelpImpl::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 ( _tcsstr(lpfindext, _T("*.*")) == NULL )
+	{// 需要保留指定后缀;
+		keepdownbyext(lpfindext, *pvtfiles);
+	}
+
+	// 再按名称过滤;
+	filterbyname(*pvtfiles, vtnames);
+
+	return TRUE;
+}
+
+BOOL filehelpImpl::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 ( _tcsstr(lpfindext, _T("*.*")) == NULL )
+	{// 需要保留指定后缀;
+		keepdownbyext(lpfindext, *pvtfiles);
+	}
+
+	// 再按名称过滤;
+	filterbyname(*pvtfiles, vtnames);
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL filehelpImpl::getnames_findin_subfolder(IN LPCTSTR lpfolder, IN LPCTSTR lpfindext, IN STR_VEC *pvtnames)
+{
+	// 路径不存在;
+	if (!PathFileExists(lpfolder))
+		return FALSE;
+
+	// 指针空;
+	if (pvtnames == NULL) return FALSE;
+#if	USE_IMGEXT
+	// 判断扩展名有效性;
+	if (!iscorrectext(lpfindext)) return FALSE;
+#endif
+	m_pvtnames = pvtnames;
+	findnames_findin_subfolder(lpfolder);
+	if ( _tcsstr(lpfindext, _T("*.*")) == NULL )
+	{// 需要保留指定后缀;
+		keepdownbyext(lpfindext, *m_pvtnames);
+	}
+
+	return TRUE;
+}
+
+BOOL filehelpImpl::getnames_findout_subfolder(IN LPCTSTR lpfolder, IN LPCTSTR lpfindext, IN STR_VEC *pvtnames)
+{
+	// 路径不存在;
+	if (!PathFileExists(lpfolder))
+		return FALSE;
+
+	// 指针空;
+	if (pvtnames == NULL) return FALSE;
+#if	USE_IMGEXT
+	// 判断扩展名有效性;
+	if (!iscorrectext(lpfindext)) return FALSE;
+#endif
+	m_pvtnames = pvtnames;
+	findnames_findout_subfolder(lpfolder);
+	if ( _tcsstr(lpfindext, _T("*.*")) == NULL )
+	{// 需要保留指定后缀;
+		keepdownbyext(lpfindext, *m_pvtnames);
+	}
+
+	return TRUE;
+}
+
+BOOL filehelpImpl::getnames_within_subfolder(IN LPCTSTR lpfolder, IN LPCTSTR lpfindext, IN STR_VEC *pvtnames, IN STR_VEC *pvtfolders)
+{
+	// 路径不存在;
+	if (!PathFileExists(lpfolder))
+		return FALSE;
+
+	// 指针空;
+	if (pvtnames == NULL || pvtfolders == NULL ) 
+		return FALSE;
+
+	m_pvtfolders = pvtfolders;
+#if	USE_IMGEXT
+	// 判断扩展名有效性;
+	if (!iscorrectext(lpfindext)) return FALSE;
+#endif
+	m_pvtnames = pvtnames;
+	m_pvtfolders = pvtfolders;
+	findnames_within_subfolder(lpfolder);
+	if ( _tcsstr(lpfindext, _T("*.*")) == NULL )
+	{// 需要保留指定后缀;
+		keepdownbyext(lpfindext, *m_pvtnames);
+	}
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL filehelpImpl::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 ( _tcsstr(lpfindext, _T("*.*")) == NULL )
+	{// 需要保留指定后缀;
+		keepdownbyext(lpfindext, *pvtnames);
+		keepdownbyext(lpfindext, *pvtfiles);
+	}
+
+	return TRUE;
+}
+
+BOOL filehelpImpl::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 ( _tcsstr(lpfindext, _T("*.*")) == NULL )
+	{// 需要保留指定后缀;
+		keepdownbyext(lpfindext, *pvtnames);
+		keepdownbyext(lpfindext, *pvtfiles);
+	}
+
+	return TRUE;
+}
+
+BOOL filehelpImpl::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 ( _tcsstr(lpfindext, _T("*.*")) == NULL )
+	{// 需要保留指定后缀;
+		keepdownbyext(lpfindext, *pvtnames);
+		keepdownbyext(lpfindext, *pvtfiles);
+	}
+
+	return TRUE;
+}
+
+#if 1
+//////////////////////////////////////////////////////////////////////////
+BOOL filehelpImpl::comparename_2file(IN LPCTSTR file1, IN LPCTSTR file2)
+{
+	if (!file1 || !file2) return FALSE;
+
+	if (!PathFileExists(file1) || !PathFileExists(file2))
+		return FALSE;
+
+	TString strfile1 = file1;
+	TString strfile2 = file2;
+
+	strfile1 = getfilename(strfile1);
+	strfile2 = getfilename(strfile2);
+
+	return !strfile1.compare(strfile2);
+}
+
+BOOL filehelpImpl::comparename_findin_names(IN LPCTSTR name)
+{
+	if (!m_pvtnames || !name) return FALSE;
+	for (STR_VEC::iterator it = m_pvtnames->begin(); it != m_pvtnames->end(); it++)
+	{
+		if ( _tcsicmp(name, it->c_str()) == 0)
+		{
+			// 打印日志,或提示用户同名文件路径在哪;
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
+
+BOOL filehelpImpl::comparename_findin_names(IN LPCTSTR name, IN STR_VEC &vtnames)
+{
+	if (!name) return FALSE;
+	for (STR_VEC::iterator it = vtnames.begin(); it != vtnames.end(); it++)
+	{
+		if ( _tcsicmp(name, it->c_str()) == 0)
+		{
+			// 打印日志,或提示用户同名文件路径在哪;
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
+
+BOOL filehelpImpl::comparename_findin_files(IN LPCTSTR name, IN STR_VEC &vtfiles)
+{
+	if (!name) return FALSE;
+
+	int nIndex = 0;
+	for (STR_VEC::iterator it = vtfiles.begin(); it != vtfiles.end(); it++)
+	{
+		if ((nIndex = it->find_last_of(_T('\\'))) != TString::npos)
+		{
+			if (_tcsicmp(name, it->substr(nIndex+1).c_str()) == 0)
+			{
+				// 打印日志,或提示用户同名文件路径在哪;
+				return TRUE;
+			}
+		}
+	}
+
+	return FALSE;
+}
+
+BOOL filehelpImpl::comparename_findin_folder(IN LPCTSTR name, IN LPCTSTR folder, IN LPCTSTR findext, IN BOOL bsubfolder)
+{
+#if	USE_IMGEXT
+	if (!name || !iscorrectext(findext)) return FALSE;
+#else
+	if ( !name ) return FALSE;
+#endif
+	STR_VEC vtnames;
+	if (bsubfolder)
+	{
+		if (!getnames_findin_subfolder(folder, findext, &vtnames))
+			return FALSE;
+	}
+	else
+	{
+		if (!getnames_findout_subfolder(folder, findext, &vtnames))
+			return FALSE;
+	}
+
+	return comparename_findin_names(name, vtnames);
+}
+
+INT filehelpImpl::comparenames_findin_names(IN STR_VEC vtSrcnames, IN STR_VEC vtDesnames, OUT STR_VEC *pvtIsonym /* = NULL */)
+{
+	if (vtSrcnames.size() == 0 || vtDesnames.size() == 0) return 0;
+
+	INT nCount = 0;
+	for (STR_VEC::iterator it1 = vtSrcnames.begin(); it1 != vtSrcnames.end(); it1++)
+	{
+		for (STR_VEC::iterator it2 = vtDesnames.begin(); it2 != vtDesnames.end(); it2++)
+		{
+			if (_tcsicmp(it1->c_str(), it2->c_str()) == 0)
+			{
+				nCount++;
+				if (pvtIsonym)
+					pvtIsonym->push_back(*it1);
+
+				break;
+			}
+		}
+	}
+
+	return nCount;
+}
+
+INT filehelpImpl::comparenames_findin_files(IN STR_VEC vtnames, IN STR_VEC vtfiles, IN LPCTSTR findext, OUT STR_VEC *pvtIsonym /* = NULL */)
+{
+	if (vtnames.size() == 0 || vtfiles.size() == 0) return 0;
+#if	USE_IMGEXT
+	if (!iscorrectext(findext)) return 0;
+#endif
+	INT nCount = 0;
+	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 filehelpImpl::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;
+#if	USE_IMGEXT
+	if (!iscorrectext(findext)) return 0;
+#endif
+	STR_VEC vtnames2;
+	if (bsubfolder)
+	{
+		getnames_findin_subfolder(folder, findext, &vtnames2);
+	}
+	else
+	{
+		getnames_findout_subfolder(folder, findext, &vtnames2);
+	}
+
+	return comparenames_findin_names(vtnames, vtnames2, pvtIsonym);
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL filehelpImpl::comparefile_findin_names(IN LPCTSTR file, IN STR_VEC& vtnames)
+{
+	if (vtnames.size() == 0) return FALSE;
+	if (!file || !PathFileExists(file)) return FALSE;
+
+	TString strfile = file;
+	TString name = getfilename(strfile);
+
+	return comparename_findin_names(name.c_str(), vtnames);
+}
+
+BOOL filehelpImpl::comparefile_findin_files(IN LPCTSTR file, IN STR_VEC& vtfiles, IN LPCTSTR findext)
+{
+	if (!file || !PathFileExists(file)) return FALSE;
+#if	USE_IMGEXT
+	if (!iscorrectext(findext)) return FALSE;
+#endif
+	TString strfile = file;
+	TString name = getfilename(strfile);
+
+	// 过滤掉不需要的扩展名;
+	keepdownbyext(findext, vtfiles);
+
+	return comparename_findin_files(name.c_str(), vtfiles);
+}
+
+BOOL filehelpImpl::comparefile_findin_folder(IN LPCTSTR file, IN LPCTSTR folder, IN BOOL bsubfolder, IN LPCTSTR findext)
+{
+	if (!file || !PathFileExists(file) || !folder || !PathFileExists(folder)) return FALSE;
+#if	USE_IMGEXT
+	if (!iscorrectext(findext)) return FALSE;
+#endif
+	TString strfile = file;
+	TString name = getfilename(strfile);
+
+	STR_VEC vtnames;
+	if (bsubfolder)
+	{
+		getnames_findin_subfolder(folder, findext, &vtnames);
+	}
+	else
+	{
+		getnames_findout_subfolder(folder, findext, &vtnames);
+	}
+
+	return comparename_findin_names(name.c_str(), vtnames);
+}
+
+INT filehelpImpl::comparefiles_findin_files(IN STR_VEC &vtfiles1, IN STR_VEC &vtfiles2, IN LPCTSTR findext, OUT STR_VEC *pvtIsonym /* = NULL */)
+{
+	if (vtfiles1.size() == 0 || vtfiles2.size() == 0) return 0;
+#if	USE_IMGEXT
+	if (!iscorrectext(findext)) return 0;
+#endif
+	// 过滤掉不需要的扩展名;
+	keepdownbyext(findext, vtfiles1);
+
+	// 过滤掉不需要的扩展名;
+	keepdownbyext(findext, vtfiles2);
+
+	INT nCount = 0;
+	TString name;
+	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 filehelpImpl::comparefiles_findin_folder(IN STR_VEC &vtfiles, IN LPCTSTR folder, IN BOOL bsubfolder, IN LPCTSTR findext, OUT STR_VEC *pvtIsonym /* = NULL */)
+{
+	if (vtfiles.size() == 0 || !folder || !PathFileExists(folder)) return 0;
+#if	USE_IMGEXT
+	if (!iscorrectext(findext)) return 0;
+#endif
+	STR_VEC vtnames;
+	if (bsubfolder)
+	{
+		getnames_findin_subfolder(folder, findext, &vtnames);
+	}
+	else
+	{
+		getnames_findout_subfolder(folder, findext, &vtnames);
+	}
+
+	return comparenames_findin_files(vtnames, vtfiles, findext, pvtIsonym);
+}
+
+INT filehelpImpl::comparefolderself(IN LPCTSTR folder, IN LPCTSTR findext, OUT STR_VEC *pvtIsonym /* = NULL */)
+{
+	OutputDebugString(_T("\n"));
+#if	USE_IMGEXT
+	if (!folder || !PathFileExists(folder) || !iscorrectext(findext)) return 0;
+#else
+	if (!folder || !PathFileExists(folder) ) return 0;
+#endif
+
+	STR_VEC vtsubfolders;
+	vtsubfolders.push_back(folder);	// 包含当前目录;
+	getsubfolder(folder, &vtsubfolders);
+
+	int n = vtsubfolders.size();
+	STR_VEC *pvtfiles = new STR_VEC[n];
+
+	for (STR_VEC::iterator it = vtsubfolders.begin(); it != vtsubfolders.end(); it++)
+	{
+		getfiles_findin_subfolder(it->c_str(), findext, &pvtfiles[--n]);
+	}
+
+	STR_VEC vtnames;
+	n = vtsubfolders.size();
+	TString name;
+	for (int i = 0; i < n; i++)
+	{
+		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 filehelpImpl::comparefolder_findin_folder(IN LPCTSTR folder1, IN LPCTSTR folder2, IN BOOL bsubfolder, IN LPCTSTR findext, OUT STR_VEC *pvtIsonym /* = NULL */)
+{
+	return 0;
+}
+
+INT filehelpImpl::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)
+		nleft = 2;
+	else if (strTo.at(2) == _T('\\'))
+		nleft = 3;
+
+	do 
+	{
+		nIndex = strTo.substr(nleft, -1).find_first_of(_T("\\"));
+		if (nIndex != TString::npos)
+		{
+			if (_tmkdir(strTo.substr(0, nIndex + nleft).c_str()) == -1 && errno != EEXIST)				
+				break;
+			nleft += nIndex + 1;
+		}		
+	} while (nIndex!=-1);
+	
+
+	return 0;
+}
+#endif
+
+

+ 324 - 0
ThresholdTools/ThresholdTools/filehelp.h

@@ -0,0 +1,324 @@
+/************************************************************************/
+/*  Copyright (C), 2016-2020, [IT], 保留所有权利;
+/*  模 块 名:;
+/*  描    述:;
+/*
+/*  版    本:[V];	
+/*  作    者:[IT];
+/*  日    期:[12/22/2016];
+/*
+/*
+/*  注    意:;
+/*
+/*  修改记录:[IT];
+/*  修改日期:;
+/*  修改版本:;
+/*  修改内容:;
+/************************************************************************/
+#ifndef __FILEHELPING_20150818__
+#define __FILEHELPING_20150818__
+
+#pragma once
+
+#include "findfile.h"
+
+
+
+#define USE_IMGEXT 0
+
+class filehelpImpl :public findfile
+{
+public:
+	filehelpImpl(void);
+	~filehelpImpl(void);
+
+public:
+	// 排序或乱序;
+	static void random(IN STR_VEC& vtContent, IN BOOL bSort = TRUE);
+	// 分隔数组;
+	static void split(OUT vector<TString>& vtSplit, IN const TString str, IN const TString strSplit);
+	// 根据后缀名保留文件;
+	static void keepdownbyext(IN const TString &keepExt, IN STR_VEC &vtfiles);
+	static void keepdownbyext(IN const TString &keepExt, IN const STR_VEC &vtfiles, OUT STR_VEC &vtresult);
+	// 根据后缀名移除文件;
+	static void keepoutbyext(IN const TString &removeext, IN STR_VEC &vtfiles);
+	static void keepoutbyext(IN const TString &removeext, IN const STR_VEC &vtfiles, OUT STR_VEC &vtresult);
+	// 保留指定文件名(有后缀的:001.jpg)的文件路径;
+	void keepdowbyname(IN const STR_VEC &vtnames);
+	static void keepdowbyname(IN const STR_VEC &vtnames, IN STR_VEC &vtfiles);
+	static void keepdowbyname(IN const STR_VEC &vtnames, IN const STR_VEC &vtfiles, OUT STR_VEC &vt_result);
+	// 保留指定文件名(无后缀的:001)的文件路径;
+	void keepdowbyname_noext(IN const STR_VEC &vtnames);
+	static void keepdowbyname_noext(IN const STR_VEC &vtnames, IN STR_VEC &vtfiles);
+	static void keepdowbyname_noext(IN const STR_VEC &vtnames, IN const STR_VEC &vtfiles, OUT STR_VEC &vt_result);
+	// 分组扩展名;
+	static void subgroupExt(IN const TString &ext1, IN STR_VEC &vt1, IN const TString &ext2, IN STR_VEC &vt2);	
+
+	// 根据有后缀的文件名(如:001.jpg)来过虑文件;
+	static void filterbyname(IN STR_VEC &vtfiles, IN const STR_VEC &vtnames);
+	void filterbyname(IN const STR_VEC &vtnames);
+
+	// 根据无后缀的文件名(如:001)来过虑文件;
+	static void filterbyname_noext(IN STR_VEC &vtfiles, IN const STR_VEC &vtnames);
+	void filterbyname_noext(IN const STR_VEC &vtnames);
+
+	// 获取文件名,带后缀名(如:001.jpg);
+	inline void getnames(IN STR_VEC &vtfiles, IN STR_VEC &vtnames)
+	{
+		INT nIndex = 0;
+		for ( STR_VEC::iterator it = vtfiles.begin(); it != vtfiles.end(); it++ )
+		{
+			if ( (nIndex = it->find_last_of(_T('\\'))) != TString::npos )
+			{
+				vtnames.push_back(it->substr(nIndex+1));
+			}
+		}
+	}
+
+	// 获取文件名,不带后缀名(如:001);
+	inline void getnames_noext(IN const STR_VEC &vtfiles, IN STR_VEC &vtnames)
+	{
+		INT nIndex = 0;
+		INT nIndex2 = 0;
+		for ( STR_VEC::const_iterator it = vtfiles.begin(); it != vtfiles.end(); it++ )
+		{
+			if ( (nIndex = it->find_last_of(_T('\\'))) != TString::npos )
+			{
+				if ( (nIndex2 = it->find_last_of(_T('.'))) != TString::npos)
+				{
+					if ( nIndex2 > nIndex)
+						vtnames.push_back(it->substr(nIndex+1, nIndex2-nIndex));
+				}
+			}
+			else
+			{// vtfiles是没有目录的文件名,如:001.jpg;
+				if ( (nIndex2 = it->find_last_of(_T('.'))) != TString::npos)
+				{
+					vtnames.push_back(it->substr(0, nIndex2));
+				}
+			}
+		}
+	}
+public:
+	// 查找全部;
+	BOOL getall(
+		IN LPCTSTR lpfolder,								// 要查找的目录;
+		IN LPCTSTR lpfindext,								// 要查找的扩展名;
+		IN OUT STR_VEC *pvtfiles,							// 返回要查找的文件全名;
+		IN OUT STR_VEC *pvtnames,							// 返回要查找的文件名(无路径,包含扩展名);
+		IN OUT STR_VEC *pvtfolders							// 返回要查找的子目录;
+		);
+
+	// 只获取当前要目录的子文件夹,不获取子文件夹中的文件夹;
+	BOOL getsubfolder(
+		IN LPCTSTR lpfolder,								// 要查找的目录;
+		IN STR_VEC *pvtfolders								// 返回子文件夹;
+		);
+
+	BOOL getallsubfolder(
+		IN LPCTSTR lpfolder,								// 要查找的目录;
+		IN STR_VEC *pvtfolders								// 返回所有子文件夹;
+		);
+
+	//////////////////////////////////////////////////////////////////////////
+	BOOL getfiles_findin_subfolder(
+		IN LPCTSTR lpfolder,								// 要查找的目录;
+		IN LPCTSTR lpfindext,								// 要查找的扩展名;
+		IN STR_VEC *pvtfiles								// 返回要查找的文件全名;
+		);
+
+	BOOL getfiles_findout_subfolder(
+		IN LPCTSTR lpfolder,								// 要查找的目录;
+		IN LPCTSTR lpfindext,								// 要查找的扩展名;
+		IN OUT STR_VEC *pvtfiles							// 返回要查找的文件全名;
+		);
+
+	BOOL getfiles_within_subfolder(
+		IN LPCTSTR lpfolder,								// 要查找的目录;
+		IN LPCTSTR lpfindext,								// 要查找的扩展名;
+		IN STR_VEC *pvtfiles,								// 返回要查找的文件全名;
+		IN STR_VEC *pvtfolders								// 文件夹;
+		);
+
+	//////////////////////////////////////////////////////////////////////////
+	virtual BOOL getfiles_bynames_findin_subfolder(
+		IN LPCTSTR lpfolder,								// 要查找的目录;
+		IN LPCTSTR lpfindext,								// 要查找的扩展名;
+		IN STR_VEC &vtnames,
+		IN STR_VEC *pvtfiles								// 返回要查找的文件全名;
+		);
+
+	virtual BOOL getfiles_bynames_findout_subfolder(
+		IN LPCTSTR lpfolder,								// 要查找的目录;
+		IN LPCTSTR lpfindext,								// 要查找的扩展名;
+		IN STR_VEC &vtnames,
+		IN OUT STR_VEC *pvtfiles							// 返回要查找的文件全名;
+		) ;
+
+	virtual BOOL getfiles_bynames_within_subfolder(
+		IN LPCTSTR lpfolder,								// 要查找的目录;
+		IN LPCTSTR lpfindext,								// 要查找的扩展名;
+		IN STR_VEC &vtnames,
+		IN STR_VEC *pvtfiles,								// 返回要查找的文件全名;
+		IN STR_VEC *pvtfolders								// 文件夹;
+		) ;
+
+	//////////////////////////////////////////////////////////////////////////
+	BOOL getnames_findin_subfolder(
+		IN LPCTSTR lpfolder,								// 要查找的目录;
+		IN LPCTSTR lpfindext,								// 要查找的扩展名;
+		IN STR_VEC *pvtnames								// 返回要查找的文件名(无路径,包含扩展名);
+		);
+
+	BOOL getnames_findout_subfolder(
+		IN LPCTSTR lpfolder,								// 要查找的目录;
+		IN LPCTSTR lpfindext,								// 要查找的扩展名;
+		IN STR_VEC *pvtnames								// 返回要查找的文件名(无路径,包含扩展名);
+		);
+
+	BOOL getnames_within_subfolder(
+		IN LPCTSTR lpfolder,								// 要查找的目录;
+		IN LPCTSTR lpfindext,								// 要查找的扩展名;
+		IN STR_VEC *pvtnames,								// 返回要查找的文件全名;
+		IN STR_VEC *pvtfolders								// 文件夹;
+		);
+
+	//////////////////////////////////////////////////////////////////////////
+	BOOL getfilesnames_findin_subfolder(
+		IN LPCTSTR lpfolder,								// 要查找的目录;
+		IN LPCTSTR lpfindext,								// 要查找的扩展名;
+		IN STR_VEC *pvtfiles,								// 返回要查找的文件全名;
+		IN STR_VEC *pvtnames								// 返回要查找的文件名(无路径,包含扩展名);
+		);
+
+	BOOL getfilesnames_findout_subfolder(
+		IN LPCTSTR lpfolder,								// 要查找的目录;
+		IN LPCTSTR lpfindext,								// 要查找的扩展名;
+		IN STR_VEC *pvtfiles,								// 返回要查找的文件全名;
+		IN STR_VEC *pvtnames								// 返回要查找的文件名(无路径,包含扩展名);
+		);
+
+	BOOL getfilesnames_within_subfolder(
+		IN LPCTSTR lpfolder,								// 要查找的目录;
+		IN LPCTSTR lpfindext,								// 要查找的扩展名;
+		IN STR_VEC *pvtfiles,								// 返回要查找的文件全名;
+		IN STR_VEC *pvtnames,								// 返回要查找的文件名(无路径,包含扩展名);
+		IN STR_VEC *pvtfolders								// 文件夹;
+		);
+
+public:
+	//////////////////////////////////////////////////////////////////////////
+	BOOL comparename_findin_names(IN LPCTSTR name);
+
+	// 两个文件对比,是否同名;
+	BOOL comparename_2file(
+		IN LPCTSTR file1,									// 文件1(全路径);
+		IN LPCTSTR file2									// 文件2(全路径);
+		);
+
+	// 指定文件名,与一组文件名对比;
+	BOOL comparename_findin_names(
+		IN LPCTSTR name,									// 文件名(无路径,不含扩展名);
+		IN STR_VEC& vtnames									// 一组文件名(无路径,不含扩展名);
+		);
+
+	// 指定文件名,与一组文件对比;
+	BOOL comparename_findin_files(
+		IN LPCTSTR name,									// 文件名(不含扩展名);
+		IN STR_VEC& vtfiles									// 一组文件(全路径);
+		);
+
+	// 指定文件名,与一文件夹对比;
+	BOOL comparename_findin_folder(
+		IN LPCTSTR name,									// 文件名(不含扩展名);
+		IN LPCTSTR folder,									// 文件夹;
+		IN LPCTSTR findext,									// 要查找的扩展名;
+		IN BOOL bsubfolder									// 是否查找文件夹内的子目录;
+		);
+
+	//////////////////////////////////////////////////////////////////////////
+	// 指定一组文件名,与另一组文件名对比;
+	INT comparenames_findin_names(
+		IN STR_VEC vtSrcnames,								// 指定的一组源文件名(无路径,不含扩展名);
+		IN STR_VEC vtDesnames,								// 指定的一组目标文件名(无路径,不含扩展名);
+		OUT STR_VEC *pvtIsonym = NULL						// 返回同名的文件名;	
+		);
+
+	// 指定一组文件名,与一组文件(全路径)对比;
+	INT comparenames_findin_files(
+		IN STR_VEC vtnames,									// 指定的一组源文件名(无路径,不含扩展名);
+		IN STR_VEC vtfiles,									// 指定的一组目标文件(全路径);
+		IN LPCTSTR findext,									// 要查找的扩展名;
+		OUT STR_VEC *pvtIsonym = NULL						// 返回同名的文件名;
+		);
+
+	// 指定的一组文件名,与一文件夹对比;
+	INT comparenames_findin_folder(
+		IN STR_VEC vtnames,									// 指定的一组源文件名(无路径,不含扩展名);
+		IN LPCTSTR folder,									// 文件夹;
+		IN BOOL bsubfolder,									// 是否查找文件夹内的子目录;
+		IN LPCTSTR findext,									// 要查找的扩展名;
+		OUT STR_VEC *pvtIsonym = NULL						// 返回同名的文件名;
+		);
+
+	//////////////////////////////////////////////////////////////////////////
+	// 指定一文件,与一组文件名对比;
+	BOOL comparefile_findin_names(
+		IN LPCTSTR file,									// 文件1(全路径);
+		IN STR_VEC& vtnames									// 指定的一组文件名(无路径,不含扩展名)
+		);
+
+	// 指定一文件,与一组文件对比;
+	BOOL comparefile_findin_files(
+		IN LPCTSTR file,									// 文件(全路径);
+		IN STR_VEC& vtfiles,									// 指定的一组文件(全路径)
+		IN LPCTSTR findext									// 要查找的扩展名;
+		);
+
+	// 指定一文件,与一文件夹对比;
+	BOOL comparefile_findin_folder(
+		IN LPCTSTR file,									// 文件(全路径);
+		IN LPCTSTR folder,									// 文件夹;
+		IN BOOL bsubfolder,									// 是否查找子文件夹;
+		IN LPCTSTR findext									// 要查找的扩展名;
+		);
+
+	//////////////////////////////////////////////////////////////////////////
+	// 指定一组文件,与另一组文件对比;
+	INT comparefiles_findin_files(
+		IN STR_VEC &vtfiles1,								// 指定的一组源文件;
+		IN STR_VEC &vtfiles2,								// 指定的一组目标文件;
+		IN LPCTSTR findext,									// 要查找的扩展名;
+		OUT STR_VEC *pvtIsonym = NULL						// 返回同名的文件名;
+		);
+
+	// 指定一组文件,与一文件夹对比;
+	INT comparefiles_findin_folder(
+		IN STR_VEC &vtfiles,								// 指定的一组源文件;
+		IN LPCTSTR folder,									// 指定的文件夹;
+		IN BOOL bsubfolder,									// 是否查找子文件夹;
+		IN LPCTSTR findext,									// 要查找的扩展名;
+		OUT STR_VEC *pvtIsonym = NULL						// 返回同名的文件名;
+		);
+
+	// 文件夹自我对比(所有子文件夹对比)
+	INT comparefolderself(
+		IN LPCTSTR folder,									// 指定文件夹;
+		IN LPCTSTR findext,									// 要查找的扩展名;
+		OUT STR_VEC *pvtIsonym = NULL						// 返回同名的文件名;
+		);
+
+	// 指定一文件夹,与另一文件夹对比;
+	INT comparefolder_findin_folder(
+		IN LPCTSTR folder1,									// 指定源文件夹;
+		IN LPCTSTR folder2,									// 指定目标文件夹;
+		IN BOOL bsubfolder,									// 是否查找子文件夹;
+		IN LPCTSTR findext,									// 要查找的扩展名;
+		OUT STR_VEC *pvtIsonym = NULL						// 返回同名的文件名;
+		);
+
+	public:
+		INT copyfolder(IN LPCTSTR from, IN LPCTSTR to);
+};
+
+#endif

+ 877 - 0
ThresholdTools/ThresholdTools/findfile.cpp

@@ -0,0 +1,877 @@
+#include "StdAfx.h"
+#include "findfile.h"
+#include <algorithm>
+
+// 查找文件的最大数量限制在nMaxLimit;
+CONST size_t nMaxLimit = 0xFFFFFFFF;	//--4294967295;
+// 查找文件的默认数量限制在nDefLimit;
+CONST size_t nDefLimit = 0xFFFFF;	//--1048575
+
+// 路径分隔符;
+CONST TCHAR		c_pathSeparator = _T('\\');
+CONST TString	s_pathSeparator = _T("\\");
+CONST TString	g_sVertical = _T("|");
+
+// 正确的扩展名及格式样列;
+// 这个值最好可以从配置文件ini或xml中获取,不用在代码里写死;
+CONST TString	g_sCorrectExt = _T("*.jpg|*.jpeg|*.png|*.bmp|*.cr2|*.nef|*.raw");
+
+TString lowercase(IN const TString &Str)
+{
+#if 1 // 多字节生僻字下会出问题;
+	TString sResult;
+	for ( TString::const_iterator it = Str.begin(); it != Str.end(); it++ )
+	{
+		if ( *it < 0 )
+		{// 小于0,含中文,什么都不做;
+			sResult.append(1, *(it++));
+			sResult.append(1, *it);
+		}
+		else
+		{
+			if (_T('A') <= *it && *it <= _T('Z'))
+				sResult.append(1, *it + 32);
+			else
+				sResult.append(1, *it);
+		}
+	}
+
+	return sResult;
+#else
+	TString sResult;
+	std::transform(Str.begin(), Str.end(), sResult.begin(), ::toupper);
+
+	
+	static CString str = _T("");
+	str = Str.c_str();
+	str.MakeLower();
+	sResult = str.GetString();
+	return sResult;
+#endif
+}
+
+TString uppercase(IN const TString &Str)
+{
+#if 1 // 多字节生僻字下会出问题;
+	TString sResult;
+	for ( TString::const_iterator it = Str.begin(); it != Str.end(); it++ )
+	{
+		if ( *it < 0 )
+		{// 小于0,含中文,什么都不做;
+			sResult.append(1, *(it++));
+			sResult.append(1, *it);
+		}
+		else
+		{
+			if (_T('A') <= *it && *it <= _T('Z'))
+				sResult.append(1, *it - 32);
+			else
+				sResult.append(1, *it);
+		}
+	}
+
+	return sResult;
+#else
+	TString sResult;
+	static CString strTemp = _T("");
+	strTemp = Str.c_str();
+	strTemp.MakeUpper();
+	sResult = strTemp.GetString();
+	return sResult;
+#endif
+}
+
+TString getfilename(IN CONST TString &file)
+{
+	TString name;
+	TString strfile = file;
+	int nIndex = strfile.find_last_of(_T('\\'));	// 如果file不包含 '\\' ,得不到文件名;
+	if (nIndex == TString::npos)
+	{
+		nIndex = strfile.find_last_of(_T('.'));
+		if ( nIndex == TString::npos )
+			return _T("");
+
+		return strfile.substr(0, nIndex);
+	}
+
+	name = strfile.substr(nIndex+1);
+	nIndex = name.find_last_of(_T('.'));
+	if (nIndex == TString::npos)
+		return _T("");
+
+	return name.substr(0, nIndex);
+}
+
+// 判断指定字符串是否在数组里(不区分大小写);
+BOOL IsStringExistNoCase(IN CONST TString& str, IN STR_VEC &tagVt)
+{
+	int nSize = tagVt.size();
+	if (nSize == 0) return FALSE;
+
+	BOOL bExist = FALSE;
+	TString stmp1 = uppercase(str);
+	TString stmp2;
+	for (STR_VEC::iterator it = tagVt.begin(); it != tagVt.end(); it++)
+	{
+		stmp2 = uppercase(*it);
+		if (stmp1.compare(stmp2) == 0)
+		{
+			bExist = TRUE;
+			break;
+		}
+	}
+
+	return bExist;
+}
+
+findfile::findfile(void):
+m_nlimit(nDefLimit),
+m_pvtfiles(NULL),
+m_pvtnames(NULL),
+m_pvtfolders(NULL),
+m_pvtfiles_sth(NULL),
+m_pvtfiles_mth(NULL)
+{
+	groupExt();
+}
+
+findfile::~findfile(void)
+{
+}
+
+/************************************************************************/
+/*  函数:groupExt[2/19/2017 Jeff];
+/*  描述:将字符串后缀名按"|"符号分隔成数组;
+/*  参数:;
+/*  	[GBL] g_sCorrectExt:全局字符串;
+/*  返回:void;
+/*  注意:;
+/*  示例:;
+/*
+/*  修改:;
+/*  日期:;
+/*  内容:;
+/************************************************************************/
+void findfile::groupExt()
+{
+	// 将所有扩展名解析到数组里;
+	INT nIndex = 0;
+	TString strtmp;
+	TString strEffctExt = g_sCorrectExt;
+	strEffctExt.append(_T("|"));
+	do
+	{
+		nIndex = strEffctExt.find(_T('|'));
+		if (nIndex != TString::npos)
+		{
+			strtmp = strEffctExt.substr(0, nIndex);
+			strEffctExt = strEffctExt.substr(nIndex + 1);
+
+			if (strtmp.compare(_T("*.*")) && strtmp.size())
+			{
+				if ( !IsStringExistNoCase(strtmp,m_vtEffctExt) )
+					m_vtEffctExt.push_back(strtmp);
+			}
+		}
+	} while (strEffctExt.find(_T('|')) != TString::npos);
+}
+
+/************************************************************************/
+/*  函数:[2/19/2017 Jeff];
+/*  描述:;
+/*  参数:;
+/*  	[IN] :;
+/*  	[OUT] :;
+/*  	[IN/OUT] :;
+/*  返回:void;
+/*  注意:;
+/*  示例:;
+/*
+/*  修改:;
+/*  日期:;
+/*  内容:;
+/************************************************************************/
+void findfile::groupExt( IN CONST TString &exts, IN STR_VEC &vtExts )
+{
+	// 将所有扩展名解析到数组里;
+	INT nIndex = 0;
+	TString strtmp;
+	TString strEffctExt = exts;
+	strEffctExt.append(_T("|"));
+	do
+	{
+		nIndex = strEffctExt.find(_T('|'));
+		if (nIndex != TString::npos)
+		{
+			strtmp = strEffctExt.substr(0, nIndex);
+			strEffctExt = strEffctExt.substr(nIndex + 1);
+
+			if (strtmp.compare(_T("*.*")) && strtmp.size())
+			{
+				if ( !IsStringExistNoCase(strtmp,vtExts) )
+					vtExts.push_back(strtmp);
+			}
+		}
+	} while (strEffctExt.find(_T('|')) != TString::npos);
+}
+
+/************************************************************************/
+/*  函数:iscorrectext[2/18/2017 Jeff];
+/*  描述:判断指定的后缀串是否有效;
+/*  参数:;
+/*  	[IN] fext:输入的扩展名,fext的格式必须是:_T("*.jpg|*.jpeg|*.png|*.bmp");
+/*  	[IN] lpMistakenExt:不符合要求的扩展名;
+/*  	[IN/OUT] :;
+/*  返回:如果指定的扩展名符合要求,则返回TRUE,否则返回FALSE;
+/*  注意:
+/*       1.如果传入的扩展名包含_T("*.*"),则返回TRUE;若lpMistakenExt指针有效,记录第一次返回不符合要求的扩展名;
+/*       2.fext的格式必须是:_T("*.jpg|*.jpeg|*.png|*.bmp");
+/*  示例:;
+/*
+/*  修改:;
+/*  日期:;
+/*  内容:;
+/************************************************************************/
+BOOL findfile::iscorrectext(IN const TString &fext, OUT TString* lpMistakenExt /*= NULL*/)
+{
+	if (fext.size() == 0) return FALSE;
+	if (fext.find(_T("*.*")) != TString::npos) return TRUE;
+
+	TString ext = lowercase(fext);
+	if (ext[ext.length() - 1] != _T('|'))
+		ext.append(g_sVertical);
+
+	BOOL bret = TRUE;
+	int nIndex = 0;
+	do
+	{
+		nIndex = ext.find(_T('|'));
+		if (nIndex != TString::npos)
+		{
+			if (g_sCorrectExt.find(ext.substr(0, nIndex)) == TString::npos)
+			{
+				if (lpMistakenExt)
+					*lpMistakenExt = ext.substr(0, nIndex);
+				bret = FALSE;
+				break;
+			}
+
+			ext = ext.substr(nIndex + 1);
+		}
+	} while (ext.find(_T('|')) != TString::npos);
+
+	return bret;
+}
+
+/************************************************************************/
+/*  函数:lowercase[2/18/2017 Jeff];
+/*  描述:将指定字符串小写化;
+/*  参数:;
+/*  	[IN] Str:要转为小写的字符串;
+/*  	[OUT] :;
+/*  	[IN/OUT] :;
+/*  返回:返回转小写后的字符串;
+/*  注意:;
+/*  示例:;
+/*
+/*  修改:;
+/*  日期:;
+/*  内容:;
+/************************************************************************/
+TString findfile::lowercase(IN const TString &Str)
+{
+	TString sResult;
+	for ( TString::const_iterator it = Str.begin(); it != Str.end(); it++ )
+	{
+		if ( *it < 0 )
+		{// 小于0,含中文,什么都不做;
+			sResult.append(1, *(it++));
+			sResult.append(1, *it);
+		}
+		else
+		{
+			if (_T('A') <= *it && *it <= _T('Z'))
+				sResult.append(1, *it + 32);
+			else
+				sResult.append(1, *it);
+		}
+	}
+
+	return sResult;
+}
+
+void findfile::lowercase(IN TString& Str)
+{
+	for ( TString::iterator it = Str.begin(); it != Str.end(); it++ )
+	{
+		if ( *it < 0 )
+		{// 小于0,含中文,什么都不做;
+			it++;
+		}
+		else
+		{
+			if (_T('A') <= *it && *it <= _T('Z'))
+				*it += 32;
+		}
+	}
+}
+
+/************************************************************************/
+/*  函数:uppercase[2/18/2017 Jeff];
+/*  描述:将指定字符串大写化;
+/*  参数:;
+/*  	[IN] Str:要转为大写的字符串;
+/*  	[OUT] :;
+/*  	[IN/OUT] :;
+/*  返回:返回转大写后的字符串;
+/*  注意:;
+/*  示例:;
+/*
+/*  修改:;
+/*  日期:;
+/*  内容:;
+/************************************************************************/
+TString findfile::uppercase(IN const TString &Str)
+{
+	TString sResult;
+	for ( TString::const_iterator it = Str.begin(); it != Str.end(); it++ )
+	{
+		if ( *it < 0 )
+		{// 小于0,含中文,什么都不做;
+			sResult.append(1, *(it++));
+			sResult.append(1, *it);
+		}
+		else
+		{
+			if (_T('a') <= *it && *it <= _T('z'))
+				sResult.append(1, *it - 32);
+			else
+				sResult.append(1, *it);
+		}
+	}
+
+	return sResult;
+}
+
+void findfile::uppercase(IN TString& Str)
+{
+	for ( TString::iterator it = Str.begin(); it != Str.end(); it++ )
+	{
+		if ( *it < 0 )
+		{// 小于0,含中文,什么都不做;
+			it++;
+		}
+		else
+		{
+			if (_T('a') <= *it && *it <= _T('z'))
+				*it -= 32;
+		}
+	}
+}
+
+/************************************************************************/
+/*
+函数:match
+描述:判断指定的文件命名是否匹配指定的扩展名;
+参数:
+IN	sFileExt	扩展名;
+IN	sFile		文件名;
+返回:匹配返回非0值,否则返回0;
+注意:
+*/
+/************************************************************************/
+void findfile::setlimit(IN CONST INT &nLimit)
+{
+	if (nLimit < 1)
+		m_nlimit = nDefLimit;
+	if (nLimit < nMaxLimit)
+		m_nlimit = nLimit;
+}
+
+
+
+// 获取文件名;
+TString findfile::getfilename(IN CONST TString &file)
+{
+	TString name;
+	TString strfile = file;
+	int nIndex = strfile.find_last_of(_T('\\'));	// 如果file不包含 '\\' ,得不到文件名;
+	if (nIndex == TString::npos)
+	{
+		nIndex = strfile.find_last_of(_T('.'));
+		if ( nIndex == TString::npos )
+			return _T("");
+
+		return strfile.substr(0, nIndex);
+	}
+
+	name = strfile.substr(nIndex+1);
+	nIndex = name.find_last_of(_T('.'));
+	if (nIndex == TString::npos)
+		return _T("");
+
+	return name.substr(0, nIndex);
+}
+
+// 全部;
+void findfile::findall(IN CONST TString& folder)
+{
+	TString path = folder;
+	if (path.size() > 0 && c_pathSeparator != path[path.size() - 1])
+		path.append(s_pathSeparator);
+
+	TString file = _T("*");
+	TString s = path + file;
+
+	WIN32_FIND_DATA fileinfo = { 0 };
+	HANDLE handle = FindFirstFile(s.c_str(), &fileinfo);
+
+	if (NULL != handle && INVALID_HANDLE_VALUE != handle)
+	{
+		do
+		{
+			// 检查是否超过最大数;
+			if (checklimit()) break;
+
+			// '.'和 '..'的系统文件去除;
+			if (_T('.') != fileinfo.cFileName[0])
+			{
+				if ((FILE_ATTRIBUTE_DIRECTORY & fileinfo.dwFileAttributes) == FILE_ATTRIBUTE_DIRECTORY)	// 目录;
+				{
+					m_pvtfolders->push_back(path + fileinfo.cFileName);
+					findall(path + fileinfo.cFileName);
+				}
+				else
+				{
+					if (!checklimit())
+					{
+						m_pvtnames->push_back(fileinfo.cFileName);
+						m_pvtfiles->push_back(path + fileinfo.cFileName);
+					}
+				}
+			}
+
+		} while (FindNextFile(handle, &fileinfo));
+
+		FindClose(handle);
+	}
+}
+
+void findfile::findsubfolder(IN CONST TString& folder)	// 查找子目录;
+{
+	TString path = folder;
+	if (path.size() > 0 && c_pathSeparator != path[path.size() - 1])
+		path.append(s_pathSeparator);
+
+	TString file = _T("*");
+	TString s = path + file;
+
+	WIN32_FIND_DATA fileinfo = { 0 };
+	HANDLE handle = FindFirstFile(s.c_str(), &fileinfo);
+
+	if (NULL != handle && INVALID_HANDLE_VALUE != handle)
+	{
+		do
+		{
+			if (_T('.') != fileinfo.cFileName[0])// '.'和 '..'的系统文件去除;
+			{
+				if ((FILE_ATTRIBUTE_DIRECTORY & fileinfo.dwFileAttributes) == FILE_ATTRIBUTE_DIRECTORY)	// 目录;
+				{
+					m_pvtfolders->push_back(path + fileinfo.cFileName);
+				}
+			}
+		} while (FindNextFile(handle, &fileinfo));
+
+		FindClose(handle);
+	}
+}
+
+void findfile::findallsubfolder(IN CONST TString& folder)
+{
+	TString path = folder;
+	if (path.size() > 0 && c_pathSeparator != path[path.size() - 1])
+		path.append(s_pathSeparator);
+
+	TString file = _T("*");
+	TString s = path + file;
+
+	WIN32_FIND_DATA fileinfo = { 0 };
+	HANDLE handle = FindFirstFile(s.c_str(), &fileinfo);
+
+	if (NULL != handle && INVALID_HANDLE_VALUE != handle)
+	{
+		do
+		{
+			if (_T('.') != fileinfo.cFileName[0])// '.'和 '..'的系统文件去除;
+			{
+				if ((FILE_ATTRIBUTE_DIRECTORY & fileinfo.dwFileAttributes) == FILE_ATTRIBUTE_DIRECTORY)	// 目录;
+				{
+					m_pvtfolders->push_back(path + fileinfo.cFileName);
+					findallsubfolder(path + fileinfo.cFileName); // 不入子目录查找;
+				}
+			}
+		} while (FindNextFile(handle, &fileinfo));
+
+		FindClose(handle);
+	}
+}
+
+//////////////////////////////////////////////////////////////////////////
+void findfile::findfiles_findin_subfolder(IN CONST TString& folder)
+{
+	TString path = folder;
+	if (path.size() > 0 && c_pathSeparator != path[path.size() - 1])
+		path.append(s_pathSeparator);
+
+	TString file = _T("*");
+	TString s = path + file;
+
+	WIN32_FIND_DATA fileinfo = { 0 };
+	HANDLE handle = FindFirstFile(s.c_str(), &fileinfo);
+
+	if (NULL != handle && INVALID_HANDLE_VALUE != handle)
+	{
+		do
+		{
+			// 检查是否超过最大数;
+			if (checklimit()) break;
+
+			// '.'和 '..'的系统文件去除;
+			if (_T('.') != fileinfo.cFileName[0])
+			{
+				if ((FILE_ATTRIBUTE_DIRECTORY & fileinfo.dwFileAttributes) == FILE_ATTRIBUTE_DIRECTORY)	// 目录;
+				{
+					findfiles_findin_subfolder(path + fileinfo.cFileName);
+				}
+				else
+				{
+					if (!checklimit())
+					{
+						m_pvtfiles->push_back(path + fileinfo.cFileName);
+					}
+				}
+			}
+		} while (FindNextFile(handle, &fileinfo));
+
+		FindClose(handle);
+	}
+}
+
+void findfile::findfiles_findout_subfolder(IN CONST TString& folder)
+{
+	TString path = folder;
+	if (path.size() > 0 && c_pathSeparator != path[path.size() - 1])
+		path.append(s_pathSeparator);
+
+	TString file = _T("*");
+	TString s = path + file;
+
+	WIN32_FIND_DATA fileinfo = { 0 };
+	HANDLE handle = FindFirstFile(s.c_str(), &fileinfo);
+
+	if (NULL != handle && INVALID_HANDLE_VALUE != handle)
+	{
+		do
+		{
+			// 检查是否超过最大数;
+			if (checklimit()) break;
+
+			// '.'和 '..'的系统文件去除;
+			if (_T('.') != fileinfo.cFileName[0])
+			{
+				if ((FILE_ATTRIBUTE_DIRECTORY & fileinfo.dwFileAttributes) != FILE_ATTRIBUTE_DIRECTORY)	// 目录;
+				{
+					if (!checklimit())
+					{
+						m_pvtfiles->push_back(path + fileinfo.cFileName);
+					}
+				}
+			}
+		} while (FindNextFile(handle, &fileinfo));
+
+		FindClose(handle);
+	}
+}
+
+void findfile::findfiles_within_subfolder(IN CONST TString& folder)
+{
+	TString path = folder;
+	if (path.size() > 0 && c_pathSeparator != path[path.size() - 1])
+		path.append(s_pathSeparator);
+
+	TString file = _T("*");
+	TString s = path + file;
+
+	WIN32_FIND_DATA fileinfo = { 0 };
+	HANDLE handle = FindFirstFile(s.c_str(), &fileinfo);
+
+	if (NULL != handle && INVALID_HANDLE_VALUE != handle)
+	{
+		do
+		{
+			// 检查是否超过最大数;
+			if (checklimit()) break;
+
+			// '.'和 '..'的系统文件去除;
+			if (_T('.') != fileinfo.cFileName[0])
+			{
+				if ((FILE_ATTRIBUTE_DIRECTORY & fileinfo.dwFileAttributes) == FILE_ATTRIBUTE_DIRECTORY)	// 目录;
+				{
+					m_pvtfolders->push_back(path + fileinfo.cFileName);
+					findfiles_within_subfolder(path + fileinfo.cFileName);
+				}
+				else
+				{
+					if (!checklimit())
+					{
+						m_pvtfiles->push_back(path + fileinfo.cFileName);
+					}
+				}
+			}
+		} while (FindNextFile(handle, &fileinfo));
+
+		FindClose(handle);
+	}
+}
+
+//////////////////////////////////////////////////////////////////////////
+void findfile::findnames_findin_subfolder(IN CONST TString& folder)
+{
+	TString path = folder;
+	if (path.size() > 0 && c_pathSeparator != path[path.size() - 1])
+		path.append(s_pathSeparator);
+
+	TString file = _T("*");
+	TString s = path + file;
+
+	WIN32_FIND_DATA fileinfo = { 0 };
+	HANDLE handle = FindFirstFile(s.c_str(), &fileinfo);
+
+	if (NULL != handle && INVALID_HANDLE_VALUE != handle)
+	{
+		do
+		{
+			// 检查是否超过最大数;
+			if (checklimit()) break;
+
+			// '.'和 '..'的系统文件去除;
+			if (_T('.') != fileinfo.cFileName[0])
+			{
+				if ((FILE_ATTRIBUTE_DIRECTORY & fileinfo.dwFileAttributes) == FILE_ATTRIBUTE_DIRECTORY)	// 目录;
+				{
+					findnames_findin_subfolder(path + fileinfo.cFileName);
+				}
+				else
+				{
+					if (!checklimit() )
+					{
+						m_pvtnames->push_back(fileinfo.cFileName);
+					}
+				}
+			}
+		} while (FindNextFile(handle, &fileinfo));
+
+		FindClose(handle);
+	}
+}
+
+void findfile::findnames_findout_subfolder(IN CONST TString& folder)
+{
+	TString path = folder;
+	if (path.size() > 0 && c_pathSeparator != path[path.size() - 1])
+		path.append(s_pathSeparator);
+
+	TString file = _T("*");
+	TString s = path + file;
+
+	WIN32_FIND_DATA fileinfo = { 0 };
+	HANDLE handle = FindFirstFile(s.c_str(), &fileinfo);
+
+	if (NULL != handle && INVALID_HANDLE_VALUE != handle)
+	{
+		do
+		{
+			// 检查是否超过最大数;
+			if (checklimit()) break;
+
+			// '.'和 '..'的系统文件去除;
+			if (_T('.') != fileinfo.cFileName[0])
+			{
+				if ((FILE_ATTRIBUTE_DIRECTORY & fileinfo.dwFileAttributes) != FILE_ATTRIBUTE_DIRECTORY)	// 目录;
+				{
+					if (!checklimit())
+					{
+						m_pvtnames->push_back(fileinfo.cFileName);
+					}
+				}
+			}
+		} while (FindNextFile(handle, &fileinfo));
+
+		FindClose(handle);
+	}
+}
+
+void findfile::findnames_within_subfolder(IN CONST TString& folder)
+{
+	TString path = folder;
+	if (path.size() > 0 && c_pathSeparator != path[path.size() - 1])
+		path.append(s_pathSeparator);
+
+	TString file = _T("*");
+	TString s = path + file;
+
+	WIN32_FIND_DATA fileinfo = { 0 };
+	HANDLE handle = FindFirstFile(s.c_str(), &fileinfo);
+
+	if (NULL != handle && INVALID_HANDLE_VALUE != handle)
+	{
+		do
+		{
+			// 检查是否超过最大数;
+			if (checklimit()) break;
+
+			// '.'和 '..'的系统文件去除;
+			if (_T('.') != fileinfo.cFileName[0])
+			{
+				if ((FILE_ATTRIBUTE_DIRECTORY & fileinfo.dwFileAttributes) == FILE_ATTRIBUTE_DIRECTORY)	// 目录;
+				{
+					m_pvtfolders->push_back(path + fileinfo.cFileName);
+					findnames_within_subfolder(path + fileinfo.cFileName);
+				}
+				else
+				{
+					if (!checklimit())
+					{
+						m_pvtnames->push_back(fileinfo.cFileName);
+					}
+				}
+			}
+		} while (FindNextFile(handle, &fileinfo));
+
+		FindClose(handle);
+	}
+}
+
+//////////////////////////////////////////////////////////////////////////
+void findfile::findfilesnames_findin_subfolder(IN CONST TString& folder)
+{
+	TString path = folder;
+	if (path.size() > 0 && c_pathSeparator != path[path.size() - 1])
+		path.append(s_pathSeparator);
+
+	TString file = _T("*");
+	TString s = path + file;
+
+	WIN32_FIND_DATA fileinfo = { 0 };
+	HANDLE handle = FindFirstFile(s.c_str(), &fileinfo);
+
+	if (NULL != handle && INVALID_HANDLE_VALUE != handle)
+	{
+		do
+		{
+			// 检查是否超过最大数;
+			if (checklimit()) break;
+
+			// '.'和 '..'的系统文件去除;
+			if (_T('.') != fileinfo.cFileName[0])
+			{
+				if ((FILE_ATTRIBUTE_DIRECTORY & fileinfo.dwFileAttributes) == FILE_ATTRIBUTE_DIRECTORY)	// 目录;
+				{
+					findfilesnames_findin_subfolder(path + fileinfo.cFileName);
+				}
+				else
+				{
+					if (!checklimit() )
+					{
+						m_pvtnames->push_back(fileinfo.cFileName);
+						m_pvtfiles->push_back(path + fileinfo.cFileName);
+					}
+				}
+			}
+		} while (FindNextFile(handle, &fileinfo));
+
+		FindClose(handle);
+	}
+}
+
+void findfile::findfilesnames_findout_subfolder(IN CONST TString& folder)
+{
+	TString path = folder;
+	if (path.size() > 0 && c_pathSeparator != path[path.size() - 1])
+		path.append(s_pathSeparator);
+
+	TString file = _T("*");
+	TString s = path + file;
+
+	WIN32_FIND_DATA fileinfo = { 0 };
+	HANDLE handle = FindFirstFile(s.c_str(), &fileinfo);
+
+	if (NULL != handle && INVALID_HANDLE_VALUE != handle)
+	{
+		do
+		{
+			// 检查是否超过最大数;
+			if (checklimit()) break;
+
+			// '.'和 '..'的系统文件去除;
+			if (_T('.') != fileinfo.cFileName[0])
+			{
+				if ((FILE_ATTRIBUTE_DIRECTORY & fileinfo.dwFileAttributes) != FILE_ATTRIBUTE_DIRECTORY)	// 目录;
+				{
+					if (!checklimit() )
+					{
+						m_pvtnames->push_back(fileinfo.cFileName);
+						m_pvtfiles->push_back(path + fileinfo.cFileName);
+					}
+				}
+			}
+
+		} while (FindNextFile(handle, &fileinfo));
+
+		FindClose(handle);
+	}
+}
+
+void findfile::findfilesnames_within_subfolder(IN CONST TString& folder)
+{
+	TString path = folder;
+	if (path.size() > 0 && c_pathSeparator != path[path.size() - 1])
+		path.append(s_pathSeparator);
+
+	TString file = _T("*");
+	TString s = path + file;
+
+	WIN32_FIND_DATA fileinfo = { 0 };
+	HANDLE handle = FindFirstFile(s.c_str(), &fileinfo);
+
+	if (NULL != handle && INVALID_HANDLE_VALUE != handle)
+	{
+		do
+		{
+			// 检查是否超过最大数;
+			if (checklimit()) break;
+
+			// '.'和 '..'的系统文件去除;
+			if (_T('.') != fileinfo.cFileName[0])
+			{
+				if ((FILE_ATTRIBUTE_DIRECTORY & fileinfo.dwFileAttributes) == FILE_ATTRIBUTE_DIRECTORY)	// 目录;
+				{
+					m_pvtfolders->push_back(path + fileinfo.cFileName);
+					findfilesnames_within_subfolder(path + fileinfo.cFileName);
+				}
+				else
+				{
+					if (!checklimit() )
+					{
+						m_pvtnames->push_back(fileinfo.cFileName);
+						m_pvtfiles->push_back(path + fileinfo.cFileName);
+					}
+				}
+			}
+
+		} while (FindNextFile(handle, &fileinfo));
+
+		FindClose(handle);
+	}
+}

+ 110 - 0
ThresholdTools/ThresholdTools/findfile.h

@@ -0,0 +1,110 @@
+/************************************************************************/
+/*  Copyright (C), 2016-2020, [IT], 保留所有权利;
+/*  模 块 名:;
+/*  描    述:;
+/*
+/*  版    本:[V];	
+/*  作    者:[IT];
+/*  日    期:[12/22/2016];
+/*
+/*
+/*  注    意:;
+/*
+/*  修改记录:[IT];
+/*  修改日期:;
+/*  修改版本:;
+/*  修改内容:;
+/************************************************************************/
+#ifndef __FIND_FILE_20151003__
+#define __FIND_FILE_20151003__
+
+#include <string>
+#include <vector>
+using namespace std;
+
+#ifndef _UNICODE
+typedef string TString;
+#else
+typedef wstring TString;
+#endif
+
+typedef vector<TString> STR_VEC;
+
+#pragma once
+
+class findfile
+{
+public:
+	findfile(void);
+	virtual ~findfile(void);
+
+//protected:
+public:
+	INT m_nlimit;
+	STR_VEC m_vtEffctExt;
+	STR_VEC *m_pvtfiles;
+	STR_VEC *m_pvtnames;
+	STR_VEC *m_pvtfolders;
+
+	STR_VEC *m_pvtfiles_sth;	// s小图;
+	STR_VEC *m_pvtfiles_mth;	// m小图;	
+public:
+	static BOOL iscorrectext(IN const TString &fext, OUT TString* lpMistakenExt = NULL);
+	// lowercase和uppercase在多字节下生僻字会出问题(珺、琤,珺转小写会变成琤,反过来琤转大写会变成珺);已修改;
+	static TString lowercase(IN const TString &Str);
+	static void lowercase(IN TString& str);
+	static TString uppercase(IN const TString &Str);
+	static void uppercase(IN TString& str);
+	//static int match(IN CONST TString &sExt, IN CONST TString &sFile);
+	static inline int findfile::match(IN CONST TString &strExt, IN CONST TString &strfile)
+	{
+		int pos = strfile.find_last_of(_T('.'));
+		if (TString::npos != pos)
+			return !_tcsicmp(strExt.c_str(), strfile.substr(pos).c_str());
+
+		return FALSE;
+	}
+	
+	static TString getfilename(IN CONST TString &file);
+protected:
+	INT  getlimit() const { return m_nlimit; }
+	void setlimit(IN CONST INT &nlimit);
+
+	void groupExt();
+	void groupExt( IN CONST TString &exts, IN STR_VEC &vtExts );
+
+	inline INT checklimit() { return m_pvtfiles->size() == getlimit(); }
+
+	BOOL IsaDirectory(CONST TString &sDirectory) { return (FILE_ATTRIBUTE_DIRECTORY == GetFileAttributes(sDirectory.c_str())); }
+
+public:
+	// 查找所有文件,包括子文件夹名、文件名、文件路径;
+	void findall(IN CONST TString& folder);
+	// 只返回2级子目录名(测试ok);
+	void findsubfolder(IN CONST TString& folder);
+	// 只返回所有子目录名(测试ok);
+	void findallsubfolder(IN CONST TString& folder);
+
+	// 查找文件路径,以及查找子目录的文件路径,但不获取子目录名(测试ok);
+	void findfiles_findin_subfolder(IN CONST TString& folder);
+	// 查找文件路径,不查找子目录的文件(测试ok);
+	void findfiles_findout_subfolder(IN CONST TString& folder);
+	// 查找文件路径,以及查找子目录的文件路径,同时获取子目录名(测试ok);
+	void findfiles_within_subfolder(IN CONST TString& folder);
+
+	// 查找文件名称,以及查找子目录的文件名称,但不获取子目录名(返回的文件包含扩展名)(测试ok);
+	void findnames_findin_subfolder(IN CONST TString& folder);
+	// 查找文件名称,不查找子目录的文件(返回的文件包含扩展名)(测试ok);
+	void findnames_findout_subfolder(IN CONST TString& folder);
+	// 查找文件名称,以及查找子目录的文件名称,同时获取子目录名(返回的文件包含扩展名)(测试ok);
+	void findnames_within_subfolder(IN CONST TString& folder);
+
+	// 查找文件路径和文件名,以及查找子目录的文件路径和文件名,但不获取子目录名;(返回的文件包含扩展名)(测试ok);
+	void findfilesnames_findin_subfolder(IN CONST TString& folder);
+	// 查找文件路径和文件名,不查找子目录;(返回的文件包含扩展名)(测试ok);
+	void findfilesnames_findout_subfolder(IN CONST TString& folder);
+	// 查找文件路径和文件名,以及查找子目录的文件路径和文件名,且获取子目录名;(返回的文件包含扩展名)(测试ok);
+	void findfilesnames_within_subfolder(IN CONST TString& folder);
+};
+
+#endif