// BigFileToolDlg.h : header file
//

#if !defined(AFX_BIGFILETOOLDLG_H__CED7419C_E030_11D2_BB2B_00E02921BF64__INCLUDED_)
#define AFX_BIGFILETOOLDLG_H__CED7419C_E030_11D2_BB2B_00E02921BF64__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include <afxtempl.h>
/////////////////////////////////////////////////////////////////////////////

typedef struct tdstFileInfo_
{
	char	szFileName[64];
	DWORD	dwSize;
	DWORD	dwMapNumber;
} tdstFileInfo;

typedef struct tdstMixUpInfo_
{
	POSITION xFileInfoPosition;
	DWORD	 dwOccur;
	DWORD	 dwOffSet;
	DWORD	 dwSize;
	DWORD	 dwMapNumber;
	char	*p_cFileName;
} tdstMixUpInfo;

typedef CList<tdstFileInfo*,tdstFileInfo*> CListOfFileInfo;

typedef struct tdstHeaderInfo_
{
	DWORD dwOccur;
	DWORD dwOffSet;
} tdstHeaderInfo;

typedef struct tdstBigFileInfo_
{
	DWORD dwNbMap;
	DWORD dwNbFile;
	DWORD dwNbOccur;
	DWORD dwMaxFileSize;
	DWORD dwBigHeaderSize;
	DWORD dwFirstHeaderSize;
	DWORD dwHeaderSize;
	DWORD dwHeaderStep;
	DWORD dwTotalSize;
	DWORD dwTotalSector;
} tdstBigFileInfo;
/////////////////////////////////////////////////////////////////////////////
// CBigFileToolDlg dialog
class CBigFileToolDlg : public CDialog
{
// Construction
public:
	void WriteINIFile();
	CBigFileToolDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CBigFileToolDlg)
	enum { IDD = IDD_BIGFILETOOL_DIALOG };
	CProgressCtrl	m_Ctrl_ProgressBar;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CBigFileToolDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	void UpdateStartPrg();
	void  InitWithCommandLine ();
	void  DeleteFiles (char *_szDataPath , CListOfFileInfo *_p_oList);
	void  ReadINIFile();
	BOOL  WriteFiles (char *_szDataPath , HANDLE hFile, CListOfFileInfo *_p_oFIList, tdstMixUpInfo *_a_MUITab, tdstBigFileInfo *p_stBFI);
	BOOL  WriteHeader (HANDLE hFile, CListOfFileInfo *_p_oFIList, tdstMixUpInfo *_a_MUITab, tdstBigFileInfo *p_stBFI);
	BOOL  MixUpFiles(DWORD _dwBigFileSize , CListOfFileInfo *_p_oFIList, tdstMixUpInfo **_a_MUITab, tdstBigFileInfo *p_stBFI);
	void  ReadListOfFiles(char *_szDataPath , CStringList *_p_oMapList , CListOfFileInfo *_p_oFIList);
	BOOL  Run ();
	void  OnBrowse(UINT nID);
	void  PeekAndPump();

	BOOL MixUpFilesWithExplodedHeader(DWORD _dwBigFileSize , CListOfFileInfo *_p_oFIList , tdstMixUpInfo **_a_MUITab, tdstBigFileInfo *p_stBFI, tdstHeaderInfo **_a_HITab);
	BOOL WriteBigFileWithExplodedHeader(char *_szDataPath , HANDLE hFile, CListOfFileInfo *_p_oFIList, tdstMixUpInfo *_a_MUITab, tdstBigFileInfo *p_stBFI, tdstHeaderInfo *_a_HITab);

	HICON m_hIcon;
	BOOL  m_bGenerateInfoFiles;
	BOOL  m_bAutoRun;
	BOOL  m_bUpdateStartPrg;
	CString m_csErrorMessage;

	// Generated message map functions
	//{{AFX_MSG(CBigFileToolDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnButtonBrowse();
	virtual void OnCancel();
	virtual void OnOK();
	afx_msg void OnButtonRun();
	afx_msg void OnButtonBrowsescript();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_BIGFILETOOLDLG_H__CED7419C_E030_11D2_BB2B_00E02921BF64__INCLUDED_)
