Program.cs

(开头部分) 2KB

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

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

namespace ImgPosWriter
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.DarkGreen;
            Console.WriteLine("图像坐标填写工具V1.0.0.0");
            Console.WriteLine();
            Console.ResetColor();

            string imgFolder = AppDomain.CurrentDomain.BaseDirectory;
            string[] imgs = GetImagesInFolder(imgFolder);

            Console.WriteLine($"当前目录下图像共 {imgs.Length} 张");


            string csvFile = Path.Combine(imgFolder, "pos.csv");
            if (File.Exists(csvFile))
            {
                string posfile = csvFile;
                PosParser parser = new PosParser();
                Pos[] poses = parser.Parse(posfile).ToArray();
                Console.WriteLine($"pos文件内pos共 {poses.Length} 个");

                int count = new int[] {poses.Length, imgs.Length}.Min();
                Console.WriteLine($"会对前 {count} 个图像执行填写坐标");
                Console.WriteLine();
                Console.WriteLine($"正在执行,请稍后......");

                for (int i = 0; i < count; i++)
                {
                    ExifUtil.WriteCoord(imgs[i],poses[i].Long,poses[i].Lat,poses[i].Height);
                }
                Console.WriteLine($"执行完毕");
            }
            else
            {
                Console.WriteLine($"当前目录下图像没有pos文件(pos.csv),无法继续执行");
            }

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine($"按任意键退出");
            Console.ResetColor();
            Console.ReadKey();


        }


        private static string[] GetImagesInFolder(string imgFolder)
        {
后面还有 7 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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