From 99ec2d76099214d2996bec87be56b686f040f9ea Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sat, 21 Feb 2026 16:51:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/App.xaml.cs | 28 +++++++-------- Ink Canvas/Helpers/AnimationsHelper.cs | 12 +++---- Ink Canvas/Helpers/AutoUpdateHelper.cs | 16 ++++----- Ink Canvas/Helpers/DeviceIdentifier.cs | 8 ++--- Ink Canvas/Helpers/FileAssociationManager.cs | 8 ++--- Ink Canvas/Helpers/LogHelper.cs | 15 ++++++-- Ink Canvas/Helpers/MultiTouchInput.cs | 2 +- Ink Canvas/Helpers/PPTInkManager.cs | 4 +-- Ink Canvas/Helpers/PPTManager.cs | 16 ++++----- Ink Canvas/Helpers/PPTROTConnectionHelper.cs | 16 ++++----- .../SuperLauncher/LauncherWindow.xaml.cs | 4 +-- .../Helpers/ProcessProtectionManager.cs | 14 ++++---- Ink Canvas/Helpers/ROTPPTManager.cs | 2 +- Ink Canvas/Helpers/StartupCount.cs | 7 ++-- Ink Canvas/MainWindow.xaml.cs | 10 +++--- Ink Canvas/MainWindow_cs/MW_AutoTheme.cs | 2 +- .../MainWindow_cs/MW_FloatingBarIcons.cs | 6 ++-- Ink Canvas/MainWindow_cs/MW_Hotkeys.cs | 7 ++-- Ink Canvas/MainWindow_cs/MW_PPT.cs | 10 +++--- Ink Canvas/MainWindow_cs/MW_Settings.cs | 8 ++--- Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs | 24 ++++++------- .../MW_SimulatePressure&InkToShape.cs | 16 ++++----- Ink Canvas/MainWindow_cs/MW_Timer.cs | 10 +++--- Ink Canvas/MainWindow_cs/MW_TouchEvents.cs | 10 +++--- Ink Canvas/MainWindow_cs/MW_VideoPresenter.cs | 20 +++++------ Ink Canvas/Windows/OobeWindow.xaml.cs | 34 +++++++++---------- .../Windows/OperatingGuideWindow.xaml.cs | 4 +-- Ink Canvas/Windows/PPTQuickPanel.xaml.cs | 4 +-- Ink Canvas/Windows/RandWindow.xaml.cs | 4 +-- .../SettingsViews/AboutPanel.xaml.cs | 6 ++-- .../SettingsViews/SecurityPanel.xaml.cs | 2 +- 31 files changed, 171 insertions(+), 158 deletions(-) diff --git a/Ink Canvas/App.xaml.cs b/Ink Canvas/App.xaml.cs index 9058cc57..102e0f9f 100644 --- a/Ink Canvas/App.xaml.cs +++ b/Ink Canvas/App.xaml.cs @@ -420,7 +420,7 @@ namespace Ink_Canvas $"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] 记录未处理异常时发生错误: {ex.Message}\r\n" ); } - catch { } + catch (Exception innerEx) { System.Diagnostics.Debug.WriteLine(innerEx); } } } @@ -576,7 +576,7 @@ namespace Ink_Canvas // 同时记录到主日志 LogHelper.WriteLogToFile(message, LogHelper.LogType.Error); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } // 增加字段保存崩溃后操作设置 @@ -593,7 +593,7 @@ namespace Ink_Canvas var json = File.ReadAllText(settingsPath); dynamic obj = JsonConvert.DeserializeObject(json); int crashAction = 0; - try { crashAction = (int)(obj["startup"]["crashAction"] ?? 0); } catch { } + try { crashAction = (int)(obj["startup"]["crashAction"] ?? 0); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } CrashAction = (CrashActionType)crashAction; } // 从主窗口同步 @@ -602,7 +602,7 @@ namespace Ink_Canvas CrashAction = (CrashActionType)Ink_Canvas.MainWindow.Settings.Startup.CrashAction; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) @@ -657,7 +657,7 @@ namespace Ink_Canvas string exePath = Process.GetCurrentProcess().MainModule.FileName; Process.Start(exePath); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } Environment.Exit(1); } // CrashActionType.NoAction 时不做处理 @@ -909,7 +909,7 @@ namespace Ink_Canvas LogHelper.WriteLogToFile("App | 清理损坏的更新标记文件"); } } - catch { } + catch (Exception innerEx) { System.Diagnostics.Debug.WriteLine(innerEx); } } } @@ -1002,7 +1002,7 @@ namespace Ink_Canvas watchdogProcess.Kill(); } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } Environment.Exit(0); } } @@ -1138,9 +1138,9 @@ namespace Ink_Canvas SenderScrollViewer.ScrollToVerticalOffset(SenderScrollViewer.VerticalOffset - e.Delta * 10 * SystemInformation.MouseWheelScrollLines / (double)120); e.Handled = true; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } // 用于设置崩溃后操作类型 @@ -1198,7 +1198,7 @@ namespace Ink_Canvas string exePath = Process.GetCurrentProcess().MainModule.FileName; Process.Start(exePath); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } Environment.Exit(1); } return; @@ -1223,7 +1223,7 @@ namespace Ink_Canvas string exePath = Process.GetCurrentProcess().MainModule.FileName; Process.Start(exePath); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } Environment.Exit(1); } } @@ -1264,7 +1264,7 @@ namespace Ink_Canvas // 检查退出信号文件 if (File.Exists(exitSignalFile)) { - try { File.Delete(exitSignalFile); } catch { } + try { File.Delete(exitSignalFile); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } Environment.Exit(0); } Thread.Sleep(2000); @@ -1293,7 +1293,7 @@ namespace Ink_Canvas } } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } Environment.Exit(0); } } @@ -1401,7 +1401,7 @@ namespace Ink_Canvas { LogHelper.WriteLogToFile($"退出处理时发生错误: {ex.Message}", LogHelper.LogType.Error); } - catch { } + catch (Exception innerEx) { System.Diagnostics.Debug.WriteLine(innerEx); } } } } diff --git a/Ink Canvas/Helpers/AnimationsHelper.cs b/Ink Canvas/Helpers/AnimationsHelper.cs index b6fe0335..dbc1c030 100644 --- a/Ink Canvas/Helpers/AnimationsHelper.cs +++ b/Ink Canvas/Helpers/AnimationsHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Windows; using System.Windows.Media; using System.Windows.Media.Animation; @@ -73,7 +73,7 @@ namespace Ink_Canvas.Helpers sb.Begin((FrameworkElement)element); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } public static void ShowWithSlideFromLeftAndFade(UIElement element, double duration = 0.25) @@ -113,7 +113,7 @@ namespace Ink_Canvas.Helpers sb.Begin((FrameworkElement)element); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } public static void ShowWithScaleFromLeft(UIElement element, double duration = 0.2) @@ -156,7 +156,7 @@ namespace Ink_Canvas.Helpers sb.Begin((FrameworkElement)element); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } public static void ShowWithScaleFromRight(UIElement element, double duration = 0.2) @@ -200,7 +200,7 @@ namespace Ink_Canvas.Helpers sb.Begin((FrameworkElement)element); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } public static void HideWithSlideAndFade(UIElement element, double duration = 0.15) @@ -246,7 +246,7 @@ namespace Ink_Canvas.Helpers element.RenderTransform = new TranslateTransform(); sb.Begin((FrameworkElement)element); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } public static void HideWithFadeOut(UIElement element, double duration = 0.15) diff --git a/Ink Canvas/Helpers/AutoUpdateHelper.cs b/Ink Canvas/Helpers/AutoUpdateHelper.cs index 1ceeda25..9b0e3b6a 100644 --- a/Ink Canvas/Helpers/AutoUpdateHelper.cs +++ b/Ink Canvas/Helpers/AutoUpdateHelper.cs @@ -288,7 +288,7 @@ namespace Ink_Canvas.Helpers } } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } return -1; } @@ -1130,7 +1130,7 @@ namespace Ink_Canvas.Helpers // 清理可能损坏的分块文件 if (File.Exists(tempPath)) { - try { File.Delete(tempPath); } catch { } + try { File.Delete(tempPath); } catch (Exception innerEx) { System.Diagnostics.Debug.WriteLine(innerEx); } } // 增加重试间隔,避免频繁重试 @@ -1316,7 +1316,7 @@ namespace Ink_Canvas.Helpers return resp.Content.Headers.ContentLength.Value; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } return -1; } @@ -1358,7 +1358,7 @@ namespace Ink_Canvas.Helpers App.IsUpdateInstalling = true; if (wasProcessProtectionEnabled) { - try { ProcessProtectionManager.SetEnabled(false); } catch { } + try { ProcessProtectionManager.SetEnabled(false); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } // 在更新前备份设置文件 @@ -2086,16 +2086,16 @@ namespace Ink_Canvas.Helpers { foreach (string file in Directory.GetFiles(updatesFolderPath, "*", SearchOption.AllDirectories)) { - try { File.Delete(file); } catch { } + try { File.Delete(file); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } foreach (string dir in Directory.GetDirectories(updatesFolderPath)) { - try { Directory.Delete(dir, true); } catch { } + try { Directory.Delete(dir, true); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } - try { Directory.Delete(updatesFolderPath, true); } catch { } + try { Directory.Delete(updatesFolderPath, true); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } // 版本修复方法,强制下载并安装指定通道的最新版本 diff --git a/Ink Canvas/Helpers/DeviceIdentifier.cs b/Ink Canvas/Helpers/DeviceIdentifier.cs index dd217bb6..31c53472 100644 --- a/Ink Canvas/Helpers/DeviceIdentifier.cs +++ b/Ink Canvas/Helpers/DeviceIdentifier.cs @@ -146,7 +146,7 @@ namespace Ink_Canvas.Helpers var disposeMethod = searcher.GetType().GetMethod("Dispose"); disposeMethod?.Invoke(searcher, null); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 主板序列号 try @@ -170,7 +170,7 @@ namespace Ink_Canvas.Helpers var disposeMethod = searcher.GetType().GetMethod("Dispose"); disposeMethod?.Invoke(searcher, null); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // BIOS序列号 try @@ -194,7 +194,7 @@ namespace Ink_Canvas.Helpers var disposeMethod = searcher.GetType().GetMethod("Dispose"); disposeMethod?.Invoke(searcher, null); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 主硬盘序列号 try @@ -218,7 +218,7 @@ namespace Ink_Canvas.Helpers var disposeMethod = searcher.GetType().GetMethod("Dispose"); disposeMethod?.Invoke(searcher, null); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } catch diff --git a/Ink Canvas/Helpers/FileAssociationManager.cs b/Ink Canvas/Helpers/FileAssociationManager.cs index b237f51d..c88c5015 100644 --- a/Ink Canvas/Helpers/FileAssociationManager.cs +++ b/Ink Canvas/Helpers/FileAssociationManager.cs @@ -519,7 +519,7 @@ namespace Ink_Canvas.Helpers File.Delete(ipcFile); } } - catch { } + catch (Exception innerEx) { System.Diagnostics.Debug.WriteLine(innerEx); } } } @@ -570,7 +570,7 @@ namespace Ink_Canvas.Helpers File.Delete(ipcFile); } } - catch { } + catch (Exception innerEx) { System.Diagnostics.Debug.WriteLine(innerEx); } } } @@ -625,7 +625,7 @@ namespace Ink_Canvas.Helpers File.Delete(ipcFile); } } - catch { } + catch (Exception innerEx) { System.Diagnostics.Debug.WriteLine(innerEx); } } } @@ -675,7 +675,7 @@ namespace Ink_Canvas.Helpers File.Delete(ipcFile); } } - catch { } + catch (Exception innerEx) { System.Diagnostics.Debug.WriteLine(innerEx); } } } } diff --git a/Ink Canvas/Helpers/LogHelper.cs b/Ink Canvas/Helpers/LogHelper.cs index 10fe8cca..bfe19f1f 100644 --- a/Ink Canvas/Helpers/LogHelper.cs +++ b/Ink Canvas/Helpers/LogHelper.cs @@ -86,7 +86,10 @@ namespace Ink_Canvas.Helpers } }); } - catch { } + catch (Exception ex) + { + System.Diagnostics.Debug.WriteLine($"[LogHelper] WriteLogToFile failed: {ex.Message}"); + } } private static void CheckAndCleanLogsFolder(string logsPath) @@ -114,7 +117,10 @@ namespace Ink_Canvas.Helpers { file.Delete(); } - catch { } + catch (Exception ex) + { + System.Diagnostics.Debug.WriteLine($"[LogHelper] Delete log file failed: {ex.Message}"); + } } // 记录清理操作 @@ -129,7 +135,10 @@ namespace Ink_Canvas.Helpers }); } } - catch { } + catch (Exception ex) + { + System.Diagnostics.Debug.WriteLine($"[LogHelper] CheckAndCleanLogsFolder failed: {ex.Message}"); + } } internal static void WriteLogToFile(string v, object warning) diff --git a/Ink Canvas/Helpers/MultiTouchInput.cs b/Ink Canvas/Helpers/MultiTouchInput.cs index 1fea525e..40391fc0 100644 --- a/Ink Canvas/Helpers/MultiTouchInput.cs +++ b/Ink Canvas/Helpers/MultiTouchInput.cs @@ -190,7 +190,7 @@ namespace Ink_Canvas.Helpers _lastDrawnPointCount = currentPointCount; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } diff --git a/Ink Canvas/Helpers/PPTInkManager.cs b/Ink Canvas/Helpers/PPTInkManager.cs index 5ff52bb9..32ddb053 100644 --- a/Ink Canvas/Helpers/PPTInkManager.cs +++ b/Ink Canvas/Helpers/PPTInkManager.cs @@ -391,7 +391,7 @@ namespace Ink_Canvas.Helpers string path = Path.Combine(folderPath, slideIndex.ToString("0000") + StrokeFileExtension); if (File.Exists(path)) File.Delete(path); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } private void CheckAndPerformMemoryCleanup() @@ -433,7 +433,7 @@ namespace Ink_Canvas.Helpers if (_memoryStreams[i] != null) { long len = _memoryStreams[i].Length; - try { _memoryStreams[i].Dispose(); freed += len; cleaned++; } catch { } + try { _memoryStreams[i].Dispose(); freed += len; cleaned++; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } finally { _memoryStreams[i] = null; } } } diff --git a/Ink Canvas/Helpers/PPTManager.cs b/Ink Canvas/Helpers/PPTManager.cs index 7e02655a..efd19c57 100644 --- a/Ink Canvas/Helpers/PPTManager.cs +++ b/Ink Canvas/Helpers/PPTManager.cs @@ -451,7 +451,7 @@ namespace Ink_Canvas.Helpers refCount = Marshal.ReleaseComObject(PPTApplication); } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } } @@ -517,7 +517,7 @@ namespace Ink_Canvas.Helpers Marshal.ReleaseComObject(comObject); } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } private void SafeReleaseComObject(object comObject, string objectName) @@ -1559,7 +1559,7 @@ namespace Ink_Canvas.Helpers } } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } return true; }, IntPtr.Zero); @@ -1697,19 +1697,19 @@ namespace Ink_Canvas.Helpers // 确保清理状态 if (CurrentSlide != null && Marshal.IsComObject(CurrentSlide)) { - try { Marshal.ReleaseComObject(CurrentSlide); } catch { } + try { Marshal.ReleaseComObject(CurrentSlide); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } if (CurrentSlides != null && Marshal.IsComObject(CurrentSlides)) { - try { Marshal.ReleaseComObject(CurrentSlides); } catch { } + try { Marshal.ReleaseComObject(CurrentSlides); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } if (CurrentPresentation != null && Marshal.IsComObject(CurrentPresentation)) { - try { Marshal.ReleaseComObject(CurrentPresentation); } catch { } + try { Marshal.ReleaseComObject(CurrentPresentation); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } if (PPTApplication != null && Marshal.IsComObject(PPTApplication)) { - try { Marshal.ReleaseComObject(PPTApplication); } catch { } + try { Marshal.ReleaseComObject(PPTApplication); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } CurrentSlide = null; @@ -1858,7 +1858,7 @@ namespace Ink_Canvas.Helpers var proc = Process.GetProcessById((int)processId); windowInfo.ProcessName = proc.ProcessName.ToLower(); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } return windowInfo; } diff --git a/Ink Canvas/Helpers/PPTROTConnectionHelper.cs b/Ink Canvas/Helpers/PPTROTConnectionHelper.cs index 84870eb1..664a0b87 100644 --- a/Ink Canvas/Helpers/PPTROTConnectionHelper.cs +++ b/Ink Canvas/Helpers/PPTROTConnectionHelper.cs @@ -175,7 +175,7 @@ namespace Ink_Canvas.Helpers object appObj = comObject.GetType().InvokeMember("Application", BindingFlags.GetProperty, null, comObject, null); candidateApp = appObj; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } bool isDuplicate = false; @@ -213,7 +213,7 @@ namespace Ink_Canvas.Helpers { activePres = candidateApp.ActivePresentation; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } if (activePres != null) { @@ -223,7 +223,7 @@ namespace Ink_Canvas.Helpers { ssWindow = activePres.SlideShowWindow; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } if (ssWindow != null) { @@ -238,7 +238,7 @@ namespace Ink_Canvas.Helpers if (val is int && (int)val == -1) isActive = true; else if (val is bool && (bool)val == true) isActive = true; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } if (isActive) { @@ -252,7 +252,7 @@ namespace Ink_Canvas.Helpers } } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } } @@ -397,7 +397,7 @@ namespace Ink_Canvas.Helpers } } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } return false; } @@ -420,7 +420,7 @@ namespace Ink_Canvas.Helpers hwnd = new IntPtr(hwndVal); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } return hwnd; } @@ -435,7 +435,7 @@ namespace Ink_Canvas.Helpers { Marshal.ReleaseComObject(comObj); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } diff --git a/Ink Canvas/Helpers/Plugins/BuiltIn/SuperLauncher/LauncherWindow.xaml.cs b/Ink Canvas/Helpers/Plugins/BuiltIn/SuperLauncher/LauncherWindow.xaml.cs index affaf22f..6ca80e90 100644 --- a/Ink Canvas/Helpers/Plugins/BuiltIn/SuperLauncher/LauncherWindow.xaml.cs +++ b/Ink Canvas/Helpers/Plugins/BuiltIn/SuperLauncher/LauncherWindow.xaml.cs @@ -207,7 +207,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher { Dispatcher.BeginInvoke(new Action(() => { - try { Close(); } catch { } + try { Close(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 启动应用程序任务 launchTask.Start(); @@ -224,7 +224,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher catch (Exception ex) { LogHelper.WriteLogToFile($"应用按钮点击事件出错: {ex.Message}", LogHelper.LogType.Error); - try { IsClosing = true; Close(); } catch { } + try { IsClosing = true; Close(); } catch (Exception innerEx) { System.Diagnostics.Debug.WriteLine(innerEx); } } } diff --git a/Ink Canvas/Helpers/ProcessProtectionManager.cs b/Ink Canvas/Helpers/ProcessProtectionManager.cs index 32820872..bc88f8bb 100644 --- a/Ink Canvas/Helpers/ProcessProtectionManager.cs +++ b/Ink Canvas/Helpers/ProcessProtectionManager.cs @@ -37,8 +37,9 @@ namespace Ink_Canvas.Helpers var enabled = settings?.Security != null && settings.Security.EnableProcessProtection; SetEnabled(enabled); } - catch + catch (Exception ex) { + LogHelper.WriteLogToFile($"ProcessProtectionManager.ApplyFromSettings 失败: {ex.Message}", LogHelper.LogType.Warning); } } @@ -72,8 +73,9 @@ namespace Ink_Canvas.Helpers LogHelper.WriteLogToFile($"ProcessProtectionManager.WithWriteAccess: 获取写入门闩超时({gateTimeoutMs}ms),将降级直接执行写入动作。目标: {targetPath}", LogHelper.LogType.Warning); } - catch + catch (Exception ex) { + System.Diagnostics.Debug.WriteLine($"[ProcessProtectionManager] 写日志失败: {ex.Message}"); } action(); @@ -113,14 +115,14 @@ namespace Ink_Canvas.Helpers { foreach (var kv in releasedFiles) { - try { kv.Value.Dispose(); } catch { } + try { kv.Value.Dispose(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } if (releasedDirs != null) { foreach (var kv in releasedDirs) { - try { kv.Value.Dispose(); } catch { } + try { kv.Value.Dispose(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } @@ -217,13 +219,13 @@ namespace Ink_Canvas.Helpers { foreach (var kv in _lockedFiles) { - try { kv.Value.Dispose(); } catch { } + try { kv.Value.Dispose(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } _lockedFiles.Clear(); foreach (var kv in _lockedDirs) { - try { kv.Value.Dispose(); } catch { } + try { kv.Value.Dispose(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } _lockedDirs.Clear(); } diff --git a/Ink Canvas/Helpers/ROTPPTManager.cs b/Ink Canvas/Helpers/ROTPPTManager.cs index e35f9c60..8873b80e 100644 --- a/Ink Canvas/Helpers/ROTPPTManager.cs +++ b/Ink Canvas/Helpers/ROTPPTManager.cs @@ -435,7 +435,7 @@ namespace Ink_Canvas.Helpers refCount = Marshal.ReleaseComObject(appToRelease); } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } } diff --git a/Ink Canvas/Helpers/StartupCount.cs b/Ink Canvas/Helpers/StartupCount.cs index 4bb46fda..406f26f9 100644 --- a/Ink Canvas/Helpers/StartupCount.cs +++ b/Ink Canvas/Helpers/StartupCount.cs @@ -1,3 +1,4 @@ +using System; using System.IO; namespace Ink_Canvas.Helpers @@ -18,7 +19,7 @@ namespace Ink_Canvas.Helpers return count; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } return 0; } @@ -31,7 +32,7 @@ namespace Ink_Canvas.Helpers { File.WriteAllText(CountFilePath, count.ToString()); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } @@ -44,7 +45,7 @@ namespace Ink_Canvas.Helpers if (File.Exists(CountFilePath)) File.Delete(CountFilePath); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } } diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs index 1e38efcd..dbc6da41 100644 --- a/Ink Canvas/MainWindow.xaml.cs +++ b/Ink Canvas/MainWindow.xaml.cs @@ -544,7 +544,7 @@ namespace Ink_Canvas inkCanvas.Gesture += InkCanvas_Gesture; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } @@ -586,7 +586,7 @@ namespace Ink_Canvas return Color.FromArgb(alpha, r, g, b); } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } return Color.FromArgb(alpha, 255, 0, 0); } @@ -866,7 +866,7 @@ namespace Ink_Canvas } } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } if (!nextInterval.HasValue) { @@ -975,7 +975,7 @@ namespace Ink_Canvas } } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } private void inkCanvas_EditingModeChanged(object sender, RoutedEventArgs e) @@ -1595,7 +1595,7 @@ namespace Ink_Canvas _lastFrame = null; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 释放PPT管理器资源 DisposePPTManagers(); diff --git a/Ink Canvas/MainWindow_cs/MW_AutoTheme.cs b/Ink Canvas/MainWindow_cs/MW_AutoTheme.cs index 097eb8c8..a4cfdb05 100644 --- a/Ink Canvas/MainWindow_cs/MW_AutoTheme.cs +++ b/Ink Canvas/MainWindow_cs/MW_AutoTheme.cs @@ -357,7 +357,7 @@ namespace Ink_Canvas if (themeKey != null) keyValue = (int)themeKey.GetValue("SystemUsesLightTheme"); if (keyValue == 1) light = true; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } return light; } diff --git a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs index d0ccf480..a32bb3d2 100644 --- a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs +++ b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs @@ -1380,7 +1380,7 @@ namespace Ink_Canvas { InkCanvasForInkReplay.Strokes.Remove(s); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } stylusPoints.Add(stylusPoint); s = new Stroke(stylusPoints.Clone()) @@ -1417,7 +1417,7 @@ namespace Ink_Canvas { InkCanvasForInkReplay.Strokes.Remove(s); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } stylusPoints.Add(stylusPoint); s = new Stroke(stylusPoints.Clone()) @@ -2759,7 +2759,7 @@ namespace Ink_Canvas else ((UIElement)((Button)sender).Content).Opacity = 0.25; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } #endregion Left Side Panel diff --git a/Ink Canvas/MainWindow_cs/MW_Hotkeys.cs b/Ink Canvas/MainWindow_cs/MW_Hotkeys.cs index e14f5e92..237e5d45 100644 --- a/Ink Canvas/MainWindow_cs/MW_Hotkeys.cs +++ b/Ink Canvas/MainWindow_cs/MW_Hotkeys.cs @@ -1,4 +1,5 @@ -using System.Windows; +using System; +using System.Windows; using System.Windows.Input; namespace Ink_Canvas @@ -39,7 +40,7 @@ namespace Ink_Canvas { SymbolIconUndo_MouseUp(lastBorderMouseDownObject, null); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } private void HotKey_Redo(object sender, ExecutedRoutedEventArgs e) @@ -48,7 +49,7 @@ namespace Ink_Canvas { SymbolIconRedo_MouseUp(lastBorderMouseDownObject, null); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } private void HotKey_Clear(object sender, ExecutedRoutedEventArgs e) diff --git a/Ink Canvas/MainWindow_cs/MW_PPT.cs b/Ink Canvas/MainWindow_cs/MW_PPT.cs index fe436068..557c7f4c 100644 --- a/Ink Canvas/MainWindow_cs/MW_PPT.cs +++ b/Ink Canvas/MainWindow_cs/MW_PPT.cs @@ -416,7 +416,7 @@ namespace Ink_Canvas { pptApplication.Presentations[i].Close(); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } @@ -444,17 +444,17 @@ namespace Ink_Canvas { if (presentation != null) { - try { if (Marshal.IsComObject(presentation)) Marshal.ReleaseComObject(presentation); } catch { } + try { if (Marshal.IsComObject(presentation)) Marshal.ReleaseComObject(presentation); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } presentation = null; } if (slides != null) { - try { if (Marshal.IsComObject(slides)) Marshal.ReleaseComObject(slides); } catch { } + try { if (Marshal.IsComObject(slides)) Marshal.ReleaseComObject(slides); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } slides = null; } if (slide != null) { - try { if (Marshal.IsComObject(slide)) Marshal.ReleaseComObject(slide); } catch { } + try { if (Marshal.IsComObject(slide)) Marshal.ReleaseComObject(slide); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } slide = null; } slidescount = 0; @@ -1030,7 +1030,7 @@ namespace Ink_Canvas currentPage = pres.SlideShowWindow.View.CurrentShowPosition; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } diff --git a/Ink Canvas/MainWindow_cs/MW_Settings.cs b/Ink Canvas/MainWindow_cs/MW_Settings.cs index 8996bdc2..078bc1d5 100644 --- a/Ink Canvas/MainWindow_cs/MW_Settings.cs +++ b/Ink Canvas/MainWindow_cs/MW_Settings.cs @@ -977,7 +977,7 @@ namespace Ink_Canvas LogHelper.WriteLogToFile($"更新白板名言时出错: {ex.Message}", LogHelper.LogType.Warning); if (Settings.Appearance.ChickenSoupSource == 3 && BlackBoardWaterMark != null) { - try { BlackBoardWaterMark.Text = "一言功能不可用"; } catch { } + try { BlackBoardWaterMark.Text = "一言功能不可用"; } catch (Exception innerEx) { System.Diagnostics.Debug.WriteLine(innerEx); } } } } @@ -3344,7 +3344,7 @@ namespace Ink_Canvas ToggleSwitchRunAtStartup.IsOn = false; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } ShowNotification("设置已重置为默认推荐设置~"); } @@ -3363,7 +3363,7 @@ namespace Ink_Canvas LoadSettings(isStartup: false, skipAutoUpdateCheck: true); isLoaded = true; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } #endregion @@ -4423,7 +4423,7 @@ namespace Ink_Canvas var path = App.RootPath + settingsFileName; ProcessProtectionManager.WithWriteAccess(path, () => File.WriteAllText(path, text)); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } private void SCManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e) diff --git a/Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs b/Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs index 1b36e02a..8a829797 100644 --- a/Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs +++ b/Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs @@ -623,7 +623,7 @@ namespace Ink_Canvas { inkCanvas.Strokes.Remove(lastTempStroke); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } lastTempStroke = stroke; inkCanvas.Strokes.Add(stroke); @@ -681,7 +681,7 @@ namespace Ink_Canvas { inkCanvas.Strokes.Remove(lastTempStroke); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } lastTempStroke = stroke; inkCanvas.Strokes.Add(stroke); @@ -870,7 +870,7 @@ namespace Ink_Canvas { inkCanvas.Strokes.Remove(lastTempStroke); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } lastTempStroke = stroke; inkCanvas.Strokes.Add(stroke); @@ -895,7 +895,7 @@ namespace Ink_Canvas { inkCanvas.Strokes.Remove(lastTempStroke); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } lastTempStroke = stroke; inkCanvas.Strokes.Add(stroke); @@ -912,7 +912,7 @@ namespace Ink_Canvas { inkCanvas.Strokes.Remove(lastTempStroke); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } lastTempStroke = stroke; inkCanvas.Strokes.Add(stroke); @@ -931,7 +931,7 @@ namespace Ink_Canvas { inkCanvas.Strokes.Remove(lastTempStroke); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } lastTempStroke = stroke; inkCanvas.Strokes.Add(stroke); @@ -957,7 +957,7 @@ namespace Ink_Canvas { inkCanvas.Strokes.Remove(lastTempStroke); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } lastTempStroke = stroke; inkCanvas.Strokes.Add(stroke); @@ -1019,7 +1019,7 @@ namespace Ink_Canvas { inkCanvas.Strokes.Remove(lastTempStrokeCollection); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } lastTempStrokeCollection = strokes; inkCanvas.Strokes.Add(strokes); @@ -1554,10 +1554,10 @@ namespace Ink_Canvas // 如果更新失败,确保清理状态 if (lastTempStroke != null && inkCanvas.Strokes.Contains(lastTempStroke)) { - try { inkCanvas.Strokes.Remove(lastTempStroke); } catch { } + try { inkCanvas.Strokes.Remove(lastTempStroke); } catch (Exception innerEx) { System.Diagnostics.Debug.WriteLine(innerEx); } } lastTempStroke = newStroke; - try { inkCanvas.Strokes.Add(newStroke); } catch { } + try { inkCanvas.Strokes.Add(newStroke); } catch (Exception innerEx) { System.Diagnostics.Debug.WriteLine(innerEx); } } }), DispatcherPriority.Render); } @@ -1612,11 +1612,11 @@ namespace Ink_Canvas { foreach (var stroke in lastTempStrokeCollection) { - try { inkCanvas.Strokes.Remove(stroke); } catch { } + try { inkCanvas.Strokes.Remove(stroke); } catch (Exception innerEx) { System.Diagnostics.Debug.WriteLine(innerEx); } } } lastTempStrokeCollection = newStrokeCollection; - try { inkCanvas.Strokes.Add(newStrokeCollection); } catch { } + try { inkCanvas.Strokes.Add(newStrokeCollection); } catch (Exception innerEx) { System.Diagnostics.Debug.WriteLine(innerEx); } } }), DispatcherPriority.Render); } diff --git a/Ink Canvas/MainWindow_cs/MW_SimulatePressure&InkToShape.cs b/Ink Canvas/MainWindow_cs/MW_SimulatePressure&InkToShape.cs index ff7a530f..b3631b6d 100644 --- a/Ink Canvas/MainWindow_cs/MW_SimulatePressure&InkToShape.cs +++ b/Ink Canvas/MainWindow_cs/MW_SimulatePressure&InkToShape.cs @@ -1,4 +1,4 @@ -using Ink_Canvas.Helpers; +using Ink_Canvas.Helpers; using System; using System.Collections.Generic; using System.Diagnostics; @@ -162,7 +162,7 @@ namespace Ink_Canvas e.Stroke.StylusPoints = stylusPoints; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } break; case 0: if (penType == 0) @@ -210,7 +210,7 @@ namespace Ink_Canvas e.Stroke.StylusPoints = stylusPoints; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } break; } } @@ -603,7 +603,7 @@ namespace Ink_Canvas } } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } InkToShapeProcess(); @@ -630,7 +630,7 @@ namespace Ink_Canvas RandWindow.randSeed = (int)(_speed * 100000 * 1000); } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } switch (Settings.Canvas.InkStyle) { @@ -663,7 +663,7 @@ namespace Ink_Canvas e.Stroke.StylusPoints = stylusPoints; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } break; case 0: @@ -712,12 +712,12 @@ namespace Ink_Canvas e.Stroke.StylusPoints = stylusPoints; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } break; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 应用高级贝塞尔曲线平滑(仅在未进行直线拉直时) Debug.WriteLine($"墨迹平滑检查: UseAdvancedBezierSmoothing={Settings.Canvas.UseAdvancedBezierSmoothing}, wasStraightened={wasStraightened}"); diff --git a/Ink Canvas/MainWindow_cs/MW_Timer.cs b/Ink Canvas/MainWindow_cs/MW_Timer.cs index 61e32308..2d6fa6be 100644 --- a/Ink Canvas/MainWindow_cs/MW_Timer.cs +++ b/Ink Canvas/MainWindow_cs/MW_Timer.cs @@ -453,7 +453,7 @@ namespace Ink_Canvas } } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } @@ -550,7 +550,7 @@ namespace Ink_Canvas return true; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } else if (Settings.Automation.IsAutoFoldInEasiCamera && windowProcessName == "EasiCamera") @@ -617,7 +617,7 @@ namespace Ink_Canvas return true; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } } @@ -699,7 +699,7 @@ namespace Ink_Canvas return true; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } // 检查EasiCamera @@ -809,7 +809,7 @@ namespace Ink_Canvas return true; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } } diff --git a/Ink Canvas/MainWindow_cs/MW_TouchEvents.cs b/Ink Canvas/MainWindow_cs/MW_TouchEvents.cs index 29e901ed..d128f25a 100644 --- a/Ink Canvas/MainWindow_cs/MW_TouchEvents.cs +++ b/Ink Canvas/MainWindow_cs/MW_TouchEvents.cs @@ -388,7 +388,7 @@ namespace Ink_Canvas TouchDownPointsList.Clear(); } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } inkCanvas.ReleaseStylusCapture(); ViewboxFloatingBar.IsHitTestVisible = true; @@ -415,7 +415,7 @@ namespace Ink_Canvas { if (e.StylusDevice.StylusButtons[1].StylusButtonState == StylusButtonState.Down) return; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } var strokeVisual = GetStrokeVisual(e.StylusDevice.Id); @@ -424,7 +424,7 @@ namespace Ink_Canvas strokeVisual.Add(new StylusPoint(stylusPoint.X, stylusPoint.Y, stylusPoint.PressureFactor)); strokeVisual.Redraw(); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } private StrokeVisual GetStrokeVisual(int id) @@ -729,7 +729,7 @@ namespace Ink_Canvas stroke.DrawingAttributes.Width *= md.Scale.X; stroke.DrawingAttributes.Height *= md.Scale.Y; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } else @@ -744,7 +744,7 @@ namespace Ink_Canvas stroke.DrawingAttributes.Width *= md.Scale.X; stroke.DrawingAttributes.Height *= md.Scale.Y; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } // 同时变换画布上的图片元素 diff --git a/Ink Canvas/MainWindow_cs/MW_VideoPresenter.cs b/Ink Canvas/MainWindow_cs/MW_VideoPresenter.cs index 7df0f766..763546d6 100644 --- a/Ink Canvas/MainWindow_cs/MW_VideoPresenter.cs +++ b/Ink Canvas/MainWindow_cs/MW_VideoPresenter.cs @@ -95,7 +95,7 @@ namespace Ink_Canvas { LogHelper.WriteLogToFile($"视频展台摄像头错误: {e}", LogHelper.LogType.Error); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } private void CameraService_FrameReceived(object sender, Bitmap frame) @@ -169,7 +169,7 @@ namespace Ink_Canvas img.Source = preview; img.Visibility = Visibility.Visible; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } private const double VideoPresenterLiveFrameScreenRatio = 0.75; @@ -201,7 +201,7 @@ namespace Ink_Canvas InitializeElementTransform(img); BindElementEvents(img); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } _liveFrameImageByPage[page] = img; return img; @@ -323,7 +323,7 @@ namespace Ink_Canvas UpdateCurrentToolMode("select"); HideSubPanels("select"); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 立即用侧栏预览刷新一次 if (VideoPresenterPreviewImage?.Source is BitmapImage bi) @@ -346,7 +346,7 @@ namespace Ink_Canvas inkCanvas.Children.Remove(img); } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } @@ -365,7 +365,7 @@ namespace Ink_Canvas _liveFrameLayoutByPage[page] = (left, top, img.Width); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } // 翻页后调用:根据该页状态恢复实时画面,并同步设备选择 @@ -404,7 +404,7 @@ namespace Ink_Canvas _cameraService?.StartPreview(idx); } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } private void BtnCapturePhoto_Click(object sender, RoutedEventArgs e) @@ -595,13 +595,13 @@ namespace Ink_Canvas } img.Visibility = Visibility.Collapsed; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } - try { _cameraService?.StopPreview(); } catch { } + try { _cameraService?.StopPreview(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } private static BitmapImage ConvertBitmapToBitmapImage(Bitmap bitmap) diff --git a/Ink Canvas/Windows/OobeWindow.xaml.cs b/Ink Canvas/Windows/OobeWindow.xaml.cs index e4ff5447..553de30a 100644 --- a/Ink Canvas/Windows/OobeWindow.xaml.cs +++ b/Ink Canvas/Windows/OobeWindow.xaml.cs @@ -124,7 +124,7 @@ namespace Ink_Canvas.Windows CheckBoxHideStrokeWhenSelecting.IsChecked = _settings.Canvas.HideStrokeWhenSelecting; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 手势操作 try @@ -137,7 +137,7 @@ namespace Ink_Canvas.Windows CheckBoxEnablePalmEraser.IsChecked = _settings.Canvas != null && _settings.Canvas.EnablePalmEraser; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 墨迹纠正 try @@ -147,7 +147,7 @@ namespace Ink_Canvas.Windows CheckBoxInkToShapeEnabled.IsChecked = _settings.InkToShape.IsInkToShapeEnabled; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 快捷键(外观) try @@ -157,7 +157,7 @@ namespace Ink_Canvas.Windows CheckBoxEnableHotkeysInMouseMode.IsChecked = _settings.Appearance.EnableHotkeysInMouseMode; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 崩溃处理 try @@ -165,7 +165,7 @@ namespace Ink_Canvas.Windows RadioCrashSilentRestart.IsChecked = _settings.Startup.CrashAction == 0; RadioCrashNoAction.IsChecked = _settings.Startup.CrashAction != 0; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 自动化行为 try @@ -180,7 +180,7 @@ namespace Ink_Canvas.Windows } } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 随机点名 try @@ -190,7 +190,7 @@ namespace Ink_Canvas.Windows CheckBoxShowRandomAndSingleDraw.IsChecked = _settings.RandSettings.ShowRandomAndSingleDraw; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 高级选项 try @@ -200,7 +200,7 @@ namespace Ink_Canvas.Windows CheckBoxIsLogEnabled.IsChecked = _settings.Advanced.IsLogEnabled; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 截图(自动化中的截图相关) try @@ -211,7 +211,7 @@ namespace Ink_Canvas.Windows CheckBoxSaveScreenshotsInDateFolders.IsChecked = _settings.Automation.IsSaveScreenshotsInDateFolders; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } private void ApplySelection() @@ -312,7 +312,7 @@ namespace Ink_Canvas.Windows _settings.Canvas.EnablePalmEraser = CheckBoxEnablePalmEraser.IsChecked == true; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 写回手势操作 try @@ -324,7 +324,7 @@ namespace Ink_Canvas.Windows _settings.Gesture.AutoSwitchTwoFingerGesture = CheckBoxAutoSwitchTwoFingerGesture.IsChecked == true; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 写回墨迹纠正 try @@ -334,7 +334,7 @@ namespace Ink_Canvas.Windows _settings.InkToShape.IsInkToShapeEnabled = CheckBoxInkToShapeEnabled.IsChecked == true; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 写回快捷键(外观) try @@ -344,14 +344,14 @@ namespace Ink_Canvas.Windows _settings.Appearance.EnableHotkeysInMouseMode = CheckBoxEnableHotkeysInMouseMode.IsChecked == true; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 写回崩溃处理(0=静默重启,1=无操作) try { _settings.Startup.CrashAction = RadioCrashNoAction.IsChecked == true ? 1 : 0; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 写回自动化行为 try @@ -368,7 +368,7 @@ namespace Ink_Canvas.Windows } } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 写回随机点名 try @@ -378,7 +378,7 @@ namespace Ink_Canvas.Windows _settings.RandSettings.ShowRandomAndSingleDraw = CheckBoxShowRandomAndSingleDraw.IsChecked == true; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 写回高级选项 try @@ -388,7 +388,7 @@ namespace Ink_Canvas.Windows _settings.Advanced.IsLogEnabled = CheckBoxIsLogEnabled.IsChecked == true; } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 标记用户已经阅读并确认过隐私说明 _settings.Startup.HasAcceptedTelemetryPrivacy = true; diff --git a/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs b/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs index 28e83faa..c21f7b57 100644 --- a/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs +++ b/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs @@ -1,4 +1,4 @@ -using Ink_Canvas.Helpers; +using Ink_Canvas.Helpers; using iNKORE.UI.WPF.Modern; using System; using System.Windows; @@ -89,7 +89,7 @@ namespace Ink_Canvas if (themeKey != null) keyValue = (int)themeKey.GetValue("SystemUsesLightTheme"); if (keyValue == 1) light = true; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } return light; } diff --git a/Ink Canvas/Windows/PPTQuickPanel.xaml.cs b/Ink Canvas/Windows/PPTQuickPanel.xaml.cs index 5f914e19..ffda3e3d 100644 --- a/Ink Canvas/Windows/PPTQuickPanel.xaml.cs +++ b/Ink Canvas/Windows/PPTQuickPanel.xaml.cs @@ -1399,7 +1399,7 @@ namespace Ink_Canvas.Windows System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance); presentation = currentPresentationProperty?.GetValue(pptManager) as Microsoft.Office.Interop.PowerPoint.Presentation; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // 如果 CurrentPresentation 不可用,尝试 GetCurrentActivePresentation if (presentation == null) @@ -1409,7 +1409,7 @@ namespace Ink_Canvas.Windows var getCurrentActivePresentationMethod = pptManager.GetType().GetMethod("GetCurrentActivePresentation"); presentation = getCurrentActivePresentationMethod?.Invoke(pptManager, null) as Microsoft.Office.Interop.PowerPoint.Presentation; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } if (presentation != null) diff --git a/Ink Canvas/Windows/RandWindow.xaml.cs b/Ink Canvas/Windows/RandWindow.xaml.cs index 64c410c3..867e9664 100644 --- a/Ink Canvas/Windows/RandWindow.xaml.cs +++ b/Ink Canvas/Windows/RandWindow.xaml.cs @@ -1,4 +1,4 @@ -using Ink_Canvas.Helpers; +using Ink_Canvas.Helpers; using iNKORE.UI.WPF.Modern.Controls; using Microsoft.VisualBasic; using System; @@ -131,7 +131,7 @@ namespace Ink_Canvas if (themeKey != null) keyValue = (int)themeKey.GetValue("SystemUsesLightTheme"); if (keyValue == 1) light = true; } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } return light; } diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml.cs index 80496e64..493c72a2 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml.cs @@ -1,4 +1,4 @@ -using iNKORE.UI.WPF.Helpers; +using iNKORE.UI.WPF.Helpers; using Ink_Canvas.Helpers; using OSVersionExtension; using System; @@ -38,7 +38,7 @@ namespace Ink_Canvas.Windows.SettingsViews CopyrightBannerImage.Source = new BitmapImage(new Uri($"file://{App.RootPath + "icc-about-illustrations.png"}")); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } else { @@ -173,7 +173,7 @@ namespace Ink_Canvas.Windows.SettingsViews } } } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } public static class TouchTabletDetectHelper diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/SecurityPanel.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsViews/SecurityPanel.xaml.cs index ed3284a6..f99997af 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/SecurityPanel.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/SecurityPanel.xaml.cs @@ -171,7 +171,7 @@ namespace Ink_Canvas.Windows.SettingsViews ThemeHelper.ApplyThemeToControl(this); LoadSettings(); } - catch { } + catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } } }