Пример #1
0
        public static int GetQbKey(Stream stream, bool NegateCrc, bool ReverseEndianness)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            if (!stream.CanRead)
            {
                throw new ArgumentException("stream is not readable.");
            }
            stream.Position = 0L;
            KeyGenerator.ResetKey();
            byte[] array = new byte[4096];
            int    int_;

            while ((int_ = stream.Read(array, 0, array.Length)) != 0)
            {
                KeyGenerator.CrcVerifyMethod1(array, 0, int_);
            }
            stream.Position = 0L;
            if (NegateCrc && ReverseEndianness)
            {
                return(KeyGenerator.ReverseEndianness((int)(KeyGenerator._key ^ 4294967295u)));
            }
            if (NegateCrc)
            {
                return((int)(KeyGenerator._key ^ 4294967295u));
            }
            if (ReverseEndianness)
            {
                return(KeyGenerator.ReverseEndianness((int)KeyGenerator._key));
            }
            return((int)KeyGenerator._key);
        }