private List <PacketSummary> HandleIncomingData(string str) { List <PacketSummary> packets = new List <PacketSummary>(); try { int amountRead = 0; while (amountRead < str.Length) { int recieveLength = Base64Encoding.DecodeInt32(str.Substring(amountRead, 3)); amountRead += 3; string packet = str.Substring(amountRead, recieveLength); PacketSummary summary = new PacketSummary(packet.Substring(0, 2), (packet.Substring(0, 2).Length > 0 ? packet.Substring(2) : "")); packets.Add(summary); amountRead += recieveLength; } } catch { } return(packets); }
public void ProcessPacketHooking(bool showMessage) { _hookedIncomingIds.Clear(); _hookedOutgoingIds.Clear(); foreach (DataRow row in _incomingDataTable.Rows) { string headerId = row.Field <string>(0); string header = row.Field <string>(1); if (headerId != null && headerId.Length > 0) { try { _hookedIncomingIds.Add(int.Parse(headerId)); continue; } catch { } } if (header != null && header.Length > 0) { _hookedIncomingIds.Add(Base64Encoding.DecodeInt32(header)); } } foreach (DataRow row in _outgoingDataTable.Rows) { string headerId = row.Field <string>(0); string header = row.Field <string>(1); if (headerId != null && headerId.Length > 0) { try { _hookedOutgoingIds.Add(int.Parse(headerId)); continue; } catch { } } if (header != null && header.Length > 0) { _hookedOutgoingIds.Add(Base64Encoding.DecodeInt32(header)); } } if (showMessage) { MessageBox.Show("Added " + _hookedIncomingIds.Count + " incoming headers and " + _hookedOutgoingIds.Count + " outgoing headers to be hooked."); } }
private void btnFromB64_Click(object sender, EventArgs e) { try { try { int value = Base64Encoding.DecodeInt32(txtFromB64.Text); txtToB64.Text = value + ""; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public PacketSummary(string Header, string Data) { this.Header = Header; this.HeaderId = Base64Encoding.DecodeInt32(this.Header); this.Data = Data; }