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);
        }
		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;
		}
 public TextureReplacement(string name, string bntx, UInt32 cflag, string Fname, string Pname, int w, int h, LayoutFilePatch p)
 {
     NxThemeName   = name;
     BntxName      = bntx;
     NewColorFlags = cflag;
     FileName      = Fname;
     PaneName      = Pname;
     W             = w; H = h;
     patch         = p;
 }