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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? eccfile.cpp

?? C++實現的橢圓曲線算法。已經寫成一個庫文件只要調用就行了
?? CPP
字號:
/* ==========================================================================

	ecc - Erik's Code Collection
	Copyright (C) 2003-2005 - 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
	
===========================================================================*/

//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "eccFile.h"
#include "eccString.h"
//#include "eccError.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
#include <Registry.hpp>	// CreateFileAssociation()
#include "shlobj.h"		// SHChangeNotify()
/*	#include "shlobj.h" Requires conditional define NO_WIN32_LEAN_AND_MEAN */
#include <fstream>
#include <StrUtils.hpp>	// AnsiReplaceStr
//---------------------------------------------------------------------------

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

//---------------------------------------------------------------------------

bool MakeFileList(String path, TStringList* list, const bool include_path)
{
	HANDLE fhandle;
	String fitem;
	WIN32_FIND_DATA filedata;
	bool done = false;

	// Get the first item:
	path = IncludeTrailingBackslash(path);
	fhandle = FindFirstFile( String(path + "*").c_str(), &filedata);
	if (fhandle == INVALID_HANDLE_VALUE)
		return false;

	while (!done)
	{
		fitem = String(filedata.cFileName);
		// Test if the filedata-object is a directory or a file:
		if (!(filedata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
		{
			// Filedata-object is a file:
			if (include_path)
				list->Append(path + fitem);
			else
				list->Append(fitem);
		}
		// Is this the last Filedata-object?
		if (!FindNextFile(fhandle, &filedata))
		{
			if (GetLastError() == ERROR_NO_MORE_FILES)
				done = true;
		}
	}

	FindClose(fhandle);
	return true;
}
//---------------------------------------------------------------------------

bool MakeDirList(String path, TStringList* list)
{
	HANDLE fhandle;
	String fitem;
	WIN32_FIND_DATA filedata;
	bool done = false;

	// Get the first item:
	path = IncludeTrailingBackslash(path);
	fhandle = FindFirstFile( String(path + "*").c_str(), &filedata);
	if (fhandle == INVALID_HANDLE_VALUE)
		return false;

	while (!done)
	{
		fitem = String(filedata.cFileName);
		// Test if the filedata-object is a directory or a file:
		if (filedata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
		{
			// Filedata-object is a directory:
			if ((fitem != ".") && (fitem != ".."))
			{
				list->Append(path + fitem);
			}
		}
		// Is this the last Filedata-object?
		if (!FindNextFile(fhandle, &filedata))
		{
			if (GetLastError() == ERROR_NO_MORE_FILES)
				done = true;
		}
	}
	FindClose(fhandle);
	return true;
}
//---------------------------------------------------------------------------

bool MakeRelativeDirList(String path, TStringList* list)
{
	HANDLE fhandle;
	String fitem;
	WIN32_FIND_DATA filedata;
	bool done = false;

	// Get the first item:
	path = IncludeTrailingBackslash(path);
	fhandle = FindFirstFile( String(path + "*").c_str(), &filedata);
	if (fhandle == INVALID_HANDLE_VALUE)
		return false;

	while (!done)
	{
		fitem = String(filedata.cFileName);
		// Test if the filedata-object is a directory or a file:
		if (filedata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
		{
			// Filedata-object is a directory:
			if ((fitem != ".") && (fitem != ".."))
			{
				list->Append(fitem);
			}
		}
		// Is this the last Filedata-object?
		if (!FindNextFile(fhandle, &filedata))
		{
			if (GetLastError() == ERROR_NO_MORE_FILES)
				done = true;
		}
	}

	FindClose(fhandle);
	return true;
}
//---------------------------------------------------------------------------

bool CopyDirectory(String src, String dest, const bool overwrite, const bool recurse)
{
	if (!ForceDirectories(dest))
		return false;

	HANDLE fhandle;
	String fitem;
	WIN32_FIND_DATA filedata;
	bool done = false;

	// Get the first item:
	src 	= IncludeTrailingBackslash(src);
	dest 	= IncludeTrailingBackslash(dest);
	fhandle = FindFirstFile( String(src + "*").c_str(), &filedata);
	if (fhandle == INVALID_HANDLE_VALUE)
		return false;

	while (!done)
	{
		fitem = String(filedata.cFileName);
		// Test if the filedata-object is a directory or a file:
		if (filedata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
		{
			// Filedata-object is a directory:
			if (recurse)
			{
				if (CreateDirectory(String(dest + fitem).c_str(), NULL) == 0)
					return false;
				if (!CopyDirectory(src + fitem, dest + fitem, overwrite, recurse))
					return false;
			}
		}
		else
		{
			// Filedata-object is a file:
			if ( !(FileExists(dest + fitem) && !overwrite) )
			{
				if (CopyFile(
					String(src + fitem).c_str(),
					String(dest + fitem).c_str(),
					FALSE	// No need to fail if dest-file exists, covered by [overwrite].
					) == 0) return false;
			}
		}
		// Is this the last Filedata-object?
		if (!FindNextFile(fhandle, &filedata))
		{
			if (GetLastError() == ERROR_NO_MORE_FILES)
				done = true;
		}
	}

	FindClose(fhandle);
	return true;
}
//---------------------------------------------------------------------------

bool StringToFile(const String str, const String fname)
{
	bool error = false;
	TStringList *sl_text = new TStringList();

	try
	{
		sl_text->Text = str;
		sl_text->SaveToFile(fname);
	}
	catch(Exception &err)
	{
		ShowMessage("Could not write to file:\n'" + fname + "'\n\nError:\n" + err.Message);
		error = true;
	}

	delete sl_text;

	return error;
}
//---------------------------------------------------------------------------

String FileToString(const String fname)
{
	if (!FileExists(fname)) return "";

	String str;
	TStringList *sl_text = new TStringList();
	try
	{
		sl_text->LoadFromFile(fname);
		str = sl_text->Text;
	}
	__finally
	{
		delete sl_text;
	}
	return str;
}
//---------------------------------------------------------------------------

String ExtractFileNameNoExt(String fname)
{
	fname = ExtractFileName(fname);
	int ext_pos = fname.Pos(ExtractFileExt(fname)) -1;
	if (ext_pos > 0) fname = fname.SubString(1,  ext_pos);
	return fname;
}
//---------------------------------------------------------------------------

String ReplaceIllegalFileNameChars(String fname, const String replace)
{
	String ill_chars = "\\/:*?\"<>|";
	if (replace.LastDelimiter(ill_chars))
        throw Exception(__FUNC__ ": [replace] cannot contain illegal chars.");

	int pos;
	while (1)
	{
		pos = fname.LastDelimiter(ill_chars);
		if (!pos) break;
		if (replace.IsEmpty()) fname.Delete(pos, 1);
		else fname = AnsiReplaceStr(fname, fname[pos], replace);
	}
	return fname;
}
//---------------------------------------------------------------------------

long GetFileSize(const String fname)
{
	HANDLE fhandle;
	WIN32_FIND_DATA filedata;

	fhandle = FindFirstFile(fname.c_str(), &filedata);
	if (fhandle == INVALID_HANDLE_VALUE)
		return -1;

	long size = (filedata.nFileSizeHigh * MAXDWORD) + filedata.nFileSizeLow;

	FindClose(fhandle);
	return size;
}
//---------------------------------------------------------------------------

String FloatToHumanFileSize(float fsize)
{
	if (fsize < 0) return "?";

	if (fsize < 10000)
		return FloatToStr(fsize) + " B";

	fsize = fsize/1024;
	if (fsize < 10000)
		return (FloatToStrF(fsize, ffFixed, 7, 0) + " kB");

	fsize = fsize/1024;
	if (fsize < 10000)
		return (FloatToStrF(fsize, ffFixed, 7, 1) + " MB");

	fsize = fsize/1024;
	return (FloatToStrF(fsize, ffFixed, 7, 1) + " GB");
}
//---------------------------------------------------------------------------

String FileAttributeStr(const String fname)
{
	HANDLE fhandle;
	WIN32_FIND_DATA filedata;

	fhandle = FindFirstFile(fname.c_str(), &filedata);
	if (fhandle == INVALID_HANDLE_VALUE)
		return "";
	if ((filedata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
		return "";

	String str;
	str += (filedata.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE)	? "A" : "";
	str += (filedata.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)	? "H" : "";
	str += (filedata.dwFileAttributes & FILE_ATTRIBUTE_READONLY)? "R" : "";
	str += (filedata.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM)	? "S" : "";

	FindClose(fhandle);
	return str;
}
//---------------------------------------------------------------------------

void AddDoubleZeroToString(String &str)
{
	str.SetLength(str.Length() + 1);
	str[str.Length()] = '\0';
	str.SetLength(str.Length() + 1);
	str[str.Length()] = '\0';
}
//---------------------------------------------------------------------------

bool FileToRecycleBin(String fpath)
{
	AddDoubleZeroToString(fpath);

	SHFILEOPSTRUCT op;
	ZeroMemory(&op,sizeof(op));
	//op.hwnd 	= Handle;
	op.hwnd 	= 0;
	op.wFunc 	= FO_DELETE;
	op.pFrom 	= fpath.c_str();
	op.fFlags 	= FOF_ALLOWUNDO;
	return !SHFileOperation(&op);
}
//---------------------------------------------------------------------------

bool MoveFile(String src_fpath, String dest_fpath)
{
	AddDoubleZeroToString(src_fpath);
	AddDoubleZeroToString(dest_fpath);

	SHFILEOPSTRUCT op;
	ZeroMemory(&op,sizeof(op));
	//op.hwnd 	= Handle;
	op.hwnd   	= 0;
	op.wFunc 	= FO_MOVE;
	op.pFrom 	= src_fpath.c_str();
	op.pTo 		= dest_fpath.c_str();
	op.fFlags	= FOF_RENAMEONCOLLISION + FOF_NOCONFIRMATION;
	return !SHFileOperation(&op);
}
//---------------------------------------------------------------------------

TDateTime FILETIMEToTDateTime(const FILETIME ftime)
{
	// Create a union/struct for DosDateTime:
	union
	{
		struct
		{
			WORD time;
			WORD date;
		};
		unsigned int fat_dt;
	} u_date;

	// Convert Coordinated Universal Time (UTC) to a local file time:
	FILETIME local_ftime;
	TDateTime fdatetime;
	try
	{
		FileTimeToLocalFileTime(
			&ftime,			// lpFileTime, pointer to UTC file time to convert
			&local_ftime);	// lpLocalFileTime, pointer to converted file time
		// Convert to DosDateTime so BCB can deal with it:
		FileTimeToDosDateTime(
			&local_ftime,	// lpFileTime, pointer to 64-bit file time
			&u_date.date, 	// lpFatDate, pointer to variable for MS-DOS date
			&u_date.time);	// lpFatTime, pointer to variable for MS-DOS time
	}
	catch (...)
	{
		return TDateTime(1911, 11, 11);
	}

	// Convert Windows time as a BCB TDateTime:
	try
	{
		fdatetime = FileDateToDateTime(u_date.fat_dt);
	}
	catch (...)
	{
		fdatetime = TDateTime(1911, 11, 11);
	}
	return fdatetime;
}
//---------------------------------------------------------------------------

bool CreateFileAssociation(String ext, String fileTypeStr,
		String appName, String appPath, bool clickStart)
{
	TRegistry *reg = new TRegistry();
	bool ok = true;

	try
	{
		reg->RootKey = HKEY_CLASSES_ROOT;
		if (reg->OpenKey(ext, true))
		{
			reg->WriteString("", appName + ext);
			reg->CloseKey();
		}
		if (reg->OpenKey(appName + ext, true))
		{
			reg->WriteString("", fileTypeStr);
			reg->CloseKey();
		}
		if (clickStart)
		{
			// Clicking opens app_path:
			if (reg->OpenKey(appName + ext + "\\shell\\open\\command", true))
			{
				reg->WriteString("", "\"" + appPath + "\" \"%1\"");
				reg->CloseKey();
			}
			// Give this file app_name's icon:
			if (reg->OpenKey(appName + ext + "\\DefaultIcon", true))
			{
				reg->WriteString("", appPath + ",0");
				reg->CloseKey();
			}
		}
		else
		{
			// Give this file no icon:
			if (reg->OpenKey(appName + ext + "\\DefaultIcon", true))
			{
				//reg->WriteString("", appPath + ",0"); // app's icon
				reg->WriteString("", "");
				reg->CloseKey();
			}
		}

/*0.3.13: 		if (click_start)
		{
			// Clicking opens app_path:
			if (reg->OpenKey(app_name + ext + "\\shell\\open\\command", true))
			{
				reg->WriteString("", "\"" + app_path + "\" \"%1\"");
				reg->CloseKey();
			}
		}
		else
		{
			// Give this file app_name's icon:
			if (reg->OpenKey(app_name + ext + "\\DefaultIcon", true))
			{
				reg->WriteString("", app_path + ",0");
				reg->CloseKey();
			}
		} */

		// Inform the shell that file associations have changed:
		SHChangeNotify(
			SHCNE_ASSOCCHANGED,	// LONG wEventId
			SHCNF_IDLIST,		// UINT uFlags
			NULL, 				// LPCVOID dwItem1
			NULL				// LPCVOID dwItem2
		);
	}
	catch(...)
	{
		ok = false;
	}
	delete reg;
	return ok;
}
//---------------------------------------------------------------------------

void AppendStrToFile(String str, String fpath, bool datetime, bool endline)
{
	if (fpath.IsEmpty()) return;

	std::ofstream log(fpath.c_str(), std::ios::out|std::ios::app); // Append, and create if necessary.
	if (!log) return;

	if (datetime)
		log	<< "[" << Now().DateTimeString().c_str() << "] ";
	log	<< str.c_str();
	if (endline)
		log << std::endl;
}
//---------------------------------------------------------------------------

String ActualPathName(const String filedir_path)
{
	// FindFirstFile() doesn't like trailing backslashes for directories:
	String path = ExcludeTrailingBackslash(filedir_path);
	String base_path = ExtractFilePath(path);

	HANDLE fhandle;
	WIN32_FIND_DATA filedata;
	fhandle = FindFirstFile( String(path).c_str(), &filedata);
	FindClose(fhandle);
	if (fhandle != INVALID_HANDLE_VALUE)
	{
		// Return 'real' charactercase for last part of [filedir_path]:
		return base_path + String(filedata.cFileName);	// 'Real' charactercase.
	}
	else
	{
		// [filedir_path] is invalid, return it unchanged:
		return filedir_path;
	}
}
//---------------------------------------------------------------------------

//===========================================================================
} // namespace ecc;
//===========================================================================

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆91免费看| 精品国产污网站| 久久亚洲精精品中文字幕早川悠里| 国产网红主播福利一区二区| 水蜜桃久久夜色精品一区的特点| 成人黄色电影在线 | 国产乱人伦偷精品视频免下载 | 久久久久久99久久久精品网站| 国产精品久久国产精麻豆99网站| 日韩高清不卡一区二区| www..com久久爱| 国产午夜精品一区二区三区视频| 免费在线视频一区| 91成人免费在线视频| 亚洲色欲色欲www在线观看| 狠狠网亚洲精品| 日韩欧美激情四射| 五月天欧美精品| 欧美日韩在线综合| 亚洲欧美国产77777| 不卡一卡二卡三乱码免费网站| 精品国产99国产精品| 麻豆国产欧美一区二区三区| 欧美绝品在线观看成人午夜影视| 亚洲欧美色一区| 不卡欧美aaaaa| 亚洲欧洲av一区二区三区久久| 国产精品99久久久久久似苏梦涵 | 国产成人亚洲精品狼色在线| 日韩一区二区不卡| 久久精品国产在热久久| 91精品国产一区二区人妖| 亚洲国产精品影院| 欧美人与性动xxxx| 三级成人在线视频| 91精品国产色综合久久ai换脸| 五月天久久比比资源色| 欧美一区三区二区| 久久国产综合精品| 久久先锋影音av鲁色资源网| 国产露脸91国语对白| 国产网站一区二区| av在线播放成人| 夜夜嗨av一区二区三区中文字幕 | a美女胸又www黄视频久久| 国产丝袜美腿一区二区三区| 懂色av中文一区二区三区| 国产欧美精品一区二区色综合| 成人av在线影院| 亚洲精品菠萝久久久久久久| 欧美日韩国产天堂| 另类调教123区| 国产精品美女久久久久久久久久久 | 日韩一区精品视频| 精品奇米国产一区二区三区| 国产美女主播视频一区| 国产精品美日韩| 欧美日韩你懂得| 国产一区二区在线电影| 亚洲天堂av一区| 欧美久久久久中文字幕| 国内精品写真在线观看| 国产精品动漫网站| 555www色欧美视频| 国产福利一区二区| 亚洲sss视频在线视频| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 老司机午夜精品| 亚洲区小说区图片区qvod| 7777精品久久久大香线蕉| 国产乱人伦偷精品视频免下载 | 国产精品久久午夜| 欧美日韩精品一区二区三区蜜桃 | 国产亚洲精品bt天堂精选| 91偷拍与自偷拍精品| 日韩高清一级片| 国产精品传媒视频| 欧美一级二级在线观看| 色婷婷国产精品久久包臀| 久久99这里只有精品| 亚洲国产wwwccc36天堂| 欧美国产日韩亚洲一区| 欧美一区三区二区| 在线中文字幕不卡| 成人性生交大合| 久久99国产精品久久99果冻传媒| 亚洲免费观看高清完整版在线观看 | 欧美日韩不卡一区| 不卡视频一二三四| 国产一区二区不卡老阿姨| 婷婷中文字幕一区三区| 亚洲欧美国产三级| 国产精品久久久久毛片软件| 久久亚洲精品国产精品紫薇| 欧美一区二区播放| 欧美片网站yy| 欧美色图在线观看| 99视频精品在线| 粉嫩av一区二区三区在线播放 | 一本到不卡免费一区二区| 国产一区二区美女诱惑| 久久电影国产免费久久电影| 日产国产欧美视频一区精品| 亚洲国产视频网站| 亚洲精品成人a在线观看| 中文字幕在线播放不卡一区| 国产精品热久久久久夜色精品三区| 精品99一区二区三区| 欧美电影免费观看完整版| 在线播放欧美女士性生活| 在线视频观看一区| 在线视频你懂得一区| 一本一本久久a久久精品综合麻豆| 成人免费高清视频| 成人精品gif动图一区| 成人av在线资源网站| 99久久伊人网影院| 91免费精品国自产拍在线不卡| 成人午夜精品在线| eeuss鲁片一区二区三区| 99精品热视频| 欧美亚洲综合色| 欧美日韩国产另类一区| 69堂精品视频| 久久久欧美精品sm网站| 国产精品美女久久久久aⅴ| 亚洲欧洲色图综合| 亚洲精品菠萝久久久久久久| 午夜久久福利影院| 久久99精品久久久久久国产越南| 国产伦精品一区二区三区在线观看| 国产成人综合视频| 色综合天天综合色综合av| 欧美亚洲免费在线一区| 欧美一区二区福利视频| 国产三区在线成人av| 亚洲少妇屁股交4| 视频一区二区中文字幕| 国产成人精品一区二区三区网站观看| 99久久久久免费精品国产| 欧美日韩高清在线| 337p粉嫩大胆色噜噜噜噜亚洲 | youjizz久久| 欧美亚洲日本一区| 亚洲精品一区二区三区精华液 | 久久国产尿小便嘘嘘尿| 成人美女视频在线观看18| 欧美视频精品在线| 久久久久久综合| 亚洲资源在线观看| 国产毛片精品一区| 欧美视频精品在线观看| 国产清纯白嫩初高生在线观看91| 亚洲综合久久av| 国产成人av一区二区三区在线| 欧美一a一片一级一片| 久久精品亚洲一区二区三区浴池| 艳妇臀荡乳欲伦亚洲一区| 国产在线视频不卡二| 91久久久免费一区二区| 精品国产三级a在线观看| 一区二区三区在线观看欧美 | 91视频国产观看| 日韩美女视频一区二区在线观看| 亚洲色欲色欲www在线观看| 久久电影网电视剧免费观看| 91成人免费在线视频| 日本一区二区三区四区在线视频| 秋霞午夜av一区二区三区| 91在线无精精品入口| 久久精品亚洲精品国产欧美| 日韩国产一二三区| 欧美亚洲国产一区在线观看网站| 欧美极品aⅴ影院| 精品一区二区三区影院在线午夜| 在线观看欧美日本| 亚洲欧洲日韩av| 国产成人一区在线| 欧美成人精精品一区二区频| 天天色 色综合| 欧美吻胸吃奶大尺度电影| 亚洲视频中文字幕| 成人小视频免费观看| 国产性色一区二区| 免费观看一级欧美片| 91精品一区二区三区久久久久久| 一区二区三区在线不卡| 99国产精品久久久久久久久久| 国产偷国产偷精品高清尤物| 国产酒店精品激情| 久久午夜国产精品| 国产精品一线二线三线精华| 欧美精品一区二区精品网| 蜜臀av性久久久久蜜臀aⅴ| 欧美三级三级三级| 视频一区二区欧美| 91精品国产综合久久久蜜臀粉嫩 | 亚洲狠狠丁香婷婷综合久久久| 99精品视频在线观看| 亚洲视频图片小说|