PosPaser.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ImgPosWriter
{
    public class Pos
    {
        public double Long { get; set; }
        public double Lat { get; set; }
        public double Height { get; set; }
    }
    public class PosParser
    {
        public List<Pos> Parse(string file)
        {
            List<Pos> gridLines = new List<Pos>();

            Encoding encoding = EncodingType.GetType(file);
            using (FileStream fs = new FileStream(file, FileMode.Open))
            {
                using (StreamReader sr = new StreamReader(fs, encoding))
                {
                    int index = 0;
                    sr.ReadLine();
                    while (!sr.EndOfStream)
                    {
                        index++;
                        try
                        {
                            string contend = sr.ReadLine();
                            var gridLine = ParseOneLine(contend);
                            if (gridLine != null)
                            {
                                gridLines.Add(gridLine);
                            }
                        }
                        catch (Exception e)
                        {
                            string msg = file + "读写出差\r\n" + "第" + index + "行读写出差\r\n";
                            throw new Exception(msg);
                        }
                    }
                }
            }
            return gridLines;
        }

      
        private static Pos ParseOneLine(string contend)
        {
            string[] arrStrings = contend.Split(new string[] { ",", "," },
                StringSplitOptions.None);
            if (arrStrings.Length < 4)
            {
                return null;
            }
后面还有 114 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。