コード例 #1
0
// On windows we're transcribing the whole of any resource based asset tree into a RAM-based
// streamer, so that when we're running across a high-latency filesystem we're not affected as much.
static ZAsset sGetAssetRootFromExecutable(const string& iAssetTreeName)
	{
	#if !ZCONFIG(OS, Win32)

		return ZUtil_Asset::sGetAssetRootFromExecutable(iAssetTreeName);

	#else
		HINSTANCE theHINSTANCE;
		if (ZUtil_Win::sUseWAPI())
			theHINSTANCE = ::GetModuleHandleW(nil);
		else
			theHINSTANCE = ::GetModuleHandleA(nil);

		ZRef<ZStreamerRWPos> theStreamer = new ZStreamerRWPos_T<ZStreamRWPos_RAM>;
		theStreamer->GetStreamWPos().CopyAllFrom(ZStreamRPos_Win_MultiResource(theHINSTANCE, "ZAO_", iAssetTreeName));
		theStreamer->GetStreamWPos().SetPosition(0);

		ZRef<ZAssetTree> theAssetTree = new ZAssetTree_Std_Streamer(theStreamer);
		return theAssetTree->GetRoot();
	#endif

	return ZAsset();
	}
コード例 #2
0
bool ZWebDAV::sHandle_PUT(const ZTrail& iPrefix, ZNode iRoot, const ZStreamR& iStreamR, const ZStreamW& iStreamW, const ZTuple& iHeader, const ZTrail& iTrail, const ZTuple& iParam)
	{
	ZHTTP::Response r;
	r.Set("date", sAsString_WebDAV(ZTime::sNow()));
	r.Set("Content-Length", 0);

	ZNode theNode = iRoot.Trail(iTrail);

	ZRef<ZStreamerWPos> theStreamerWPos = theNode.CreateWPos(true);
	if (!theStreamerWPos)
		{
		r.SetResult(409);
		}
	else
		{
		theStreamerWPos->GetStreamW().CopyAllFrom(iStreamR);
		theStreamerWPos->GetStreamWPos().Truncate();

		r.SetResult(204);
		}

	r.Send(iStreamW);
	return true;
	}