Exemple #1
0
    static void Check(uint first, uint count)
    {
        using (Stream strm = new MemoryStream((int)(count * 4)))
        {
            uint i, j, k;

            for (i = 0, k = first; i < count; i++, k++)
            {
                StreamPacker.PackUInt32(strm, k);
            }

            strm.Position = 0;

            for (i = 0, k = first; i < count; i++, k++)
            {
                j = StreamPacker.UnpackInt32(strm);
                if (j != k)
                {
                    throw new Exception(string.Format("failed on {0}: {1}", k, j));
                }
            }
        }
    }