Example #1
0
        public static int GetEntryHashCode(IntPtr entry)
        {
            var hashCode = default(int);
            var buffer   = new byte[10240];

            do
            {
                var count = ArchiveEntry.ReadEntry(entry, buffer, buffer.Length);
                if (count <= 0)
                {
                    break;
                }
                for (var a = 0; a < count; a++)
                {
                    unchecked
                    {
                        hashCode += buffer[a];
                    }
                }
            } while (true);
            return(Math.Abs(hashCode));
        }
        public void Test004(string archiveName)
        {
            var fileName = Path.Combine(Location, "Media", archiveName);
            var count    = Utils.GetEntryCount(fileName);

            for (var a = 0; a < count; a++)
            {
                var entry = default(IntPtr);
                if (!ArchiveEntry.OpenEntry(fileName, a, out entry))
                {
                    Assert.Fail("Failed to open entry.");
                }

                try
                {
                    var buffer = new byte[10240];
                    Assert.Greater(ArchiveEntry.ReadEntry(entry, buffer, buffer.Length), 0);
                }
                finally
                {
                    ArchiveEntry.CloseEntry(entry);
                }
            }
        }
Example #3
0
 public override int Read(byte[] buffer, int offset, int count)
 {
     return(ArchiveEntry.ReadEntry(this.Entry, buffer, offset, count));
 }