private void WriteHighlight(string message, Color highlight) { LoggerTxt.SelectionStart = LoggerTxt.TextLength; LoggerTxt.SelectionLength = 0; LoggerTxt.SelectionColor = highlight; LoggerTxt.AppendText(message); }
public void Write(InterceptedEventArgs e) { if (InvokeRequired) { Invoke(_write, e); } else { bool toServer = (e.Packet.Destination == HDestination.Server); string directionArrow = (toServer ? "->" : "<-"); string packetType = (toServer ? "Outgoing" : "Incoming"); string dataLog = $"{packetType}({e.Replacement.Header}, {e.Replacement.Length}) {directionArrow} {e.Replacement}"; Color highlight = toServer ? OutgoingHighlight : IncomingHighlight; if (e.IsBlocked) { WriteHighlight("Blocked | ", BlockHighlight); } else if (e.WasReplaced) { WriteHighlight("Replaced | ", ReplaceHighlight); } string splitter = (DisplaySplitter ? "\n--------------------\n" : "\n"); WriteHighlight(dataLog + splitter, highlight); LoggerTxt.SelectionStart = LoggerTxt.TextLength; LoggerTxt.ScrollToCaret(); Application.DoEvents(); } }
public void Halt() { _wasClosed = true; ToggleItem(ViewIncomingBtn, false); ToggleItem(ViewOutgoingBtn, false); ToggleItem(DisplaySplitterBtn, false); _dataQueue.Clear(); LoggerTxt.Clear(); }
protected override void OnFormClosing(FormClosingEventArgs e) { e.Cancel = IsHalted = true; Intercepted.Clear(); LoggerTxt.Clear(); base.OnFormClosing(e); WindowState = FormWindowState.Minimized; }
protected override void OnActivated(EventArgs e) { if (!IsReceiving) { LoggerTxt.Clear(); IsReceiving = true; } LogMessageQueue(); base.OnActivated(e); }
private void Display(string message, Color highlight) { LoggerTxt.SelectionStart = LoggerTxt.TextLength; LoggerTxt.SelectionLength = 0; LoggerTxt.SelectionColor = highlight; LoggerTxt.AppendText(message + (DisplayVisualSplit ? "\n--------------------\n" : "\n")); LoggerTxt.SelectionStart = LoggerTxt.TextLength; LoggerTxt.ScrollToCaret(); Application.DoEvents(); }
public void Halt() { _wasClosed = true; ToggleItem(ToggleIncomingBtn, false); ToggleItem(ToggleOutgoingBtn, false); ToggleItem(DisplayFiltersBtn, false); ToggleItem(DisplayVisualSplitBtn, false); _displayQueue.Clear(); LoggerTxt.Clear(); }
protected override void OnFormClosing(FormClosingEventArgs e) { IsLoaded = false; e.Cancel = IsHalted = true; WindowState = FormWindowState.Minimized; Intercepted.Clear(); _readQueueTask?.Wait(); LoggerTxt.Clear(); }
protected override void OnActivated(EventArgs e) { if (IsHalted) { IsHalted = false; IsHandlingOutgoing = ViewOutgoingBtn.Checked; IsHandlingIncoming = ViewIncomingBtn.Checked; LoggerTxt.Clear(); } LogMessageQueue(); base.OnActivated(e); }
private void RefreshLog() { if (InvokeRequired) { Invoke(_refreshLog); } else { LoggerTxt.SelectionStart = LoggerTxt.TextLength; LoggerTxt.ScrollToCaret(); } }
protected override void OnFormClosing(FormClosingEventArgs e) { IsReceiving = false; e.Cancel = true; Intercepted.Clear(); LoggerTxt.Clear(); WindowState = FormWindowState.Minimized; base.OnFormClosing(e); }
protected override void OnFormClosing(FormClosingEventArgs e) { e.Cancel = IsHalted = true; Intercepted.Clear(); IsHandlingOutgoing = IsHandlingIncoming = false; LoggerTxt.Clear(); WindowState = FormWindowState.Minimized; base.OnFormClosing(e); }
public void WriteHighlight(string value, Color highlight) { if (InvokeRequired) { Invoke(_writeHighlight, value, highlight); } else { LoggerTxt.SelectionStart = LoggerTxt.TextLength; LoggerTxt.SelectionLength = 0; LoggerTxt.SelectionColor = highlight; LoggerTxt.AppendText(value); } }
private void Display(string message, DataToEventArgs e) { Color highlight = (e.Packet.Destination == HDestination.Client ? IncomingHighlight : OutgoingHighlight); if (e.IsBlocked) { WriteHighlight("Blocked | ", BlockHighlight); } else if (e.IsReplaced) { WriteHighlight("Replaced | ", ReplaceHighlight); } WriteHighlight(message + (DisplaySplitter ? "\n--------------------\n" : "\n"), highlight); LoggerTxt.SelectionStart = LoggerTxt.TextLength; LoggerTxt.ScrollToCaret(); Application.DoEvents(); }
private void EmptyLogBtn_Click(object sender, EventArgs e) { LoggerTxt.Clear(); }