private void ForwardImage(stMsg outMsg, stMsgImageReply outMsgImageReply) { imageBuffEl buffEl = imageBuff.popSave(outMsg.Recipient); byte[][] imagePack = sHGG.ArrayChop <byte>(buffEl.bin, 1800); byte[] filename = StrToByteArray(buffEl.path); for (int i = 0; i < imagePack.Length; i++) { outMsg.Header.Size = 13 + (uint)imagePack[i].Length; // msg outMsg.Header.Size += 9; // image reply struct if (i == 0) { outMsg.Header.Size += (uint)(filename.Length + 1); // image name } outMsgImageReply.Flag = (i > 0) ? (byte)0x6 : (byte)0x5; ForwardData(RawSerialize(outMsg), 21 + outMsg.Message.Length); ForwardData(RawSerialize(outMsgImageReply), 9); if (i == 0) { ForwardData(filename); ForwardData(new byte[] { 0 }); } ForwardData(imagePack[i]); } }
internal void ImageReply(int size, uint crc32, uint uin) { stMsg outMsg = BuildMsgInfo(uin, string.Empty); stMsgImageReply outMsgImageReply = BuildImageReply(size, crc32); ForwardImage(outMsg, outMsgImageReply); }
private stMsgImageReply BuildImageReply(int size, uint crc32) { stMsgImageReply outMsgImageReply = new stMsgImageReply(); outMsgImageReply.Flag = 0x05; // or 0x06 outMsgImageReply.Size = size; outMsgImageReply.CRC32 = crc32; return(outMsgImageReply); }