00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #pragma once
00023
00024 class CSettingsItem;
00025
00026 class CSettings
00027 {
00028
00029 public:
00030 CSettings();
00031 virtual ~CSettings();
00032
00033
00034 public:
00035 struct sGeneral
00036 {
00037 CString Path;
00038 CString UserPath;
00039 BOOL Debug;
00040 BOOL DebugLog;
00041 DWORD MaxDebugLogSize;
00042 BOOL UpdateCheck;
00043 DWORD DiskSpaceWarning;
00044 DWORD DiskSpaceStop;
00045 DWORD MinTransfersRest;
00046 INT GUIMode;
00047 BOOL CloseMode;
00048 BOOL TrayMinimise;
00049 BOOL VerboseMode;
00050 BOOL ShowTimestamp;
00051 BOOL SizeLists;
00052 BOOL HashIntegrity;
00053 BOOL RatesInBytes;
00054 DWORD RatesUnit;
00055 BOOL AlwaysOpenURLs;
00056 CString Language;
00057 BOOL IgnoreXPsp2;
00058 } General;
00059
00060 struct sInterface
00061 {
00062 DWORD TipDelay;
00063 DWORD TipAlpha;
00064 BOOL TipSearch;
00065 BOOL TipLibrary;
00066 BOOL TipDownloads;
00067 BOOL TipUploads;
00068 BOOL TipNeighbours;
00069 BOOL TipMedia;
00070 BOOL LowResMode;
00071 } Interface;
00072
00073 struct sLibrary
00074 {
00075 BOOL WatchFolders;
00076 BOOL PartialMatch;
00077 BOOL VirtualFiles;
00078 BOOL SourceMesh;
00079 DWORD SourceExpire;
00080 DWORD TigerHeight;
00081 DWORD QueryRouteSize;
00082 DWORD HistoryTotal;
00083 DWORD HistoryDays;
00084
00085 BOOL ShowVirtual;
00086 DWORD TreeSize;
00087 DWORD PanelSize;
00088 BOOL ShowPanel;
00089 BOOL StoreViews;
00090 BOOL ShowCoverArt;
00091 CString SchemaURI;
00092 CString FilterURI;
00093 CString SafeExecute;
00094 CString PrivateTypes;
00095 DWORD ThumbSize;
00096 CString BitziWebView;
00097 CString BitziWebSubmit;
00098 CString BitziXML;
00099 BOOL BitziOkay;
00100 BOOL HighPriorityHash;
00101 BOOL HashWindow;
00102
00103
00104 DWORD BufferSize;
00105
00106 DWORD Parallel;
00107 int LowPriorityHashing;
00108 } Library;
00109
00110 struct sSearch
00111 {
00112 CString LastSchemaURI;
00113 CString BlankSchemaURI;
00114 BOOL HideSearchPanel;
00115 BOOL SearchPanel;
00116 BOOL ExpandMatches;
00117 BOOL HighlightNew;
00118 BOOL SwitchToTransfers;
00119 BOOL SchemaTypes;
00120 BOOL ShowNames;
00121 DWORD FilterMask;
00122 CString MonitorSchemaURI;
00123 CString MonitorFilter;
00124 DWORD MonitorQueue;
00125 DWORD BrowseTreeSize;
00126 BOOL DetailPanelVisible;
00127 DWORD DetailPanelSize;
00128 DWORD MaxPreviewLength;
00129 BOOL AdultFilter;
00130 BOOL AdvancedPanel;
00131 DWORD GeneralThrottle;
00132 } Search;
00133
00134 struct sMediaPlayer
00135 {
00136 BOOL EnablePlay;
00137 BOOL EnableEnqueue;
00138 CString FileTypes;
00139 BOOL Repeat;
00140 BOOL Random;
00141 MediaZoom Zoom;
00142 double Aspect;
00143 double Volume;
00144 BOOL ListVisible;
00145 DWORD ListSize;
00146 BOOL StatusVisible;
00147 CString VisCLSID;
00148 CString VisPath;
00149 INT VisSize;
00150 } MediaPlayer;
00151
00152 struct sWeb
00153 {
00154 BOOL Magnet;
00155 BOOL Gnutella;
00156 BOOL ED2K;
00157 BOOL Piolet;
00158 BOOL Torrent;
00159 } Web;
00160
00161 struct sConnection
00162 {
00163 BOOL AutoConnect;
00164 int FirewallStatus;
00165 CString OutHost;
00166 CString InHost;
00167 DWORD InPort;
00168 BOOL InBind;
00169 DWORD InSpeed;
00170 DWORD OutSpeed;
00171 BOOL IgnoreLocalIP;
00172 BOOL IgnoreOwnIP;
00173 DWORD TimeoutConnect;
00174 DWORD TimeoutHandshake;
00175 DWORD TimeoutTraffic;
00176 DWORD SendBuffer;
00177 BOOL RequireForTransfers;
00178 BOOL AsyncIO;
00179 DWORD ConnectThrottle;
00180 BOOL DetectConnectionLoss;
00181 BOOL DetectConnectionReset;
00182 BOOL ForceConnectedState;
00183 BOOL SlowConnect;
00184 } Connection;
00185
00186 struct sBandwidth
00187 {
00188 DWORD Request;
00189 DWORD HubIn;
00190 DWORD HubOut;
00191 DWORD LeafIn;
00192 DWORD LeafOut;
00193 DWORD PeerIn;
00194 DWORD PeerOut;
00195 DWORD UdpOut;
00196 DWORD Downloads;
00197 DWORD Uploads;
00198 DWORD HubUploads;
00199 } Bandwidth;
00200
00201 struct sCommunity
00202 {
00203 BOOL ChatEnable;
00204 BOOL ChatAllNetworks;
00205 BOOL ChatFilter;
00206 BOOL ChatFilterED2K;
00207 BOOL ChatCensor;
00208 BOOL Timestamp;
00209 BOOL ServeProfile;
00210 BOOL ServeFiles;
00211 } Community;
00212
00213 struct sDiscovery
00214 {
00215 DWORD AccessThrottle;
00216 DWORD Lowpoint;
00217 DWORD FailureLimit;
00218 DWORD UpdatePeriod;
00219 DWORD DefaultUpdate;
00220 DWORD BootstrapCount;
00221 CString G2DAddress;
00222 DWORD G2DRetryAfter;
00223 int CacheCount;
00224 } Discovery;
00225
00226 struct sGnutella
00227 {
00228 DWORD ConnectFactor;
00229 BOOL DeflateHub2Hub;
00230 BOOL DeflateLeaf2Hub;
00231 BOOL DeflateHub2Leaf;
00232 DWORD MaxResults;
00233 DWORD MaxHits;
00234 DWORD HitsPerPacket;
00235 DWORD RouteCache;
00236 DWORD HostCacheSize;
00237 DWORD HostCacheView;
00238 DWORD ConnectThrottle;
00239 BOOL BlockBlankClients;
00240 BOOL SpecifyProtocol;
00241 } Gnutella;
00242
00243 struct sGnutella1
00244 {
00245 DWORD ClientMode;
00246 BOOL EnableToday;
00247 BOOL EnableAlways;
00248 int NumHubs;
00249 int NumLeafs;
00250 int NumPeers;
00251 DWORD PacketBufferSize;
00252 DWORD PacketBufferTime;
00253 DWORD DefaultTTL;
00254 DWORD SearchTTL;
00255 DWORD TranslateTTL;
00256 DWORD MaximumTTL;
00257 DWORD MaximumPacket;
00258 DWORD MaximumQuery;
00259 BOOL StrictPackets;
00260 BOOL EnableGGEP;
00261 BOOL VendorMsg;
00262 DWORD QueryThrottle;
00263 DWORD RequeryDelay;
00264 DWORD HostExpire;
00265 DWORD PingFlood;
00266 DWORD PingRate;
00267 DWORD PongCache;
00268 int PongCount;
00269 int HitQueueLimit;
00270 BOOL QueryHitUTF8;
00271 BOOL QuerySearchUTF8;
00272 } Gnutella1;
00273
00274 struct sGnutella2
00275 {
00276 DWORD ClientMode;
00277 BOOL HubVerified;
00278 BOOL EnableToday;
00279 BOOL EnableAlways;
00280 int NumHubs;
00281 int NumLeafs;
00282 int NumPeers;
00283 int PingRelayLimit;
00284 DWORD UdpMTU;
00285 DWORD UdpBuffers;
00286 DWORD UdpInFrames;
00287 DWORD UdpOutFrames;
00288 DWORD UdpGlobalThrottle;
00289 DWORD UdpOutExpire;
00290 DWORD UdpOutResend;
00291 DWORD UdpInExpire;
00292 DWORD KHLPeriod;
00293 DWORD KHLHubCount;
00294 DWORD HAWPeriod;
00295 DWORD HostCurrent;
00296 DWORD HostExpire;
00297 DWORD QueryGlobalThrottle;
00298 DWORD QueryHostThrottle;
00299 DWORD QueryHostDeadline;
00300 DWORD RequeryDelay;
00301 DWORD HubHorizonSize;
00302 DWORD QueryLimit;
00303 } Gnutella2;
00304
00305 struct seDonkey
00306 {
00307 BOOL EnableToday;
00308 BOOL EnableAlways;
00309 BOOL FastConnect;
00310 DWORD NumServers;
00311 int MaxLinks;
00312 int MaxResults;
00313 DWORD MaxShareCount;
00314 BOOL ServerWalk;
00315 DWORD StatsGlobalThrottle;
00316 DWORD QueryGlobalThrottle;
00317 DWORD StatsServerThrottle;
00318 DWORD QueryServerThrottle;
00319 DWORD QueryFileThrottle;
00320 DWORD GetSourcesThrottle;
00321 DWORD QueueRankThrottle;
00322 DWORD PacketThrottle;
00323 DWORD SourceThrottle;
00324 DWORD MetAutoQuery;
00325 BOOL LearnNewServers;
00326 BOOL LearnNewServersClient;
00327 CString ServerListURL;
00328 DWORD RequestPipe;
00329 DWORD RequestSize;
00330 DWORD FrameSize;
00331 DWORD ReAskTime;
00332 DWORD DequeueTime;
00333 BOOL ExtendedRequest;
00334 BOOL MagnetSearch;
00335 DWORD MinServerFileSize;
00336 BOOL TagNames;
00337 DWORD DefaultServerFlags;
00338 BOOL Endgame;
00339 } eDonkey;
00340
00341 struct sBitTorrent
00342 {
00343 BOOL AdvancedInterface;
00344 BOOL AdvancedInterfaceSet;
00345 CString TorrentCreatorPath;
00346 CString DefaultTracker;
00347 DWORD DefaultTrackerPeriod;
00348 int MaxTrackerRetry;
00349 int TorrentCodePage;
00350 int TorrentExtraKeys;
00351 BOOL TorrentIgnoreErrors;
00352 DWORD LinkTimeout;
00353 DWORD LinkPing;
00354 DWORD RequestPipe;
00355 DWORD RequestSize;
00356 DWORD RequestLimit;
00357 DWORD RandomPeriod;
00358 DWORD SourceExchangePeriod;
00359 int UploadCount;
00360 int DownloadConnections;
00361 int DownloadTorrents;
00362 BOOL Endgame;
00363 BOOL AutoClear;
00364 DWORD ClearRatio;
00365 BOOL AutoSeed;
00366 DWORD BandwidthPercentage;
00367 BOOL TrackerKey;
00368 BOOL StandardPeerID;
00369 BOOL PreferenceBTSources;
00370 } BitTorrent;
00371
00372 struct sDownloads
00373 {
00374 CString IncompletePath;
00375 CString CompletePath;
00376 CString TorrentPath;
00377 CString CollectionPath;
00378 DWORD BufferSize;
00379 DWORD SparseThreshold;
00380 INT MaxFiles;
00381 INT MaxTransfers;
00382 INT MaxFileTransfers;
00383 INT MaxFileSearches;
00384 INT MaxConnectingSources;
00385 INT MinSources;
00386 DWORD ConnectThrottle;
00387 INT QueueLimit;
00388 DWORD SearchPeriod;
00389 DWORD StarveTimeout;
00390 DWORD StarveGiveUp;
00391 DWORD RetryDelay;
00392 DWORD PushTimeout;
00393 BOOL StaggardStart;
00394 BOOL AllowBackwards;
00395 DWORD ChunkSize;
00396 DWORD ChunkStrap;
00397 BOOL Metadata;
00398 BOOL VerifyFiles;
00399 BOOL VerifyTiger;
00400 BOOL VerifyED2K;
00401 BOOL NeverDrop;
00402 BOOL RequestHash;
00403 BOOL RequestHTTP11;
00404 BOOL RequestURLENC;
00405 DWORD SaveInterval;
00406 BOOL FlushSD;
00407 BOOL ShowSources;
00408 BOOL SimpleBar;
00409 BOOL ShowPercent;
00410 BOOL ShowGroups;
00411 BOOL AutoExpand;
00412 BOOL AutoClear;
00413 DWORD ClearDelay;
00414 DWORD FilterMask;
00415 BOOL ShowMonitorURLs;
00416 BOOL SortColumns;
00417 BOOL SortSources;
00418 int SourcesWanted;
00419 int MaxReviews;
00420 } Downloads;
00421
00422 struct sUploads
00423 {
00424 int MaxPerHost;
00425 DWORD FreeBandwidthValue;
00426 DWORD FreeBandwidthFactor;
00427 DWORD ClampdownFactor;
00428 DWORD ClampdownFloor;
00429 BOOL ThrottleMode;
00430 DWORD QueuePollMin;
00431 DWORD QueuePollMax;
00432 DWORD RotateChunkLimit;
00433 BOOL SharePartials;
00434 BOOL ShareTiger;
00435 BOOL ShareHashset;
00436 BOOL ShareMetadata;
00437 BOOL SharePreviews;
00438 BOOL DynamicPreviews;
00439 DWORD PreviewQuality;
00440 DWORD PreviewTransfers;
00441 BOOL AllowBackwards;
00442 BOOL HubUnshare;
00443 CString BlockAgents;
00444 BOOL AutoClear;
00445 DWORD ClearDelay;
00446 DWORD FilterMask;
00447 int RewardQueuePercentage;
00448 } Uploads;
00449
00450 struct sRemote
00451 {
00452 BOOL Enable;
00453 CString Username;
00454 CString Password;
00455 } Remote;
00456
00457 struct sScheduler
00458 {
00459 BOOL Enable;
00460 DWORD LimitedBandwidth;
00461 BOOL LimitedNetworks;
00462 BOOL AllowHub;
00463 } Scheduler;
00464
00465 struct sLive
00466 {
00467 BOOL DiskSpaceWarning;
00468 BOOL DiskWriteWarning;
00469 BOOL AdultWarning;
00470 BOOL QueueLimitWarning;
00471 BOOL DonkeyServerWarning;
00472 BOOL UploadLimitWarning;
00473 BOOL DiskSpaceStop;
00474 DWORD BandwidthScale;
00475 BOOL LoadWindowState;
00476 BOOL AutoClose;
00477 BOOL FirstRun;
00478 } Live;
00479
00480
00481 protected:
00482 CPtrList m_pItems;
00483 public:
00484 class Item
00485 {
00486 public:
00487 Item(LPCTSTR pszName, DWORD* pDword, DOUBLE* pFloat, CString* pString);
00488 void Load();
00489 void Save();
00490 public:
00491 CString m_sName;
00492 DWORD* m_pDword;
00493 DOUBLE* m_pFloat;
00494 CString* m_pString;
00495 };
00496
00497
00498 public:
00499 void Load();
00500 void Save(BOOL bShutdown = FALSE);
00501 Item* GetSetting(LPCTSTR pszName) const;
00502 Item* GetSetting(LPVOID pValue) const;
00503 public:
00504 BOOL LoadWindow(LPCTSTR pszName, CWnd* pWindow);
00505 void SaveWindow(LPCTSTR pszName, CWnd* pWindow);
00506 BOOL LoadList(LPCTSTR pszName, CListCtrl* pCtrl, int nSort = 0);
00507 void SaveList(LPCTSTR pszName, CListCtrl* pCtrl);
00508 CString SmartAgent();
00509 CString SmartVolume(QWORD nVolume, BOOL bInKB, BOOL bRateInBits = FALSE, BOOL bTruncate = FALSE );
00510 QWORD ParseVolume(LPCTSTR psz, BOOL bSpeedInBits);
00511 DWORD GetOutgoingBandwidth();
00512 BOOL CheckStartup();
00513 void SetStartup(BOOL bStartup);
00514 protected:
00515 void Setup();
00516 void Add(LPCTSTR pszName, DWORD* pDword, DWORD nDefault);
00517 void Add(LPCTSTR pszName, int* pDword, DWORD nDefault);
00518 void Add(LPCTSTR pszName, DOUBLE* pFloat, DOUBLE nDefault);
00519 void Add(LPCTSTR pszName, CString* pString, LPCTSTR pszDefault);
00520 void SmartUpgrade();
00521 };
00522
00523 extern CSettings Settings;
00524
00525 enum
00526 {
00527 GUI_WINDOWED, GUI_TABBED, GUI_BASIC
00528 };
00529
00530 enum
00531 {
00532 MODE_AUTO, MODE_LEAF, MODE_HUB, MODE_ULTRAPEER = MODE_HUB
00533 };
00534
00535 enum
00536 {
00537 CONNECTION_FIREWALLED, CONNECTION_OPEN, CONNECTION_AUTO
00538 };
00539
00540 #define GNUTELLA_DEFAULT_PORT 6346
00541 #define ED2K_DEFAULT_PORT 4661