diff --git a/.gitignore b/.gitignore index b737457..af27061 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,5 @@ Superstar.mdf Superstar_log.ldf .vs build.bat -DualScreenKTVPlayStation.exe +*.exe themes/superstar/_www/ \ No newline at end of file diff --git a/CommandHandler.cs b/CommandHandler.cs index 081f875..de42765 100644 --- a/CommandHandler.cs +++ b/CommandHandler.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using System.Windows.Forms; using System.Collections.Generic; using System.Diagnostics; - +using DBObj; namespace DualScreenDemo { public class CommandHandler diff --git a/Artist.cs b/DBObj/Artist.cs similarity index 96% rename from Artist.cs rename to DBObj/Artist.cs index 4e74b02..670e708 100644 --- a/Artist.cs +++ b/DBObj/Artist.cs @@ -1,4 +1,4 @@ -namespace DualScreenDemo +namespace DBObj { // artist OOP test public class Artist diff --git a/ArtistManager.cs b/DBObj/ArtistManager.cs similarity index 99% rename from ArtistManager.cs rename to DBObj/ArtistManager.cs index f5e4617..0f8fb44 100644 --- a/ArtistManager.cs +++ b/DBObj/ArtistManager.cs @@ -4,8 +4,8 @@ using System.Data.SQLite; using System.IO; using System.Linq; using System.Windows.Forms; - -namespace DualScreenDemo +using DualScreenDemo; +namespace DBObj { /** 重資料庫取資料回來 diff --git a/SongData.cs b/DBObj/SongData.cs similarity index 99% rename from SongData.cs rename to DBObj/SongData.cs index 163035f..21c7529 100644 --- a/SongData.cs +++ b/DBObj/SongData.cs @@ -1,6 +1,6 @@ using System; -namespace DualScreenDemo +namespace DBObj { public class SongData { diff --git a/SongListManager.cs b/DBObj/SongListManager.cs similarity index 99% rename from SongListManager.cs rename to DBObj/SongListManager.cs index 5f7e7db..2b48d13 100644 --- a/SongListManager.cs +++ b/DBObj/SongListManager.cs @@ -6,8 +6,8 @@ using System.Linq; using System.Windows.Forms; using System.Globalization; using System.Diagnostics; - -namespace DualScreenDemo +using DualScreenDemo; +namespace DBObj { public class SongListManager { @@ -278,7 +278,7 @@ namespace DualScreenDemo } catch (System.FormatException ex) { - // Console.WriteLine(String.Format("Invalid date format for song: {0}. Error: {1}", song, ex.Message)); + //Console.WriteLine(String.Format("Invalid date format for song: {0}. Error: {1}", song, ex.Message)); addedTime = DateTime.Now; } } diff --git a/HttpServer.cs b/HttpServer.cs index 07a8e04..6bb2735 100644 --- a/HttpServer.cs +++ b/HttpServer.cs @@ -17,6 +17,7 @@ using SystemAction = System.Action; using ZXingAction = ZXing.Action; using System.Threading; using System.Collections.Concurrent; +using DBObj; namespace DualScreenDemo { public class HttpServer @@ -26,7 +27,7 @@ namespace DualScreenDemo // 服务器类变量 private static SongListManager songListManager; // 使用完整命名空间来避免歧义 - //public static event ActionString OnDisplayBarrage; + public static event ActionString OnDisplayBarrage; private static DateTime lastClickTime = DateTime.MinValue; public static string randomFolderPath; // 声明全局变量 //private static OverlayForm form; @@ -961,16 +962,16 @@ namespace DualScreenDemo } } } - catch (JsonException ex) - { - context.Response.StatusCode = 400; - Console.WriteLine("解析留言数据时出错"); - } - catch (Exception ex) - { - context.Response.StatusCode = 500; - Console.WriteLine("服务器内部错误"); - } + //catch (JsonException ex) + //{ + // context.Response.StatusCode = 400; + // Console.WriteLine("解析留言数据时出错"); + //} + //catch (Exception ex) + //{ + // context.Response.StatusCode = 500; + // Console.WriteLine("服务器内部错误"); + //} finally { context.Response.Close(); diff --git a/HttpServerManager.cs b/HttpServerManager.cs index 6911cb7..b77c7fe 100644 --- a/HttpServerManager.cs +++ b/HttpServerManager.cs @@ -6,13 +6,13 @@ namespace DualScreenDemo { public static class HttpServerManager { - public static void StartServer() + public static async void StartServer() { int httpPort = 9090; // 你可以修改此端口 string baseDirectory = Path.Combine(Application.StartupPath, @"themes\superstar\_www"); CleanUpDirectory(baseDirectory); - HttpServer.StartServer(baseDirectory, httpPort, Program.songListManager); + await HttpServer.StartServer(baseDirectory, httpPort, Program.songListManager); } diff --git a/OverlayForm/OverlayForm.Labels.cs b/OverlayForm/OverlayForm.Labels.cs index cea1bbd..8bbe3ea 100644 --- a/OverlayForm/OverlayForm.Labels.cs +++ b/OverlayForm/OverlayForm.Labels.cs @@ -7,7 +7,7 @@ using System; using System.Linq; using System.Threading; using System.Threading.Tasks; - +using DBObj; namespace DualScreenDemo { public partial class OverlayForm diff --git a/OverlayForm/OverlayForm.cs b/OverlayForm/OverlayForm.cs index 5718ffa..44b88f0 100644 --- a/OverlayForm/OverlayForm.cs +++ b/OverlayForm/OverlayForm.cs @@ -12,7 +12,7 @@ using Newtonsoft.Json; using ZXing; using ZXing.QrCode; using System.Timers; - +using DBObj; namespace DualScreenDemo { public partial class OverlayForm : Form @@ -479,7 +479,7 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e) private readonly object _lockObject = new object(); - private void UnifiedTimer_Elapsed(object sender, EventArgs e) + private async void UnifiedTimer_Elapsed(object sender, EventArgs e) { // Console.WriteLine("UnifiedTimer_Elapsed called"); @@ -496,28 +496,28 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e) case UIState.SelectingLanguage: SetUIState(UIState.Initial); - HandleTimeout(""); + await HandleTimeout(""); break; case UIState.SelectingArtistCategory: SetUIState(UIState.Initial); - HandleTimeout(""); + await HandleTimeout(""); break; case UIState.SelectingAction: SetUIState(UIState.Initial); - HandleTimeout(""); + await HandleTimeout(""); break; case UIState.SelectingSong: SetUIState(UIState.Initial); - HandleTimeout(""); + await HandleTimeout(""); break; case UIState.SelectingArtist: SetUIState(UIState.Initial); - HandleTimeout(""); + await HandleTimeout(""); break; case UIState.PlayHistory: SetUIState(UIState.Initial); - HandleTimeout(""); + await HandleTimeout(""); break; } } @@ -1313,7 +1313,7 @@ public void UpdateHistoryLabel(List historySongs, List play int mainTitleFontSize = 60; int optionFontSize = 50; int lineSpacing = 15; - int columnSpacing = 400; + //int columnSpacing = 400; // 主標題 string mainTitle = messages[0]; diff --git a/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs b/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs index 8715a77..9eddf01 100644 --- a/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs +++ b/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs @@ -4,7 +4,7 @@ using System.Drawing; using System.IO; using System.Linq; using System.Collections.Generic; - +using DBObj; namespace DualScreenDemo { public partial class PrimaryForm diff --git a/PrimaryFormParts/PrimaryForm.Favorite.cs b/PrimaryFormParts/PrimaryForm.Favorite.cs index a4bcc5e..7e8aa54 100644 --- a/PrimaryFormParts/PrimaryForm.Favorite.cs +++ b/PrimaryFormParts/PrimaryForm.Favorite.cs @@ -4,7 +4,7 @@ using System.IO; using System.Linq; using System.Windows.Forms; using System.Collections.Generic; - +using DBObj; namespace DualScreenDemo { public partial class PrimaryForm diff --git a/PrimaryFormParts/PrimaryForm.VodScreen.cs b/PrimaryFormParts/PrimaryForm.VodScreen.cs index 2dafdef..38a88ef 100644 --- a/PrimaryFormParts/PrimaryForm.VodScreen.cs +++ b/PrimaryFormParts/PrimaryForm.VodScreen.cs @@ -3,7 +3,7 @@ using System.Drawing; using System.Windows.Forms; using System.IO; using System.Linq; - +using DBObj; namespace DualScreenDemo { public partial class PrimaryForm diff --git a/PrimaryFormParts/PrimaryForm.cs b/PrimaryFormParts/PrimaryForm.cs index cb17bd0..0633089 100644 --- a/PrimaryFormParts/PrimaryForm.cs +++ b/PrimaryFormParts/PrimaryForm.cs @@ -11,7 +11,7 @@ using NAudio.Wave; using Microsoft.Ink; using System.Text.RegularExpressions; using WMPLib; - +using DBObj; namespace DualScreenDemo { public partial class PrimaryForm : Form diff --git a/Program.cs b/Program.cs index 2f1fa56..153f14d 100644 --- a/Program.cs +++ b/Program.cs @@ -32,6 +32,7 @@ using Microsoft.Ink; using Microsoft.Win32; using System.Diagnostics; using DualScreenDemo; +using DBObj; namespace DualScreenDemo { diff --git a/SerialPortManager.cs b/SerialPortManager.cs index 52ea4b3..c5ac6ab 100644 --- a/SerialPortManager.cs +++ b/SerialPortManager.cs @@ -106,7 +106,7 @@ namespace DualScreenDemo } catch (Exception processEx) { - // Console.WriteLine($"處理資料時發生錯誤: {processEx.Message}"); + Console.WriteLine($"處理資料時發生錯誤: {processEx.Message}"); } }); } @@ -117,7 +117,7 @@ namespace DualScreenDemo } catch (Exception ex) { - // Console.WriteLine($"接收資料時發生錯誤: {ex.Message}"); + Console.WriteLine($"接收資料時發生錯誤: {ex.Message}"); } } @@ -137,7 +137,7 @@ namespace DualScreenDemo } catch (Exception ex) { - // Console.WriteLine($"關閉串列埠時發生錯誤: {ex.Message}"); + Console.WriteLine($"關閉串列埠時發生錯誤: {ex.Message}"); } } } diff --git a/TCPServer.cs b/TCPServer.cs index 1656b5c..b729b44 100644 --- a/TCPServer.cs +++ b/TCPServer.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using System.IO; // 為 Path 和 File 提供支持 using System.Windows.Forms; // 為 Invoke 和 Form 控件提供支持 using System.Collections.Generic; - +using DBObj; namespace DualScreenDemo { public class TCPServer diff --git a/VideoPlayerForm.cs b/VideoPlayerForm.cs index 1845be5..103184b 100644 --- a/VideoPlayerForm.cs +++ b/VideoPlayerForm.cs @@ -7,7 +7,7 @@ using System.Runtime.InteropServices; using System.Windows.Forms; using System.Threading.Tasks; using DirectShowLib; - +using DBObj; namespace DualScreenDemo { public class VideoPlayerForm : Form @@ -399,7 +399,7 @@ namespace DualScreenDemo } catch (Exception ex) { - // Console.WriteLine($"Exception in AddFilterByClsid: {ex.Message}"); + Console.WriteLine($"Exception in AddFilterByClsid: {ex.Message}"); throw; // Rethrow the exception to handle it further up the call stack } } @@ -514,10 +514,10 @@ namespace DualScreenDemo } } - public void InitializePublicPlaylist(List initialPlaylist) + public async void InitializePublicPlaylist(List initialPlaylist) { publicPlaylist = initialPlaylist; - PlayPublicPlaylist(); // 开始播放公播歌单 + await PlayPublicPlaylist(); // 开始播放公播歌单 } public async Task SetPlayingSongList(List songList) @@ -1528,6 +1528,7 @@ namespace DualScreenDemo } catch (Exception ex) { + Console.WriteLine( ex.Message); } } @@ -1580,6 +1581,7 @@ namespace DualScreenDemo } catch (Exception ex) { + Console.WriteLine( ex.Message); } } diff --git a/c42bba66-bfd8-45a5-8d74-6e2ed5b88600_DualScreenKTVPlayStation.exe b/c42bba66-bfd8-45a5-8d74-6e2ed5b88600_DualScreenKTVPlayStation.exe deleted file mode 100644 index a759d7e..0000000 Binary files a/c42bba66-bfd8-45a5-8d74-6e2ed5b88600_DualScreenKTVPlayStation.exe and /dev/null differ diff --git a/d76112a3-46ad-4b7d-bbef-61b34e23c9af_DualScreenKTVPlayStation.exe b/d76112a3-46ad-4b7d-bbef-61b34e23c9af_DualScreenKTVPlayStation.exe deleted file mode 100644 index 1e3a076..0000000 Binary files a/d76112a3-46ad-4b7d-bbef-61b34e23c9af_DualScreenKTVPlayStation.exe and /dev/null differ