Exemplo n.º 1
0
        public HzdCore AddFile(string file)
        {
            var subPath = NormalizeSubPath(HzdCore.EnsureExt(file));
            var path    = Path.Combine(WorkingDir, subPath);

            var core = Files.Contains(subPath) ?
                       HzdCore.FromFile(path, subPath) :
                       IoC.Archiver.LoadGameFile(subPath);

            var patchCore = new HzdCorePatch(core)
            {
                Patch    = this,
                FilePath = path
            };

            return(patchCore);
        }
Exemplo n.º 2
0
        private bool UpdateLinks(int[][] fileLinks, string filepath, string name)
        {
            var fileCore = HzdCore.FromFile(filepath, name);

            // Regenerate links for this specific file (don't forget to remove duplicates (Distinct()!!!))
            var newLinks = fileCore.Binary.GetAllReferences()
                           .Where(x => x.Type == BaseRef.Types.ExternalCoreUUID)
                           .Select(x => Files[x.ExternalFile.Value])
                           .Distinct()
                           .ToArray();

            var oldLinks = fileLinks[Files[name]].ToHashSet();

            if (!oldLinks.SetEquals(newLinks))
            {
                fileLinks[Files[name]] = newLinks;
                return(true);
            }

            return(false);
        }