📄 preferences.cpp
字号:
uint16 CPreferences::deadserverretries;
DWORD CPreferences::m_dwServerKeepAliveTimeout;
uint16 CPreferences::m_uCHNScore; //VeryCD版
uint16 CPreferences::m_uUploadClients;
bool CPreferences::m_bUPnPNat; // UPnP On/Off
bool CPreferences::m_bUPnPTryRandom; // Try to use random external port if already in use On/Off
uint16 CPreferences::m_iUPnPTCPExternal = 0; // TCP External Port
uint16 CPreferences::m_iUPnPUDPExternal = 0; // UDP External Port
char CPreferences::m_sScoreAdjustor[16384];
bool CPreferences::m_bBrowser;
//EastShare - added by AndCycle, IP to Country
IP2CountryNameSelection CPreferences::m_iIP2CountryNameMode;
bool CPreferences::m_bIP2CountryShowFlag;
//EastShare - added by AndCycle, IP to Country
uint16 CPreferences::statsMax;
uint8 CPreferences::statsAverageMinutes;
uint8 CPreferences::useDownloadNotifier;
uint8 CPreferences::useNewDownloadNotifier;
uint8 CPreferences::useChatNotifier;
uint8 CPreferences::useServerNotifier; //VeryCD
uint8 CPreferences::useLogNotifier;
uint8 CPreferences::useSoundInNotifier;
uint8 CPreferences::notifierPopsEveryChatMsg;
uint8 CPreferences::notifierImportantError;
uint8 CPreferences::notifierNewVersion;
TCHAR CPreferences::notifierSoundFilePath[510];
TCHAR CPreferences::m_sircserver[50];
TCHAR CPreferences::m_sircnick[30];
TCHAR CPreferences::m_sircchannamefilter[50];
bool CPreferences::m_bircaddtimestamp;
bool CPreferences::m_bircusechanfilter;
uint16 CPreferences::m_iircchanneluserfilter;
TCHAR CPreferences::m_sircperformstring[255];
bool CPreferences::m_bircuseperform;
bool CPreferences::m_birclistonconnect;
bool CPreferences::m_bircacceptlinks;
bool CPreferences::m_bircacceptlinksfriends;
bool CPreferences::m_bircsoundevents;
bool CPreferences::m_bircignoremiscmessage;
bool CPreferences::m_bircignorejoinmessage;
bool CPreferences::m_bircignorepartmessage;
bool CPreferences::m_bircignorequitmessage;
bool CPreferences::m_bircignoreemuleprotoaddfriend;
bool CPreferences::m_bircallowemuleprotoaddfriend;
bool CPreferences::m_bircignoreemuleprotosendlink;
bool CPreferences::m_birchelpchannel;
bool CPreferences::m_bRemove2bin;
bool CPreferences::m_bpreviewprio;
bool CPreferences::smartidcheck;
uint8 CPreferences::smartidstate;
bool CPreferences::safeServerConnect;
bool CPreferences::startMinimized;
bool CPreferences::m_bAutoStart;
bool CPreferences::m_bRestoreLastMainWndDlg;
int CPreferences::m_iLastMainWndDlgID;
bool CPreferences::m_bRestoreLastLogPane;
int CPreferences::m_iLastLogPaneID;
uint16 CPreferences::MaxConperFive;
int CPreferences::checkDiskspace;
UINT CPreferences::m_uMinFreeDiskSpace;
TCHAR CPreferences::yourHostname[127];
bool CPreferences::m_bEnableVerboseOptions;
bool CPreferences::m_bVerbose;
bool CPreferences::m_bFullVerbose;
bool CPreferences::m_bDebugSourceExchange;
bool CPreferences::m_bLogBannedClients;
bool CPreferences::m_bLogRatingDescReceived;
bool CPreferences::m_bLogSecureIdent;
bool CPreferences::m_bLogFilteredIPs;
bool CPreferences::m_bLogFileSaving;
bool CPreferences::m_bLogA4AF; // ZZ:DownloadManager
bool CPreferences::m_bLogUlDlEvents;
#if defined(_DEBUG) || defined(USE_DEBUG_DEVICE)
bool CPreferences::m_bUseDebugDevice = true;
#else
bool CPreferences::m_bUseDebugDevice = false;
#endif
int CPreferences::m_iDebugServerTCPLevel;
int CPreferences::m_iDebugServerUDPLevel;
int CPreferences::m_iDebugServerSourcesLevel;
int CPreferences::m_iDebugServerSearchesLevel;
int CPreferences::m_iDebugClientTCPLevel;
int CPreferences::m_iDebugClientUDPLevel;
int CPreferences::m_iDebugClientKadUDPLevel;
bool CPreferences::m_bupdatequeuelist;
bool CPreferences::m_bmanualhighprio;
bool CPreferences::m_btransferfullchunks;
int CPreferences::m_istartnextfile;
bool CPreferences::m_bshowoverhead;
bool CPreferences::m_bDAP;
bool CPreferences::m_bUAP;
bool CPreferences::m_bDisableKnownClientList;
bool CPreferences::m_bDisableQueueList;
bool CPreferences::m_bExtControls;
bool CPreferences::m_bTransflstRemain;
uint8 CPreferences::versioncheckdays;
int CPreferences::tableSortItemDownload;
int CPreferences::tableSortItemUpload;
int CPreferences::tableSortItemQueue;
int CPreferences::tableSortItemSearch;
int CPreferences::tableSortItemShared;
int CPreferences::tableSortItemServer;
int CPreferences::tableSortItemClientList;
int CPreferences::tableSortItemFilenames;
bool CPreferences::tableSortAscendingDownload;
bool CPreferences::tableSortAscendingUpload;
bool CPreferences::tableSortAscendingQueue;
bool CPreferences::tableSortAscendingSearch;
bool CPreferences::tableSortAscendingShared;
bool CPreferences::tableSortAscendingServer;
bool CPreferences::tableSortAscendingClientList;
bool CPreferences::tableSortAscendingFilenames;
bool CPreferences::showRatesInTitle;
TCHAR CPreferences::TxtEditor[256];
TCHAR CPreferences::VideoPlayer[256];
bool CPreferences::moviePreviewBackup;
int CPreferences::m_iPreviewSmallBlocks;
int CPreferences::m_iPreviewCopiedArchives;
int CPreferences::m_iInspectAllFileTypes;
bool CPreferences::indicateratings;
bool CPreferences::watchclipboard;
bool CPreferences::filterserverbyip;
bool CPreferences::m_bFirstStart;
bool CPreferences::m_bCreditSystem;
bool CPreferences::log2disk;
bool CPreferences::debug2disk;
int CPreferences::iMaxLogBuff;
UINT CPreferences::uMaxLogFileSize;
bool CPreferences::scheduler;
bool CPreferences::dontcompressavi;
bool CPreferences::msgonlyfriends;
bool CPreferences::msgsecure;
uint8 CPreferences::filterlevel;
UINT CPreferences::m_iFileBufferSize;
UINT CPreferences::m_iQueueSize;
int CPreferences::m_iCommitFiles;
uint16 CPreferences::maxmsgsessions;
uint32 CPreferences::versioncheckLastAutomatic;
TCHAR CPreferences::messageFilter[512];
CString CPreferences::commentFilter;
TCHAR CPreferences::filenameCleanups[512];
TCHAR CPreferences::notifierConfiguration[510];
TCHAR CPreferences::datetimeformat[64];
TCHAR CPreferences::datetimeformat4log[64];
LOGFONT CPreferences::m_lfHyperText;
LOGFONT CPreferences::m_lfLogText;
int CPreferences::m_iExtractMetaData;
bool CPreferences::m_bAdjustNTFSDaylightFileTime = true;
TCHAR CPreferences::m_sWebPassword[256];
TCHAR CPreferences::m_sWebLowPassword[256];
uint16 CPreferences::m_nWebPort;
bool CPreferences::m_bWebEnabled;
bool CPreferences::m_bWebUseGzip;
int CPreferences::m_nWebPageRefresh;
bool CPreferences::m_bWebLowEnabled;
TCHAR CPreferences::m_sWebResDir[MAX_PATH];
TCHAR CPreferences::m_sTemplateFile[MAX_PATH];
ProxySettings CPreferences::proxy;
bool CPreferences::m_bIsASCWOP;
bool CPreferences::m_bShowProxyErrors;
bool CPreferences::showCatTabInfos;
bool CPreferences::resumeSameCat;
bool CPreferences::dontRecreateGraphs;
bool CPreferences::autofilenamecleanup;
int CPreferences::allcatType;
bool CPreferences::m_bUseAutocompl;
bool CPreferences::m_bShowDwlPercentage;
bool CPreferences::m_bRemoveFinishedDownloads;
uint16 CPreferences::m_iMaxChatHistory;
bool CPreferences::m_bShowActiveDownloadsBold;
int CPreferences::m_iSearchMethod;
bool CPreferences::m_bAdvancedSpamfilter;
bool CPreferences::m_bUseSecureIdent;
TCHAR CPreferences::m_sMMPassword[256];
bool CPreferences::m_bMMEnabled;
uint16 CPreferences::m_nMMPort;
bool CPreferences::networkkademlia;
bool CPreferences::networked2k;
uint8 CPreferences::m_nToolbarLabels;
TCHAR CPreferences::m_sToolbarBitmap[256];
TCHAR CPreferences::m_sToolbarBitmapFolder[256];
TCHAR CPreferences::m_sToolbarSettings[256];
bool CPreferences::m_bPreviewEnabled;
bool CPreferences::m_bDynUpEnabled;
int CPreferences::m_iDynUpPingTolerance;
int CPreferences::m_iDynUpGoingUpDivider;
int CPreferences::m_iDynUpGoingDownDivider;
int CPreferences::m_iDynUpNumberOfPings;
int CPreferences::m_iDynUpPingToleranceMilliseconds;
bool CPreferences::m_bDynUpUseMillisecondPingTolerance;
// ZZ:DownloadManager -->
bool CPreferences::m_bA4AFSaveCpu;
// ZZ:DownloadManager <--
CStringList CPreferences::shareddir_list;
CStringList CPreferences::adresses_list;
CString CPreferences::appdir;
CString CPreferences::configdir;
CString CPreferences::m_strWebServerDir;
CString CPreferences::m_strLangDir;
CString CPreferences::m_strFileCommentsFilePath;
Preferences_Ext_Struct* CPreferences::prefsExt;
WORD CPreferences::m_wWinVer;
bool CPreferences::m_UseProxyListenPort;
uint16 CPreferences::ListenPort;
CArray<Category_Struct*,Category_Struct*> CPreferences::catMap;
uint8 CPreferences::m_nWebMirrorAlertLevel;
bool CPreferences::m_bRunAsUser;
bool CPreferences::m_bUseOldTimeRemaining;
uint32 CPreferences::m_uPeerCacheLastSearch;
bool CPreferences::m_bPeerCacheWasFound;
bool CPreferences::m_bPeerCacheEnabled;
uint16 CPreferences::m_nPeerCachePort;
bool CPreferences::m_bOpenPortsOnStartUp;
uint8 CPreferences::m_byLogLevel;
bool CPreferences::m_bTrustEveryHash;
CPreferences::CPreferences()
{
#ifdef _DEBUG
m_iDbgHeap = 1;
#endif
}
CPreferences::~CPreferences()
{
delete prefsExt;
}
void CPreferences::Init()
{
srand((uint32)time(0)); // we need random numbers sometimes
prefsExt = new Preferences_Ext_Struct;
memset(prefsExt, 0, sizeof *prefsExt);
//get application start directory
TCHAR buffer[490];
::GetModuleFileName(0, buffer, 490);
LPTSTR pszFileName = _tcsrchr(buffer, _T('\\')) + 1;
*pszFileName = _T('\0');
appdir = buffer;
configdir = appdir + CONFIGFOLDER;
m_strWebServerDir = appdir + _T("webserver\\");
m_strLangDir = appdir + _T("lang\\");
m_strFileCommentsFilePath = configdir + _T("fileinfo.ini");
::CreateDirectory(GetConfigDir(), 0);
// lets move config-files in the appdir to the configdir (for upgraders <0.29a to >=0.29a )
if ( PathFileExists(appdir+_T("preferences.ini"))) MoveFile(appdir+_T("preferences.ini"),configdir+_T("preferences.ini"));
if ( PathFileExists(appdir+_T("preferences.dat"))) MoveFile(appdir+_T("preferences.dat"),configdir+_T("preferences.dat"));
if ( PathFileExists(appdir+_T("adresses.dat"))) MoveFile(appdir+_T("adresses.dat"),configdir+_T("adresses.dat"));
if ( PathFileExists(appdir+_T("Category.ini"))) MoveFile(appdir+_T("Category.ini"),configdir+_T("Category.ini"));
if ( PathFileExists(appdir+_T("clients.met"))) MoveFile(appdir+_T("clients.met"),configdir+_T("clients.met"));
if ( PathFileExists(appdir+_T("emfriends.met"))) MoveFile(appdir+_T("emfriends.met"),configdir+_T("emfriends.met"));
if ( PathFileExists(appdir+_T("fileinfo.ini"))) MoveFile(appdir+_T("fileinfo.ini"),configdir+_T("fileinfo.ini"));
if ( PathFileExists(appdir+_T("ipfilter.dat"))) MoveFile(appdir+_T("ipfilter.dat"),configdir+_T("ipfilter.dat"));
if ( PathFileExists(appdir+_T("known.met"))) MoveFile(appdir+_T("known.met"),configdir+_T("known.met"));
if ( PathFileExists(appdir+_T("server.met"))) MoveFile(appdir+_T("server.met"),configdir+_T("server.met"));
if ( PathFileExists(appdir+_T("shareddir.dat"))) MoveFile(appdir+_T("shareddir.dat"),configdir+_T("shareddir.dat"));
if ( PathFileExists(appdir+_T("staticservers.dat"))) MoveFile(appdir+_T("staticservers.dat"),configdir+_T("staticservers.dat"));
if ( PathFileExists(appdir+_T("webservices.dat"))) MoveFile(appdir+_T("webservices.dat"),configdir+_T("webservices.dat"));
CreateUserHash();
// load preferences.dat or set standart values
TCHAR* fullpath = new TCHAR[_tcslen(configdir)+16];
_stprintf(fullpath,_T("%spreferences.dat"),configdir);
FILE* preffile = _tfsopen(fullpath,_T("rb"), _SH_DENYWR);
delete[] fullpath;
LoadPreferences();
if (!preffile){
SetStandartValues();
}
else{
fread(prefsExt,sizeof(Preferences_Ext_Struct),1,preffile);
if (ferror(preffile))
SetStandartValues();
// import old pref-files
if (prefsExt->version<20) {
if (prefsExt->version>17) {// v0.20b+
Preferences_Import20b_Struct* prefsImport20b;
prefsImport20b=new Preferences_Import20b_Struct;
memset(prefsImport20b,0,sizeof(Preferences_Import20b_Struct));
fseek(preffile,0,0);
fread(prefsImport20b,sizeof(Preferences_Import20b_Struct),1,preffile);
md4cpy(userhash, prefsImport20b->userhash);
memcpy(incomingdir, prefsImport20b->incomingdir, 510);
memcpy(tempdir, prefsImport20b->tempdir, 510);
strNick = prefsImport20b->nick;
totalDownloadedBytes=prefsImport20b->totalDownloadedBytes;
totalUploadedBytes=prefsImport20b->totalUploadedBytes;
delete prefsImport20b;
} else if (prefsExt->version>7) { // v0.20a
Preferences_Import20a_Struct* prefsImport20a;
prefsImport20a=new Preferences_Import20a_Struct;
memset(prefsImport20a,0,sizeof(Preferences_Import20a_Struct));
fseek(preffile,0,0);
fread(prefsImport20a,sizeof(Preferences_Import20a_Struct),1,preffile);
md4cpy(userhash, prefsImport20a->userhash);
memcpy(incomingdir, prefsImport20a->incomingdir, 510);
memcpy(tempdir, prefsImport20a->tempdir, 510);
strNick = prefsImport20a->nick;
totalDownloadedBytes=prefsImport20a->totalDownloaded;
totalUploadedBytes=prefsImport20a->totalUploaded;
delete prefsImport20a;
} else { //v0.19c-
Preferences_Import19c_Struct* prefsImport19c;
prefsImport19c=new Preferences_Import19c_Struct;
memset(prefsImport19c,0,sizeof(Preferences_Import19c_Struct));
fseek(preffile,0,0);
fread(prefsImport19c,sizeof(Preferences_Import19c_Struct),1,preffile);
if (prefsExt->version < 3)
CreateUserHash();
else
md4cpy(userhash, prefsImport19c->userhash);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -