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

📄 ed2k.h

📁 p2p软件
💻 H
字号:
//
// ED2K.h
//
// Copyright (c) Shareaza Development Team, 2002-2004.
// This file is part of SHAREAZA (www.shareaza.com)
//
// Shareaza 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.
//
// Shareaza 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 Shareaza; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//

#if !defined(AFX_ED2K_H__0ED688AE_E4F5_49C6_8EC8_5C80EFA6EF6C__INCLUDED_)
#define AFX_ED2K_H__0ED688AE_E4F5_49C6_8EC8_5C80EFA6EF6C__INCLUDED_

#pragma once

#include "MD4.h"


class CED2K  
{
// Construction
public:
	CED2K();
	virtual ~CED2K();
	
// Operations
public:
	void	Clear();
	void	Serialize(CArchive& ar);
	DWORD	GetSerialSize() const;
	BOOL	GetRoot(MD4* pHash) const;
public:
	void	BeginFile(QWORD nLength);
	void	AddToFile(LPCVOID pInput, DWORD nLength);
	BOOL	FinishFile();
public:
	void	BeginBlockTest();
	void	AddToTest(LPCVOID pInput, DWORD nLength);
	BOOL	FinishBlockTest(DWORD nBlock);
public:
	LPCVOID	GetRawPtr() const;
	BOOL	ToBytes(BYTE** pOutput, DWORD* pnOutput);
	BOOL	FromBytes(BYTE* pOutput, DWORD nOutput, QWORD nSize = 0);
	BOOL	FromRoot(MD4* pHash);
	BOOL	CheckIntegrity();
public:
	static CString	HashToString(const MD4* pHash, BOOL bURN = FALSE);
	static BOOL		HashFromString(LPCTSTR pszHash, MD4* pHash);
	static BOOL		HashFromURN(LPCTSTR pszHash, MD4* pHash);

// Inlines
public:
	inline BOOL		IsAvailable() const { return m_pList != NULL; }
	inline DWORD	GetBlockCount() const { return m_nList; }

// Attributes
protected:
	MD4		m_pRoot;
	MD4*	m_pList;
	DWORD	m_nList;
protected:
	CMD4	m_pSegment;
	DWORD	m_nCurHash;
	DWORD	m_nCurByte;

};

#define ED2K_PART_SIZE	9728000	// 1024*9500

#endif // !defined(AFX_ED2K_H__0ED688AE_E4F5_49C6_8EC8_5C80EFA6EF6C__INCLUDED_)

⌨️ 快捷键说明

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