Example #1
0
        private void CreateFileDicts(RAFArchive raf, UInt32 offsetFileList, UInt32 offsetStringTable)
        {
            //The file list starts with a uint stating how many files we have
            UInt32 fileListCount = BitConverter.ToUInt32(m_content.SubArray((Int32)offsetFileList, 4), 0);

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

            for (UInt32 currentOffset = offsetFileList; currentOffset < offsetFileList + 16 * fileListCount; currentOffset += 16)
            {
                RAFFileListEntry entry = new RAFFileListEntry(raf, ref raf.m_content, currentOffset, offsetStringTable);
                raf.m_fileDictFull.Add(entry.FileName.ToLower(), entry);

                FileInfo fi = new FileInfo(entry.FileName);
                if (!raf.m_fileDictShort.ContainsKey(fi.Name.ToLower()))
                {
                    raf.m_fileDictShort.Add(fi.Name.ToLower(), new List <RAFFileListEntry> {
                        entry
                    });
                }
                else
                {
                    raf.m_fileDictShort[fi.Name.ToLower()].Add(entry);
                }
            }
        }
Example #2
0
 /// <summary>
 /// A class that represents a file within an RAF archive. Creates an entry that only exists in memory.
 /// </summary>
 /// <param name="raf">Pointer to the owning RAFArchive</param>
 /// <param name="fileName">Full path of the file, ie. DATA/Characters/Ahri/Ahri.skn</param>
 /// <param name="offsetDatFile">Offset to the entry data offsets</param>
 /// <param name="fileSize">Length of the file in bytes</param>
 public RAFFileListEntry(RAFArchive raf, string fileName, UInt32 offsetDatFile, UInt32 fileSize)
 {
     m_raf        = raf;
     m_fileName   = fileName;
     m_fileOffset = offsetDatFile;
     m_fileSize   = fileSize;
 }
        /// <summary>
        /// Allows the easy manipulation of RAF archives. With this class the user can pretend there is only one giant RAF archive
        /// </summary>
        /// <param name="rafFilePaths">An array whose values are the paths to each RAF file you want to be combined together</param>
        public RAFMasterFileList(String[] rafFilePaths)
        {
            foreach (String path in rafFilePaths)
            {
                RAFArchive raf = new RAFArchive(path);

                fileDictFull = combineFileDicts(fileDictFull, raf.FileDictFull);
                fileDictShort = combineFileDicts(fileDictShort, raf.FileDictShort);
            }
        }
Example #4
0
        /// <summary>
        /// Allows the easy manipulation of RAF archives. With this class the user can pretend there is only one giant RAF archive
        /// </summary>
        /// <param name="rafFilePaths">An array whose values are the paths to each RAF file you want to be combined together</param>
        public RAFMasterFileList(String[] rafFilePaths)
        {
            foreach (String path in rafFilePaths)
            {
                RAFArchive raf = new RAFArchive(path);

                fileDictFull  = combineFileDicts(fileDictFull, raf.FileDictFull);
                fileDictShort = combineFileDicts(fileDictShort, raf.FileDictShort);
            }
        }
        /// <summary>
        /// Allows the easy manipulation of RAF archives. With this class the user can pretend there is only one giant RAF archive
        /// </summary>
        /// <param name="fileArchivePath">The path to RADS\projects\lol_game_client\filearchives</param>
        public RAFMasterFileList(String fileArchivePath)
        {
            List<String> rafFilePaths = getRAFFiles(fileArchivePath);

            foreach (String path in rafFilePaths)
            {
                RAFArchive raf = new RAFArchive(path);

                fileDictFull = combineFileDicts(fileDictFull, raf.FileDictFull);
                fileDictShort = combineFileDicts(fileDictShort, raf.FileDictShort);
            }
        }
Example #6
0
        /// <summary>
        /// Allows the easy manipulation of RAF archives. With this class the user can pretend there is only one giant RAF archive
        /// </summary>
        /// <param name="fileArchivePath">The path to RADS\projects\lol_game_client\filearchives</param>
        public RAFMasterFileList(String fileArchivePath)
        {
            List <String> rafFilePaths = getRAFFiles(fileArchivePath);

            foreach (String path in rafFilePaths)
            {
                RAFArchive raf = new RAFArchive(path);

                fileDictFull  = combineFileDicts(fileDictFull, raf.FileDictFull);
                fileDictShort = combineFileDicts(fileDictShort, raf.FileDictShort);
            }
        }
Example #7
0
        /// <summary>
        /// A class that represents a file within an RAF archive
        /// </summary>
        /// <param name="raf">Pointer to the owning RAFArchive</param>
        /// <param name="directoryFileContent">Pointer to the content of the .raf.dat file</param>
        /// <param name="offsetDirectoryEntry">Offset to the entry data offsets</param>
        /// <param name="offsetStringTable">Offset to the entry's file name</param>
        public RAFFileListEntry(RAFArchive raf, ref byte[] directoryFileContent, UInt32 offsetDirectoryEntry, UInt32 offsetStringTable)
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

            m_raf = raf;

            m_fileOffset = BitConverter.ToUInt32(directoryFileContent, (int)offsetDirectoryEntry + 4);
            m_fileSize = BitConverter.ToUInt32(directoryFileContent, (int)offsetDirectoryEntry + 8);

            UInt32 strIndex = BitConverter.ToUInt32(directoryFileContent, (int)offsetDirectoryEntry + 12);
            UInt32 entryOffset = offsetStringTable + 8 + strIndex * 8;

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

            byte[] stringBytes = directoryFileContent.SubArray((int)(entryValueOffset + offsetStringTable), (int)entryValueSize - 1);

            m_fileName = Encoding.ASCII.GetString(stringBytes);
        }
Example #8
0
        /// <summary>
        /// A class that represents a file within an RAF archive
        /// </summary>
        /// <param name="raf">Pointer to the owning RAFArchive</param>
        /// <param name="directoryFileContent">Pointer to the content of the .raf.dat file</param>
        /// <param name="offsetDirectoryEntry">Offset to the entry data offsets</param>
        /// <param name="offsetStringTable">Offset to the entry's file name</param>
        public RAFFileListEntry(RAFArchive raf, ref byte[] directoryFileContent, UInt32 offsetDirectoryEntry, UInt32 offsetStringTable)
        {
            Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

            m_raf = raf;

            m_fileOffset = BitConverter.ToUInt32(directoryFileContent, (int)offsetDirectoryEntry + 4);
            m_fileSize   = BitConverter.ToUInt32(directoryFileContent, (int)offsetDirectoryEntry + 8);

            UInt32 strIndex    = BitConverter.ToUInt32(directoryFileContent, (int)offsetDirectoryEntry + 12);
            UInt32 entryOffset = offsetStringTable + 8 + strIndex * 8;

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

            byte[] stringBytes = directoryFileContent.SubArray((int)(entryValueOffset + offsetStringTable), (int)entryValueSize - 1);

            m_fileName = Encoding.ASCII.GetString(stringBytes);
        }
Example #9
0
 /// <summary>
 /// A class that represents a file within an RAF archive. Creates an entry that only exists in memory.
 /// </summary>
 /// <param name="raf">Pointer to the owning RAFArchive</param>
 /// <param name="fileName">Full path of the file, ie. DATA/Characters/Ahri/Ahri.skn</param>
 /// <param name="offsetDatFile">Offset to the entry data offsets</param>
 /// <param name="fileSize">Length of the file in bytes</param>
 public RAFFileListEntry(RAFArchive raf, string fileName, UInt32 offsetDatFile, UInt32 fileSize)
 {
     m_raf = raf;
     m_fileName = fileName;
     m_fileOffset = offsetDatFile;
     m_fileSize = fileSize;
 }
Example #10
0
        private void createFileDicts(RAFArchive raf, UInt32 offsetFileList, UInt32 offsetStringTable)
        {
            //The file list starts with a uint stating how many files we have
            UInt32 fileListCount = BitConverter.ToUInt32(content.SubArray((Int32)offsetFileList, 4), 0);

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

            for (UInt32 currentOffset = offsetFileList; currentOffset < offsetFileList + 16 * fileListCount; currentOffset += 16)
            {
                RAFFileListEntry entry = new RAFFileListEntry(raf, ref raf.content, currentOffset, offsetStringTable);
                raf.fileDictFull.Add(entry.FileName.ToLower(), entry);

                FileInfo fi = new FileInfo(entry.FileName);
                if (!raf.fileDictShort.ContainsKey(fi.Name.ToLower()))
                    raf.fileDictShort.Add(fi.Name.ToLower(), new List<RAFFileListEntry> { entry });
                else
                    raf.fileDictShort[fi.Name.ToLower()].Add(entry);
            }
        }