private async Task LoadSniff() { LoadingInProgress = true; FilteringInProgress = true; AssertNoOnGoingTask(); currentActionToken = new CancellationTokenSource(); try { var packets = await sniffLoader.LoadSniff(solutionItem.File, currentActionToken.Token, this); if (currentActionToken.IsCancellationRequested) { LoadingInProgress = false; currentActionToken = null; return; } using (AllPackets.SuspendNotifications()) { foreach (var packet in packets.Packets_) { AllPackets.Add(packetViewModelCreator.Process(packet) !); } } } catch (ParserException e) { await messageBoxService.ShowDialog(new MessageBoxFactory <bool>() .SetIcon(MessageBoxIcon.Error) .SetTitle("Error with parser") .SetMainInstruction("Parser error") .SetContent(e.Message) .WithOkButton(false) .Build()); if (CloseCommand != null) { await CloseCommand.ExecuteAsync(); } } catch (Exception e) { Console.WriteLine(e.ToString()); } FilteringProgress = -1; await SplitPacketsIfNeededAsync().ConfigureAwait(true); LoadingInProgress = false; FilteringInProgress = false; currentActionToken = null; await ApplyFilterCommand.ExecuteAsync(); }
public void Find(ParsedMessage message) { PacketCount++; AllPackets.Add(PacketCount, message); NetworkController.Instance.UiUpdateData.Add(message); if (message.Direction == MessageDirection.ClientToServer) { Parallel.ForEach(ClientOpcode, x => x.Key.Invoke(x.Value, new object[] { message })); } else { Parallel.ForEach(ServerOpcode, x => x.Key.Invoke(x.Value, new object[] { message })); } }