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

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

?? sharemanager.h

?? 一個不錯的關于手機模塊程序This page contains everything that has changed in the history of DC++. Read this to fin
?? H
字號:
/*
 * Copyright (C) 2001-2006 Jacek Sieka, arnetheduck on gmail point com
 *
 * This program 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.
 *
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#if !defined(SHARE_MANAGER_H)
#define SHARE_MANAGER_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "TimerManager.h"
#include "SearchManager.h"
#include "SettingsManager.h"
#include "HashManager.h"
#include "DownloadManager.h"

#include "Exception.h"
#include "CriticalSection.h"
#include "StringSearch.h"
#include "Singleton.h"
#include "BloomFilter.h"
#include "FastAlloc.h"
#include "MerkleTree.h"

STANDARD_EXCEPTION(ShareException);

class SimpleXML;
class Client;
class File;
class OutputStream;
class MemoryInputStream;

struct ShareLoader;
class ShareManager : public Singleton<ShareManager>, private SettingsManagerListener, private Thread, private TimerManagerListener,
	private HashManagerListener, private DownloadManagerListener
{
public:
	/**
	 * @param aDirectory Physical directory location
	 * @param aName Virtual name
	 */
	void addDirectory(const string& aDirectory, const string & aName) throw(ShareException);
	void removeDirectory(const string& aName, bool duringRefresh = false);	
	void renameDirectory(const string& oName, const string& nName) throw(ShareException);
	string translateTTH(const string& TTH) throw(ShareException);
	string translateFileName(const string& aFile) throw(ShareException);
	bool getTTH(const string& aFile, TTHValue& tth) throw();
	void refresh(bool dirs = false, bool aUpdate = true, bool block = false) throw(ThreadException, ShareException);
	void setDirty() { xmlDirty = true; }

	void search(SearchResult::List& l, const string& aString, int aSearchType, int64_t aSize, int aFileType, Client* aClient, StringList::size_type maxResults);
	void search(SearchResult::List& l, const StringList& params, StringList::size_type maxResults);

	StringPairList getDirectories() const { RLock<> l(cs); return virtualMap; }

	MemoryInputStream* generatePartialList(const string& dir, bool recurse);
	MemoryInputStream* getTree(const string& aFile);

	AdcCommand getFileInfo(const string& aFile) throw(ShareException);

	int64_t getShareSize() throw();
	int64_t getShareSize(const string& aDir) throw();

	size_t getSharedFiles() throw();

	string getShareSizeString() { return Util::toString(getShareSize()); }
	string getShareSizeString(const string& aDir) { return Util::toString(getShareSize(aDir)); }
	
	SearchManager::TypeModes getType(const string& fileName);

	string validateVirtual(const string& /*aVirt*/);

	void addHits(u_int32_t aHits) {
		hits += aHits;
	}

	string getOwnListFile() {
		generateXmlList();
		return getBZXmlFile();
	}

	bool isTTHShared(const TTHValue& tth){
		HashFileIter i = tthIndex.find(const_cast<TTHValue*>(&tth));
		return (i != tthIndex.end());
	}

	GETSET(u_int32_t, hits, Hits);
	GETSET(string, listFile, ListFile);
	GETSET(string, bzXmlFile, BZXmlFile);

private:
	struct AdcSearch;
	class Directory : public FastAlloc<Directory> {
	public:
		struct File {
			struct StringComp {
				StringComp(const string& s) : a(s) { }
				bool operator()(const File& b) const { return Util::stricmp(a, b.getName()) == 0; }
				const string& a;
			private:
				StringComp& operator=(const StringComp&);
			};
			struct FileLess {
				bool operator()(const File& a, const File& b) const { return (Util::stricmp(a.getName(), b.getName()) < 0); }
			};
			typedef set<File, FileLess> Set;
			typedef Set::iterator Iter;

			File() : size(0), parent(NULL) { }
			File(const string& aName, int64_t aSize, Directory* aParent, const TTHValue& aRoot) : 
			name(aName), tth(aRoot), size(aSize), parent(aParent) { }
			File(const File& rhs) : 
			name(rhs.getName()), tth(rhs.getTTH()), size(rhs.getSize()), parent(rhs.getParent()) { }

			~File() { }

			File& operator=(const File& rhs) {
				name = rhs.name; size = rhs.size; parent = rhs.parent; tth = rhs.tth;
				return *this;
			}

			bool operator==(const File& rhs) const {
				return getParent() == rhs.getParent() && (Util::stricmp(getName(), rhs.getName()) == 0);
			}

			string getADCPath() const { return parent->getADCPath() + name; }
			string getFullName() const { return parent->getFullName() + getName(); }

			GETSET(string, name, Name);
			GETSET(TTHValue, tth, TTH);
			GETSET(int64_t, size, Size);
			GETSET(Directory*, parent, Parent);
		};

		typedef Directory* Ptr;
		typedef HASH_MAP<string, Ptr> Map;
		typedef Map::iterator MapIter;

		int64_t size;
		Map directories;
		File::Set files;

		Directory(const string& aName = Util::emptyString, Directory* aParent = NULL) : 
		size(0), name(aName), parent(aParent), fileTypes(0) { 
		}

		~Directory();

		bool hasType(u_int32_t type) const throw() {
			return ( (type == SearchManager::TYPE_ANY) || (fileTypes & (1 << type)) );
		}
		void addType(u_int32_t type) throw();

		string getADCPath() const throw();
		string getFullName() const throw(); 

		int64_t getSize() {
			int64_t tmp = size;
			for(MapIter i = directories.begin(); i != directories.end(); ++i)
				tmp+=i->second->getSize();
			return tmp;
		}

		size_t countFiles() {
			size_t tmp = files.size();
			for(MapIter i = directories.begin(); i != directories.end(); ++i)
				tmp+=i->second->countFiles();
			return tmp;			
		}

		void search(SearchResult::List& aResults, StringSearch::List& aStrings, int aSearchType, int64_t aSize, int aFileType, Client* aClient, StringList::size_type maxResults) throw();
		void search(SearchResult::List& aResults, AdcSearch& aStrings, StringList::size_type maxResults) throw();

		void toNmdc(string& nmdc, string& indent, string& tmp2);
		void toXml(OutputStream& xmlFile, string& indent, string& tmp2, bool fullList);
		void filesToXml(OutputStream& xmlFile, string& indent, string& tmp2);

		File::Iter findFile(const string& aFile) { return find_if(files.begin(), files.end(), Directory::File::StringComp(aFile)); }

		GETSET(string, name, Name);
		GETSET(Directory*, parent, Parent);
	private:
		Directory(const Directory&);
		Directory& operator=(const Directory&);

		/** Set of flags that say which SearchManager::TYPE_* a directory contains */
		u_int32_t fileTypes;

	};

	friend class Directory;
	friend struct ShareLoader;

	friend class Singleton<ShareManager>;
	ShareManager();
	
	virtual ~ShareManager();
	
	struct AdcSearch {
		AdcSearch(const StringList& params);

		bool isExcluded(const string& str) {
			for(StringSearch::Iter i = exclude.begin(); i != exclude.end(); ++i) {
				if(i->match(str))
					return true;
			}
			return false;
		}

		bool hasExt(const string& name) {
			if(ext.empty())
				return true;
			for(StringIter i = ext.begin(); i != ext.end(); ++i) {
				if(name.length() >= i->length() && Util::stricmp(name.c_str() + name.length() - i->length(), i->c_str()) == 0)
					return true;
			}
			return false;
		}

		StringSearch::List* include;
		StringSearch::List includeX;
		StringSearch::List exclude;
		StringList ext;

		int64_t gt;
		int64_t lt;

		TTHValue root;
		bool hasRoot;

		bool isDirectory;
	};

	typedef HASH_MULTIMAP_X(TTHValue*, Directory::File::Iter, TTHValue::PtrHash, TTHValue::PtrHash, TTHValue::PtrLess) HashFileMap;
	typedef HashFileMap::iterator HashFileIter;

	HashFileMap tthIndex;

	int64_t listLen;
	int64_t bzXmlListLen;
	TTHValue xmlbzRoot;
	TTHValue xmlRoot;

	bool xmlDirty;
	bool refreshDirs;
	bool update;
	bool initial;
	
	int listN;

	volatile long refreshing;

	File* lFile;
	File* xFile;

	u_int32_t lastXmlUpdate;
	u_int32_t lastFullUpdate;

	mutable RWLock<> cs;
	CriticalSection listGenLock;

	// Map real name to directory structure
	Directory::Map directories;

	// Map virtual to real dir name
	StringPairList virtualMap;

	BloomFilter<5> bloom;
	
	/** Find virtual name from real name */
	StringPairIter findVirtual(const string& name);
	/** Find real name from virtual name */
	StringPairIter lookupVirtual(const string& name);

	bool checkFile(const string& aDir, const string& aFile, Directory::File::Iter& it);

	Directory* buildTree(const string& aName, Directory* aParent);
	void addTree(Directory* aDirectory);
	void addFile(Directory* dir, Directory::File::Iter i);
	void generateXmlList();
	bool loadCache();

	void removeTTH(const TTHValue& tth, const Directory::File& file);

	Directory* getDirectory(const string& fname);

	virtual int run();

	// DownloadManagerListener
	virtual void on(DownloadManagerListener::Complete, Download* d) throw();

	// HashManagerListener
	virtual void on(HashManagerListener::TTHDone, const string& fname, const TTHValue& root) throw();

	// SettingsManagerListener
	virtual void on(SettingsManagerListener::Save, SimpleXML* xml) throw() {
		save(xml);
	}
	virtual void on(SettingsManagerListener::Load, SimpleXML* xml) throw() {
		load(xml);
	}
	
	// TimerManagerListener
	virtual void on(TimerManagerListener::Minute, u_int32_t tick) throw();
	void load(SimpleXML* aXml);
	void save(SimpleXML* aXml);
	
};

#endif // !defined(SHARE_MANAGER_H)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产美女在线观看一区| 99久久婷婷国产综合精品| 精品一区二区三区免费播放| 国产河南妇女毛片精品久久久 | 亚洲综合精品自拍| 日韩国产欧美视频| 粉嫩绯色av一区二区在线观看| 日本精品视频一区二区三区| 88在线观看91蜜桃国自产| 久久综合久久综合亚洲| 亚洲色图.com| 狠狠v欧美v日韩v亚洲ⅴ| av电影在线观看完整版一区二区 | 欧美国产精品一区| 午夜精品一区在线观看| 国产成人在线视频网站| 5858s免费视频成人| 国产精品国产三级国产有无不卡| 图片区小说区国产精品视频| 激情深爱一区二区| 欧美日韩黄色一区二区| 国产精品久久网站| 久久超碰97人人做人人爱| 色妞www精品视频| 综合久久久久久| 激情成人综合网| 欧美日韩精品欧美日韩精品一综合| 久久欧美一区二区| 调教+趴+乳夹+国产+精品| 色综合一区二区| 国产日产欧美一区二区视频| 蜜桃传媒麻豆第一区在线观看| 欧美性三三影院| 综合av第一页| a亚洲天堂av| 国产精品免费久久久久| 国产精品一区免费在线观看| 欧美一区二区久久| 日本欧美肥老太交大片| 欧美日韩免费在线视频| 一区二区久久久| 在线一区二区视频| 亚洲丝袜另类动漫二区| av电影一区二区| ...中文天堂在线一区| 成人av资源下载| 国产精品乱人伦一区二区| 国产成人av福利| 欧美激情一区二区三区在线| 国产成人av影院| 国产亚洲美州欧州综合国| 国产精品888| 国产情人综合久久777777| 国产成人精品影视| 欧美国产禁国产网站cc| 成人爱爱电影网址| 成人欧美一区二区三区视频网页| 成人免费毛片嘿嘿连载视频| 国产女人水真多18毛片18精品视频| 国产在线一区二区综合免费视频| 2020日本不卡一区二区视频| 国产精品夜夜嗨| 国产精品初高中害羞小美女文| 97久久精品人人澡人人爽| 亚洲日本电影在线| 欧美日韩国产系列| 看片的网站亚洲| 久久精品亚洲精品国产欧美kt∨| 国产福利一区二区三区视频在线| 国产欧美精品一区| 一本久久精品一区二区| 日韩精品亚洲一区二区三区免费| 欧美成人三级电影在线| 国产成人精品午夜视频免费| 亚洲人被黑人高潮完整版| 欧美日韩中字一区| 国产在线国偷精品免费看| 国产精品毛片大码女人| 欧美日韩精品一区二区三区四区| 精品一区二区三区免费毛片爱| 中文成人av在线| 欧美日韩国产综合视频在线观看| 久久激情五月婷婷| 亚洲少妇屁股交4| 欧美久久高跟鞋激| 国产91精品一区二区麻豆网站| 最新日韩在线视频| 日韩一区二区三区视频在线 | 日韩一区二区三区观看| 老色鬼精品视频在线观看播放| 精品国产乱码久久久久久久久 | 一区二区三区四区av| 日韩三级视频在线看| 不卡视频在线看| 麻豆视频一区二区| 一区二区高清在线| 国产日韩精品一区二区三区| 在线观看亚洲a| 国产高清精品在线| 欧美aa在线视频| 亚洲日本乱码在线观看| 久久理论电影网| 欧美日韩成人激情| 91丨九色丨尤物| 国产精品一级在线| 日本中文字幕一区二区视频| 亚洲欧美视频在线观看| 久久久99久久精品欧美| 欧美日韩成人在线| 色婷婷久久99综合精品jk白丝| 国产一区二区剧情av在线| 午夜精品久久久久久久久 | 91精品久久久久久久99蜜桃| 99久久精品一区| 国产一区二区电影| 免费成人美女在线观看| 亚洲福中文字幕伊人影院| 亚洲欧美另类久久久精品| 中文一区二区完整视频在线观看 | 日本道免费精品一区二区三区| 激情久久五月天| 日本亚洲免费观看| 三级成人在线视频| 最新不卡av在线| 日韩毛片精品高清免费| 亚洲国产成人午夜在线一区| 久久久综合激的五月天| 精品国产乱码久久久久久影片| 日韩免费视频一区| 欧美性做爰猛烈叫床潮| 欧美性生交片4| 欧洲色大大久久| 欧美自拍偷拍一区| 欧美色图激情小说| 欧美精品第一页| 在线不卡免费欧美| 欧美一区二区啪啪| 欧美成人video| 精品国产一区二区三区忘忧草 | 蜜桃精品视频在线| 免费成人性网站| 老司机精品视频线观看86| 国产呦萝稀缺另类资源| 国产一区亚洲一区| 成人久久久精品乱码一区二区三区| 国产激情精品久久久第一区二区| 国产成人在线免费观看| 成人高清免费在线播放| 91在线播放网址| 欧美三级一区二区| 日韩精品影音先锋| 欧美国产一区二区在线观看| 国产精品国产三级国产普通话99 | 亚洲国产日韩一区二区| 日本美女一区二区| 国产传媒欧美日韩成人| 99这里都是精品| 欧美日韩在线播放三区四区| 日韩亚洲欧美综合| 中文字幕欧美激情一区| 一区二区三区四区国产精品| 日韩av在线播放中文字幕| 韩国精品在线观看| 99国内精品久久| 欧美美女网站色| 久久午夜国产精品| 亚洲精品国产第一综合99久久 | 国产亚洲一区二区三区在线观看 | 国产日韩欧美精品在线| 亚洲主播在线观看| 狠狠色狠狠色综合系列| 色视频成人在线观看免| 日韩欧美一级二级| 亚洲欧美色综合| 国产原创一区二区三区| 色婷婷精品久久二区二区蜜臀av| 日韩欧美精品在线| 亚洲自拍与偷拍| 国产高清久久久| 欧美一个色资源| 亚洲激情自拍偷拍| 国产一区二区三区黄视频| 欧美天堂一区二区三区| 久久久精品黄色| 婷婷六月综合亚洲| 岛国精品在线观看| 欧美一区二区视频网站| 亚洲欧洲性图库| 韩日精品视频一区| 7777精品伊人久久久大香线蕉超级流畅 | 99久久久国产精品| 欧美mv日韩mv| 性欧美疯狂xxxxbbbb| av在线不卡免费看| 国产精品久久久爽爽爽麻豆色哟哟| 国产一区二区三区免费| 久久久精品国产免费观看同学| 精品亚洲国内自在自线福利| 日韩一区国产二区欧美三区| 日韩不卡一区二区|