Beispiel #1
0
        public static RDAFile FromUnmanaged(FileHeader.Version version, DirEntry dir, BlockInfo block, BinaryReader reader, RDAMemoryResidentHelper mrm)
        {
            RDAFile rdaFile = new RDAFile();

            rdaFile.FileName = dir.filename;
            rdaFile.Version  = version;
            if ((block.flags & 4) != 4)
            {
                if ((block.flags & 1) == 1)
                {
                    rdaFile.Flags |= Flag.Compressed;
                }
                if ((block.flags & 2) == 2)
                {
                    rdaFile.Flags |= Flag.Encrypted;
                }
            }
            if ((block.flags & 4) == 4)
            {
                rdaFile.Flags |= Flag.MemoryResident;
            }
            if ((block.flags & 8) == 8)
            {
                rdaFile.Flags |= Flag.Deleted;
            }
            rdaFile.Offset           = dir.offset;
            rdaFile.UncompressedSize = dir.filesize;
            rdaFile.CompressedSize   = dir.compressed;
            rdaFile.TimeStamp        = DateTimeExtension.FromTimeStamp(dir.timestamp);
            rdaFile.BinaryFile       = mrm == null ? reader : new BinaryReader(mrm.Data);
            return(rdaFile);
        }