Skip to content

Commit

Permalink
Made it visible when a patch was successful
Browse files Browse the repository at this point in the history
  • Loading branch information
Ceiridge committed Apr 28, 2020
1 parent ea57cae commit 0289d4c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ChromeDevExtWarningPatcher/DllPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public DllPatcher(string dllPath) {
DllPath = dllPath;
}

public void Patch(BytePatchPattern.WriteToLog log) {
public bool Patch(BytePatchPattern.WriteToLog log) {
FileInfo dllFile = new FileInfo(DllPath);
if (!dllFile.Exists)
throw new IOException("File not found");
Expand All @@ -20,9 +20,12 @@ public void Patch(BytePatchPattern.WriteToLog log) {
if(Program.bytePatchManager.PatchBytes(ref raw, IsImageX64(dllFile.FullName), log)) {
File.WriteAllBytes(dllFile.FullName, raw);
log("Patched and saved successfully " + dllFile.FullName);
return true;
} else {
log("Error trying to patch " + dllFile.FullName);
}

return false;
}

// Taken from https://stackoverflow.com/questions/480696/how-to-find-if-a-native-dll-file-is-compiled-as-x64-or-x86
Expand Down
6 changes: 5 additions & 1 deletion ChromeDevExtWarningPatcher/PatcherGui.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ private void PatchBtn_Click(object sender, RoutedEventArgs e) {
new Thread(() => {
try {
DllPatcher patcher = new DllPatcher(path);
patcher.Patch(Log);
if (patcher.Patch(Log)) {
installationBox.Dispatcher.Invoke(new Action(() => {
installationBox.Foreground = installationBox.BorderBrush = new SolidColorBrush(Color.FromRgb(72, 207, 133));
}));
}
} catch (Exception ex) {
Log("Error while patching " + path + ":" + ex.Message);
}
Expand Down

0 comments on commit 0289d4c

Please sign in to comment.