Exemple #1
0
        void EndRecording()
        {
            if (_recording)
            {
                System.Diagnostics.Debug.WriteLine("End recording");

                var record = new Record();

                foreach (var input in InputPorts.OfType <NodeSystemLib2.FormatData1D.InputPortData1D>().Where(c => c.Connection != null))
                {
                    var writer = _writers[input];

                    var line = new RecordLineStream1D(
                        DateTime.Now,
                        writer.FirstWritten,
                        writer.LastWritten,
                        GetRelativePath(writer.Path, WorkingDirectory),
                        input.Samplerate
                        );

                    record.Lines.Add(line);
                }

                foreach (var input in InputPorts.OfType <NodeSystemLib2.FormatValue.InputPortValueDouble>().Where(c => c.Connection != null && c != _portEn))
                {
                    var writer = _writers[input];

                    var line = new RecordLineStream2D(
                        DateTime.Now,
                        writer.FirstWritten,
                        writer.LastWritten,
                        GetRelativePath(writer.Path, WorkingDirectory)
                        );

                    record.Lines.Add(line);
                }

                _set.AddRecord(record);
                RecordSetWriter.WriteToFile(_set, System.IO.Path.Combine(WorkingDirectory, "index.lst"));


                foreach (var writer in _writers.Values.Select(v => v.Writer).OfType <IDisposable>())
                {
                    writer.Dispose();
                }
                _writers.Clear();

                _recording = false;
            }
        }
        public DataLineFile2D CreatePlot(RecordLineStream2D input, string directory)
        {
            Stream2DReader reader = null;

            try {
                reader = new Stream2DReader(
                    System.IO.File.OpenText(System.IO.Path.Combine(directory, input.Path)), ','
                    );
            } catch (Exception ex) {
                GlobalSettings.Instance.UserLog.Add(new FormMessage(this, LogMessage.LogType.Error, $"Can't create stream for file {input.Path}: {ex}"));
                return(null);
            }

            var line2d = new DataLineFile2D(input.Path, reader, input.Begin, input.End);

            line2d.LineColor = _colors[(_set.Data.Count + 1) % _colors.Length];
            line2d.Visible   = true;

            _set.Data.Add(line2d);

            return(line2d);
        }
 private RecordSetView(RecordLineStream2D line, string directory) : this()
 {
     _input     = line;
     _directory = directory;
 }