Exemple #1
0
 public static void TransformToBinary(String sourcePath, string destinationPath)
 {
     using (var destinationFile = File.Create(destinationPath))
         using (var binaryWriter = new BinaryWriter(destinationFile))
             foreach (var csvLine in File.ReadLines(sourcePath).Skip(1))
             {
                 InternetCaptureEntry.Parse(csvLine).Iter(capture => capture.ToBinary(binaryWriter));
             }
 }
Exemple #2
0
 public static void Statistics(string binaryPath)
 {
     using (var sourceFile = File.OpenRead(binaryPath))
         using (var binaryReader = new BinaryReader(sourceFile))
         {
             InternetCaptureEntry.FromBinary(binaryReader)
             .GroupBy(ip => ip.SourceIP.Byte0 / 64)
             .OrderBy(x => x.Key)
             .Select(group => group.Key.ToString() + "\t" + group.Count().ToString())
             .ForEach(date => Console.WriteLine(date));
             //Console.WriteLine("Count: " + count);
         }
 }