/*
 * Copyright (c) 2005-2006 Tom N Harris.
 *
 *     This program is free software; you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation; either version 2 of the License, or
 *     (at your option) any later version.
 *
 *     A copy of the GNU General Public License can be found at
 *     http://www.gnu.org/
 *
 * Written by Tom N Harris <telliamed@whoopdedo.org>.
 *
 */

#ifndef SETUP_BACKUP_H
#define SETUP_BACKUP_H

#include "win32.h"
#include "cString.h"

#include "ZipArchive.h"

namespace Setup
{

using zLib::ZipArchive;

class Backup
{
public:
	Backup(String const& name);
	~Backup();

	bool SetDest(String const& dest);
	bool AddFile(String const& fname);
	void Close(void);

	String const& GetBackupName(void)
		{ return m_filename; }
	
private:
	
	DWORD GetFileInfo(HANDLE fh, LPFILETIME mt, LPFILETIME at, LPFILETIME ct);
	void ZipFileTimes(LPFILETIME mt, LPFILETIME at, LPFILETIME ct);
	char* GetFileSD(String const& fname, unsigned long *plength);
	void ZipFileSD(char const* psd, unsigned long length);
	
	String m_prefix;
	String m_dir;
	String m_filename;

	ZipArchive* m_archive;
};

};

#endif
