⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eccfileproperties.h

📁 vc++实现的ecc加密算法
💻 H
字号:
/* ==========================================================================

	Ecc - Erik's Code Collection
	Copyright (C) 2003 - Erik Dienske

	This file is part of Ecc.

	Ecc is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	Ecc is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with Ecc; if not, write to the Free Software Foundation, Inc.,
	59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
	
===========================================================================*/

//---------------------------------------------------------------------------
#ifndef EccFilePropertiesH
#define EccFilePropertiesH
//---------------------------------------------------------------------------

//===========================================================================
namespace ecc {
//===========================================================================

//---------------------------------------------------------------------------
/* TODO : This class does not handle directories, yet */

/* 	TFileProperties provides easy access to attributes, size and dates of a file.

	Example:
	{
	TFileProperties fp("c:\\file.txt");
	if (fp.HasError()) return;
	ShowMessage(
	"a:" + IntToStr(fp.IsArchive()) +
	" h:" + IntToStr(fp.IsHidden()) +
	" r:" + IntToStr(fp.IsReadOnly()) +
	" s:" + IntToStr(fp.IsSystem())
	);
	ShowMessage( fp.GetLastWriteTime().DateTimeString()	);

	}
*/
//---------------------------------------------------------------------------

class TFileProperties {

private:
	bool FInitialized;	// Is false if class properties contain no valid data.
	bool FError;
	String FErrorMessage;

	String FName;
	HANDLE FHandle;

	bool FArchive;
	bool FCompressed;
	bool FHidden;
	bool FReadOnly;
	bool FSystem;
	bool FTemporary;
	bool FDir;
	DWORD FdwFileAttributes;

	unsigned long FSize;

	TDateTime FCreationTime;    // Created
	TDateTime FLastAccessTime;  // Accessed
	TDateTime FLastWriteTime;	// Modified

	void SetFileAttributes(const WIN32_FIND_DATA &fi);
	void SetFileSize(const WIN32_FIND_DATA &fi);
	void SetFileDateTime(const WIN32_FIND_DATA &fi);

public:
	TFileProperties();
	TFileProperties(String fname);
	bool GetFileProps(String fname);

	bool HasError() { return FError; }
	String GetErrorMessage() { return FErrorMessage; }
	bool IsInitialized() { return FInitialized; }

	String GetName() { return FName; }
	HANDLE GetHandle() { return FHandle; }

	bool IsArchive() { return FArchive; }
	bool IsCompressed() { return FCompressed; }
	bool IsHidden() { return FHidden; }
	bool IsReadOnly() { return FReadOnly; }
	bool IsSystem() { return FSystem; }
	bool IsTemporary() { return FTemporary; }
	String GetAttributeStr() const;
	DWORD GetdwFileAttributes()
	{	return FdwFileAttributes; }

	bool IsDir() { return FDir; }

	unsigned long GetSize() { return FSize; }
	String GetHumanSize();

	TDateTime GetCreationTime() { return FCreationTime; }
	TDateTime GetLastAccessTime() { return FLastAccessTime; }
	TDateTime GetLastWriteTime() { return FLastWriteTime; }
	/* The ..Time() functions return NULL if the filedatetime could not be read. */

	String GetCreationTimeStr() const;
	String GetLastAccessTimeStr() const;
	String GetLastWriteTimeStr() const;
	/* The ..TimeStr() functions return "?" if the filedatetime could not be read. */
};
//---------------------------------------------------------------------------

//===========================================================================
} // namespace ecc;
//===========================================================================
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -