Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the updater view layout #33

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions MelonLoader.Installer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,14 @@ private static bool CheckProcessLock()
#endif
}

processLock = File.Open(processLockPath, FileMode.Create, FileAccess.Write, FileShare.Read);
processLock = File.Create(processLockPath);
processLock.Write(BitConverter.GetBytes(Environment.ProcessId));
processLock.Flush();

#if WINDOWS
GrabAttention();
// On Windows, we need to reopen a new stream with only read perms, otherwise other processes will fail to read it
processLock.Dispose();
processLock = File.OpenRead(processLockPath);
#endif

return true;
Expand Down
7 changes: 4 additions & 3 deletions MelonLoader.Installer/Views/DetailsView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private void OnInstallProgress(double progress, string? newStatus)
MelonIcon.Opacity = progress * 0.7 + 0.3;
}

private void OnInstallFinished(string? errorMessage)
private void OnInstallFinished(string? errorMessage, bool showConfirmation = true)
{
if (Model == null)
return;
Expand All @@ -173,7 +173,8 @@ private void OnInstallFinished(string? errorMessage)
return;
}

DialogBox.ShowNotice("Success!", $"Successfully {(Model.Game.MLInstalled ? (wasReinstall ? "reinstalled" : "installed") : "uninstalled")} MelonLoader!");
if (showConfirmation)
DialogBox.ShowNotice("Success!", $"Successfully {(Model.Game.MLInstalled ? (wasReinstall ? "reinstalled" : "installed") : "uninstalled")} MelonLoader!");
}

private void OpenDirHandler(object sender, RoutedEventArgs args)
Expand Down Expand Up @@ -240,7 +241,7 @@ private async void SelectZipHandler(object sender, TappedEventArgs args)
}
}

OnInstallFinished(errorMessage);
OnInstallFinished(errorMessage, false);
UpdateVersionList();
})));
}
Expand Down
2 changes: 1 addition & 1 deletion MelonLoader.Installer/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public async Task HandleUpdate(Task updaterTask)
{
try
{
Content = new UpdaterView();
SetViewport(new UpdaterView());
await updaterTask;
Close();
}
Expand Down