Beispiel #1
0
        public void readCSV(string filepath)
        {
            var reader = new StreamReader(File.OpenRead(filepath));

            while (!reader.EndOfStream)
            {
                // read line
                var line = reader.ReadLine();

                // new signal started, create temp signal to add to later
                if (line.Contains("DisplayName: "))
                {
                    // last line of log, break all
                    if (line.Contains("SignalType: EventLog"))
                    {
                        break;
                    }

                    if (tempsig.used == true)
                    {
                        tempsig.processStoredData();
                        signalList.Add(tempsig);
                        Console.WriteLine("Signal Addded: " + tempsig.name + " with " + tempsig.samples.Count + " samples!" + tempsig.IP);
                    }

                    tempsig = new signal();

                    var info = line.Split(',');
                    tempsig.rawinfo = line;
                    tempsig.addName(info[0]);
                    tempsig.addIP(info[1]);
                    tempsig.addSource(info[2]);
                    tempsig.addUnit(info[3]);
                    tempsig.addType(info[4]);
                    tempsig.used = true;
                    signalCount++;
                }
                else
                {
                    if (line != "")
                    {
                        var values = line.Split(',');
                        var sample = new sample(values[0], values[1]);
                        tempsig.addSample(sample);
                        sampleCount++;
                    }
                }
            }
            Console.WriteLine("---------------------------------------------------------------------");
            Console.WriteLine("read " + sampleCount + " samples from " + signalCount + " signals...\n");
        }
Beispiel #2
0
 public void addToList(sample sample)
 {
     sampleList.Add(sample);
     numberList.Add(sample.value);
 }
Beispiel #3
0
 public void addSample(sample sample)
 {
     this.samples.Add(sample);
 }
Beispiel #4
0
 public void addSample(sample sample)
 {
     samples.Add(sample);
 }