// // This example does an acquisition and then converts the output file into a CSV file // void ScriptMain() { string l_daqFilename = "E:/Data/TEMP/test.daq"; System.IO.BinaryReader l_reader = new BinaryReader(File.Open(l_daqFilename, FileMode.Open)); var l_strB = new System.Text.StringBuilder(); l_strB.AppendLine("WordIndex;Val;PrevVal;Val-PrevVal"); bool l_continue = true; int l_error = 0; bool l_started = false; UInt32 l_prev=0; UInt32 l_nbWord=0; while (l_continue) { try { // read word32 in file UInt32 l_word = l_reader.ReadUInt32(); if(l_started) { if((l_prev+1) != l_word) { l_error++; if(l_error < 100) { Int32 l_diff = (Int32)(l_word - (l_prev + 1)); l_strB.AppendLine(l_nbWord.ToString() + ";" + l_word.ToString() + ";" + l_prev.ToString() + ";" + l_diff.ToString()); } } } l_started = true; l_prev = l_word; l_nbWord++; } catch (Exception x_e) { l_continue = false; if (!(x_e is EndOfStreamException)) Console.WriteLine("ERROR : IO access during DAQ read file : " + x_e.Message); } } l_reader.Close(); Console.WriteLine("Nb words read = " + l_nbWord.ToString()); Console.WriteLine("Nb KBytes read = " + (l_nbWord*4/1024).ToString()); Console.WriteLine("Errors = " + l_error.ToString()); l_strB.AppendLine("Errors = " + l_error.ToString()); // Print report to CSV -------------------------- try { string l_fileout = System.IO.Path.GetDirectoryName(l_daqFilename) + "/" + System.IO.Path.GetFileNameWithoutExtension(l_daqFilename); System.IO.File.WriteAllText(l_fileout + ".csv" , l_strB.ToString()); } catch { Console.WriteLine("ERROR : IO access during CSV write"); } // We're done! Console.WriteLine("Script ended"); }