namespace Azaion.Common.DTO; using System.Collections.Generic; using System.IO; public class GpsMatchResult { public int Index { get; set; } public string Image { get; set; } = null!; public double Latitude { get; set; } public double Longitude { get; set; } public int KeyPoints { get; set; } public int Rotation { get; set; } public string MatchType { get; set; } = null!; public static List ReadFromCsv(string csvFilePath) { var imageDatas = new List(); using var reader = new StreamReader(csvFilePath); //read header reader.ReadLine(); if (reader.EndOfStream) return new List(); while (!reader.EndOfStream) { var line = reader.ReadLine(); if (string.IsNullOrWhiteSpace(line)) continue; var values = line.Split(','); if (values.Length == 6) { imageDatas.Add(new GpsMatchResult { Image = GetFilename(values[0]), Latitude = double.Parse(values[1]), Longitude = double.Parse(values[2]), KeyPoints = int.Parse(values[3]), Rotation = int.Parse(values[4]), MatchType = values[5] }); } } return imageDatas; } private static string GetFilename(string imagePath) => Path.GetFileNameWithoutExtension(imagePath) .Replace("-small", ""); }