示例#1
0
BOOL XsiExp::ReadConfig()
{
	TSTR filename = GetCfgFilename();
	FILE* cfgStream;

	cfgStream = fopen(filename, "rb");
	if (!cfgStream)
  {
		return FALSE;
  }

	// First item is a file version
	int fileVersion = _getw(cfgStream);

	if (fileVersion > CFG_VERSION)
  {
		// Unknown version
		fclose(cfgStream);
		return FALSE;
	}

	SetIncludeAnim(fgetc(cfgStream));
  SetIncludeVertexColors(fgetc(cfgStream));

	SetAlwaysSample(fgetc(cfgStream));
	SetMeshFrameStep(_getw(cfgStream));
	SetKeyFrameStep(_getw(cfgStream));

	SetPrecision(_getw(cfgStream));

	fclose(cfgStream);

	return TRUE;
}
示例#2
0
文件: png.cpp 项目: 2asoft/xray
void BitmapIO_PNG::WriteCfg() {
 
	TCHAR filename[MAX_PATH];
	GetCfgFilename(filename);
	
	//-- Find out buffer size
	
	DWORD size = EvaluateConfigure();
	
	if (!size)
		return;
	
	//-- Allocate Temp Buffer
	
	BYTE *buf = (BYTE *)LocalAlloc(LPTR,size);
	
	if (!buf)
		return;
	
	//-- Get Data Block and Write it
	
	if (SaveConfigure(buf)) {   
		File file(filename, _T("wb"));
		if (file.stream) {
			fwrite(buf,1,size,file.stream);
		}
	}
	
	LocalFree(buf);
	
}
示例#3
0
void XsiExp::WriteConfig()
{
	TSTR filename = GetCfgFilename();
	FILE* cfgStream;

	cfgStream = fopen(filename, "wb");
	if (!cfgStream)
  {
		return;
  }

	// Write CFG version
	_putw(CFG_VERSION,				cfgStream);

	fputc(GetIncludeAnim(),			cfgStream);
	fputc(GetIncludeVertexColors(),	cfgStream);

	fputc(GetAlwaysSample(),		cfgStream);
	_putw(GetMeshFrameStep(),		cfgStream);
	_putw(GetKeyFrameStep(),		cfgStream);

  _putw(GetPrecision(),			cfgStream);

	fclose(cfgStream);
}
示例#4
0
void BatchExporter::WriteConfig()
{
	TSTR filename = GetCfgFilename();
	FILE* cfgStream;

	cfgStream = fopen(filename, "w+");
	if (!cfgStream) return;
	fputs(rbefile, cfgStream );
	fclose(cfgStream);
}
示例#5
0
void BatchExporter::ReadConfig()
{
	TSTR filename = GetCfgFilename();
	FILE* cfgStream;

	cfgStream = fopen(filename, "r");
	if (!cfgStream) return;
	fgets(rbefile, MAX_PATH , cfgStream );
	fclose(cfgStream);
}
示例#6
0
void BitmapIO_BMP::WriteCfg() {
   TCHAR filename[MAX_PATH];
   GetCfgFilename(filename);
   BMPParams tbuf;
   tbuf = mParams;
   tbuf.saved = false;
   File file(filename, _T("wb"));
   if (file.stream) {
      fwrite(&tbuf,1,sizeof(BMPParams),file.stream);
   }
}
示例#7
0
void AscOut::WriteConfig()
{
	TSTR filename = GetCfgFilename();
	FILE* cfgStream;

	cfgStream = fopen(filename, "wb");
	if (!cfgStream)
		return;

	// Write CFG version
	_putw(CFG_VERSION,				cfgStream);

	_putw(GetPrecision(),			cfgStream);

	fclose(cfgStream);
}
示例#8
0
文件: png.cpp 项目: 2asoft/xray
BOOL BitmapIO_PNG::ReadCfg() {
	
	TCHAR filename[MAX_PATH];
	GetCfgFilename(filename);

	//-- Open Configuration File
	
	File file(filename, _T("rb"));
	
	if (!file.stream)
		return (FALSE);
	
	fseek(file.stream,0,SEEK_END);
	DWORD size = (DWORD)ftell(file.stream);
	
	if (size) {

		fseek(file.stream,0,SEEK_SET);
		
		//-- Allocate Temp Buffer
		
		BYTE *buf = (BYTE *)LocalAlloc(LPTR,size);
		
		if (!buf)
			return (FALSE);
		
		//-- Read Data Block and Set it
		
		BOOL res = FALSE;
		
		if (fread(buf,1,size,file.stream) == size)
			res = LoadConfigure(buf);

		if(!res)
			InitUserData(&cfg);
					
		LocalFree(buf);
	
		return (res);
	
	}
	
	return (FALSE);
}
示例#9
0
BOOL AscOut::ReadConfig()
{
	TSTR filename = GetCfgFilename();
	FILE* cfgStream;

	cfgStream = fopen(filename, "rb");
	if (!cfgStream)
		return FALSE;

	// First item is a file version
	int fileVersion = _getw(cfgStream);

	if (fileVersion > CFG_VERSION) {
		// Unknown version
		fclose(cfgStream);
		return FALSE;
	}

	SetPrecision(_getw(cfgStream));

	fclose(cfgStream);

	return TRUE;
}