private bool PatchSingleLayout(LayoutFilePatch p) { if (p == null || p.FileName == null) return true; if (!sarc.Files.ContainsKey(p.FileName)) return false; var target = new BflytFile(sarc.Files[p.FileName]); target.ApplyMaterialsPatch(p.Materials); //Do not check result as it fails only if the file doesn't have any material var res = target.ApplyLayoutPatch(p.Patches); if (!res) return res; res = target.AddGroupNames(p.AddGroups); if (!res) return res; if (p.PullFrontPanes != null) foreach (var n in p.PullFrontPanes) target.PanePullToFront(n); if (p.PushBackPanes != null) foreach (var n in p.PushBackPanes) target.PanePushBack(n); sarc.Files[p.FileName] = target.SaveFile(); return true; }
private BflytFile.PatchResult PatchSingleLayout(LayoutFilePatch p) { if (p == null || p.FileName == null) { return(BflytFile.PatchResult.OK); } if (!sarc.Files.ContainsKey(p.FileName)) { return(BflytFile.PatchResult.Fail); } var target = new BflytFile(sarc.Files[p.FileName]); target.ApplyMaterialsPatch(p.Materials); //Do not check result as it fails only if the file doesn't have any material var res = target.ApplyLayoutPatch(p.Patches); if (res != BflytFile.PatchResult.OK) { return(res); } if (EnableAnimations) { res = target.AddGroupNames(p.AddGroups); if (res != BflytFile.PatchResult.OK) { return(res); } } sarc.Files[p.FileName] = target.SaveFile(); return(BflytFile.PatchResult.OK); }
public static BflytFile.PatchResult PatchLayouts(SARCExt.SarcData sarc, LayoutPatch Patch, bool FixFor8, bool AddAnimations = false) { List <LayoutFilePatch> Files = new List <LayoutFilePatch>(); Files.AddRange(Patch.Files); if (FixFor8 && !Patch.Ready8X) { var extra = NewFirmFixes.GetFix(Patch.PatchName); if (extra != null) { Files.AddRange(extra); } } foreach (var p in Files) { if (!sarc.Files.ContainsKey(p.FileName)) { return(BflytFile.PatchResult.Fail); } var target = new BflytFile(sarc.Files[p.FileName]); var res = target.ApplyLayoutPatch(p.Patches); if (res != BflytFile.PatchResult.OK) { return(res); } if (AddAnimations) { res = target.AddGroupNames(p.AddGroups); if (res != BflytFile.PatchResult.OK) { return(res); } } sarc.Files[p.FileName] = target.SaveFile(); } return(BflytFile.PatchResult.OK); }