📄 statisticsdlg.cpp
字号:
if ( PortDataTotal!=0 && PortDataDefault!=0 )
percentPortTransferred = (double) 100 * PortDataDefault / PortDataTotal;
cbuffer.Format( _T("%s: %s (%1.1f%%)") , GetResString(IDS_STATS_PRTDEF) , CastItoXBytes( PortDataDefault ) , percentPortTransferred);
stattree.SetItemText( down_spb[i] , cbuffer ); i++;
if ( PortDataTotal!=0 && PortDataOther!=0 )
percentPortTransferred = (double) 100 * PortDataOther / PortDataTotal;
else
percentPortTransferred = 0;
cbuffer.Format( _T("%s: %s (%1.1f%%)") , GetResString(IDS_STATS_PRTOTHER) , CastItoXBytes( PortDataOther ) , percentPortTransferred);
stattree.SetItemText( down_spb[i] , cbuffer ); i++;
}
}
// Completed Downloads
cbuffer.Format( _T("%s: %u") , GetResString( IDS_STATS_COMPDL ) , thePrefs.GetDownSessionCompletedFiles() );
stattree.SetItemText( down_S[1] , cbuffer );
// Active Downloads
cbuffer.Format( GetResString( IDS_STATS_ACTDL ) , myStats.a[1] );
stattree.SetItemText( down_S[2] , cbuffer );
// Found Sources
cbuffer.Format( GetResString( IDS_STATS_FOUNDSRC ) , myStats.a[0] );
stattree.SetItemText( down_S[3] , cbuffer );
if (forceUpdate || stattree.IsExpanded(down_S[3])) {
int i = 0;
// Sources By Status
cbuffer.Format( _T("%s: %u") , GetResString( IDS_ONQUEUE ) , myStats.a[2] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format( _T("%s: %u") , GetResString( IDS_QUEUEFULL ) , myStats.a[3] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format( _T("%s: %u") , GetResString( IDS_NONEEDEDPARTS ) , myStats.a[4] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format( _T("%s: %u") , GetResString( IDS_ASKING ) , myStats.a[5] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format( _T("%s: %u") , GetResString( IDS_RECHASHSET ) , myStats.a[6] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format( _T("%s: %u") , GetResString( IDS_CONNECTING ) , myStats.a[7] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format( _T("%s: %u") , GetResString(IDS_CONNVIASERVER) , myStats.a[8] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format( _T("%s: %u") , GetResString(IDS_TOOMANYCONNS) , myStats.a[9] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format( _T("%s: %u") , GetResString(IDS_NOCONNECTLOW2LOW) , myStats.a[10] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format( _T("%s: %u") , GetResString(IDS_STATS_PROBLEMATIC) , myStats.a[12] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format( _T("%s: %u") , GetResString(IDS_BANNED) , myStats.a[13] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format( _T("%s: %u") , GetResString(IDS_ASKED4ANOTHERFILE) , myStats.a[15] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format( _T("%s: %u") , GetResString(IDS_UNKNOWN) , myStats.a[11] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
// where from? (3)
cbuffer.Format( _T("%s: %u") , GetResString( IDS_VIAED2KSQ ) , myStats.a[16] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format( _T("%s: %u") , GetResString( IDS_VIAKAD ) , myStats.a[17] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format( _T("%s: %u") , GetResString( IDS_VIASE ) , myStats.a[18] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format( _T("%s: %u") , GetResString( IDS_VIAPASSIVE ) , myStats.a[14] );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
cbuffer.Format(_T("%s: %s, %s: %s (%.1f%%)"), GetResString(IDS_UDPREASKS), CastItoIShort(theApp.downloadqueue->GetUDPFileReasks()), GetResString(IDS_UFAILED), CastItoIShort(theApp.downloadqueue->GetFailedUDPFileReasks()), theApp.downloadqueue->GetUDPFileReasks() ? (theApp.downloadqueue->GetFailedUDPFileReasks() * 100.0 / theApp.downloadqueue->GetUDPFileReasks()) : 0.0 );
stattree.SetItemText( down_sources[i] , cbuffer ); i++;
}
// Set Download Sessions
statGoodSessions = thePrefs.GetDownS_SuccessfulSessions() + myStats.a[1]; // Add Active Downloads
statBadSessions = thePrefs.GetDownS_FailedSessions();
cbuffer.Format( _T("%s: %u") , GetResString(IDS_STATS_DLSES) , statGoodSessions + statBadSessions );
stattree.SetItemText( down_S[4] , cbuffer );
if (forceUpdate || stattree.IsExpanded(down_S[4])) {
// Set Successful Download Sessions and Average Downloaded Per Session
percentSessions = 0;
if (statGoodSessions > 0) {
percentSessions = (double) 100 * statGoodSessions / (statGoodSessions + statBadSessions);
cbuffer.Format( _T("%s: %s") , GetResString(IDS_STATS_AVGDATADLSES) , CastItoXBytes( (uint64) theApp.stat_sessionReceivedBytes / statGoodSessions ) ); }
else cbuffer.Format( _T("%s: %s") , GetResString(IDS_STATS_AVGDATADLSES) , CastItoXBytes(0) );
stattree.SetItemText( down_ssessions[2] , cbuffer ); // Set Avg DL/Session
cbuffer.Format( _T("%s: %u (%1.1f%%)") , GetResString(IDS_STATS_SDLSES) , statGoodSessions , percentSessions );
stattree.SetItemText( down_ssessions[0] , cbuffer ); // Set Succ Sessions
// Set Failed Download Sessions (Avoid Division)
if (percentSessions != 0 && statBadSessions > 0) percentSessions = 100 - percentSessions; // There were some good sessions and bad ones...
else if (percentSessions == 0 && statBadSessions > 0) percentSessions = 100; // There were bad sessions and no good ones, must be 100%
else percentSessions = 0; // No sessions at all, or no bad ones.
cbuffer.Format( _T("%s: %u (%1.1f%%)") , GetResString(IDS_STATS_FDLSES) , statBadSessions , percentSessions );
stattree.SetItemText( down_ssessions[1] , cbuffer );
// Set Average Download Time
cbuffer.Format(_T("%s: %s"), GetResString(IDS_STATS_AVGDLTIME), CastSecondsToLngHM(thePrefs.GetDownS_AvgTime()));
stattree.SetItemText( down_ssessions[3] , cbuffer );
}
// Set Gain Due To Compression
cbuffer.Format(GetResString(IDS_STATS_GAINCOMP) + _T(" (%.1f%%)"), CastItoXBytes(thePrefs.GetSesSavedFromCompression()), theApp.stat_sessionReceivedBytes!=0 ? (thePrefs.GetSesSavedFromCompression() * 100.0 / theApp.stat_sessionReceivedBytes) : 0.0);
stattree.SetItemText( down_S[5] , cbuffer );
// Set Lost Due To Corruption
cbuffer.Format(GetResString(IDS_STATS_LOSTCORRUPT) + _T(" (%.1f%%)"), CastItoXBytes(thePrefs.GetSesLostFromCorruption()), theApp.stat_sessionReceivedBytes!=0 ? (thePrefs.GetSesLostFromCorruption() * 100.0 / theApp.stat_sessionReceivedBytes) : 0.0);
stattree.SetItemText( down_S[6] , cbuffer );
// Set Parts Saved Due To ICH
cbuffer.Format(GetResString(IDS_STATS_ICHSAVED), thePrefs.GetSesPartsSavedByICH());
stattree.SetItemText( down_S[7] , cbuffer );
// Calculate downline OH totals
DownOHTotal = theStats.GetDownDataOverheadFileRequest() +
theStats.GetDownDataOverheadSourceExchange() +
theStats.GetDownDataOverheadServer() +
theStats.GetDownDataOverheadKad() +
theStats.GetDownDataOverheadOther();
DownOHTotalPackets =
theStats.GetDownDataOverheadFileRequestPackets() +
theStats.GetDownDataOverheadSourceExchangePackets() +
theStats.GetDownDataOverheadServerPackets() +
theStats.GetDownDataOverheadKadPackets() +
theStats.GetDownDataOverheadOtherPackets();
// Downline Overhead
cbuffer.Format( GetResString( IDS_TOVERHEAD ) , CastItoXBytes( DownOHTotal ) , CastItoIShort( DownOHTotalPackets ) );
stattree.SetItemText( hdown_soh , cbuffer );
if (forceUpdate || stattree.IsExpanded(hdown_soh)) {
int i = 0;
// Set down session file req OH
cbuffer.Format( GetResString( IDS_FROVERHEAD ) , CastItoXBytes( theStats.GetDownDataOverheadFileRequest() ) , CastItoIShort( theStats.GetDownDataOverheadFileRequestPackets() ) );
stattree.SetItemText( down_soh[i] , cbuffer ); i++;
// Set down session source exch OH
cbuffer.Format( GetResString( IDS_SSOVERHEAD ) , CastItoXBytes( theStats.GetDownDataOverheadSourceExchange() ), CastItoIShort( theStats.GetDownDataOverheadSourceExchangePackets() ) );
stattree.SetItemText( down_soh[i] , cbuffer ); i++;
// Set down session server OH
cbuffer.Format(GetResString(IDS_SOVERHEAD),
CastItoXBytes(theStats.GetDownDataOverheadServer()),
CastItoIShort(theStats.GetDownDataOverheadServerPackets()));
stattree.SetItemText( down_soh[i] , cbuffer ); i++;
// Set down session Kad OH
cbuffer.Format(GetResString(IDS_KADOVERHEAD),
CastItoXBytes(theStats.GetDownDataOverheadKad()),
CastItoIShort(theStats.GetDownDataOverheadKadPackets()));
stattree.SetItemText( down_soh[i] , cbuffer ); i++;
}
}
// TRANSFER -> DOWNLOADS -> CUMULATIVE SECTION
if (forceUpdate || stattree.IsExpanded(h_down_total)) {
// Downloaded Data
uint64 ullCumReceived = theApp.stat_sessionReceivedBytes + thePrefs.GetTotalDownloaded();
cbuffer.Format(GetResString(IDS_STATS_DDATA), CastItoXBytes(ullCumReceived));
stattree.SetItemText(down_T[0], cbuffer);
if (forceUpdate || stattree.IsExpanded(down_T[0])) {
// Downloaded Data By Client
if (forceUpdate || stattree.IsExpanded(hdown_tcb)) {
int i = 0;
uint64 DownDataTotal = thePrefs.GetDownTotalClientData();
uint64 DownDataClient = thePrefs.GetCumDownData_EMULE();
double percentClientTransferred = 0;
if ( DownDataTotal!=0 && DownDataClient!=0 )
percentClientTransferred = (double) 100 * DownDataClient / DownDataTotal;
cbuffer.Format( _T("eMule: %s (%1.1f%%)") , CastItoXBytes( DownDataClient ) , percentClientTransferred);
stattree.SetItemText( down_tcb[i] , cbuffer ); i++;
DownDataClient = thePrefs.GetCumDownData_EDONKEYHYBRID();
if ( DownDataTotal!=0 && DownDataClient!=0 )
percentClientTransferred = (double) 100 * DownDataClient / DownDataTotal;
else
percentClientTransferred = 0;
cbuffer.Format( _T("eD Hybrid: %s (%1.1f%%)") , CastItoXBytes( DownDataClient ) , percentClientTransferred );
stattree.SetItemText( down_tcb[i] , cbuffer ); i++;
DownDataClient = thePrefs.GetCumDownData_EDONKEY();
if ( DownDataTotal!=0 && DownDataClient!=0 )
percentClientTransferred = (double) 100 * DownDataClient / DownDataTotal;
else
percentClientTransferred = 0;
cbuffer.Format( _T("eDonkey: %s (%1.1f%%)") , CastItoXBytes( DownDataClient ), percentClientTransferred );
stattree.SetItemText( down_tcb[i] , cbuffer ); i++;
DownDataClient = thePrefs.GetCumDownData_AMULE();
if ( DownDataTotal!=0 && DownDataClient!=0 )
percentClientTransferred = (double) 100 * DownDataClient / DownDataTotal;
else
percentClientTransferred = 0;
cbuffer.Format( _T("aMule: %s (%1.1f%%)") , CastItoXBytes( DownDataClient ), percentClientTransferred );
stattree.SetItemText( down_tcb[i] , cbuffer ); i++;
DownDataClient = thePrefs.GetCumDownData_MLDONKEY();
if ( DownDataTotal!=0 && DownDataClient!=0 )
percentClientTransferred = (double) 100 * DownDataClient / DownDataTotal;
else
percentClientTransferred = 0;
cbuffer.Format( _T("MLdonkey: %s (%1.1f%%)") , CastItoXBytes( DownDataClient ), percentClientTransferred );
stattree.SetItemText( down_tcb[i] , cbuffer ); i++;
DownDataClient = thePrefs.GetCumDownData_SHAREAZA();
if ( DownDataTotal!=0 && DownDataClient!=0 )
percentClientTransferred = (double) 100 * DownDataClient / DownDataTotal;
else
percentClientTransferred = 0;
cbuffer.Format( _T("Shareaza: %s (%1.1f%%)") , CastItoXBytes( DownDataClient ), percentClientTransferred );
stattree.SetItemText( down_tcb[i] , cbuffer ); i++;
DownDataClient = thePrefs.GetCumDownData_EMULECOMPAT();
if ( DownDataTotal!=0 && DownDataClient!=0 )
percentClientTransferred = (double) 100 * DownDataClient / DownDataTotal;
else
percentClientTransferred = 0;
cbuffer.Format( _T("eM Compat: %s (%1.1f%%)") , CastItoXBytes( DownDataClient ), percentClientTransferred );
stattree.SetItemText( down_tcb[i] , cbuffer ); i++;
DownDataClient = thePrefs.GetCumDownData_URL();
if ( DownDataTotal!=0 && DownDataClient!=0 )
percentClientTransferred = (double) 100 * DownDataClient / DownDataTotal;
else
percentClientTransferred = 0;
cbuffer.Format( _T("URL: %s (%1.1f%%)") , CastItoXBytes( DownDataClient ), percentClientTransferred );
stattree.SetItemText( down_tcb[i] , cbuffer ); i++;
}
// Downloaded Data By Port
if (forceUpdate || stattree.IsExpanded(hdown_tpb)) {
int i = 0;
uint64 PortDataDefault = thePrefs.GetCumDownDataPort_4662();
uint64 PortDataOther = thePrefs.GetCumDownDataPort_OTHER();
uint64 PortDataTotal = thePrefs.GetDownTotalPortData();
double percentPortTransferred = 0;
if ( PortDataTotal!=0 && PortDataDefault!=0 )
percentPortTransferred = (double) 100 * PortDataDefault / PortDataTotal;
cbuffer.Format( _T("%s: %s (%1.1f%%)") , GetResString(IDS_STATS_PRTDEF) , CastItoXBytes( PortDataDefault ) , percentPortTransferred);
stattree.SetItemText( down_tpb[i] , cbuffer ); i++;
if ( PortDataTotal!=0 && PortDataOther!=0 )
percentPortTransferred = (double) 100 * PortDataOther / PortDataTotal;
else
percentPortTransferred = 0;
cbuffer.Format( _T("%s: %s (%1.1f%%)") , GetResString(IDS_STATS_PRTOTHER), CastItoXBytes( PortDataOther ) , percentPortTransferred);
stattree.SetItemText( down_tpb[i] , cbuffer ); i++;
}
}
// Set Cum Completed Downloads
cbuffer.Format(_T("%s: %u"), GetResString(IDS_STATS_COMPDL), thePrefs.GetDownCompletedFiles() );
stattree.SetItemText(down_T[1], cbuffer);
// Set Cum Download Sessions
statGoodSessions = thePrefs.GetDownC_SuccessfulSessions() + myStats.a[1]; // Need to reset these from the session section. Declared up there.
statBadSessions = thePrefs.GetDownC_FailedSessions(); // ^^^^^^^^^^^^^^
cbuffer.Format(_T("%s: %u"), GetResString(IDS_STATS_DLSES), statGoodSessions+statBadSessions );
stattree.SetItemText(down_T[2], cbuffer);
if (forceUpdate || stattree.IsExpanded(down_T[2])) {
// Set Cum Successful Download Sessions & Cum Average Download Per Sessions (Save an if-else statement)
if (statGoodSessions > 0) {
percentSessions = (double) 100 * statGoodSessions / (statGoodSessions + statBadSessions);
cbuffer.Format( _T("%s: %s") , GetResString(IDS_STATS_AVGDATADLSES), CastItoXBytes(ullCumReceived / statGoodSessions));
}
else {
percentSessions = 0;
cbuffer.Format( _T("%s: %s") , GetResString(IDS_STATS_AVGDATADLSES) , CastItoXBytes(0) );
}
stattree.SetItemText( down_tsessions[2] , cbuffer ); // Set Avg DL/Session
cbuffer.Format( _T("%s: %u (%1.1f%%)"), GetResString(IDS_STATS_SDLSES) , statGoodSessions , percentSessions );
stattree.SetItemText( down_tsessions[0] , cbuffer ); // Set Successful Sessions
// Set Cum Failed Download Sessions
if (percentSessions != 0 && statBadSessions > 0) percentSessions = 100 - percentSessions; // There were some good sessions and bad ones...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -