本文整理汇总了C#中LLClientView.SendImageNextPart方法的典型用法代码示例。如果您正苦于以下问题:C# LLClientView.SendImageNextPart方法的具体用法?C# LLClientView.SendImageNextPart怎么用?C# LLClientView.SendImageNextPart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLClientView
的用法示例。
在下文中一共展示了LLClientView.SendImageNextPart方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendPacket
private bool SendPacket(LLClientView client)
{
if (client == null || m_asset == null)
return false;
bool complete = false;
int imagePacketSize = ((int) m_currentPacket == (TexturePacketCount()))
? LastPacketSize()
: IMAGE_PACKET_SIZE;
try
{
if ((CurrentBytePosition() + IMAGE_PACKET_SIZE) > m_asset.Length)
{
imagePacketSize = LastPacketSize();
complete = true;
if ((CurrentBytePosition() + imagePacketSize) > m_asset.Length)
{
imagePacketSize = m_asset.Length - CurrentBytePosition();
complete = true;
}
}
// It's concievable that the client might request packet one
// from a one packet image, which is really packet 0,
// which would leave us with a negative imagePacketSize..
if (imagePacketSize > 0)
{
byte[] imageData = new byte[imagePacketSize];
int currentPosition = CurrentBytePosition();
try
{
Buffer.BlockCopy(m_asset, currentPosition, imageData, 0, imagePacketSize);
}
catch (Exception e)
{
MainConsole.Instance.ErrorFormat(
"[J2KIMAGE]: Texture block copy for the first packet failed. textureid={0}, assetlength={1}, currentposition={2}, imagepacketsize={3}, exception={4}",
TextureID, m_asset.Length, currentPosition, imagePacketSize, e.Message);
return false;
}
//Send the packet
client.SendImageNextPart((ushort) (m_currentPacket - 1), TextureID, imageData);
}
return !complete;
}
catch (Exception)
{
return false;
}
}
示例2: SendPacket
private bool SendPacket(LLClientView client)
{
bool complete = false;
int imagePacketSize = ((int)m_packetNumber == (TexturePacketCount())) ? LastPacketSize() : cImagePacketSize;
try
{
if ((CurrentBytePosition() + cImagePacketSize) > m_asset.Data.Length)
{
imagePacketSize = LastPacketSize();
complete=true;
if ((CurrentBytePosition() + imagePacketSize) > m_asset.Data.Length)
{
imagePacketSize = m_asset.Data.Length - CurrentBytePosition();
complete = true;
}
}
// It's concievable that the client might request packet one
// from a one packet image, which is really packet 0,
// which would leave us with a negative imagePacketSize..
if (imagePacketSize > 0)
{
byte[] imageData = new byte[imagePacketSize];
try
{
Buffer.BlockCopy(m_asset.Data, CurrentBytePosition(), imageData, 0, imagePacketSize);
}
catch (Exception e)
{
m_log.Error("Error copying texture block. Out of memory? imagePacketSize was " + imagePacketSize.ToString() + " on packet " + m_packetNumber.ToString() + " out of " + m_stopPacket.ToString() + ". Exception: " + e.ToString());
return false;
}
//Send the packet
client.SendImageNextPart((ushort)(m_packetNumber-1), m_requestedUUID, imageData);
}
if (complete)
{
return false;
}
else
{
return true;
}
}
catch (Exception)
{
return false;
}
}