static bool DiffSzs(string[] args) { if (args.Length != 4) { Console.Error.WriteLine("Error: Wrong number of arguments."); return(false); } var original = args[1]; var edited = args[2]; var outName = args[3]; var options = new LayoutDiff.DiffOptions { HideOnlineButton = args.Any(x => x == "--hide-online") }; try { var res = LayoutDiff.Diff( SARC.Unpack(ManagedYaz0.Decompress(File.ReadAllBytes(original))), SARC.Unpack(ManagedYaz0.Decompress(File.ReadAllBytes(edited))), options ); File.WriteAllBytes(outName, res.Item1.AsByteArray()); Console.WriteLine(res.Item2); } catch (Exception ex) { Console.Error.WriteLine($"There was an error:\r\n{ex}"); } return(true); }
private void materialRaisedButton6_Click(object sender, EventArgs e) { if (CommonSzs == null) { MessageBox.Show("Open the modded file via SZS PATCHING>OPEN SZS first"); return; } OpenFileDialog opn = new OpenFileDialog() { Title = "Open the original SZS to diff", Filter = "SZS file|*.szs" }; if (opn.ShowDialog() != DialogResult.OK) { return; } var originalSzs = SARCExt.SARC.UnpackRamN(ManagedYaz0.Decompress(File.ReadAllBytes(opn.FileName))); LayoutPatch res = null; #if !DEBUG try { #endif string msg; (res, msg) = LayoutDiff.Diff(originalSzs, CommonSzs); if (msg != null) { MessageBox.Show(msg); } #if !DEBUG } catch (Exception ex) { MessageBox.Show(ex.Message); return; } #endif SaveFileDialog sav = new SaveFileDialog() { Title = "save the patch file", Filter = "json patch file|*.json" }; if (sav.ShowDialog() != DialogResult.OK) { return; } File.WriteAllText(sav.FileName, res.AsJson()); }
private void materialRaisedButton6_Click(object sender, EventArgs e) { if (CommonSzs == null) { MessageBox.Show("Open the modded file via SZS PATCHING>OPEN SZS first"); return; } OpenFileDialog opn = new OpenFileDialog() { Title = "Open the original SZS to diff", Filter = "SZS file|*.szs" }; if (opn.ShowDialog() != DialogResult.OK) { return; } var originalSzs = SARCExt.SARC.UnpackRamN(ManagedYaz0.Decompress(File.ReadAllBytes(opn.FileName))); var res = LayoutDiff.Diff(originalSzs, CommonSzs); if (res == null) { return; } res.TargetName = targetPatch?.szsName; //if (targetPatch == null || targetPatch.NXThemeName == "home") //if (MessageBox.Show( // "Do you want to patch the applet buttons color property in the bntx ? This allow you to properly change their color via a layout, select no if you did not edit them.\r\n" + // "This feature is only for the home menu.", "", MessageBoxButtons.YesNo) == DialogResult.Yes) // res.PatchAppletColorAttrib = true; SaveFileDialog sav = new SaveFileDialog() { Title = "save the patch file", Filter = "json patch file|*.json" }; if (sav.ShowDialog() != DialogResult.OK) { return; } File.WriteAllText(sav.FileName, res.AsJson()); }
private void materialRaisedButton6_Click(object sender, EventArgs e) { if (CommonSzs == null) { MessageBox.Show("Open the modded file from Open szs first"); return; } OpenFileDialog opn = new OpenFileDialog() { Title = "open the original szs to diff", Filter = "szs file|*.szs" }; if (opn.ShowDialog() != DialogResult.OK) { return; } var originalSzs = SARCExt.SARC.UnpackRamN(ManagedYaz0.Decompress(File.ReadAllBytes(opn.FileName))); var res = LayoutDiff.Diff(originalSzs, CommonSzs); if (res == null) { return; } res.TargetName = targetPatch?.szsName; SaveFileDialog sav = new SaveFileDialog() { Title = "save the patch file", Filter = "json patch file|*.json" }; if (sav.ShowDialog() != DialogResult.OK) { return; } File.WriteAllText(sav.FileName, res.AsJson()); }