Ejemplo n.º 1
0
        /**
         * Add an annotation to the current CSV file SharpBCI is logging to
         * @param time time of the annotation
         * @param comment an optional comment to add to row in the csv file
         */
        public void MarkTime(DateTime time, string comment)
        {
            if (time == null)
            {
                throw new ArgumentException("time must not be null");
            }

            if (file == null)
            {
                throw new InvalidOperationException("SharpBCI is not currently logging any data to a CSV file");
            }

            if (comment == null)
            {
                comment = "";
            }

            var row = new StringBuilder()
                      .Append(time.ToString("o"))
                      .Append(",")
                      .Append("ANNOTATION")
                      .Append(",")
                      .Append(comment)
                      .Append(",")
                      .ToString();

            file.WriteLine(row);
        }
Ejemplo n.º 2
0
        /**
         * Records the raw data for the current session to the filename/filepath specified
         * @throws ArgumentException if dataType is null
         */

        public void LogRawData(EEGDataType dataType, String fileName)
        {
            if (fileName == null)
            {
                fileName = DateTime.Now.ToString("MM-dd-yyyy HH-mm-ss");
                fileName = fileName + ".csv";
            }

            if (file == null)
            {
                file = new AsyncStreamWriter(fileName, true);
                var csv = new StringBuilder();
                csv.Append("Timestamp,Data Type,Extra,Data");
                var writableCsv = csv.ToString();
                file.WriteLine(writableCsv);
            }
            this.AddRawHandler(dataType, OnRawEEGData);
        }
Ejemplo n.º 3
0
 public void Log(LogLevel level, object message)
 {
     outputStream.WriteLine(string.Format("{0} - [{1}]: {2}", DateTime.Now, level, message));
 }
Ejemplo n.º 4
0
 public FileLogger(string logName)
 {
     outputStream = new AsyncStreamWriter(logName, true);
     outputStream.WriteLine("\n\n\n");
 }