public static void rle_unpack(byte[] in_buf, List <byte> buffer) { buffer.Clear(); if (in_buf.Length == 0) { return; } int i = 0; while (i < in_buf.Length) { Packer_Opcap opcap = new Packer_Opcap(in_buf[i++]); if (opcap.tzero) { byte count = (byte)(opcap.tlen + 1); for (; count > 0; count--) { buffer.Add(0); } } else { byte count = (byte)(8 - opcap.tlen); for (; count > 0; count--) { buffer.Add(in_buf[i++]); } } if (opcap.bzero) { byte count = (byte)(opcap.blen + 1); for (; count > 0; count--) { buffer.Add(0); } } else { byte count = (byte)(8 - opcap.blen); for (; count > 0; count--) { buffer.Add(in_buf[i++]); } } } }
public static void rle_unpack(byte[] in_buf, List<byte> buffer) { buffer.Clear(); if (in_buf.Length == 0) return; int i = 0; while (i < in_buf.Length) { Packer_Opcap opcap = new Packer_Opcap(in_buf[i++]); if (opcap.tzero) { byte count = (byte)(opcap.tlen + 1); for (; count > 0; count--) buffer.Add(0); } else { byte count = (byte)(8 - opcap.tlen); for (; count > 0; count--) buffer.Add(in_buf[i++]); } if (opcap.bzero) { byte count = (byte)(opcap.blen + 1); for (; count > 0; count--) buffer.Add(0); } else { byte count = (byte)(8 - opcap.blen); for (; count > 0; count--) buffer.Add(in_buf[i++]); } } }