TryCheckApplyMod() public method

public TryCheckApplyMod ( string romPath, string outPath, bool apply, bool commit ) : bool
romPath string
outPath string
apply bool
commit bool
return bool
示例#1
0
文件: RomMod.cs 项目: Merp/SharpTune
 private static bool TryApply(string patchPath, string romPath, bool apply, bool commit)
 {
     Mod currentMod = new Mod(patchPath);//TODO: KING KLUDGE!
     return currentMod.TryCheckApplyMod(romPath, romPath, apply, commit);
 }
示例#2
0
        private bool TryUpgradeMod(Mod m, string outfile)
        {
            foreach (KeyValuePair<Mod,ModDirection> mkvp in sharpTuner.activeImage.ModList)
            {
                if (mkvp.Value == ModDirection.Remove)
                {
                    if (m.TryCheckApplyMod(sharpTuner.activeImage.FilePath, outfile, false, true))
                    {
                        if (m.TryCheckApplyMod(outfile, outfile, true, true))
                        {
                            MessageBox.Show("MOD SUCCESSFULLY UPGRADED!", "SharpTune", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            sharpTuner.fileQueued = true;
                            sharpTuner.QueuedFilePath = outfile;
                            return true;
                        }
                    }
                }
            }
            return false;
        }
示例#3
0
文件: RomMod.cs 项目: Merp/SharpTune
 public static bool TryHewBuild(AvailableDevices ad, string patchPath, string romPath, string bc, string defPath)
 {
     Mod mod = new Mod(patchPath, bc);
     using (Stream romStream = File.OpenRead(romPath))
     {
         Trace.WriteLine("Attempting to read patches");
         if (!mod.TryReadPatches())
         {
             PrintError("READING PATCH");
             return false;
         }
         Trace.WriteLine("Attempting to baseline patches");
         if (!mod.TryPrintBaselines(patchPath, romStream))
         {
             PrintError("GENERATING BASELINES");
             return false;
         }
     }
     File.Copy(romPath, "oem.bin", true);
     Trace.WriteLine("Attempting to test patches");
     if (!mod.TryCheckApplyMod(romPath, romPath, true, false)) //&& !mod.TryCheckApplyMod(romPath, romPath, false, false)) ;
     {
         PrintError("TESTING PATCH");
         return false;
     }
     Trace.WriteLine("Attempting to apply patches");
     if (!mod.TryCheckApplyMod(romPath, romPath, true, true))
     {
         PrintError("APPLYING PATCH");
         return false;
     }
     Trace.WriteLine("Attempting to remove patches");
     File.Copy(romPath, "reverted.bin", true);
     if (!mod.TryCheckApplyMod("reverted.bin", "reverted.bin", false, true))
     {
         PrintError("REMOVING PATCH");
         return false;
     }
     Trace.WriteLine("Attempting to verify patch removal");
     if (!Utils.FileCompare("reverted.bin", "oem.bin"))
     {
         PrintError("VERIFYING REMOVED PATCH");
         return false;
     }
     Trace.WriteLine("Attempting to define patch");
     if (!mod.TryDefinition(ad, defPath))
     {
         PrintError("WRITING DEFINITIONS");
         return false;
     }
     Trace.WriteLine("Attempting to copy patch to: "+ bc + "\\" + mod.InitialCalibrationId + "\\" + mod.FileName);
     string d = bc + "\\" + mod.InitialCalibrationId + "\\";
     Directory.CreateDirectory(d);
     string c = d + mod.FileName;
     File.Copy(mod.FilePath,c,true);
     Trace.WriteLine("HEW BUILD SUCCESS!!");
     return true;
 }
示例#4
0
        private bool TryRemoveMod(Mod m, string infile, string outfile)
        {
            if (m.TryCheckApplyMod(infile, outfile, false, true))
            {
                MessageBox.Show("MOD SUCCESSFULLY REMOVED!", "SharpTune", MessageBoxButtons.OK, MessageBoxIcon.Information);

                sharpTuner.fileQueued = true;
                sharpTuner.QueuedFilePath = outfile;
                return true;
            }
            return false;
        }