public static Maybe <InternetCaptureEntry> Parse(string csvLine) { var tokens = csvLine.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (tokens.Length < 8) { return(Maybe.None <InternetCaptureEntry>()); } return (tokens[0].TryParseDateTime() .Bind(timestamp => IP.TryParse(tokens[3]) .Bind(sourceIp => IP.TryParse(tokens[6]) .Map(destionationIp => new InternetCaptureEntry(sourceIp, destionationIp, timestamp))))); }
public InternetCaptureEntry(IP sourceIp, IP destinationIp, DateTime timestamp) { SourceIP = sourceIp; DestinationIP = destinationIp; Timestamp = timestamp; }