00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "StdAfx.h"
00023 #include "Shareaza.h"
00024 #include "Settings.h"
00025 #include "Library.h"
00026 #include "SharedFolder.h"
00027 #include "SharedFile.h"
00028 #include "ShellIcons.h"
00029 #include "PageFileGeneral.h"
00030
00031 #include "SHA.h"
00032 #include "TigerTree.h"
00033 #include "MD5.h"
00034 #include "ED2K.h"
00035
00036 #ifdef _DEBUG
00037 #define new DEBUG_NEW
00038 #undef THIS_FILE
00039 static char THIS_FILE[] = __FILE__;
00040 #endif
00041
00042 IMPLEMENT_DYNCREATE(CFileGeneralPage, CFilePropertiesPage)
00043
00044 BEGIN_MESSAGE_MAP(CFileGeneralPage, CFilePropertiesPage)
00045
00046 ON_WM_PAINT()
00047
00048 END_MESSAGE_MAP()
00049
00050
00052
00053
00054 CFileGeneralPage::CFileGeneralPage() : CFilePropertiesPage( CFileGeneralPage::IDD )
00055 {
00056
00057 m_sSHA1 = _T("");
00058 m_sTiger = _T("");
00059 m_sType = _T("");
00060 m_sSize = _T("");
00061 m_sPath = _T("");
00062 m_sModified = _T("");
00063 m_sIndex = _T("");
00064 m_sMD5 = _T("");
00065 m_sED2K = _T("");
00066
00067 }
00068
00069 CFileGeneralPage::~CFileGeneralPage()
00070 {
00071 }
00072
00073 void CFileGeneralPage::DoDataExchange(CDataExchange* pDX)
00074 {
00075 CFilePropertiesPage::DoDataExchange(pDX);
00076
00077 DDX_Text(pDX, IDC_FILE_SHA1, m_sSHA1);
00078 DDX_Text(pDX, IDC_FILE_TIGER, m_sTiger);
00079 DDX_Text(pDX, IDC_FILE_TYPE, m_sType);
00080 DDX_Text(pDX, IDC_FILE_SIZE, m_sSize);
00081 DDX_Text(pDX, IDC_FILE_PATH, m_sPath);
00082 DDX_Text(pDX, IDC_FILE_MODIFIED, m_sModified);
00083 DDX_Text(pDX, IDC_FILE_INDEX, m_sIndex);
00084 DDX_Text(pDX, IDC_FILE_MD5, m_sMD5);
00085 DDX_Text(pDX, IDC_FILE_ED2K, m_sED2K);
00086
00087 }
00088
00090
00091
00092 BOOL CFileGeneralPage::OnInitDialog()
00093 {
00094 CFilePropertiesPage::OnInitDialog();
00095
00096 {
00097 CQuickLock oLock( Library.m_pSection );
00098 CLibraryFile* pFile = GetFile();
00099 if ( ! pFile ) return TRUE;
00100
00101 if ( pFile->m_pFolder != NULL ) m_sPath = pFile->m_pFolder->m_sPath;
00102 m_sSize = Settings.SmartVolume( pFile->GetSize(), FALSE );
00103 m_sType = ShellIcons.GetTypeString( pFile->m_sName );
00104 m_sIndex.Format( _T("# %lu"), pFile->m_nIndex );
00105
00106 if ( pFile->m_bSHA1 )
00107 {
00108 m_sSHA1 = _T("sha1:") + CSHA::HashToString( &pFile->m_pSHA1 );
00109 }
00110 else
00111 {
00112 LoadString(m_sSHA1, IDS_GENERAL_NOURNAVAILABLE );
00113 }
00114
00115 if ( pFile->m_bTiger )
00116 {
00117 m_sTiger = _T("tree:tiger/:") + CTigerNode::HashToString( &pFile->m_pTiger );
00118 }
00119 else
00120 {
00121 m_sTiger.Empty();
00122 }
00123
00124 if ( pFile->m_bMD5 )
00125 {
00126 m_sMD5 = _T("md5:") + CMD5::HashToString( &pFile->m_pMD5 );
00127 }
00128 else
00129 {
00130 m_sMD5.Empty();
00131 }
00132
00133 if ( pFile->m_bED2K )
00134 {
00135 m_sED2K = _T("ed2k:") + CED2K::HashToString( &pFile->m_pED2K );
00136 }
00137 else
00138 {
00139 m_sED2K.Empty();
00140 }
00141
00142 CString strDate, strTime;
00143 SYSTEMTIME pTime;
00144
00145 FileTimeToSystemTime( &pFile->m_pTime, &pTime );
00146 SystemTimeToTzSpecificLocalTime( NULL, &pTime, &pTime );
00147
00148 GetDateFormat( LOCALE_USER_DEFAULT, DATE_LONGDATE, &pTime, NULL, strDate.GetBuffer( 64 ), 64 );
00149 GetTimeFormat( LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT, &pTime, NULL, strTime.GetBuffer( 64 ), 64 );
00150 strDate.ReleaseBuffer(); strTime.ReleaseBuffer();
00151
00152 m_sModified = strDate + _T(", ") + strTime;
00153 }
00154
00155 UpdateData( FALSE );
00156
00157 return TRUE;
00158 }
00159
00160 void CFileGeneralPage::OnOK()
00161 {
00162 UpdateData();
00163
00164
00165
00166 CFilePropertiesPage::OnOK();
00167 }
00168