diff --git a/DeliCounter/Backend/ModRepository.cs b/DeliCounter/Backend/ModRepository.cs
index bcbc6e3..f46f5a7 100644
--- a/DeliCounter/Backend/ModRepository.cs
+++ b/DeliCounter/Backend/ModRepository.cs
@@ -311,6 +311,13 @@ private void LoadModCache()
}
}
+ public void Reset()
+ {
+ if (Repo is not null) Repo.Dispose();
+ if (Directory.Exists(RepoPath)) Directory.Delete(RepoPath, true);
+ Refresh();
+ }
+
///
/// Writes the installed mods cache to the game folder
///
diff --git a/DeliCounter/Controls/ModRepositoryStatus.xaml b/DeliCounter/Controls/ModRepositoryStatus.xaml
index 6701a89..d91cf2f 100644
--- a/DeliCounter/Controls/ModRepositoryStatus.xaml
+++ b/DeliCounter/Controls/ModRepositoryStatus.xaml
@@ -18,6 +18,9 @@
Please wait...
-
+
+
+
+
\ No newline at end of file
diff --git a/DeliCounter/Controls/ModRepositoryStatus.xaml.cs b/DeliCounter/Controls/ModRepositoryStatus.xaml.cs
index 2623b06..4cd5fef 100644
--- a/DeliCounter/Controls/ModRepositoryStatus.xaml.cs
+++ b/DeliCounter/Controls/ModRepositoryStatus.xaml.cs
@@ -28,12 +28,14 @@ private void Update()
StatusIcon.Foreground = new SolidColorBrush(Colors.Red);
LastUpdateText.Text = ModRepository.Instance.Exception.Message;
StatusText.Text = "Error";
+ ButtonReset.IsEnabled = true;
break;
case ModRepository.State.CantUpdate:
StatusIcon.Text = "\uF13C";
StatusIcon.Foreground = new SolidColorBrush(Colors.Orange);
LastUpdateText.Text = ModRepository.Instance.Exception.Message;
StatusText.Text = "Offline";
+ ButtonReset.IsEnabled = true;
break;
case ModRepository.State.UpToDate:
StatusIcon.Text = SegoeGlyphs.Checkmark;
@@ -41,6 +43,7 @@ private void Update()
LastUpdateText.Text =
$"Last update: {ModRepository.Instance.Repo.Head.Commits.First().Author.When}";
StatusText.Text = "Up to date!";
+ ButtonReset.IsEnabled = false;
break;
}
});
@@ -53,7 +56,13 @@ private void ButtonRefresh_Click(object sender, System.Windows.RoutedEventArgs e
LastUpdateText.Text = "Please wait...";
StatusText.Text = "Fetching data...";
ButtonRefresh.IsEnabled = false;
+ ButtonReset.IsEnabled = false;
App.RunInBackgroundThread(ModRepository.Instance.Refresh);
}
+
+ private void ButtonReset_Click(object sender, System.Windows.RoutedEventArgs e)
+ {
+ App.RunInBackgroundThread(ModRepository.Instance.Reset);
+ }
}
}
\ No newline at end of file