亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? sadirread.cpp

?? 一個(gè)windows ce上的notepad
?? CPP
字號(hào):
/*********************************************************************

   SADirRead

   Copyright (C) 2002 Smaller Animals Software, Inc.

   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   arising from the use of this software.

   Permission is granted to anyone to use this software for any purpose,
   including commercial applications, and to alter it and redistribute it
   freely, subject to the following restrictions:

   1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.

   2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.

   3. This notice may not be removed or altered from any source distribution.

   http://www.smalleranimals.com
   smallest@smalleranimals.com

**********************************************************************/

// SADirRead.cpp: implementation of the CSADirRead class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
//#include "Dir.h"
#include "SADirRead.h"
//#include <io.h>
//#include <errno.h>
//#include <sys/types.h>
//#include <sys/stat.h>

#include <algorithm>

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

// some helper functions we'll use here
bool asc_alpha_dir_sort(const CSADirRead::CSADirEntry &a, const CSADirRead::CSADirEntry &b);
bool asc_date_file_sort(const CSADirRead::CSAFileEntry &a, const CSADirRead::CSAFileEntry &b);
bool asc_size_file_sort(const CSADirRead::CSAFileEntry &a, const CSADirRead::CSAFileEntry &b);
bool asc_alpha_file_sort(const CSADirRead::CSAFileEntry &a, const CSADirRead::CSAFileEntry &b);
bool dsc_date_file_sort(const CSADirRead::CSAFileEntry &a, const CSADirRead::CSAFileEntry &b);
bool dsc_size_file_sort(const CSADirRead::CSAFileEntry &a, const CSADirRead::CSAFileEntry &b);
bool dsc_alpha_file_sort(const CSADirRead::CSAFileEntry &a, const CSADirRead::CSAFileEntry &b);

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CSADirRead::CSADirRead()
{
}

//////////////////////////////////////////////////////////////////////

CSADirRead::~CSADirRead()
{

}

//////////////////////////////////////////////////////////////////////

bool CSADirRead::GetDirs(const TCHAR * pDirPath, bool bRecurse)
{
	m_sSourceDir = pDirPath;

	FormatPath(m_sSourceDir);

	// find tree starting from pDirPath
	if (bRecurse)
	{
		GetSubDirs(m_dirs, m_sSourceDir);
	}

	// add the main directory. 
	m_dirs.push_back(CSADirEntry(m_sSourceDir));

	return true;	
}

//////////////////////////////////////////////////////////////////////

bool CSADirRead::GetSubDirs(vector<CSADirRead::CSADirEntry> &dir_array, const CString &path)
{
	CString newPath;

	CString searchString;
	searchString = path;
	searchString+= "\\*.*";

   try 
   {
#ifndef USE_WIN32_FINDFILE
      struct _finddata_t  c_file;
      long fhandle;

      if ((fhandle=_findfirst( searchString, &c_file ))!=-1) 
      {
         // we only care about subdirs
         if ((c_file.attrib & _A_SUBDIR)==_A_SUBDIR) 
         {
            // add c_file.name to the string array
            
            // we'll handle parents on our own
            if ((strcmp(c_file.name, ".")!=0) && (strcmp(c_file.name, "..")!=0)) 
            {
               newPath = path;
               newPath+= "\\";
               newPath+= c_file.name;
               GetSubDirs(dir_array, newPath);
               
               dir_array.push_back(newPath);
            }
         }
         
         // find the rest of them	
         while(_findnext( fhandle, &c_file ) == 0 ) 
         {
            
            if ((c_file.attrib & _A_SUBDIR)==_A_SUBDIR) 
            {
               // we'll handle parents on our own
               if ((strcmp(c_file.name, ".")!=0) && (strcmp(c_file.name, "..")!=0)) 
               {
                  newPath = path;
                  newPath+= "\\";
                  newPath+= c_file.name;
                  GetSubDirs(dir_array, newPath);
                  dir_array.push_back(newPath);
               }
            }
         }
         _findclose(fhandle);
      }
#else
      WIN32_FIND_DATA FindFileData;
      HANDLE hFind;
      if ((hFind = FindFirstFile(searchString, &FindFileData))!=INVALID_HANDLE_VALUE)
      {
         // we only care about files, not subdirs
         if ((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)==FILE_ATTRIBUTE_DIRECTORY) 
         {
            // we'll handle parents on our own
            if ((wcscmp(FindFileData.cFileName, _T("."))!=0) && (wcscmp(FindFileData.cFileName, _T(".."))!=0)) 
            {
               newPath = path;
               newPath+= _T("\\");
               newPath+=FindFileData.cFileName;
               GetSubDirs(dir_array, newPath);
               
               dir_array.push_back(newPath);
            }
         }
         
         // find the rest of them	
         while(FindNextFile( hFind, &FindFileData )) 
         {
            // we only care about files, not subdirs
            if ((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)==FILE_ATTRIBUTE_DIRECTORY) 
            {
               // we'll handle parents on our own
               if ((wcscmp(FindFileData.cFileName, _T("."))!=0) && (wcscmp(FindFileData.cFileName, _T(".."))!=0)) 
               {
                  newPath = path;
                  newPath+= _T("\\");
                  newPath+=FindFileData.cFileName;
                  GetSubDirs(dir_array, newPath);
                  
                  dir_array.push_back(newPath);
               }
               
            }
         }
      }
      FindClose(hFind);
#endif
   } 
   catch (...) 
   {
      return false;
   }
   
   return true;
}

//////////////////////////////////////////////////////////////////////

bool CSADirRead::ClearFiles()
{
   m_files.clear();
	return true;
}

//////////////////////////////////////////////////////////////////////

bool CSADirRead::ClearDirs()
{
	m_dirs.clear();
	return true;
}

//////////////////////////////////////////////////////////////////////

bool CSADirRead::GetFiles(const TCHAR *pFilemask, bool bIncludeFilesInFileList, bool bIncludeFoldersInFileList)
{
	// get the files in each of our directories
	for (vector<CSADirEntry>::iterator it = m_dirs.begin();it!=m_dirs.end(); it++) 
	{
		CString curDir = (*it).m_sName;

      // sanity check
		if (curDir.IsEmpty())
		{
			continue;
		}
		
		if (!FindFiles(curDir, pFilemask, bIncludeFilesInFileList, bIncludeFoldersInFileList))
		{
			return false;
		}
	}

	return true;
}	

//////////////////////////////////////////////////////////////////////

bool CSADirRead::SortFiles(int iSortStyle, bool bReverse)
{
	switch (iSortStyle)
	{
	default:
		break;
	case eSortAlpha:
		std::sort(m_files.begin(), m_files.end(), (bReverse ? dsc_alpha_file_sort : asc_alpha_file_sort));
		break;
	case eSortWriteDate:
		std::sort(m_files.begin(), m_files.end(), (bReverse ? dsc_date_file_sort : asc_date_file_sort));
		break;
	case eSortSize:
		std::sort(m_files.begin(), m_files.end(), (bReverse ? dsc_size_file_sort : asc_size_file_sort));
		break;
	}

	return true;
}

//////////////////////////////////////////////////////////////////////

// chop off trailing "\"
void CSADirRead::FormatPath(CString &path)
{
	CString inPath = path;
	inPath.TrimRight();
	CString tmp;
	
	int iLastSlashPos = inPath.ReverseFind('\\');
	if (iLastSlashPos == -1)
	{
		iLastSlashPos = inPath.ReverseFind('/');
	}
	
	if (iLastSlashPos!=-1) 
	{
		if (iLastSlashPos==inPath.GetLength()-1) 
		{
			path = inPath.Left(iLastSlashPos);

			FormatPath(path); // in case the incoming path is "C:\temp\\\..."
		}
	} 
}

//////////////////////////////////////////////////////////////////////

UINT CSADirRead::FindFiles(const CString & dir, const CString & filter, bool bIncludeFilesInFileList, bool bIncludeFoldersInFileList)
{
	// make sure the path ends in a single "\"
	CString baseName = dir;
	FormatPath(baseName);
	baseName+='\\';

	CString fullPath = baseName;
	fullPath += filter;

	CString fileName;

	// find first file in current directory
#ifndef USE_WIN32_FINDFILE
	struct _finddata_t  c_file;
	long fhandle;

	try 
	{
		if ((fhandle=_findfirst( fullPath, &c_file ))!=-1) 
		{
         bool bIsFolder = (c_file.attrib & _A_SUBDIR)==_A_SUBDIR;

         bool bAddThisOne = (bIsFolder && bIncludeFoldersInFileList) || (!bIsFolder && bIncludeFilesInFileList);

         // skip . and ..
         if (bIsFolder && (strcmp(c_file.name, ".")==0) || (strcmp(c_file.name, "..")==0))
         {
            bAddThisOne = false;
         }

         if (bAddThisOne) 
			{
				fileName = baseName;
				fileName += c_file.name;

				CSAFileEntry t;
            t.bIsFolder = bIsFolder;
            t.attrib = c_file.attrib;
				t.m_sName = fileName;
				t.time_write = c_file.time_write;
				t.time_create = c_file.time_create;
            t.size = c_file.size;
				m_files.push_back(t);
			}

			// find the rest of them	
			while(_findnext( fhandle, &c_file ) == 0 ) 
			{
            bool bIsFolder = (c_file.attrib & _A_SUBDIR)==_A_SUBDIR;
            bool bAddThisOne = (bIsFolder && bIncludeFoldersInFileList) || (!bIsFolder && bIncludeFilesInFileList);

            // skip . and ..
            if (bIsFolder && (strcmp(c_file.name, ".")==0) || (strcmp(c_file.name, "..")==0))
            {
               bAddThisOne = false;
            }

			   if (bAddThisOne) 
				{
					fileName=baseName;
					fileName += c_file.name;

					CSAFileEntry t;
               t.bIsFolder = bIsFolder;
               t.attrib = c_file.attrib;
					t.m_sName = fileName;
					t.time_write = c_file.time_write;
					t.time_create = c_file.time_create;
               t.size = c_file.size;
					m_files.push_back(t);
				}
			}
			_findclose(fhandle);
		}
	} 
	catch (...) 
	{
		return false;
	}
#else
   WIN32_FIND_DATA FindFileData;
   HANDLE hFind;
	try 
	{
		if ((hFind = FindFirstFile(fullPath, &FindFileData))!=INVALID_HANDLE_VALUE)
		{
         bool bIsFolder = (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)==FILE_ATTRIBUTE_DIRECTORY;

         bool bAddThisOne = (bIsFolder && bIncludeFoldersInFileList) || ((!bIsFolder) && bIncludeFilesInFileList);

         // skip . and ..
         if (bIsFolder && (wcscmp(FindFileData.cFileName, _T("."))==0) || (wcscmp(FindFileData.cFileName, _T(".."))==0))
         {
            bAddThisOne = false;
         }

			if (bAddThisOne) 
         {
				fileName = baseName;
				fileName += FindFileData.cFileName;

				CSAFileEntry t;
				t.m_sName = fileName;

            t.bIsFolder = bIsFolder;
            t.attrib = FindFileData.dwFileAttributes;

            ASSERT(sizeof(FindFileData.ftLastWriteTime)== sizeof(_FILETIME));
				memcpy(&t.time_write, &FindFileData.ftLastWriteTime, sizeof(_FILETIME));
				
            ASSERT(sizeof(FindFileData.ftLastWriteTime)== sizeof(_FILETIME));
				memcpy(&t.time_create, &FindFileData.ftCreationTime, sizeof(_FILETIME));

            t.size = ((unsigned __int64)FindFileData.nFileSizeHigh * ((unsigned __int64)MAXDWORD+1)) + (unsigned __int64)FindFileData.nFileSizeLow;
				m_files.push_back(t);
			}

			// find the rest of them	
			while (FindNextFile(hFind, &FindFileData))
			{
            bool bIsFolder = (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)==FILE_ATTRIBUTE_DIRECTORY;

            bool bAddThisOne = (bIsFolder && bIncludeFoldersInFileList) || ((!bIsFolder) && bIncludeFilesInFileList);

            // skip . and ..
            if (bIsFolder && (wcscmp(FindFileData.cFileName, _T("."))==0) || (wcscmp(FindFileData.cFileName, _T(".."))==0))
            {
               bAddThisOne = false;
            }

			   if (bAddThisOne) 
			   {
				   fileName = baseName;
				   fileName += FindFileData.cFileName;

				   CSAFileEntry t;
				   t.m_sName = fileName;
               
               t.bIsFolder = bIsFolder;
               t.attrib = FindFileData.dwFileAttributes;

               ASSERT(sizeof(FindFileData.ftLastWriteTime)== sizeof(_FILETIME));
				   memcpy(&t.time_write, &FindFileData.ftLastWriteTime, sizeof(_FILETIME));
				   
               ASSERT(sizeof(FindFileData.ftLastWriteTime)== sizeof(_FILETIME));
				   memcpy(&t.time_create, &FindFileData.ftCreationTime, sizeof(_FILETIME));

               t.size = ((unsigned __int64)FindFileData.nFileSizeHigh * ((unsigned __int64)MAXDWORD+1)) + (unsigned __int64)FindFileData.nFileSizeLow;
				   m_files.push_back(t);
			   }
			}
			FindClose(hFind);
		}
	} 
	catch (...) 
	{
		return false;
	}
#endif

	return true;
}

//////////////////////////////////////////////////////////////////////

bool asc_alpha_dir_sort(const CSADirRead::CSADirEntry &a, const CSADirRead::CSADirEntry &b)
{
	return (wcsicmp(a.m_sName, b.m_sName) < 0);
}

//////////////////////////////////////////////////////////////////////

bool asc_alpha_file_sort(const CSADirRead::CSAFileEntry &a, const CSADirRead::CSAFileEntry &b)
{
	return (wcsicmp(a.m_sName, b.m_sName) < 0);
}

//////////////////////////////////////////////////////////////////////

bool asc_date_file_sort(const CSADirRead::CSAFileEntry &a, const CSADirRead::CSAFileEntry &b)
{
#ifndef USE_WIN32_FINDFILE
	return (difftime(a.time_write, b.time_write) < 0);
#else
   return (a.time_write < b.time_write);
#endif
}

//////////////////////////////////////////////////////////////////////

bool asc_size_file_sort(const CSADirRead::CSAFileEntry &a, const CSADirRead::CSAFileEntry &b)
{
	return (a.size < b.size);
}

//////////////////////////////////////////////////////////////////////

bool dsc_alpha_file_sort(const CSADirRead::CSAFileEntry &a, const CSADirRead::CSAFileEntry &b)
{
	return (!asc_alpha_file_sort(a,b));
}

//////////////////////////////////////////////////////////////////////

bool dsc_date_file_sort(const CSADirRead::CSAFileEntry &a, const CSADirRead::CSAFileEntry &b)
{
	return (!asc_date_file_sort(a,b));
}

//////////////////////////////////////////////////////////////////////

bool dsc_size_file_sort(const CSADirRead::CSAFileEntry &a, const CSADirRead::CSAFileEntry &b)
{
	return (!asc_size_file_sort(a,b));
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费国产亚洲视频| 成人av在线影院| 一个色妞综合视频在线观看| 久久久久久麻豆| 777亚洲妇女| 一本一道综合狠狠老| 国产资源在线一区| 男女男精品视频| 亚洲视频一二三| 中文字幕免费观看一区| 欧美mv和日韩mv的网站| 日韩你懂的在线播放| 日韩欧美高清在线| 日韩美女主播在线视频一区二区三区 | 中文字幕电影一区| 中文字幕免费一区| 综合久久给合久久狠狠狠97色 | 大尺度一区二区| 久久国产日韩欧美精品| 日韩精品国产欧美| 亚洲精品福利视频网站| 自拍偷拍亚洲欧美日韩| 国产日韩精品一区| 国产偷国产偷精品高清尤物| 久久精品免视看| 国产三级精品视频| 国产精品免费久久久久| 国产精品美女久久久久久| 国产精品久久久久久亚洲毛片| 国产午夜精品一区二区三区嫩草 | 亚洲美女视频在线观看| 日韩精彩视频在线观看| 蜜臀久久久久久久| 久久成人综合网| 国产91丝袜在线18| 91首页免费视频| 91香蕉视频mp4| 欧美影视一区在线| 欧美妇女性影城| 欧美一区二区私人影院日本| 欧美大尺度电影在线| 国产精品美女一区二区| 一区二区三区加勒比av| 国产精品亚洲视频| 欧美日韩视频在线第一区| 欧美xxxxxxxxx| 一区二区三区久久| 国产真实乱子伦精品视频| 91女人视频在线观看| 日韩欧美国产麻豆| 亚洲男人的天堂av| 国产精品一区免费视频| 欧美在线观看18| 久久看人人爽人人| 亚洲 欧美综合在线网络| 精品中文字幕一区二区小辣椒| 美国一区二区三区在线播放| caoporn国产精品| 26uuu欧美| 麻豆国产欧美一区二区三区| 99久久久无码国产精品| 日韩三级在线观看| 国产精品传媒在线| 日韩高清欧美激情| 在线欧美日韩精品| 久久先锋影音av| 国产成人无遮挡在线视频| 久久亚洲一区二区三区明星换脸 | 国产经典欧美精品| 亚洲一区二区av电影| 成人激情动漫在线观看| 日本一区二区免费在线| 日本91福利区| 3751色影院一区二区三区| 亚洲夂夂婷婷色拍ww47| 色综合天天综合网国产成人综合天| 精品少妇一区二区三区日产乱码 | 国产人妖乱国产精品人妖| 国产一区999| 国产精品美女一区二区三区| 91精品国产麻豆| 九九九久久久精品| 国产精品久线观看视频| 色婷婷久久久综合中文字幕| 日韩一区有码在线| av综合在线播放| 亚洲午夜久久久久中文字幕久| 在线观看91精品国产麻豆| 久热成人在线视频| 国产精品人人做人人爽人人添| 91麻豆免费观看| 男男gaygay亚洲| 国产精品妹子av| 69av一区二区三区| 成人精品国产一区二区4080| 亚洲一区自拍偷拍| 欧美电影免费观看完整版| 国产成都精品91一区二区三| 成人免费在线视频| 日韩精品一区二区三区在线| 色综合久久中文综合久久牛| 精品一区二区三区日韩| 性感美女久久精品| 一色桃子久久精品亚洲| 日韩精品一区二区三区中文不卡 | 欧美亚洲免费在线一区| 另类小说色综合网站| 一区二区三区欧美日韩| 欧美mv日韩mv国产| 51精品秘密在线观看| 在线观看视频一区二区欧美日韩| 国产精品综合一区二区| 亚洲成人你懂的| 日韩久久一区二区| 国产精品另类一区| 精品成人免费观看| 日韩视频永久免费| 欧美日本在线视频| 在线视频国内自拍亚洲视频| 国产在线看一区| 狠狠网亚洲精品| 国产精品一区二区在线播放| 国产高清精品在线| 成年人国产精品| 国产一区二区在线电影| 久久国产夜色精品鲁鲁99| 亚洲成人精品在线观看| 天堂成人国产精品一区| 亚洲自拍与偷拍| 亚洲一区二区五区| 亚洲一区av在线| 亚洲综合清纯丝袜自拍| 日日夜夜免费精品视频| 日本 国产 欧美色综合| 免费看黄色91| 国产河南妇女毛片精品久久久 | 最近中文字幕一区二区三区| 国产精品麻豆一区二区| 亚洲精品水蜜桃| 香蕉av福利精品导航 | 亚洲大片在线观看| 精品一区二区三区在线观看国产| 国产一区二区看久久| gogo大胆日本视频一区| 在线免费一区三区| 精品国产精品网麻豆系列| 中文字幕五月欧美| 亚洲综合偷拍欧美一区色| 麻豆91免费观看| a4yy欧美一区二区三区| 日韩欧美国产精品| 亚洲国产精品ⅴa在线观看| 亚洲综合无码一区二区| 国产91丝袜在线观看| 欧美日韩国产小视频在线观看| 国产亚洲欧洲997久久综合| 5858s免费视频成人| 国产婷婷一区二区| 三级亚洲高清视频| 99久久国产综合色|国产精品| 这里只有精品视频在线观看| 国产精品不卡一区| 国产一区二区三区四区五区美女| 一本到高清视频免费精品| 国产亚洲精久久久久久| 日本va欧美va瓶| 欧美精品丝袜中出| 悠悠色在线精品| 99国产精品久久久久久久久久久| 久久久亚洲国产美女国产盗摄| 视频一区视频二区中文| 在线日韩国产精品| 亚洲伊人色欲综合网| 色播五月激情综合网| 亚洲小少妇裸体bbw| 欧美影片第一页| 亚洲国产日韩一区二区| 欧美日韩精品一区视频| 亚洲成人动漫在线观看| 欧美日韩国产经典色站一区二区三区 | 国产成人aaaa| 亚洲欧美日韩综合aⅴ视频| 一本大道久久精品懂色aⅴ| 亚洲裸体xxx| 欧美日韩中文精品| 日韩专区中文字幕一区二区| 日韩视频免费观看高清完整版 | 99久久er热在这里只有精品66| 国产精品第13页| 欧美日韩美少妇| 久久精品国产一区二区三区免费看| 日韩欧美成人激情| 国产精品一区一区| 一区二区三区在线不卡| 欧美成人一区二区三区在线观看| 色噜噜狠狠一区二区三区果冻| 国产成人精品www牛牛影视| 久久国产欧美日韩精品| 日韩福利视频网| 爽好久久久欧美精品|