示例#1
0
 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);
 }
示例#2
0
        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);
        }
示例#3
0
        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;
        }
示例#4
0
 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;
 }