Ejemplo n.º 1
0
bool rab::RollABall::ProcessData( Options const& options, Config& config, DiffEncoders const& diffEncoders, LogOutput_t& out )
{
	bool result = true;

	if( diffEncoders.Empty() )
	{
		out << "No encoders added!" << std::endl;
		return false;
	}

	out << "Building optimized regular expressions..." << std::endl;
	config.BuildRegexps();

	FolderInfo rootFolder;
	BuildFileTree( options, config, rootFolder, out );

	zip::ZipArchiveOutput zipOut;
	if( !zipOut.Open( options.packageFile, true, config.zipCompressionLevel ) )
	{
		out << "Can't open zip archive " << options.packageFile << " zip error: " << zipOut.ErrorMessage() << std::endl;
		return false;
	}

	result &= BuildTempCopies( options, config, rootFolder, zipOut, out );
	result &= BuildDiffs( options, config, diffEncoders, rootFolder, zipOut, out );
	result &= GatherSha1( options, config, rootFolder, out );

	result &= WriteRegistry( options, config, rootFolder, zipOut, out );	

	if( !zipOut.Close() )
	{
		out << "Can't close zip archive " << options.packageFile << " zip error: " << zipOut.ErrorMessage() << std::endl;
		result = false;
	}

	if( result )
		out << "Successfully done!" << std::endl;
	else
		out << "FAILED." << std::endl;

	return result;
}
Ejemplo n.º 2
0
void InitOnStart()
{
	isEditing=false;
	//读取系统块三个数据
	fseek(fpDisk,0,0);
	char flag[5];
	memset(flag,0,5);
	fread(flag,1,4,fpDisk);
	if (lstrcmpiA(flag,"u-fs"))
	{
		printf("该文件不是mini-Ufs的有效文件。\n");
		exit(0);
	}
	fread(&TotalFileNum,4,1,fpDisk);
	fread(&FirstBlankFDB,4,1,fpDisk);
	fread(&FirstBlankFCB,4,1,fpDisk);

	//读取控制块
	fseek(fpDisk,1024,0);

	IndexSpace=TotalFileNum*3>1000?TotalFileNum:1000;
	IndexSpace=IndexSpace<FCBRemainNum?IndexSpace:FCBRemainNum;

	fileIndex=(FileIndex*)malloc(IndexSpace*sizeof(FileNode));
	memset(fileIndex,0,sizeof(fileIndex));

	BuildFileTree(2,1,1);

	DeletedNum=0;
	DeletedSpace=100;

	Deleted=(int*)malloc(DeletedSpace*sizeof(int));

	int add=AddressOfBlock(2+FCBRemainNum);
	fseek(fpDisk,add,0);
	memset(FDBBitmap,0,sizeof(FDBBitmap));
	FreeFDBNum=0;
	for(int i=0;i<FDBNum/8;i++)
	{
		char tmp;
		tmp=0;
		fread(&tmp,1,1,fpDisk);
		for (int j=0;j<8;j++)
		{
			bool ifFree=(tmp&(0x01<<(7-j)))>0;
			FDBBitmap[8*i+j]=ifFree;
			if (!ifFree)
			{
				FreeFDBNum++;
			}
		}

	}
	//NowDirFid=1;
	//NowDirDirTree
	ChangeNowDirFid(1);
	memset(NowDirRoute,0,sizeof(NowDirRoute));

	strcpy(NowDirRoute,"~");
	

}