• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ VirtualDrive类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中VirtualDrive的典型用法代码示例。如果您正苦于以下问题:C++ VirtualDrive类的具体用法?C++ VirtualDrive怎么用?C++ VirtualDrive使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VirtualDrive类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: LS_VirtualDrive_FileExtract

int LS_VirtualDrive_FileExtract(LuaState* state, LuaStackObject* args)
{
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
	const char* srcFileName = luaL_checkstring(*state, 2);
	const char* destFileName = luaL_checkstring(*state, 3);
	VirtualDrive::FileEntry* entry = drive->FindFileEntry(srcFileName);
	if (!entry)
	{
		state->PushBoolean(false);
		return 1;
	}

	VirtualFile file;
    if (!file.Open(*drive, srcFileName))
	{
		state->PushBoolean(false);
		return 1;
	}

	bool ret = Copy(file, destFileName);

/*	FILETIME createTime;
	FILETIME accessTime;
	FILETIME writeTime;
	HANDLE handle = CreateFile(destFileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	GetFileTime(handle, &createTime, &accessTime, &writeTime);
	writeTime.dwLowDateTime = args[ 2 ].GetInteger();
	writeTime.dwHighDateTime = args[ 3 ].GetInteger();
	SetFileTime(handle, &createTime, &accessTime, &writeTime);
	CloseHandle(handle);
*/
	state->PushBoolean(ret);
	return 1;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:34,代码来源:vdrive.cpp


示例2: LS_VirtualDrive_FileOpen

int LS_VirtualDrive_FileOpen(LuaState* state, LuaStackObject* args)
{
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
	const char* fileName = NULL;
	int entryIndex = -1;
	if (args[2].IsString())
		fileName = args[2].GetString();
	else if (args[2].IsNumber())
		entryIndex = args[2].GetInteger();
	else
		luaL_error(*state, "Argument 2 is not a string or integer.");

	VirtualFileHandle* file = PushVirtualFileHandleObj(state);
	if (fileName)
	{
		if (!drive->FileOpen(fileName, *file))
			return 0;
	}
	else
	{
		if (!drive->FileOpenIndex((size_t)entryIndex, *file))
			return 0;
	}

	return 1;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:26,代码来源:vdrive.cpp


示例3: LS_VirtualDrive_Pack

int LS_VirtualDrive_Pack(LuaState* state, LuaStackObject* args)
{
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
    VirtualDrive::FileOrderInfoArray fileOrder;
	if (args[2].IsTable())
	{
        VirtualDrive::FileOrderInfo info;
		LuaObject tableObj = args[2];
        int index = 1;
		while (true)
		{
			LuaObject entryNameObj = tableObj[index++];
			if (!entryNameObj.IsString())
				break;
			info.entryName = entryNameObj.GetString();

			LuaObject srcPathObj = tableObj[index++];
			if (srcPathObj.IsNil())
				break;
			info.srcPath = srcPathObj.GetString();

			info.compressionMethod = 8;
			LuaObject compressionMethodObj = tableObj[index];
			if (compressionMethodObj.IsNumber())
			{
				info.compressionMethod = compressionMethodObj.GetInteger();
				index++;
			}

            fileOrder.Add(info);
		}
	}
	state->PushBoolean(drive->Pack(&fileOrder) != 0);
	return 1;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:35,代码来源:vdrive.cpp


示例4: ASSERT

BOOL VirtualFile::Open(LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* /*pError*/)
{
	// Open() only works if a VirtualDriveManager is present.
	VirtualDriveManager* manager = VirtualDriveManager::GetInstance();
	if (!manager)
	{
		ASSERT(0);
		return FALSE;
	}

	m_strFileName = lpszFileName;

	// Parse the incoming filename.
	CString virtualDriveName;
	CString virtualFileName;
	manager->ParseFilename(lpszFileName, virtualDriveName, virtualFileName);

	VirtualDrive* drive = manager->Open(virtualDriveName, false);
	if (!drive)
		return FALSE;

	if (nOpenFlags & modeCreate)
	{
		if (drive->m_readOnly)
			return false;

		return drive->FileCreate(virtualFileName, *this);
	}

	return drive->FileOpen(virtualFileName, *this);
}
开发者ID:Luomu,项目名称:workspacewhiz,代码行数:31,代码来源:VirtualFile.cpp


示例5: LS_VirtualDrive_FileGetFileName

int LS_VirtualDrive_FileGetFileName(LuaState* state)
{
    LuaStack args(state);
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
	VirtualFileHandle* fileHandle = VirtualFileHandleHandleFromLua(state, args[2]);
	state->PushString(drive->FileGetFileName(*fileHandle));
	return 1;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:8,代码来源:vdrive.cpp


示例6: LS_VirtualDrive_FileErase

int LS_VirtualDrive_FileErase(LuaState* state)
{
    LuaStack args(state);
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
	const char* fileName = luaL_checkstring(*state, 2);
	state->PushBoolean(drive->FileErase(fileName) != 0);
	return 1;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:8,代码来源:vdrive.cpp


示例7: LS_VirtualDrive_Open

int LS_VirtualDrive_Open(LuaState* state, LuaStackObject* args)
{
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
	const char* fileName = luaL_checkstring(*state, 2);
	const char* defaultPassword = luaL_optstring(*state, 3, NULL);
	state->PushBoolean(drive->Open(fileName, false, defaultPassword) != 0);
	return 1;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:8,代码来源:vdrive.cpp


示例8: LS_VirtualDrive_FileGetLength

int LS_VirtualDrive_FileGetLength(LuaState* state)
{
    LuaStack args(state);
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
	VirtualFileHandle* fileHandle = VirtualFileHandleHandleFromLua(state, args[2]);
	state->PushNumber((lua_Number)drive->FileGetLength(*fileHandle));
	return 1;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:8,代码来源:vdrive.cpp


示例9: LS_VirtualDrive_GetFileEntryIndex

int LS_VirtualDrive_GetFileEntryIndex(LuaState* state, LuaStackObject* args)
{
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);

	const char* fileName = luaL_checkstring(*state, 2);
	state->PushNumber(drive->FindFileEntryIndex(fileName));
	return 1;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:8,代码来源:vdrive.cpp


示例10: LS_VirtualDrive_FileSetLength

int LS_VirtualDrive_FileSetLength(LuaState* state)
{
    LuaStack args(state);
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
	VirtualFileHandle* fileHandle = VirtualFileHandleHandleFromLua(state, args[2]);
	long len = luaL_checklong(*state, 3);
	drive->FileSetLength(*fileHandle, len);
	return 0;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:9,代码来源:vdrive.cpp


示例11: LS_VirtualDrive_FileCreate

int LS_VirtualDrive_FileCreate(LuaState* state, LuaStackObject* args)
{
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
	const char* fileName = luaL_checkstring(*state, 2);
	UINT compressionLevel = (UINT)luaL_optnumber(*state, 3, 8);
	time_t fileTime = (UINT)luaL_optnumber(*state, 4, (lua_Number)time(NULL));
    VirtualFileHandle* fileHandle = PushVirtualFileHandleObj(state);
	if (!drive->FileCreate(fileName, *fileHandle, compressionLevel, &fileTime))
		return 0;
	return 1;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:11,代码来源:vdrive.cpp


示例12: LS_VirtualDrive_FileWrite

int LS_VirtualDrive_FileWrite(LuaState* state)
{
    LuaStack args(state);
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
	VirtualFileHandle* file = VirtualFileHandleHandleFromLua(state, args[2]);
	size_t len;
    const char* buffer = luaL_checklstring(*state, 3, &len);
	len = luaL_optlong(*state, 4, len);
	drive->FileWrite(*file, buffer, len);
	return 0;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:11,代码来源:vdrive.cpp


示例13: LS_VirtualDrive_FindFileEntry

int LS_VirtualDrive_FindFileEntry(LuaState* state, LuaStackObject* args)
{
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);

	const char* fileName = luaL_checkstring(*state, 2);

	VirtualDrive::FileEntry* entry = drive->FindFileEntry(fileName);

	if (!entry)
		return 0;

	BuildFileEntry(state, entry);
	return 1;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:14,代码来源:vdrive.cpp


示例14: LS_VirtualDrive_FileRead

int LS_VirtualDrive_FileRead(LuaState* state)
{
    LuaStack args(state);
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
	VirtualFileHandle* fileHandle = VirtualFileHandleHandleFromLua(state, args[2]);
	long len = luaL_optlong(*state, 3, -1);
	if (len == 0)
		len = (long)drive->FileGetLength(*fileHandle);

	char* buffer = new char[len];
	UINT nr = (UINT)drive->FileRead(*fileHandle, buffer, len);
	state->PushLString(buffer, nr);
	delete[] buffer;
	return 1;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:15,代码来源:vdrive.cpp


示例15: LS_VirtualDrive_GetFileEntry

int LS_VirtualDrive_GetFileEntry(LuaState* state, LuaStackObject* args)
{
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);

	int entryIndex = (int)luaL_optlong(*state, 2, -1);

	VirtualDrive::FileEntry* entry;

	entry = drive->GetFileEntry(entryIndex - 1);

	if (!entry)
		return 0;

	BuildFileEntry(state, entry);
	return 1;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:16,代码来源:vdrive.cpp


示例16: LS_VirtualDrive_FileInsert

int LS_VirtualDrive_FileInsert(LuaState* state, LuaStackObject* args)
{
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
	const char* srcFileName = luaL_checkstring(*state, 2);
	const char* destFileName = luaL_checkstring(*state, 3);
    int compressionMethod = (UINT)luaL_optnumber(*state, 4, VirtualDrive::COMPRESSED);

	DiskFile file;
    if (!file.Open(srcFileName, File::MODE_READONLY))
	{
		state->PushBoolean(false);
		return 1;
	}

	time_t fileTime = (UINT)luaL_optnumber(*state, 5, (lua_Number)file.GetLastWriteTime());

	state->PushBoolean(drive->FileCopy(file, destFileName, compressionMethod, &fileTime) != 0);
	return 1;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:19,代码来源:vdrive.cpp


示例17: LS_VirtualDrive_GetFileEntryCount

int LS_VirtualDrive_GetFileEntryCount(LuaState* state, LuaStackObject* args)
{
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
	state->PushNumber(drive->GetFileEntryCount());
	return 1;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:6,代码来源:vdrive.cpp


示例18: LS_VirtualDrive_GetFileName

int LS_VirtualDrive_GetFileName(LuaState* state, LuaStackObject* args)
{
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
	state->PushString(drive->GetFileName());
	return 1;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:6,代码来源:vdrive.cpp


示例19: LS_VirtualDrive_FileCloseAll

int LS_VirtualDrive_FileCloseAll(LuaState* state, LuaStackObject* args)
{
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
	drive->FileCloseAll();
	return 0;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:6,代码来源:vdrive.cpp


示例20: LS_VirtualDrive_Flush

int LS_VirtualDrive_Flush(LuaState* state, LuaStackObject* args)
{
	VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
	drive->Flush();
	return 0;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:6,代码来源:vdrive.cpp



注:本文中的VirtualDrive类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VirtualMachine类代码示例发布时间:2022-05-31
下一篇:
C++ VirtioDeviceClass类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap