Exemplo n.º 1
0
        public static ParseTSharkTextOutput Parse(string[] packetsTextLines)
        {
            Regex lessTabs = new Regex("\t+");

            List <ParsedTsharkTextPacket> packets = new List <ParsedTsharkTextPacket>();

            foreach (string packetsTextLine in packetsTextLines)
            {
                string   newLine = lessTabs.Replace(packetsTextLine, "\t");
                string[] fields  = newLine.Split('\t');
                fields = fields.Select(fld => " " + fld.Trim() + " ").ToArray();
                if (fields.Length < 8)
                {
                    fields = fields.Concat(new string[8 - fields.Length]).ToArray();
                }
                ParsedTsharkTextPacket packet = new ParsedTsharkTextPacket()
                {
                    Number = fields[0],
                    Time   = fields[1],
                    Source = fields[2],
                    Dest   = fields[4],
                    Proto  = fields[5],
                    Length = fields[6],
                    Info   = fields[7]
                };

                packets.Add(packet);
            }

            return(new ParseTSharkTextOutput(packets));
        }
Exemplo n.º 2
0
 public static LinkedParsedPacket FromUnlinked(ParsedTsharkTextPacket packet, TabPageAdv page)
 {
     return(new LinkedParsedPacket(page)
     {
         Dest = packet.Dest,
         Info = packet.Info,
         Number = packet.Number,
         Proto = packet.Proto,
         Source = packet.Source,
         Time = packet.Time,
         Length = packet.Length
     });
 }