📄 wxcascte.cpp
字号:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Name: wxCasCte Structure////// Purpose: Store constants used in wxCas application////// Author: ThePolish <thepolish@vipmail.ru>////// Copyright (C) 2004 by ThePolish////// Derived from CAS by Pedro de Oliveira <falso@rdk.homeip.net>////// Pixmats from aMule http://www.amule.org////// 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.,/// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// For compilers that support precompilation#ifdef __BORLANDC__#pragma hdrstop#endif#include <wx/filename.h>#ifdef __WXMAC__ #include <CoreServices/CoreServices.h> // Do_not_auto_remove #include <wx/mac/corefoundation/cfstring.h> // Do_not_auto_remove #include <wx/intl.h> // Do_not_auto_remove#elif defined(__WXMSW__) #include <winerror.h> // Do_not_auto_remove #include <shlobj.h> // Do_not_auto_remove#endif#include "wxcascte.h"const wxStringWxCasCte::AMULESIG_FILENAME ( wxT( "amulesig.dat" ) );const wxStringWxCasCte::AMULESIG_IMG_NAME ( wxT( "aMule-online-sign" ) );// Refresh rate limitsconst wxUint32WxCasCte::MIN_REFRESH_RATE = 1;const wxUint32WxCasCte::MAX_REFRESH_RATE = 3600;// FTP update limitsconst wxUint32WxCasCte::MIN_FTP_RATE = 1;const wxUint32WxCasCte::MAX_FTP_RATE = 1440;// Key config namesconst wxStringWxCasCte::AMULESIG_PATH_KEY ( wxT( "OSDirectory" ) );const wxStringWxCasCte::REFRESH_RATE_KEY ( wxT( "RefreshRate" ) );const wxStringWxCasCte::ENABLE_AUTOSTATIMG_KEY ( wxT( "EnableAutoStatImg" ) );const wxStringWxCasCte::AUTOSTATIMG_DIR_KEY ( wxT( "StatImgDirectory" ) );const wxStringWxCasCte::AUTOSTATIMG_TYPE_KEY ( wxT( "StatImgType" ) );const wxStringWxCasCte::ENABLE_FTP_UPDATE_KEY( wxT( "EnableFtpUpdate" ) );const wxStringWxCasCte::FTP_UPDATE_RATE_KEY ( wxT( "FtpUpdateRate" ) );const wxStringWxCasCte::FTP_URL_KEY ( wxT( "FtpUrl" ) );const wxStringWxCasCte::FTP_PATH_KEY ( wxT( "FtpPath" ) );const wxStringWxCasCte::FTP_USER_KEY ( wxT( "FtpUser" ) );const wxStringWxCasCte::FTP_PASSWD_KEY ( wxT( "FtpPasswd" ) );const wxStringWxCasCte::ABSOLUTE_MAX_DL_KEY ( wxT( "AbsoluteMaxDL" ) );const wxStringWxCasCte::ABSOLUTE_MAX_DL_DATE_KEY ( wxT( "AbsoluteMaxDlDate" ) );// Default config parametersconst wxStringWxCasCte::DEFAULT_AMULESIG_PATH ( GetDefaultAmulesigPath() );const wxUint32WxCasCte::DEFAULT_REFRESH_RATE = 5;const boolWxCasCte::DEFAULT_AUTOSTATIMG_ISENABLED = FALSE;const wxStringWxCasCte::DEFAULT_AUTOSTATIMG_PATH ( wxFileName::GetHomeDir () );const wxStringWxCasCte::DEFAULT_AUTOSTATIMG_TYPE ( wxT( "PNG" ) );const boolWxCasCte::DEFAULT_FTP_UPDATE_ISENABLED = FALSE;const wxUint32WxCasCte::DEFAULT_FTP_UPDATE_RATE = 10;const wxStringWxCasCte::DEFAULT_FTP_URL( wxT( "ftp.myftp.cx" ) );const wxStringWxCasCte::DEFAULT_FTP_PATH( wxT( "/pub/myamuledir" ) );const wxStringWxCasCte::DEFAULT_FTP_USER( wxT( "anonymous" ) );const wxStringWxCasCte::DEFAULT_FTP_PASSWD( wxT( "whiterabit@here" ) );wxString GetDefaultAmulesigPath(){ wxString strDir;#ifdef __WXMAC__ FSRef fsRef; if (FSFindFolder(kUserDomain, kApplicationSupportFolderType, kCreateFolder, &fsRef) == noErr) { CFURLRef urlRef = CFURLCreateFromFSRef(NULL, &fsRef); CFStringRef cfString = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle); CFRelease(urlRef) ; strDir = wxMacCFStringHolder(cfString).AsString(wxLocale::GetSystemEncoding()) + wxFileName::GetPathSeparator() + wxT("aMule"); }#elif defined(__WXMSW__) LPITEMIDLIST pidl; HRESULT hr = SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidl); if (SUCCEEDED(hr)) { if (!SHGetPathFromIDList(pidl, wxStringBuffer(strDir, MAX_PATH))) { strDir = wxEmptyString; } else { strDir = strDir + wxFileName::GetPathSeparator() + wxT("aMule"); } } if (pidl) { LPMALLOC pMalloc; SHGetMalloc(&pMalloc); if (pMalloc) { pMalloc->Free(pidl); pMalloc->Release(); } }#else strDir = wxFileName::GetHomeDir() + wxFileName::GetPathSeparator() + wxT(".aMule");#endif return strDir;}// File_checked_for_headers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -