using SkiaSharp; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AuroraLaser.Trupulse.DataTables { public class WaveFormData { public int Index { get; set; } public string PRF0 { get; set; } public string PRFmax { get; set; } public override string ToString() { return $"[{Index}] PRF0={PRF0}, PRFmax={PRFmax}"; } } public class WaveFormTable { public List DataList { get; private set; } = new List(); public bool LoadFromFile(string filePath) { if (!File.Exists(filePath)) return false; DataList.Clear(); try { using (var reader = new StreamReader(filePath)) { string headerLine = reader.ReadLine(); // 헤더 무시 (index,PRF0,PRFmax) if (string.IsNullOrEmpty(headerLine)) return false; while (!reader.EndOfStream) { var line = reader.ReadLine(); if (string.IsNullOrWhiteSpace(line)) continue; var tokens = line.Split(','); if (tokens.Length < 3) continue; int index; if (!int.TryParse(tokens[0].Trim(), out index)) continue; var data = new WaveFormData { Index = index, PRF0 = tokens[1].Trim(), PRFmax = tokens[2].Trim() }; DataList.Add(data); } } return true; } catch (Exception ex) { Console.WriteLine("CSV Load Error: " + ex.Message); return false; } } public WaveFormData GetWaveForm(int index) => DataList.Find(d => d.Index == index); } }