📄 tpropertiesgeneral.cpp
字号:
/*****************************************************************************/
/* TPropertiesGeneral.cpp Copyright (c) Ladislav Zezula 2003 */
/*---------------------------------------------------------------------------*/
/* Description : */
/*---------------------------------------------------------------------------*/
/* Date Ver Who Comment */
/* -------- ---- --- ------- */
/* 09.04.03 1.00 Lad The first version of TPropertiesGeneral.cpp */
/*****************************************************************************/
#include "stdafx.h"
#include "resource.h"
#include "TPropertiesGeneral.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//-----------------------------------------------------------------------------
// TPropertiesGeneral property page
IMPLEMENT_DYNCREATE(TPropertiesGeneral, CPropertyPage)
BEGIN_MESSAGE_MAP(TPropertiesGeneral, CPropertyPage)
//{{AFX_MSG_MAP(TPropertiesGeneral)
ON_CBN_SELCHANGE(IDC_LANGUAGE, OnLanguageChange)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
TPropertiesGeneral::TPropertiesGeneral():CPropertyPage(TPropertiesGeneral::IDD)
{
m_szMpqName = NULL;
m_szFileName = NULL;
m_hMpq = NULL;
m_hFile = NULL;
m_bChanged = FALSE;
}
TPropertiesGeneral::~TPropertiesGeneral()
{}
void TPropertiesGeneral::SetInfo(const char * szMpqName, const char * szFileName, HANDLE hMpq, HANDLE hFile)
{
m_szMpqName = szMpqName;
m_szFileName = szFileName;
m_hMpq = hMpq;
m_hFile = hFile;
}
//-----------------------------------------------------------------------------
// TPropertiesGeneral message handlers
BOOL TPropertiesGeneral::OnInitDialog()
{
CComboBox * pCombo;
CButton * pButton;
CString str;
DWORD dwBlockSize = SFileGetFileInfo(m_hMpq, SFILE_INFO_BLOCK_TABLE_SIZE);
DWORD dwHashSize = SFileGetFileInfo(m_hMpq, SFILE_INFO_HASH_TABLE_SIZE);
DWORD dwFSize = SFileGetFileInfo(m_hFile, SFILE_INFO_FILE_SIZE);
DWORD dwCSize = SFileGetFileInfo(m_hFile, SFILE_INFO_COMPRESSED_SIZE);
DWORD dwFlags = SFileGetFileInfo(m_hFile, SFILE_INFO_FLAGS);
LCID lcID = SFileGetFileInfo(m_hFile, SFILE_INFO_LOCALEID);
// Call ancestor
CPropertyPage::OnInitDialog();
// Set the informations about the archive
GetDlgItem(IDC_MPQNAME)->SetWindowText(m_szMpqName);
str.Format(IDS_SIZEBYTES, SFileGetFileInfo(m_hMpq, SFILE_INFO_ARCHIVE_SIZE));
GetDlgItem(IDC_MPQSIZE)->SetWindowText(str);
str.Format(IDS_SIZEENTRIES, dwHashSize, dwHashSize);
GetDlgItem(IDC_HASHSIZE)->SetWindowText(str);
str.Format(IDS_SIZEENTRIES, dwBlockSize, dwBlockSize);
GetDlgItem(IDC_BLOCKSIZE)->SetWindowText(str);
str.Format("%u", SFileGetFileInfo(m_hMpq, SFILE_INFO_NUM_FILES));
GetDlgItem(IDC_NFILES)->SetWindowText(str);
// Set the informations about the file
GetDlgItem(IDC_FILENAME)->SetWindowText(m_szFileName);
str.Format(IDS_SIZEBYTES, dwFSize);
GetDlgItem(IDC_SIZE_ORIGINAL)->SetWindowText(str);
str.Format(IDS_SIZEBYTES, dwCSize);
GetDlgItem(IDC_SIZE_COMPRESSED)->SetWindowText(str);
str.Format("%u %%", (dwCSize * 100) / dwFSize);
GetDlgItem(IDC_RATIO)->SetWindowText(str);
pButton = (CButton *)GetDlgItem(IDC_CHECK1);
if(dwFlags & MPQ_FILE_COMPRESSED)
pButton->SetCheck(BST_CHECKED);
pButton = (CButton *)GetDlgItem(IDC_CHECK2);
if(dwFlags & MPQ_FILE_ENCRYPTED)
pButton->SetCheck(BST_CHECKED);
// Fill the combo box with locales
pCombo = (CComboBox *)GetDlgItem(IDC_LANGUAGE);
FillLocalesAndSelect(pCombo, lcID);
return TRUE;
}
void TPropertiesGeneral::OnLanguageChange()
{
CComboBox * pCombo = (CComboBox *)GetDlgItem(IDC_LANGUAGE);
// Remember that the file language has changed.
m_lcLocale = pCombo->GetItemData(pCombo->GetCurSel());
m_bChanged = TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -