From a132d98517f7dc30f68931a51d131533a805d8bf Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期四, 24 八月 2023 17:33:58 +0800
Subject: [PATCH] 完成入库的开发

---
 DataLoader/CS/Importor.cs |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/DataLoader/CS/Importor.cs b/DataLoader/CS/Importor.cs
index 99d6ec0..82ced01 100644
--- a/DataLoader/CS/Importor.cs
+++ b/DataLoader/CS/Importor.cs
@@ -15,14 +15,6 @@
         public static void Loading(ObservableCollection<ViewData> viewDatas)
         {
             Importor.GetFiles(viewDatas, CommonProp.SourcePath);
-
-            foreach (ViewData vd in viewDatas)
-            {
-                if (StaticData.RASTER_EXT.Contains(vd.Ext))
-                {
-                    GdalHelper.Instance.ReadRasterInfo(vd);
-                }
-            }
         }
 
         /// <summary>
@@ -261,6 +253,7 @@
         public static void ImportFiles(ObservableCollection<ViewData> viewDatas)
         {
             Parallel.ForEach(viewDatas, (vd, ParallelLoopState) =>
+            //foreach (ViewData vd in viewDatas)
             {
                 try
                 {
@@ -270,7 +263,7 @@
                     if (!string.IsNullOrEmpty(vd.Meta.guid) && DBHelper.IsFileExists(vd.Meta.guid))
                     {
                         vd.Status = "宸插瓨鍦紒";
-                        return;
+                        return; // continue;
                     }
 
                     vd.Status = "璇诲彇鏍呮牸淇℃伅...";
@@ -330,7 +323,7 @@
             foreach (string file in files)
             {
                 string md5 = MD5Helper.GetMD5Hash(file);
-                if (string.IsNullOrEmpty(md5)) list.Add(md5);
+                if (!string.IsNullOrEmpty(md5)) list.Add(md5);
             }
 
             if (list.Count == 0) return null;
@@ -411,6 +404,10 @@
                 try
                 {
                     string target = source.Replace(vd.FilePath, targetFolder);
+                    string path = new FileInfo(target).Directory.FullName;
+                    if (!Directory.Exists(path)) Directory.CreateDirectory(path);
+
+                    File.Copy(source, target, true);
                     count++;
                 }
                 catch (Exception ex)
@@ -435,6 +432,9 @@
             {
                 try
                 {
+                    string source = vd.FilePath.Replace(vd.Ext, ext);
+                    if (!File.Exists(source)) continue;
+
                     File.Copy(vd.FilePath.Replace(vd.Ext, ext), target.Replace(vd.Ext, ext), true);
                     count++;
                 }

--
Gitblit v1.9.3