1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2 /// Name: OnLineSig Class 3 /// 4 /// Purpose: Monitor aMule Online Statistics by reading amulesig.dat file 5 /// 6 /// Author: ThePolish <thepolish@vipmail.ru> 7 /// 8 /// Copyright (c) 2004-2011 ThePolish ( thepolish@vipmail.ru ) 9 /// 10 /// Derived from CAS by Pedro de Oliveira <falso@rdk.homeip.net> 11 /// 12 /// Pixmaps from aMule http://www.amule.org 13 /// 14 /// This program is free software; you can redistribute it and/or modify 15 /// it under the terms of the GNU General Public License as published by 16 /// the Free Software Foundation; either version 2 of the License, or 17 /// (at your option) any later version. 18 /// 19 /// This program is distributed in the hope that it will be useful, 20 /// but WITHOUT ANY WARRANTY; without even the implied warranty of 21 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 /// GNU General Public License for more details. 23 /// 24 /// You should have received a copy of the GNU General Public License 25 /// along with this program; if not, write to the 26 /// Free Software Foundation, Inc., 27 /// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 28 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 29 30 #ifndef _ONLINESIG_H 31 #define _ONLINESIG_H 32 33 34 #include <wx/filename.h> 35 #include <wx/datetime.h> 36 37 /// amulesig.dat file monitoring 38 class OnLineSig 39 { 40 private: 41 double m_sessionMaxDL; 42 wxDateTime m_sessionMaxDLDate; 43 bool m_isSessionMaxDlChanged; 44 bool m_isSessionMaxDlReseted; 45 46 double m_absoluteMaxDL; 47 wxDateTime m_absoluteMaxDlDate; 48 bool m_isAbsoluteMaxDlChanged; 49 bool m_isAbsoluteMaxDlReseted; 50 51 int m_amuleState; 52 wxString m_serverName; 53 wxString m_serverIP; 54 wxString m_serverPort; 55 wxString m_connexionID; 56 int m_kadInfo; 57 wxString m_ULRate; 58 wxString m_DLRate; 59 wxString m_queue; 60 wxString m_sharedFiles; 61 wxString m_user; 62 wxString m_totalUL; 63 wxString m_totalDL; 64 wxString m_version; 65 wxString m_sessionUL; 66 wxString m_sessionDL; 67 unsigned int m_runTimeS; 68 69 wxFileName m_amulesig; 70 71 wxString BytesConvertion ( const wxString& bytes ); 72 unsigned int PullCount ( unsigned int *runtime, const unsigned int count ); 73 74 75 public: 76 /// Constructor 77 OnLineSig ( const wxFileName& file, const double absoluteMaxDL = 0.0, 78 const wxDateTime absoluteMaxDlDate = wxDateTime::Now() ); 79 80 /// Destructor 81 ~OnLineSig (); 82 83 /// Set amulesig.dat file name and path 84 void SetAmuleSig ( const wxFileName& file ); 85 86 /// Refresh stored informations 87 void Refresh (); 88 89 /// Return TRUE if aMule is running 90 int GetAmuleState () const; 91 92 /// Return kad stat 93 int GetKadState () const; 94 95 /// Get server name 96 wxString GetServerName () const; 97 98 /// Get server IP 99 wxString GetServerIP () const; 100 101 /// Get server Port 102 wxString GetServerPort () const; 103 104 /// Get server connexion ID: H or L 105 wxString GetConnexionID () const; 106 107 /// Get Upload rate 108 wxString GetULRate () const; 109 110 /// Get Download rate 111 wxString GetDLRate () const; 112 113 /// Get number of clients in queue 114 wxString GetQueue () const; 115 116 /// Get number of shared files 117 wxString GetSharedFiles () const; 118 119 /// Get user name 120 wxString GetUser () const; 121 122 /// Get total Upload 123 wxString GetTotalUL () const; 124 125 /// Get total Download 126 wxString GetTotalDL () const; 127 128 /// Get aMule version 129 wxString GetVersion () const; 130 131 /// Get session Upload 132 wxString GetSessionUL () const; 133 134 /// Get session Download 135 wxString GetSessionDL () const; 136 137 /// Getrunnin Status 138 int GetUpStatus () const; 139 140 /// Get aMule runtime 141 wxString GetRunTime (); 142 143 /// Get total Upload in the best representative unit 144 wxString GetConvertedTotalUL (); 145 146 /// Get total Download in the best representative unit 147 wxString GetConvertedTotalDL (); 148 149 /// Get session Upload in the best representative unit 150 wxString GetConvertedSessionUL (); 151 152 /// Get session Download in the best representative unit 153 wxString GetConvertedSessionDL (); 154 155 /// Get server connexion ID: LowID or HighID 156 wxString GetConnexionIDType () const; 157 158 /// Get max Download rate since wxCas is running 159 double GetSessionMaxDL () const; 160 161 /// Get max Download date since wxCas is running 162 wxDateTime GetSessionMaxDlDate () const; 163 164 /// Has the Max session DL rate been beated since last refresh 165 bool IsSessionMaxDlChanged() const; 166 167 /// Reset absolute max Download rate and date 168 void ResetSessionMaxDL (); 169 170 /// Get absolute max Download rate 171 double GetAbsoluteMaxDL () const; 172 173 /// Get absolute max Download date 174 wxDateTime GetAbsoluteMaxDlDate () const; 175 176 /// Has the absolute Max session DL rate been beated since last refresh 177 bool IsAbsoluteMaxDlChanged() const; 178 179 /// Reset absolute max Download rate 180 void ResetAbsoluteMaxDL (); 181 }; 182 183 #endif /* _ONLINESIG_H */ 184 // File_checked_for_headers 185