From b5de05007117e520d455417d9365766cb762c932 Mon Sep 17 00:00:00 2001 From: vessel Date: Tue, 28 Apr 2020 22:39:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG:=20=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=9C=A8=E9=83=A8=E5=88=86=E6=83=85=E5=86=B5=E4=B8=8B=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E7=B2=98=E8=B4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/ClipService.cs | 11 +++++++++-- view/MainWindow.xaml.cs | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/service/ClipService.cs b/service/ClipService.cs index 55f51d1..8f8c3a6 100644 --- a/service/ClipService.cs +++ b/service/ClipService.cs @@ -91,7 +91,14 @@ public void SetValueToClipboard(ClipModel result) } else { - string ext = Path.GetExtension(result.DisplayValue).ToLower(); + string ext; + if (result.DisplayValue == null || result.DisplayValue == string.Empty) + { + ext = ".jpg"; + } + else { + ext = Path.GetExtension(result.DisplayValue).ToLower(); + } string savePath = Path.GetTempPath() + Guid.NewGuid().ToString() + ext; //savePath= @"C:\users\xiecan\desktop\" + Guid.NewGuid().ToString() + ext; @@ -402,7 +409,7 @@ public void HandleImage(ClipModel clip) base64 = Convert.ToBase64String(ms.GetBuffer()); } clip.Type = IMAGE_TYPE; - + clip.DisplayValue = "image.jpg"; clip.ClipValue = base64; diff --git a/view/MainWindow.xaml.cs b/view/MainWindow.xaml.cs index 40801ff..d326410 100644 --- a/view/MainWindow.xaml.cs +++ b/view/MainWindow.xaml.cs @@ -74,6 +74,7 @@ public MainWindow() private void Window_Loaded(object sender, RoutedEventArgs e) { + taskbar = (TaskbarIcon)FindResource("Taskbar"); @@ -152,7 +153,7 @@ private void WebView1_ScriptNotify(object sender, WebViewControlScriptNotifyEven if (args[0] == "PasteValue") { - + PasteValue(args[1]);