コード例 #1
0
ファイル: Compiler.cs プロジェクト: renngar/wabbajack
        private void GatherArchives()
        {
            var archives = IndexedArchives.GroupBy(a => a.Hash).ToDictionary(k => k.Key, k => k.First());

            var shas = InstallDirectives.OfType <FromArchive>()
                       .Select(a => a.ArchiveHash)
                       .Distinct();

            SelectedArchives = shas.Select(sha => ResolveArchive(sha, archives)).ToList();
        }
コード例 #2
0
ファイル: Compiler.cs プロジェクト: kman012/wabbajack
        private void GatherArchives()
        {
            Info($"Building a list of archives based on the files required");

            var shas = InstallDirectives.OfType <FromArchive>()
                       .Select(a => a.ArchiveHashPath[0])
                       .Distinct();

            var archives = IndexedArchives.OrderByDescending(f => f.File.LastModified)
                           .GroupBy(f => f.File.Hash)
                           .ToDictionary(f => f.Key, f => f.First());

            SelectedArchives = shas.PMap(sha => ResolveArchive(sha, archives));
        }
コード例 #3
0
ファイル: Compiler.cs プロジェクト: renngar/wabbajack
        /// <summary>
        /// Fills in the Patch fields in files that require them
        /// </summary>
        private void BuildPatches()
        {
            var groups = InstallDirectives.OfType <PatchedFromArchive>()
                         .GroupBy(p => p.ArchiveHash)
                         .ToList();

            Info("Patching building patches from {0} archives", groups.Count);
            var absolute_paths = AllFiles.ToDictionary(e => e.Path, e => e.AbsolutePath);

            groups.PMap(group => BuildArchivePatches(group.Key, group, absolute_paths));

            if (InstallDirectives.OfType <PatchedFromArchive>().FirstOrDefault(f => f.Patch == null) != null)
            {
                Error("Missing patches after generation, this should not happen");
            }
        }
コード例 #4
0
ファイル: Compiler.cs プロジェクト: renngar/wabbajack
        private byte[] LoadDataForTo(string to, Dictionary <string, string> absolute_paths)
        {
            if (absolute_paths.TryGetValue(to, out var absolute))
            {
                return(File.ReadAllBytes(absolute));
            }

            if (to.StartsWith(Consts.BSACreationDir))
            {
                var bsa_id = to.Split('\\')[1];
                var bsa    = InstallDirectives.OfType <CreateBSA>().First(b => b.TempID == bsa_id);

                using (var a = new BSAReader(Path.Combine(MO2Folder, bsa.To)))
                {
                    var file = a.Files.First(e => e.Path == Path.Combine(to.Split('\\').Skip(2).ToArray()));
                    return(file.GetData());
                }
            }
            Error($"Couldn't load data for {to}");
            return(null);
        }