1
0
Эх сурвалжийг харах

修复一个测试遗留bug

liufei 3 жил өмнө
parent
commit
37e8631f73

+ 1 - 1
Constant/Constants.cs

@@ -11,7 +11,7 @@ namespace GeekDesk.Constant
         public static string APP_DIR = AppDomain.CurrentDomain.BaseDirectory.Trim();
 
         // 是否为开发模式
-        public static bool DEV = true;
+        public static bool DEV = false;
 
         public static string MY_NAME = DEV ? "GeekDesk-D" : "GeekDesk";
 

+ 0 - 4
Control/UserControls/Config/MotionControl.xaml.cs

@@ -290,9 +290,5 @@ namespace GeekDesk.Control.UserControls.Config
             }
         }
 
-        private void HookListener_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
-        {
-            Console.WriteLine(e.KeyChar);
-        }
     }
 }

+ 6 - 12
Control/UserControls/PannelCard/RightCardControl.xaml.cs

@@ -5,25 +5,16 @@ using GeekDesk.Util;
 using GeekDesk.ViewModel;
 using HandyControl.Controls;
 using System;
-using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Diagnostics;
-using System.Drawing.Imaging;
 using System.IO;
-using System.Linq;
-using System.Text;
+using System.Text.RegularExpressions;
 using System.Threading;
-using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
 using System.Windows.Input;
-using System.Windows.Media;
 using System.Windows.Media.Animation;
 using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
 
 namespace GeekDesk.Control.UserControls.PannelCard
 {
@@ -190,8 +181,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
                 string path = (string)obj;
 
                 //string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Png);
-
-                string ext = System.IO.Path.GetExtension(path).ToLower();
+                string ext = "";
+                if (!ImageUtil.IsSystemItem(path))
+                {
+                    ext = System.IO.Path.GetExtension(path).ToLower();
+                }
 
                 if (".lnk".Equals(ext))
                 {

+ 0 - 1
Util/FileIcon.cs

@@ -74,7 +74,6 @@ namespace GeekDesk.Util
             myEncoderParameters.Param[0] = myEncoderParameter;
 
             bmp.Save(strm, myImageCodecInfo, myEncoderParameters);
-            bmp.Save("d:\\test.png", myImageCodecInfo, myEncoderParameters);
             BitmapImage bmpImage = new BitmapImage();
             bmpImage.BeginInit();
             strm.Seek(0, SeekOrigin.Begin);

+ 13 - 1
Util/ImageUtil.cs

@@ -4,6 +4,7 @@ using System.Drawing;
 using System.Drawing.Drawing2D;
 using System.Drawing.Imaging;
 using System.IO;
+using System.Text.RegularExpressions;
 using System.Windows;
 using System.Windows.Interop;
 using System.Windows.Media;
@@ -13,6 +14,7 @@ namespace GeekDesk.Util
 {
     class ImageUtil
     {
+        private static readonly string SYSTEM_ITEM = "::{.*}";
 
         /// <summary>
         /// 图片数组转 BitmapImage
@@ -84,7 +86,7 @@ namespace GeekDesk.Util
         /// <returns></returns>
         public static BitmapImage GetBitmapIconByPath(string filePath)
         {
-            if (File.Exists(filePath))
+            if (File.Exists(filePath) || IsSystemItem(filePath))
             {
                 if (IsImage(filePath)) {
                     //图片
@@ -334,5 +336,15 @@ namespace GeekDesk.Util
         }
 
 
+        /// <summary>
+        /// 判断是否为系统项
+        /// </summary>
+        /// <returns></returns>
+        public static bool IsSystemItem(string path)
+        {
+            return Regex.IsMatch(path, SYSTEM_ITEM);
+        }
+
+
     }
 }