Skip to content

Commit

Permalink
Fix event downloading + version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsLogic committed Apr 25, 2024
1 parent 7e93e4b commit f52c891
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions XAU/ViewModels/Pages/HomeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ private async void CheckForEventUpdates()
client.DefaultRequestHeaders.Add("Host", "raw.githubusercontent.com");
var responseString =
await client.GetStringAsync("https://raw.githubusercontent.com/Fumo-Unlockers/Xbox-Achievement-Unlocker/Events-Data/meta.json");
var Jsonresponse = (dynamic)(new JArray());
Jsonresponse = (dynamic)JArray.Parse(responseString);
var Jsonresponse = (dynamic)(new JObject());
Jsonresponse = (dynamic)JObject.Parse(responseString);
var EventsTimestamp = 0;
if (File.Exists(EventsMetaFilePath))
{
Expand Down Expand Up @@ -239,10 +239,10 @@ private void UpdateEvents()
{
string fileName = Path.GetFileName(eventFile);
string destinationPath = Path.Combine(backupFolderPath, fileName);
File.Copy(eventFile, destinationPath, true);
File.Move(eventFile, destinationPath, true);
}

string zipUrl = "https://github.com/Fumo-Unlockers/Actions-Test/raw/Events-Data/Events.zip";
string zipUrl = "https://github.com/Fumo-Unlockers/Xbox-Achievement-Unlocker/raw/Events-Data/Events.zip";
string zipFilePath = Path.Combine(XAUPath, "Events.zip");
string extractPath = XAUPath;

Expand All @@ -252,6 +252,14 @@ private void UpdateEvents()
}
ZipFile.ExtractToDirectory(zipFilePath, extractPath);
File.Delete(zipFilePath);
//download and place meta.json in the events folder
string MetaURL = "https://raw.githubusercontent.com/Fumo-Unlockers/Xbox-Achievement-Unlocker/Events-Data/meta.json";
string MetaFilePath = Path.Combine(eventsFolderPath, "meta.json");
using (var client = new WebClient())
{
client.DownloadFile(MetaURL, MetaFilePath);
}
_snackbarService.Show("Events Update Complete", "Events have been updated to the latest version.", ControlAppearance.Success, new SymbolIcon(SymbolRegular.Checkmark24), _snackbarDuration);
}

#endregion
Expand Down

0 comments on commit f52c891

Please sign in to comment.