本文整理汇总了C#中LLClientView.SendImageFirstPart方法的典型用法代码示例。如果您正苦于以下问题:C# LLClientView.SendImageFirstPart方法的具体用法?C# LLClientView.SendImageFirstPart怎么用?C# LLClientView.SendImageFirstPart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLClientView
的用法示例。
在下文中一共展示了LLClientView.SendImageFirstPart方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendFirstPacket
private bool SendFirstPacket(LLClientView client)
{
if (client == null)
return false;
if (m_asset == null)
{
MainConsole.Instance.Warn("[J2KIMAGE]: Sending ImageNotInDatabase for texture " + TextureID);
client.SendImageNotFound(TextureID);
return true;
}
if (m_asset.Length <= FIRST_PACKET_SIZE)
{
// We have less then one packet's worth of data
client.SendImageFirstPart(1, TextureID, (uint) m_asset.Length, m_asset, 2);
m_stopPacket = 0;
return true;
}
// This is going to be a multi-packet texture download
byte[] firstImageData = new byte[FIRST_PACKET_SIZE];
try
{
Buffer.BlockCopy(m_asset, 0, firstImageData, 0, FIRST_PACKET_SIZE);
}
catch (Exception)
{
MainConsole.Instance.ErrorFormat(
"[J2KIMAGE]: Texture block copy for the first packet failed. textureid={0}, assetlength={1}",
TextureID, m_asset.Length);
return true;
}
client.SendImageFirstPart(TexturePacketCount(), TextureID, (uint) m_asset.Length, firstImageData,
(byte) ImageCodec.J2C);
return false;
}
示例2: SendFirstPacket
public bool SendFirstPacket(LLClientView client)
{
// this means we don't have
if (Data == null)
{
client.SendImageNotFound(m_requestedUUID);
m_log.WarnFormat("[TEXTURE]: Got null Data element on a asset {0}.. and the missing image Data property is al", m_requestedUUID);
return true;
}
// Do we have less then 1 packet's worth of data?
else if (m_asset.Data.Length <= cFirstPacketSize)
{
// Send only 1 packet
client.SendImageFirstPart(1, m_requestedUUID, (uint)m_asset.Data.Length, m_asset.Data, 2);
m_stopPacket = 0;
return true;
}
else
{
byte[] firstImageData = new byte[cFirstPacketSize];
try
{
Buffer.BlockCopy(m_asset.Data, 0, firstImageData, 0, (int)cFirstPacketSize);
client.SendImageFirstPart(TexturePacketCount(), m_requestedUUID, (uint)m_asset.Data.Length, firstImageData, 2);
}
catch (Exception)
{
m_log.Error("Texture block copy failed. Possibly out of memory?");
return true;
}
}
return false;
}