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(); } }
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(); }
private void RefreshLog() { if (InvokeRequired) { Invoke(_refreshLog); } else { LoggerTxt.SelectionStart = LoggerTxt.TextLength; LoggerTxt.ScrollToCaret(); } }
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(); }