Exemple #1
0
//###########################################
CPAGE_FUNC(Bool32)  CPAGE_DeleteAll()
{
	CPAGE_CONVERTOR ConvertorPages = {0,DefConvertPage}; // Piter
	PROLOG;
	Bool32 rc = TRUE;
	Page.Clear();
	NameData.Clear();
	SetConvertorPages(ConvertorPages); // Piter
	hCurPage = NULL;
	EPILOG;
	return rc;
}
Exemple #2
0
//###########################################
CPAGE_FUNC(Handle)  CPAGE_RestorePage(Bool32 remove,char * lpName)
{
	PROLOG;
	Handle rc = NULL;
	Bool decompress=FALSE;

	SetReturnCode_cpage(IDS_ERR_NO);

	Handle file = myOpenRestore((char *)lpName);
	if(file)
	{
		int i;
		int count;

		uint32_t vers = 0;
		if(myRead(file,&vers,sizeof(vers))==sizeof(vers))
		{
			if (vers==VERSION_FILE_COMPRESSED)
			   decompress=TRUE;
			else
				if(vers!=VERSION_FILE)
				{
					SetReturnCode_cpage(IDS_ERR_OLDFILEVERSION);
					myClose(file);
					return FALSE;
				}
			{
				if(remove)
				{
					Page.Clear();
					NameData.Clear();
				}

				if(myRead(file,&count,sizeof(count))==sizeof(count))
					for(i=0;i<count ;i++)
					{
						BACKUPPAGE page;
						if(decompress ? page.RestoreCompress(file) : page.Restore(file))
							rc = Page.AddTail(page);
						else
							break;
					}
			}
		}
		myClose(file);
	}
	EPILOG;
return rc;
}