示例#1
0
        public static List <UavLog> GetUavLogFromDjiCsv(TextFieldParser csvParser)
        {
            var uavLogs = new List <UavLog>();

            csvParser.CommentTokens = new string[] { "#" };
            csvParser.SetDelimiters(new string[] { "," });
            csvParser.HasFieldsEnclosedInQuotes = true;

            //Processing row
            string[] headers             = csvParser.ReadFields();
            var      djiHeaderDictionary = CsvUtilities.GetDjiHeaderDictionary(headers);


            if (djiHeaderDictionary.Any())
            {
                int rowNumber = 1;
                while (csvParser.PeekChars(1) != null)
                {
                    rowNumber++;
                    string[] fields = csvParser.ReadFields();
                    var      index  = djiHeaderDictionary["VideoRecordTime"];

                    var noko = fields[index];

                    if (fields.Length > index && !string.IsNullOrEmpty(fields[index]) && fields[index] != "0")
                    {
                        uavLogs.Add(CsvUtilities.GetUavLog(fields, djiHeaderDictionary, rowNumber));
                    }
                }
            }
            return(uavLogs);
        }
示例#2
0
        public static List <UavLog> GetUavLogFromTextFile(TextFieldParser csvParser)
        {
            csvParser.SetDelimiters(new string[] { "," });
            csvParser.HasFieldsEnclosedInQuotes = true;

            string[] headers             = csvParser.ReadFields();
            var      djiHeaderDictionary = CsvUtilities.GetHeaderDictionary(headers);

            var uavLogs = new List <UavLog>();

            if (djiHeaderDictionary.Any())
            {
                int rowNumber = 1;
                while (csvParser.PeekChars(1) != null)
                {
                    rowNumber++;
                    string[] fields = csvParser.ReadFields();
                    uavLogs.Add(GetUavLog(fields, djiHeaderDictionary, rowNumber));
                }
            }
            return(uavLogs);
        }