bool ConvertIPv4ToDouble(string str, out double val) { val = IPv4Tools.IPString2Double(str); if (val < 0.0) { return(false); } return(true); }
public bool SetFromData(StreamReader reader) { string line = reader.ReadLine(); if (line == null) { return(false); } char [] delimiters = { ',', '\n' }; string[] words = line.Split(delimiters); if (words.Length < 8) { return(false); } if ((srcAddress = IPv4Tools.IPString2Double(words[0])) < 0) { return(false); } if ((dstAddress = IPv4Tools.IPString2Double(words[1])) < 0) { return(false); } if ((srcPort = String2Double(words[2])) < 0) { return(false); } if ((dstPort = String2Double(words[3])) < 0) { return(false); } if ((gatewayAddress = IPv4Tools.IPString2Double(words[4])) < 0) { return(false); } if ((gatewayPort = String2Double(words[5])) < 0) { return(false); } srcAddress = ConfigReader.Instance.RevisionXAxis(srcAddress); dstAddress = ConfigReader.Instance.RevisionXAxis(dstAddress); srcPort = ConfigReader.Instance.RevisionYAxis(srcPort); dstPort = ConfigReader.Instance.RevisionYAxis(dstPort); packetImageString = words[6]; if (byte.TryParse(words[7], out packetImageNumber) == false) { packetImageNumber = 0; } packetDescription = words[7]; originalString = line; return(true); }