From 533cc9eb4a74b6639dbef5037d4467f043a73b62 Mon Sep 17 00:00:00 2001 From: jasonchenwork Date: Wed, 9 Apr 2025 11:46:18 +0800 Subject: [PATCH] =?UTF-8?q?txt=E6=AA=94=E6=A1=88=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OverlayFormObj/OverlayForm.cs | 4 ++-- PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs | 2 +- PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs | 2 +- PrimaryFormParts/PrimaryForm.cs | 7 +++---- Program.cs | 5 +++-- TCPServer.cs | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/OverlayFormObj/OverlayForm.cs b/OverlayFormObj/OverlayForm.cs index 2b00d30..35dc75f 100644 --- a/OverlayFormObj/OverlayForm.cs +++ b/OverlayFormObj/OverlayForm.cs @@ -360,7 +360,7 @@ private Rectangle FindContentBounds(Bitmap bmp) try { - string filePath = Path.Combine(Application.StartupPath, "WelcomeMessage.txt"); + string filePath = Path.Combine(Application.StartupPath,"txt","WelcomeMessage.txt"); marqueeText = File.ReadAllText(filePath); } catch (Exception ex) @@ -612,7 +612,7 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e) { try { - string filePath = Path.Combine(Application.StartupPath, "WelcomeMessage.txt"); + string filePath = Path.Combine(Application.StartupPath,"txt","WelcomeMessage.txt"); string welcomeMessage = File.ReadAllText(filePath); this.UpdateMarqueeText(welcomeMessage, MarqueeStartPosition.Right, Color.White); } diff --git a/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs b/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs index ea41e66..eed5e28 100644 --- a/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs +++ b/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs @@ -251,7 +251,7 @@ namespace DualScreenDemo public static int ReadHotSongLimit() { - string filePath = Path.Combine(Application.StartupPath, "SongLimitsSettings.txt"); + string filePath = Path.Combine(Application.StartupPath,"txt","SongLimitsSettings.txt"); try { diff --git a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs index f90a694..effe678 100644 --- a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs +++ b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs @@ -221,7 +221,7 @@ namespace DualScreenDemo public static int ReadNewSongLimit() { - string filePath = Path.Combine(Application.StartupPath, "SongLimitsSettings.txt"); + string filePath = Path.Combine(Application.StartupPath, "txt", "SongLimitsSettings.txt"); try { diff --git a/PrimaryFormParts/PrimaryForm.cs b/PrimaryFormParts/PrimaryForm.cs index 3a76b01..9d77b77 100644 --- a/PrimaryFormParts/PrimaryForm.cs +++ b/PrimaryFormParts/PrimaryForm.cs @@ -660,7 +660,7 @@ namespace DualScreenDemo private string ReadSelectedThemePath() { - string configFilePath = Path.Combine(Application.StartupPath, "theme_description.txt"); + string configFilePath = Path.Combine(Application.StartupPath, "txt", "theme_description.txt"); try { @@ -2371,9 +2371,8 @@ public class MultiPagePanel : Panel public static void WriteLog(string message) { - string logFilePath = "logfile.txt"; - - + string logFilePath = Path.Combine(Application.StartupPath, "txt", "logfile.txt"); + using (StreamWriter sw = new StreamWriter(logFilePath, true)) { diff --git a/Program.cs b/Program.cs index 10243d7..d45176f 100644 --- a/Program.cs +++ b/Program.cs @@ -72,7 +72,7 @@ static void Main() primaryForm.Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); // 在完整初始化後檢查狀態 - string stateFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "states.txt"); + string stateFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"txt","states.txt"); bool isClosedState = File.Exists(stateFilePath) && File.ReadAllText(stateFilePath).Trim().Equals("CLOSE", StringComparison.OrdinalIgnoreCase); @@ -229,7 +229,8 @@ static void Main() static void WriteLog(string message) { // 指定日志文件的路径 - string logFilePath = "mainlog.txt"; // 请根据需要修改文件路径 + string logFilePath = Path.Combine(Application.StartupPath, "txt", "mainlog.txt"); + try { diff --git a/TCPServer.cs b/TCPServer.cs index 30eae15..5c3accc 100644 --- a/TCPServer.cs +++ b/TCPServer.cs @@ -82,7 +82,7 @@ namespace DualScreenDemo listener.Start(); Console.WriteLine("Server started on port " + Port + "."); try { - string stateFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "states.txt"); + string stateFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"txt","states.txt"); string initialState = ReadStateFile(stateFilePath); if (initialState.Equals("CLOSE", StringComparison.OrdinalIgnoreCase))