txt檔案整理

This commit is contained in:
jasonchenwork 2025-04-09 11:46:18 +08:00
parent 74c5121eb7
commit 533cc9eb4a
6 changed files with 11 additions and 11 deletions

View File

@ -360,7 +360,7 @@ private Rectangle FindContentBounds(Bitmap bmp)
try try
{ {
string filePath = Path.Combine(Application.StartupPath, "WelcomeMessage.txt"); string filePath = Path.Combine(Application.StartupPath,"txt","WelcomeMessage.txt");
marqueeText = File.ReadAllText(filePath); marqueeText = File.ReadAllText(filePath);
} }
catch (Exception ex) catch (Exception ex)
@ -612,7 +612,7 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
{ {
try try
{ {
string filePath = Path.Combine(Application.StartupPath, "WelcomeMessage.txt"); string filePath = Path.Combine(Application.StartupPath,"txt","WelcomeMessage.txt");
string welcomeMessage = File.ReadAllText(filePath); string welcomeMessage = File.ReadAllText(filePath);
this.UpdateMarqueeText(welcomeMessage, MarqueeStartPosition.Right, Color.White); this.UpdateMarqueeText(welcomeMessage, MarqueeStartPosition.Right, Color.White);
} }

View File

@ -251,7 +251,7 @@ namespace DualScreenDemo
public static int ReadHotSongLimit() public static int ReadHotSongLimit()
{ {
string filePath = Path.Combine(Application.StartupPath, "SongLimitsSettings.txt"); string filePath = Path.Combine(Application.StartupPath,"txt","SongLimitsSettings.txt");
try try
{ {

View File

@ -221,7 +221,7 @@ namespace DualScreenDemo
public static int ReadNewSongLimit() public static int ReadNewSongLimit()
{ {
string filePath = Path.Combine(Application.StartupPath, "SongLimitsSettings.txt"); string filePath = Path.Combine(Application.StartupPath, "txt", "SongLimitsSettings.txt");
try try
{ {

View File

@ -660,7 +660,7 @@ namespace DualScreenDemo
private string ReadSelectedThemePath() private string ReadSelectedThemePath()
{ {
string configFilePath = Path.Combine(Application.StartupPath, "theme_description.txt"); string configFilePath = Path.Combine(Application.StartupPath, "txt", "theme_description.txt");
try try
{ {
@ -2371,9 +2371,8 @@ public class MultiPagePanel : Panel
public static void WriteLog(string message) 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)) using (StreamWriter sw = new StreamWriter(logFilePath, true))
{ {

View File

@ -72,7 +72,7 @@ static void Main()
primaryForm.Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); 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) && bool isClosedState = File.Exists(stateFilePath) &&
File.ReadAllText(stateFilePath).Trim().Equals("CLOSE", StringComparison.OrdinalIgnoreCase); File.ReadAllText(stateFilePath).Trim().Equals("CLOSE", StringComparison.OrdinalIgnoreCase);
@ -229,7 +229,8 @@ static void Main()
static void WriteLog(string message) static void WriteLog(string message)
{ {
// 指定日志文件的路径 // 指定日志文件的路径
string logFilePath = "mainlog.txt"; // 请根据需要修改文件路径 string logFilePath = Path.Combine(Application.StartupPath, "txt", "mainlog.txt");
try try
{ {

View File

@ -82,7 +82,7 @@ namespace DualScreenDemo
listener.Start(); listener.Start();
Console.WriteLine("Server started on port " + Port + "."); Console.WriteLine("Server started on port " + Port + ".");
try { try {
string stateFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "states.txt"); string stateFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"txt","states.txt");
string initialState = ReadStateFile(stateFilePath); string initialState = ReadStateFile(stateFilePath);
if (initialState.Equals("CLOSE", StringComparison.OrdinalIgnoreCase)) if (initialState.Equals("CLOSE", StringComparison.OrdinalIgnoreCase))