From 351a3cb270a785682ae45da2b47d9c31af81caa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=89=E9=B8=AD=E8=9B=8B?= Date: Sun, 29 Dec 2024 18:30:48 +0800 Subject: [PATCH] utc+8 --- BetterGenshinImpact/Core/Config/CommonConfig.cs | 4 ++-- .../Core/Recorder/KeyMouseRecorderJsonLine.cs | 4 ++-- BetterGenshinImpact/Core/Video/FfmpegRecorder.cs | 2 +- BetterGenshinImpact/Core/Video/ObsRecorder.cs | 4 ++-- .../Service/Singletons/StartEndSingleton.cs | 8 ++++---- .../ViewModel/Pages/KeyMouseRecordPageViewModel.cs | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/BetterGenshinImpact/Core/Config/CommonConfig.cs b/BetterGenshinImpact/Core/Config/CommonConfig.cs index 8bbd8997..a61cbb2e 100644 --- a/BetterGenshinImpact/Core/Config/CommonConfig.cs +++ b/BetterGenshinImpact/Core/Config/CommonConfig.cs @@ -41,9 +41,9 @@ public partial class CommonConfig : ObservableObject // 关闭时还原分辨率 [ObservableProperty] - private bool _restoreResolutionOnExit; + private bool _restoreResolutionOnExit = false; // 录制工具 ffmpeg/obs [ObservableProperty] - private string _recorder = "ffmpeg"; + private string _recorder = "obs"; } diff --git a/BetterGenshinImpact/Core/Recorder/KeyMouseRecorderJsonLine.cs b/BetterGenshinImpact/Core/Recorder/KeyMouseRecorderJsonLine.cs index f13ce674..f2d5889b 100644 --- a/BetterGenshinImpact/Core/Recorder/KeyMouseRecorderJsonLine.cs +++ b/BetterGenshinImpact/Core/Recorder/KeyMouseRecorderJsonLine.cs @@ -46,7 +46,7 @@ public class KeyMouseRecorderJsonLine { var path = Global.Absolute($@"User\KeyMouseScript\{folderName}\"); - DateTime startTime = DateTime.UtcNow; + DateTime startTime = DateTime.Now; // var bootTime = EnvironmentUtil.LastBootUpTime(); // if (bootTime == null) // { @@ -66,7 +66,7 @@ public class KeyMouseRecorderJsonLine Height = rect.Height, RecordDpi = TaskContext.Instance().DpiScale, StartTime = $"{startTime:yyyy-MM-dd HH:mm:ss:ffff}", - StartTimeUnixTimestamp = (startTime - new DateTime(1970, 1, 1)).TotalNanoseconds.ToString("F0"), + StartTimeUnixTimestamp = (startTime.ToUniversalTime() - new DateTime(1970, 1, 1)).TotalNanoseconds.ToString("F0"), SysParams = RecordContext.Instance.SysParams }; var infoJson = JsonSerializer.Serialize(Info, JsonOptions); diff --git a/BetterGenshinImpact/Core/Video/FfmpegRecorder.cs b/BetterGenshinImpact/Core/Video/FfmpegRecorder.cs index 8d2c5b19..0fa7c546 100644 --- a/BetterGenshinImpact/Core/Video/FfmpegRecorder.cs +++ b/BetterGenshinImpact/Core/Video/FfmpegRecorder.cs @@ -66,7 +66,7 @@ public class FfmpegRecorder : IVideoRecorder { _startTime = match.Groups[1].Value.Replace(".", ""); TaskControl.Logger.LogInformation("ffmpeg录制: 视频起始时间戳 {Text}", _startTime); - File.WriteAllText(Path.Combine(folderPath, $"videoStartTime.txt"), _startTime); + File.WriteAllText(Path.Combine(folderPath, $"videoStartTime.txt"), _startTime + "000"); } } } diff --git a/BetterGenshinImpact/Core/Video/ObsRecorder.cs b/BetterGenshinImpact/Core/Video/ObsRecorder.cs index 7a908bc7..309561a7 100644 --- a/BetterGenshinImpact/Core/Video/ObsRecorder.cs +++ b/BetterGenshinImpact/Core/Video/ObsRecorder.cs @@ -95,7 +95,7 @@ public class ObsRecorder : IVideoRecorder try { obs.StartRecord(); - _lastRecordTime = DateTime.UtcNow; + _lastRecordTime = DateTime.Now; TaskControl.Logger.LogInformation("OBS: 开始录制,时间: {Time}", _lastRecordTime.ToString("yyyy-MM-dd HH:mm:ss:ffff")); return true; } @@ -179,7 +179,7 @@ public class ObsRecorder : IVideoRecorder TaskControl.Logger.LogError("OBS: 未找到录制结果文件"); } - File.WriteAllText(Path.Combine(folderPath, "videoStartTime.txt"), (_lastRecordTime - new DateTime(1970, 1, 1)).TotalNanoseconds.ToString("F0")); + File.WriteAllText(Path.Combine(folderPath, "videoStartTime.txt"), (_lastRecordTime.ToUniversalTime() - new DateTime(1970, 1, 1)).TotalNanoseconds.ToString("F0")); } catch (Exception e) { diff --git a/BetterGenshinImpact/Service/Singletons/StartEndSingleton.cs b/BetterGenshinImpact/Service/Singletons/StartEndSingleton.cs index 4eea63f0..a16ddb47 100644 --- a/BetterGenshinImpact/Service/Singletons/StartEndSingleton.cs +++ b/BetterGenshinImpact/Service/Singletons/StartEndSingleton.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using BetterGenshinImpact.Core.Config; using BetterGenshinImpact.GameTask; using BetterGenshinImpact.GameTask.Common; +using BetterGenshinImpact.Helpers; using BetterGenshinImpact.Helpers.Device; using BetterGenshinImpact.Model; using BetterGenshinImpact.ViewModel.Pages; @@ -28,9 +29,8 @@ public class StartEndSingleton: Singleton TouchpadSoft.Instance.CheckAndRecordStatus(); TouchpadSoft.Instance.DisableTouchpadWhenEnabledByHotKey(); - - - if (TaskContext.Instance().Config.CommonConfig.ChangeResolutionOnStart) + + if (TaskContext.Instance().Config.CommonConfig.ChangeResolutionOnStart && !RuntimeHelper.IsDebug) { // 设置DPI SysDpi.Instance.SetDpi(); @@ -63,7 +63,7 @@ public class StartEndSingleton: Singleton { TouchpadSoft.Instance.RestoreTouchpadByHotKey(); - if (TaskContext.Instance().Config.CommonConfig.RestoreResolutionOnExit) + if (TaskContext.Instance().Config.CommonConfig.RestoreResolutionOnExit && !RuntimeHelper.IsDebug) { ResetResolution(); Thread.Sleep(2000); diff --git a/BetterGenshinImpact/ViewModel/Pages/KeyMouseRecordPageViewModel.cs b/BetterGenshinImpact/ViewModel/Pages/KeyMouseRecordPageViewModel.cs index 71a074d6..bf6f6e4c 100644 --- a/BetterGenshinImpact/ViewModel/Pages/KeyMouseRecordPageViewModel.cs +++ b/BetterGenshinImpact/ViewModel/Pages/KeyMouseRecordPageViewModel.cs @@ -102,7 +102,7 @@ public partial class KeyMouseRecordPageViewModel : ObservableObject, INavigation return; } - if (TaskContext.Instance().Config.CommonConfig.ProcessCheckEnabled) + if (TaskContext.Instance().Config.CommonConfig.ProcessCheckEnabled && !RuntimeHelper.IsDebug) { try {