如何在C#中将文件注入英雄联盟?

时间:2017-04-04 07:41:48

标签: c#

我使用RAFLib-Plus(https://github.com/RichieSams/raflib-plus)插入自定义皮肤文件。

RAFExtractor显示我正确地替换了文件,但是当我尝试时游戏一直崩溃。

以下是代码:

    private void button5_Click(object sender, EventArgs e)
    {
        string league_path = "C:\\Riot Games\\League of Legends\\RADS\\projects\\lol_game_client\\filearchives";
        RAFMasterFileList RAFMasterFileList = new RAFMasterFileList(league_path);
        List<string> entry = RAFMasterFileList.GetRAFFiles(league_path);
        entry.ForEach(raf_access);
    }

    private static void raf_access(string s)
    {
        bool content_changed = false;
        string[] fileEntries = Directory.GetFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\DATA", "*", SearchOption.AllDirectories);
        //Console.WriteLine(s);
        RAFArchive RAFArchive = new RAFArchive(s);

        Dictionary<string, RAFFileListEntry> entries = RAFArchive.FileDictFull;
        foreach (KeyValuePair<string, RAFFileListEntry> entry in entries)
        {
            foreach (string fileName in fileEntries)
            {
                string correct_name;
                correct_name = fileName.Replace(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "").Replace("\\", "/").Substring(1);
                if( correct_name.ToLower() == entry.Key )
                {
                    content_changed = true;
                    if (RAFArchive.InsertFile(correct_name, File.ReadAllBytes(fileName), false))
                    {
                        Console.Write("\n");
                        Console.Write(correct_name);
                    }
                }
            }
        }
        if(content_changed)
        {
            RAFArchive.SaveRAFFile();
            Console.Write("\n");
            Console.Write(RAFArchive.RAFFilePath + " saved.");
        }

    }

这里有一些错误日志:

  

000016.279 | ERROR | Riot :: RADS :: Reader :: DecompressZlib:解压缩用完了缓冲区空间:并非所有压缩数据都被消耗(11341 B读取)。   000016.279 | ERROR | Riot :: RADS :: Reader :: ProjectListing :: ArchiveFile :: LogFailure:无法从“C:/ Riot Games / League of Legends”解压缩档案文件“DATA / Characters / Ashe / Skins / Base / Particles / Ashe_Base_Q_flying_shards.dds” /RADS/projects/lol_game_client/filearchives/0.0.1.29/Archive_1.raf.dat“,版本= 0.0.1.29,compressionId = 1112099930,偏移= 21023779,archiveSize = 16880,entrySize = 65664。   000016.279 | ERROR | Riot :: RADS :: Reader :: ProjectListing :: ArchiveFile :: LogCompressedData:78 9C EC 7D 0D 74 13 D7 99 F6 D5 8C 6C EB C7 FA B1 8D B1 F9 CD 08 6C 04 38 C2 D0 C6 01 E7 07 29 x ..}。t ...... l ......... l.8 ......)

0 个答案:

没有答案