Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Commit

Permalink
Fixed inaccurate statuses
Browse files Browse the repository at this point in the history
The status label would be stuck at "Decoding replay file..." if the user clicked cancel on the open replay window. The status label would also be stuck at "Saving editing file" (which is also incorrect grammar) if a similar thing happened. These inaccuracies have been fixed in this commit.
  • Loading branch information
Plextora committed Jan 18, 2023
1 parent c3f6785 commit 34f2006
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,14 @@ private async void OpenReplayButton_Click(object sender, RoutedEventArgs e)
$@"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\osu!\Replays"
};

if (openFileDialog.ShowDialog() != true) return;
if (openFileDialog.ShowDialog() != true)
{
SetStatusLabel.Default();
return;
}

_osuReplay = ReplayDecoder.Decode(openFileDialog.FileName);
SetStatusLabel.Completed("Finished decoding replay!");
SetStatusLabel.Completed("Finished decoding replay! Now loading replay info...");
await Task.Delay(2000);
SetStatusLabel.Pending("Loading replay info...");
LoadReplayInfo();
Expand All @@ -53,7 +58,8 @@ private async void LoadReplayInfo()
{
ReplayUsernameTextbox.Text = _osuReplay?.PlayerName;
ComboTextbox.Text = (_osuReplay?.Combo).ToString();
ReplayTimestampTextBox.Text = _osuReplay?.ReplayTimestamp.ToLocalTime().ToString(CultureInfo.CurrentCulture);
ReplayTimestampTextBox.Text =
_osuReplay?.ReplayTimestamp.ToLocalTime().ToString(CultureInfo.CurrentCulture);
IsPerfectComboCheckbox.IsChecked = _osuReplay is { PerfectCombo: true };
_300CountTextBox.Text = _osuReplay?.Count300.ToString();
_100CountTextBox.Text = _osuReplay?.Count100.ToString();
Expand All @@ -69,12 +75,17 @@ private async void LoadReplayInfo()

private async void SaveReplayButton_Click(object sender, RoutedEventArgs e)
{
if (_osuReplay == null) return;
if (_osuReplay == null)
{
SetStatusLabel.Error("You must open a replay before saving it!");
return;
}

if (!CheckFields.CheckCombo()) return;
if (!CheckFields.CheckJudgements()) return;
if (!CheckFields.CheckTimestamp()) return;

SetStatusLabel.Pending("Saving editing replay...");
SetStatusLabel.Pending("Saving replay file...");
SaveFileDialog saveFileDialog = new()
{
Filter = "osu! Replay files (*.osr)|*.osr|All files (*.*)|*.*",
Expand All @@ -83,7 +94,11 @@ private async void SaveReplayButton_Click(object sender, RoutedEventArgs e)
$@"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\osu!\Replays"
};

if (saveFileDialog.ShowDialog() != true) return;
if (saveFileDialog.ShowDialog() != true)
{
SetStatusLabel.Default();
return;
}

_osuReplay.PlayerName = ReplayUsernameTextbox.Text;
_osuReplay.Combo = Convert.ToUInt16(ComboTextbox.Text);
Expand Down

0 comments on commit 34f2006

Please sign in to comment.