Пример #1
0
 private void WriteModdedArchive(RpfListBuilder.IDirectory rpf, IAbsoluteFilePath moddedPath)
 {
     using (
         var archive = moddedPath.Exists
             ? RageArchiveWrapper7.Open(moddedPath.ToString())
             : RageArchiveWrapper7.Create(moddedPath.ToString()))
     {
         ProcessModdedRpfFile(rpf, archive);
         archive.Flush();
     }
 }
Пример #2
0
        private void ProcessModdedRpf(RpfListBuilder.RootRpf rpf)
        {
            var relativeRpf = rpf.FilePath.GetRelativePathFrom(_gamePath);
            var moddedPath = relativeRpf.GetAbsolutePathFrom(_outputPath);

            CopyRpf(rpf.FilePath, moddedPath);
            WriteModdedArchive(rpf, moddedPath);
        }
Пример #3
0
 private void ProcessModdedRpfFile(RpfListBuilder.IDirectory rpf, IArchive rageArchiveWrapper7)
 {
     foreach (var c in rpf.Contents)
         ProcessContent(c, rageArchiveWrapper7.Root);
 }
Пример #4
0
 private void Handle(IArchiveDirectory root, RpfListBuilder.InnerFile file, string name)
 {
     switch (file.Action)
     {
         case ContentAction.Delete:
             var archiveFile = root.GetFile(name);
             if (archiveFile != null)
                 root.DeleteFile(archiveFile);
             break;
         case ContentAction.Import:
         {
             if (!_config.TreatImportsAsInserts)
                 break;
             NewImport(root, file, file.FilePath, name);
             break;
         }
         case ContentAction.Insert:
         {
             NewImport(root, file, file.FilePath, name);
             break;
         }
     }
 }
Пример #5
0
 private void Handle(IArchiveDirectory root, RpfListBuilder.InnerRpf innerRpf,
     string name)
 {
     var rpf = root.GetFile(name);
     // IMPORTANT: The RPF must have the exact filename like original or it seems to make the RPF corrupt (loading either in RageLib, or in OIV)
     var tmpRpf = _tempPath.GetChildFileWithName(name);
     if (tmpRpf.Exists)
         tmpRpf.FileInfo.Delete();
     try
     {
         rpf.Export(tmpRpf.ToString());
         WriteModdedArchive(innerRpf, tmpRpf);
         NewImport(root, innerRpf, tmpRpf, name);
     }
     finally
     {
         tmpRpf.FileInfo.Delete();
     }
 }
Пример #6
0
 private void Handle(IArchiveDirectory root, RpfListBuilder.IDirectory innerD, string name)
 {
     var dir = root.GetDirectory(name);
     foreach (var c in innerD.Contents)
         ProcessContent(c, dir);
 }
Пример #7
0
 private static void NewImport(IArchiveDirectory root, RpfListBuilder.IFileContent fc, IAbsoluteFilePath tmpRpf,
     string name)
 {
     var existingFile = root.GetFile(name);
     var af = root.CreateArchiveFile(tmpRpf.ToString(),
         fc.Type == FileType.Default && existingFile != null ? DetermineType(existingFile) : fc.Type);
     if (existingFile != null)
         root.DeleteFile(existingFile);
     //af.IsCompressed = true;
     af.Name = name;
     af.Import(tmpRpf.ToString());
 }
Пример #8
0
 public Packager(IAbsoluteDirectoryPath gamePath, IAbsoluteDirectoryPath outputPath,
     IAbsoluteDirectoryPath tempPath, PackagerConfig config)
 {
     _config = config;
     _gamePath = gamePath;
     _outputPath = outputPath;
     _tempPath = tempPath;
     _rpfListBuilder = new RpfListBuilder(_gamePath, _config.BuilderConfig);
 }