コード例 #1
0
 /// <summary>
 /// Creates an entry that only exists in memory.
 /// </summary>
 public RAFFileListEntry(RiotArchive archive, string rafPath, UInt32 offsetDatFile, UInt32 fileSize, UInt32 nameStringTableIndex)
 {
     inMemory              = true;
     this.archive          = archive;
     this.fileName         = rafPath;
     this.fileOffset       = offsetDatFile;
     this.fileSize         = fileSize;
     this.stringTableIndex = nameStringTableIndex;
 }
コード例 #2
0
        //(string rafPath, UInt32 offset, UInt32 fileSize, UInt32 nameStringTableIndex)
        public RAFFileListEntry(RiotArchive archive, ref byte[] directoryFileContent, UInt32 offsetDirectoryEntry)
        {
            this.archive = archive;
            this.directoryFileContent = directoryFileContent;
            this.offsetEntry          = offsetDirectoryEntry;

            this.fileOffset = BitConverter.ToUInt32(directoryFileContent, (int)offsetEntry + 4);
            ;
            this.fileSize         = BitConverter.ToUInt32(directoryFileContent, (int)offsetEntry + 8);
            this.stringTableIndex = BitConverter.ToUInt32(directoryFileContent, (int)offsetEntry + 12);
            this.fileName         = null; // this.raf.GetDirectoryFile().GetStringTable()[this.stringTableIndex];
        }
コード例 #3
0
        public RAFFileList(RiotArchive riot, byte[] directoryFileContent, UInt32 offsetFileListHeader)
        {
            this.content = directoryFileContent;
            this.offsetFileListHeader = offsetFileListHeader;

            //The file list starts with a uint stating how many files we have
            fileListCount = BitConverter.ToUInt32(content.SubArray((Int32)offsetFileListHeader, 4), 0);

            //After the file list count, we have the actual data.
            UInt32 offsetEntriesStart = offsetFileListHeader + 4;

            this.fileEntries = new List <RAFFileListEntry>();
            for (UInt32 currentOffset = offsetEntriesStart;
                 currentOffset < offsetEntriesStart + 16 * fileListCount; currentOffset += 16)
            {
                this.fileEntries.Add(new RAFFileListEntry(riot, ref directoryFileContent, currentOffset));
            }
        }
コード例 #4
0
ファイル: RAFDirectoryFile.cs プロジェクト: miyu/Dargon.RADS
        public RAFDirectoryFile(RiotArchive riot, string location)
        {
            this.riot         = riot;
            content           = System.IO.File.ReadAllBytes(location);
            magic             = BitConverter.ToUInt32(content.SubArray(0, 4), 0);
            version           = BitConverter.ToUInt32(content.SubArray(4, 4), 0);
            mgrIndex          = BitConverter.ToUInt32(content.SubArray(8, 4), 0);
            offsetFileList    = BitConverter.ToUInt32(content.SubArray(12, 4), 0);
            offsetStringTable = BitConverter.ToUInt32(content.SubArray(16, 4), 0);

            //UINT32 is casted to INT32.  This should be fine, since i doubt that the RAF will become
            //a size of 2^31-1 in bytes.

            fileList = new RAFFileList(riot, content, offsetFileList);

            //Now we load our string table
            stringTable = new RAFStringTable(riot, content, offsetStringTable);
        }
コード例 #5
0
        public RAFStringTable(RiotArchive riot, byte[] directoryFileContent, UInt32 offsetTable)
        {
            this.riot = riot;
            this.directoryFileContent = directoryFileContent;

            //Console.WriteLine("String Table Offset: " + offsetTable.ToString("x"));
            UInt32 sizeOfData  = BitConverter.ToUInt32(directoryFileContent, (int)offsetTable);
            UInt32 stringCount = BitConverter.ToUInt32(directoryFileContent, (int)offsetTable + 4);

            //Load strings in memory
            for (UInt32 i = 0; i < stringCount; i++)
            {
                UInt32 entryOffset = offsetTable + 8 + i * 8; //+8 because of table header { size, count }
                //Above value points to the actual entry

                UInt32 entryValueOffset = BitConverter.ToUInt32(directoryFileContent, (int)entryOffset);
                UInt32 entryValueSize   = BitConverter.ToUInt32(directoryFileContent, (int)entryOffset + 4);

                //-1 seems necessary.  I'd assume some null padding ends strings...
                byte[] stringBytes = directoryFileContent.SubArray((int)(entryValueOffset + offsetTable), (int)entryValueSize - 1);
                strings.Add(Encoding.ASCII.GetString(stringBytes));
            }
        }