Skip to content

Commit

Permalink
Update event types URL
Browse files Browse the repository at this point in the history
  • Loading branch information
BlossomiShymae committed Dec 16, 2024
1 parent 2e4637f commit cf947f3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Needlework.Net/ViewModels/Pages/Websocket/WebsocketViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,16 @@ public WebsocketViewModel(HttpClient httpClient) : base("Event Viewer", "plug",

private async Task InitializeEventTypes()
{
var file = await HttpClient.GetStringAsync("https://raw.githubusercontent.com/dysolix/hasagi-types/refs/heads/main/lcu-events.d.ts");
var matches = EventTypesRegex().Matches(file);
Avalonia.Threading.Dispatcher.UIThread.Invoke(() => EventTypes.AddRange(matches.Select(m => m.Groups[1].Value)));
try
{
var file = await HttpClient.GetStringAsync("https://raw.githubusercontent.com/dysolix/hasagi-types/refs/heads/main/dist/lcu-events.d.ts");
var matches = EventTypesRegex().Matches(file);
Avalonia.Threading.Dispatcher.UIThread.Invoke(() => EventTypes.AddRange(matches.Select(m => m.Groups[1].Value)));
}
catch (HttpRequestException ex)
{
WeakReferenceMessenger.Default.Send(new InfoBarUpdateMessage(new("Failed to get event types", true, ex.Message, FluentAvalonia.UI.Controls.InfoBarSeverity.Error, TimeSpan.FromSeconds(10))));
}
}

private void InitializeWebsocket()
Expand Down

0 comments on commit cf947f3

Please sign in to comment.