コード例 #1
0
        public bool CanPatch(ModInfo modInfo, string romPath, PatchOptions patchOptions, out string reasonCannotPatch)
        {
            if (patchOptions.HasFlag(PatchOptions.IncludeSprites))
            {
                if (!_fallbackSpriteProvider.IsDefaultsPopulated)
                {
                    reasonCannotPatch = "Cannot patch sprites unless 'Populate Graphics Defaults' has been run";
                    return(false);
                }
            }

            reasonCannotPatch = "";
            return(true);
        }
コード例 #2
0
        public void GetFilesToPatch(ConcurrentBag <FileToPatch> filesToPatch, PatchOptions patchOptions)
        {
            if (!patchOptions.HasFlag(PatchOptions.IncludeSprites))
            {
                return;
            }

            if (!_fallbackSpriteProvider.IsDefaultsPopulated)
            {
                throw new Exception("Cannot patch sprites unless 'Populate Graphics Defaults' has been run");
            }

            Parallel.ForEach(GraphicsInfoResource.All, gInfo =>
            {
                foreach (var builder in _builders)
                {
                    builder.GetFilesToPatch(filesToPatch, gInfo);
                }
            });
        }