diff --git a/Constant/Constants.cs b/Constant/Constants.cs index 1cda463..eae0885 100644 --- a/Constant/Constants.cs +++ b/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"; diff --git a/Control/UserControls/Config/MotionControl.xaml.cs b/Control/UserControls/Config/MotionControl.xaml.cs index c32b449..14d3761 100644 --- a/Control/UserControls/Config/MotionControl.xaml.cs +++ b/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); - } } } diff --git a/Control/UserControls/PannelCard/RightCardControl.xaml.cs b/Control/UserControls/PannelCard/RightCardControl.xaml.cs index 19a34af..f86cebe 100644 --- a/Control/UserControls/PannelCard/RightCardControl.xaml.cs +++ b/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)) { diff --git a/Util/FileIcon.cs b/Util/FileIcon.cs index bc7f5b1..1acc48b 100644 --- a/Util/FileIcon.cs +++ b/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); diff --git a/Util/ImageUtil.cs b/Util/ImageUtil.cs index 803358c..25ac354 100644 --- a/Util/ImageUtil.cs +++ b/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 = "::{.*}"; /// /// 图片数组转 BitmapImage @@ -84,7 +86,7 @@ namespace GeekDesk.Util /// 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 } + /// + /// 判断是否为系统项 + /// + /// + public static bool IsSystemItem(string path) + { + return Regex.IsMatch(path, SYSTEM_ITEM); + } + + } }