/// <summary> /// 拆包 /// </summary> /// <param name="buff">源文件字节数组</param> /// <returns>原始文件字节数组</returns> public static byte[] Unpackage(byte[] buff) { try { if (Encoding.UTF8.GetString(buff, 0, _key.Length) != _key) { return(null); } ulong l = BitConverter.ToUInt64(buff, _key.Length + 19); byte[] mbuf = new byte[l]; Buffer.BlockCopy(buff, 15 + 19, mbuf, 0, (int)l); byte[] desbuff = DesByte.Decrypt(mbuf); byte[] outbuff = new byte[desbuff.Length + buff.Length - 15 - 19 - (int)l]; Buffer.BlockCopy(desbuff, 0, outbuff, 0, desbuff.Length); Buffer.BlockCopy(buff, 15 + 19 + (int)l, outbuff, desbuff.Length, buff.Length - 15 - 19 - (int)l); return(outbuff); } catch (Exception ex) { throw ex; } }