From ccb19c832c61625da5c6390439459b385cff3e40 Mon Sep 17 00:00:00 2001 From: HolographicHat Date: Sat, 8 Oct 2022 19:41:39 +0800 Subject: [PATCH] ignore tmp file delete exception --- src/AppConfig.cs | 4 +++- src/Utils.cs | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/AppConfig.cs b/src/AppConfig.cs index 4e39bd1..b6d095b 100644 --- a/src/AppConfig.cs +++ b/src/AppConfig.cs @@ -49,7 +49,9 @@ public static class AppConfig { var copiedLogFilePath = Path.GetTempFileName(); File.Copy(path, copiedLogFilePath, true); var content = File.ReadAllText(copiedLogFilePath); - File.Delete(copiedLogFilePath); + try { + File.Delete(copiedLogFilePath); + } catch (Exception) { /* ignore */} var matchResult = Regex.Match(content, @"(?m).:/.+(GenshinImpact_Data|YuanShen_Data)"); if (!matchResult.Success) { return null; diff --git a/src/Utils.cs b/src/Utils.cs index 840cf34..e0480dc 100644 --- a/src/Utils.cs +++ b/src/Utils.cs @@ -8,7 +8,6 @@ using System.Runtime.InteropServices; using Microsoft.Win32; using YaeAchievement.AppCenterSDK; using YaeAchievement.res; -using YaeAchievement.res; using YaeAchievement.Win32; namespace YaeAchievement;