// SpanFile.cpp: implementation of the CSpanFile class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "PatchIT.h"
#include "SpanFile.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CSpanFile::CSpanFile()
{
	Buffer=NULL;
	FileSpan=NULL;
}

void CSpanFile::Load(CString fname)
{
File.Open(fname,CFile::modeRead);
if(Buffer) delete Buffer;
if(FileSpan) delete FileSpan;
Size=File.GetLength();
Buffer=new BYTE[Size];
File.Read(Buffer,Size);
FileSpan=new Span(Buffer,Size);
File.Close();
}

CString CSpanFile::SpanReport(CSpanFile &file)
{
CString str;
	str="";
	FileSpan->SpanInfo(str,Buffer,file.Buffer);
	
	return str;
}

void CSpanFile::MapFiles(CSpanFile &file,DWORD MinSize)
{
	FileSpan->MapLargestSpan(file.FileSpan,1);

	int blocksize=MinSize;
}

void CSpanFile::BuildOps(CSpanFile &file,CPatchOperation *oplist)
{
FileSpan->BuildOps(file.FileSpan,oplist,Buffer,file.Buffer);

}

CSpanFile::~CSpanFile()
{

}
