From 67c05a122bbc9b5c238114c798002778eaa691cb Mon Sep 17 00:00:00 2001 From: jasonchenwork Date: Tue, 22 Apr 2025 15:25:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=8C=E6=9B=B2SQL=E6=94=B9=E7=89=88(class?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DBObj/ArtistManager.cs | 60 --- DBObj/SongData.cs | 12 - DBObj/SongListManager.cs | 447 +++--------------- .../PrimaryForm.CategorySearch.cs | 2 +- .../PrimaryForm.GroupSearch.GuoYu.cs | 2 +- .../PrimaryForm.GroupSearch.HanYu.cs | 2 +- .../PrimaryForm.GroupSearch.RiYu.cs | 3 +- .../PrimaryForm.GroupSearch.TaiYu.cs | 2 +- .../PrimaryForm.GroupSearch.YingYu.cs | 2 +- .../PrimaryForm.GroupSearch.YueYu.cs | 3 +- .../GroupSearch/PrimaryForm.GroupSearch.cs | 2 +- .../HotSong/PrimaryForm.HotSong.cs | 4 +- .../HotSong/PrimaryForm.HotSongMandarinNew.cs | 3 +- .../PrimaryForm.HotSongTaiwaneseNew.cs | 2 +- .../PrimaryForm.LanguageSearch.cs | 5 +- .../NewSongAlert/PrimaryForm.NewSongAlert.cs | 3 +- .../PrimaryForm.MultiPagePanel.cs | 3 +- PrimaryFormParts/PrimaryForm.SQLSearch.cs | 32 +- PrimaryFormParts/PrimaryForm.VodScreen.cs | 2 +- .../PrimaryForm.SongSearch.BopomofoSearch.cs | 7 +- .../PrimaryForm.SongSearch.EnglishSearch.cs | 4 +- ...rimaryForm.SongSearch.HandwritingSearch.cs | 4 +- .../PrimaryForm.SongSearch.NumberSearch.cs | 2 +- .../PrimaryForm.SongSearch.PinyinSearch.cs | 6 +- .../PrimaryForm.SongSearch.WordCountSearch.cs | 2 +- 25 files changed, 104 insertions(+), 512 deletions(-) diff --git a/DBObj/ArtistManager.cs b/DBObj/ArtistManager.cs index 65945f6..89555d6 100644 --- a/DBObj/ArtistManager.cs +++ b/DBObj/ArtistManager.cs @@ -30,66 +30,6 @@ namespace DBObj } - /* - private void LoadArtists() - { - string databaseFileName = "KSongDatabase.db"; - string databasePath = Path.Combine(Application.StartupPath,"db" ,databaseFileName); - - Console.WriteLine(databasePath); - string connectionString = String.Format("Data Source={0};Version=3;", databasePath); - - using (var connection = new SQLiteConnection(connectionString)) - { - try - { - connection.Open(); - - string sql = "SELECT 歌手姓名, 歌手注音, 歌手分類, 歌手筆畫 FROM ArtistLibrary"; - using (var command = new SQLiteCommand(sql, connection)) - { - using (SQLiteDataReader reader = command.ExecuteReader()) - { - while (reader.Read()) - { - string artist = reader["歌手姓名"].ToString(); - string phonetic = reader["歌手注音"].ToString(); - string category = reader["歌手分類"].ToString(); - string strokesStr = reader["歌手筆畫"].ToString(); - - - if (string.IsNullOrEmpty(strokesStr)) - { - // Console.WriteLine("歌手筆畫的值為空或無效"); - } - - if (double.TryParse(strokesStr, out double strokesDouble)) - { - int strokes = (int)Math.Round(strokesDouble); - AllArtists.Add(new Artist(artist, phonetic, category, strokes)); - - } - else - { - // Console.WriteLine($"Failed to parse '歌手筆畫' value: {strokesStr}"); - } - } - } - } - - connection.Close(); - - - - } - catch (Exception ex) - { - Console.WriteLine("Failed to load artists from SQLite database: " + ex.Message); - } - } - } - - */ public List GetArtistsByCategoryAndStrokeCountRange(string category, int minStrokes, int maxStrokes) { if (category == "全部") diff --git a/DBObj/SongData.cs b/DBObj/SongData.cs index b74e02d..c0c2afe 100644 --- a/DBObj/SongData.cs +++ b/DBObj/SongData.cs @@ -3,26 +3,14 @@ namespace DBObj public class SongData { public string SongNumber { get; set; } - public string Category { get; set; } public string Song { get; set; } - public double Plays { get; set; } public string ArtistA { get; set; } public string ArtistB { get; set; } - public string ArtistACategory { get; set; } - public string ArtistBCategory { get; set; } - public DateTime AddedTime { get; set; } public string SongFilePathHost1 { get; set; } public string SongFilePathHost2 { get; set; } - public string PhoneticNotation { get; set; } - public string PinyinNotation { get; set; } - public string ArtistAPhonetic { get; set; } - public string ArtistBPhonetic { get; set; } public string ArtistASimplified { get; set; } public string ArtistBSimplified { get; set; } public string SongSimplified { get; set; } - public string SongGenre { get; set; } - public string ArtistAPinyin { get; set; } - public string ArtistBPinyin { get; set; } public int HumanVoice { get; set; } /* diff --git a/DBObj/SongListManager.cs b/DBObj/SongListManager.cs index f047522..546f2a7 100644 --- a/DBObj/SongListManager.cs +++ b/DBObj/SongListManager.cs @@ -12,7 +12,7 @@ namespace DBObj public static Dictionary> NewSongLists { get; private set; } public static Dictionary> HotSongLists { get; private set; } public List FavoriteSongs { get; private set; } - public const int SongsPerPage = 9; + //public const int SongsPerPage = 9; public bool IsUserLoggedIn { get; set; } public string UserPhoneNumber { get; set; } @@ -25,74 +25,74 @@ namespace DBObj FavoriteSongs = new List(); // 尝试更新数据库,但无论结果如何都继续运行 - TryUpdateDatabase(); + //TryUpdateDatabase(); // 继续使用可用的数据库(可能是更新后的或原本的本地数据库) - InitializeDatabase(); + //InitializeDatabase(); //LoadSongs(); - InitializeNewSongLists(); - InitializeHotSongLists(); + //InitializeNewSongLists(); + //InitializeHotSongLists(); } - - - private bool TryUpdateDatabase() - { - try + + /* + private bool TryUpdateDatabase() { - // 1. 检查是否能连接到 SVR01 - if (!Directory.Exists(@"\\SVR01\SuperstarB")) + try { - Console.WriteLine("未連接到SVR使用本地DB"); - return true; // 继续使用本地数据库 - } - - // 2. 比较本地和服务器文件 - string localDbPath = Path.Combine(Application.StartupPath,"db" ,"KSongDatabase.db"); - string serverDbPath = @"\\SVR01\SuperstarB\KSongDatabase.db"; - - if (!File.Exists(localDbPath)) - { - Console.WriteLine("本地無db"); - } - else - { - FileInfo localFile = new FileInfo(localDbPath); - FileInfo serverFile = new FileInfo(serverDbPath); - - if (serverFile.LastWriteTime <= localFile.LastWriteTime) + // 1. 检查是否能连接到 SVR01 + if (!Directory.Exists(@"\\SVR01\SuperstarB")) { - Console.WriteLine("歌單已是最新"); - return true; + Console.WriteLine("未連接到SVR使用本地DB"); + return true; // 继续使用本地数据库 } + + // 2. 比较本地和服务器文件 + string localDbPath = Path.Combine(Application.StartupPath,"db" ,"KSongDatabase.db"); + string serverDbPath = @"\\SVR01\SuperstarB\KSongDatabase.db"; + + if (!File.Exists(localDbPath)) + { + Console.WriteLine("本地無db"); + } + else + { + FileInfo localFile = new FileInfo(localDbPath); + FileInfo serverFile = new FileInfo(serverDbPath); + + if (serverFile.LastWriteTime <= localFile.LastWriteTime) + { + Console.WriteLine("歌單已是最新"); + return true; + } + } + + // 3. 需要更新时,复制新文件 + Process copyProcess = new Process(); + copyProcess.StartInfo.FileName = "cmd.exe"; + copyProcess.StartInfo.Arguments = "/C copy /Y \\\\SVR01\\SuperstarB\\KSongDatabase.db \\db\\KSongDatabase.db"; + copyProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; + copyProcess.StartInfo.CreateNoWindow = true; + copyProcess.Start(); + copyProcess.WaitForExit(); + + if (copyProcess.ExitCode == 0) + { + Console.WriteLine("歌單更新成功"); + } + else + { + Console.WriteLine("歌單複製失敗,使用本地歌單"); + } + + return true; } - - // 3. 需要更新时,复制新文件 - Process copyProcess = new Process(); - copyProcess.StartInfo.FileName = "cmd.exe"; - copyProcess.StartInfo.Arguments = "/C copy /Y \\\\SVR01\\SuperstarB\\KSongDatabase.db \\db\\KSongDatabase.db"; - copyProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; - copyProcess.StartInfo.CreateNoWindow = true; - copyProcess.Start(); - copyProcess.WaitForExit(); - - if (copyProcess.ExitCode == 0) + catch (Exception ex) { - Console.WriteLine("歌單更新成功"); + Console.WriteLine($"更新歌單失敗:{ex.Message}"); + return true; // 出错时继续使用本地数据库 } - else - { - Console.WriteLine("歌單複製失敗,使用本地歌單"); - } - - return true; } - catch (Exception ex) - { - Console.WriteLine($"更新歌單失敗:{ex.Message}"); - return true; // 出错时继续使用本地数据库 - } - } - + */ public static SongListManager Instance { get @@ -179,180 +179,7 @@ namespace DBObj } } } - - /* - private void LoadSongs() - { - string databaseFileName = "KSongDatabase.db"; - string databasePath = Path.Combine(Application.StartupPath, "db", databaseFileName); - - Console.WriteLine(databasePath); - string connectionString = String.Format("Data Source={0};Version=3;", databasePath); - - using (var connection = new SQLiteConnection(connectionString)) - { - try - { - connection.Open(); - - string sql = "SELECT 歌曲編號, 語別, 歌曲名稱, 點播次數, [歌星 A], [歌星 B], 新增日期, [路徑 1], [路徑 2], 歌曲檔名, 歌曲注音, 歌曲拼音, 歌星A分類, 歌星B分類, 歌星A注音, 歌星B注音, 歌星A簡體, 歌星B簡體, 歌名簡體, 分類, 歌星A拼音, 歌星B拼音, 人聲 FROM SongLibrary"; - using (var command = new SQLiteCommand(sql, connection)) - { - using (SQLiteDataReader reader = command.ExecuteReader()) - { - while (reader.Read()) - { - string songNumber = reader["歌曲編號"].ToString(); - string category = reader["語別"].ToString(); - string song = reader["歌曲名稱"].ToString(); - int plays = Convert.ToInt32(reader["點播次數"]); - string artistA = reader["歌星 A"].ToString(); - string artistB = reader["歌星 B"].ToString(); - string artistACategory = reader["歌星A分類"].ToString(); - string artistBCategory = reader["歌星B分類"].ToString(); - string dateValue = reader["新增日期"]?.ToString() ?? ""; - DateTime addedTime; - try - { - addedTime=DateTime.Parse(dateValue, CultureInfo.InvariantCulture).Date ; - } - catch (System.FormatException) - { - addedTime = DateTime.Today; - } - string basePathHost1 = reader["路徑 1"].ToString(); - string basePathHost2 = reader["路徑 2"].ToString(); - string fileName = reader["歌曲檔名"].ToString(); - string songFilePathHost1 = Path.Combine(basePathHost1, fileName); - string songFilePathHost2 = Path.Combine(basePathHost2, fileName); - string phoneticNotation = reader["歌曲注音"].ToString(); - string pinyinNotation = reader["歌曲拼音"].ToString(); - string artistAPhonetic = reader["歌星A注音"].ToString(); - string artistBPhonetic = reader["歌星B注音"].ToString(); - string artistASimplified = reader["歌星A簡體"].ToString(); - string artistBSimplified = reader["歌星B簡體"].ToString(); - string songSimplified = reader["歌名簡體"].ToString(); - string songGenre = reader["分類"].ToString(); - string artistAPinyin = reader["歌星A拼音"].ToString(); - string artistBPinyin = reader["歌星B拼音"].ToString(); - int humanVoice = Convert.ToInt32(reader["人聲"]); - - AllSongs.Add(new SongData(songNumber, category, song, plays, artistA, artistB, artistACategory, artistBCategory, addedTime, songFilePathHost1, songFilePathHost2, phoneticNotation, pinyinNotation, artistAPhonetic, artistBPhonetic, artistASimplified, artistBSimplified, songSimplified, songGenre, artistAPinyin, artistBPinyin, humanVoice)); - } - } - } - - connection.Close(); - } - catch (Exception ex) - { - Console.WriteLine("Failed to load songs from SQLite database: " + ex.Message); - } - } - } - public void LoadFavoriteSongs() - { - if (!IsUserLoggedIn || string.IsNullOrEmpty(UserPhoneNumber)) - return; - - string databaseFileName = "KSongDatabase.db"; - string databasePath = Path.Combine(Application.StartupPath, "db", databaseFileName); - string connectionString = String.Format("Data Source={0};Version=3;", databasePath); - - - FavoriteSongs.Clear(); - FavoriteSongs.Add(new SongData("", "", UserPhoneNumber + " 的歌單", 0, "", "", "", "", DateTime.MinValue, "", "", "", "", "", "", "", "", "", "", "", "", 1)); - - using (var connection = new SQLiteConnection(connectionString)) - { - try - { - connection.Open(); - - string sql = @" - SELECT - sl.歌曲編號, sl.語別, sl.歌曲名稱, sl.點播次數, - sl.[歌星 A], sl.[歌星 B], sl.新增日期, sl.[路徑 1], - sl.[路徑 2], sl.歌曲檔名, sl.歌曲注音, sl.歌曲拼音, - sl.歌星A分類, sl.歌星B分類, sl.歌星A注音, sl.歌星B注音, - sl.歌星A簡體, sl.歌星B簡體, sl.歌名簡體, sl.分類, - sl.歌星A拼音, sl.歌星B拼音, sl.人聲 - FROM - FavoriteSongs fs - JOIN - SongLibrary sl - ON - fs.SongNumber = sl.歌曲編號 - WHERE - fs.PhoneNumber = @PhoneNumber"; - - using (var command = new SQLiteCommand(sql, connection)) - { - command.Parameters.AddWithValue("@PhoneNumber", UserPhoneNumber); - - using (SQLiteDataReader reader = command.ExecuteReader()) - { - while (reader.Read()) - { - string songNumber = reader["歌曲編號"].ToString(); - string category = reader["語別"].ToString(); - string song = reader["歌曲名稱"].ToString(); - int plays = Convert.ToInt32(reader["點播次數"]); - string artistA = reader["歌星 A"].ToString(); - string artistB = reader["歌星 B"].ToString(); - string artistACategory = reader["歌星A分類"].ToString(); - string artistBCategory = reader["歌星B分類"].ToString(); - DateTime addedTime; - - try - { - addedTime = DateTime.ParseExact(reader["新增日期"].ToString(), "yyyy-MM-dd", CultureInfo.InvariantCulture); - } - catch (System.FormatException) - { - addedTime = DateTime.Today; - } - - string basePathHost1 = reader["路徑 1"].ToString(); - string basePathHost2 = reader["路徑 2"].ToString(); - string fileName = reader["歌曲檔名"].ToString(); - string songFilePathHost1 = Path.Combine(basePathHost1, fileName); - string songFilePathHost2 = Path.Combine(basePathHost2, fileName); - string phoneticNotation = reader["歌曲注音"].ToString(); - string pinyinNotation = reader["歌曲拼音"].ToString(); - string artistAPhonetic = reader["歌星A注音"].ToString(); - string artistBPhonetic = reader["歌星B注音"].ToString(); - string artistASimplified = reader["歌星A簡體"].ToString(); - string artistBSimplified = reader["歌星B簡體"].ToString(); - string songSimplified = reader["歌名簡體"].ToString(); - string songGenre = reader["分類"].ToString(); - string artistAPinyin = reader["歌星A拼音"].ToString(); - string artistBPinyin = reader["歌星B拼音"].ToString(); - int humanVoice = Convert.ToInt32(reader["人聲"]); - - FavoriteSongs.Add(new SongData( - songNumber, category, song, plays, artistA, artistB, - artistACategory, artistBCategory, addedTime, songFilePathHost1, - songFilePathHost2, phoneticNotation, pinyinNotation, - artistAPhonetic, artistBPhonetic, artistASimplified, - artistBSimplified, songSimplified, songGenre, - artistAPinyin, artistBPinyin, humanVoice)); - } - PrimaryForm.Instance.multiPagePanel.currentPageIndex = 0; - PrimaryForm.Instance.multiPagePanel.LoadSongs(FavoriteSongs); - } - } - - connection.Close(); - } - catch (Exception ex) - { - Console.WriteLine("Failed to load favorite songs from SQLite database: " + ex.Message); - } - } - } - */ public void AddToFavorite(string songNumber) { if (!IsUserLoggedIn || string.IsNullOrEmpty(UserPhoneNumber)) @@ -448,165 +275,5 @@ namespace DBObj return null; } - private void InitializeNewSongLists() - { - int songLimit = PrimaryForm.ReadNewSongLimit(); - - - string[] categories = new string[] { "國語", "台語", "粵語", "英文", "日語", "韓語" }; - - foreach (var category in categories) - { - - var songsInCategory = AllSongs - .Where(s => s.Category == category) - .OrderByDescending(s => s.AddedTime) - .Take(songLimit) - .ToList(); - - - NewSongLists.Add(category, songsInCategory); - } - } - - private void InitializeHotSongLists() - { - int songLimit = PrimaryForm.ReadHotSongLimit(); - - - string[] categories = new string[] { "國語", "台語", "英文", "日語", "韓語" }; - - foreach (var category in categories) - { - - var songsInCategory = AllSongs - .Where(s => s.Category == category) - .OrderByDescending(s => s.Plays) - .Take(songLimit) - .ToList(); - - - HotSongLists.Add(category, songsInCategory); - } - } - - public List GetNewSongsByCategory(string category) - { - - if (NewSongLists.ContainsKey(category)) - return NewSongLists[category]; - else - return new List(); - } - - public List GetHotSongsByCategory(string category) - { - - if (HotSongLists.ContainsKey(category)) - return HotSongLists[category]; - else - return new List(); - } - /* - public List GetFavoriteSongsByPhoneNumber() - { - List favoriteSongs = new List(); - - if (string.IsNullOrEmpty(UserPhoneNumber)) - return favoriteSongs; - - string databaseFileName = "KSongDatabase.db"; - string databasePath = Path.Combine(Application.StartupPath, "db", databaseFileName); - string connectionString = String.Format("Data Source={0};Version=3;", databasePath); - - using (var connection = new SQLiteConnection(connectionString)) - { - try - { - connection.Open(); - - string sql = @" - SELECT - sl.歌曲編號, sl.語別, sl.歌曲名稱, sl.點播次數, - sl.[歌星 A], sl.[歌星 B], sl.新增日期, sl.[路徑 1], - sl.[路徑 2], sl.歌曲檔名, sl.歌曲注音, sl.歌曲拼音, - sl.歌星A分類, sl.歌星B分類, sl.歌星A注音, sl.歌星B注音, - sl.歌星A簡體, sl.歌星B簡體, sl.歌名簡體, sl.分類, - sl.歌星A拼音, sl.歌星B拼音, sl.人聲 - FROM - FavoriteSongs fs - JOIN - SongLibrary sl - ON - fs.SongNumber = sl.歌曲編號 - WHERE - fs.PhoneNumber = @PhoneNumber"; - - using (var command = new SQLiteCommand(sql, connection)) - { - command.Parameters.AddWithValue("@PhoneNumber", UserPhoneNumber); - - using (SQLiteDataReader reader = command.ExecuteReader()) - { - while (reader.Read()) - { - string songNumber = reader["歌曲編號"].ToString(); - string category = reader["語別"].ToString(); - string song = reader["歌曲名稱"].ToString(); - int plays = Convert.ToInt32(reader["點播次數"]); - string artistA = reader["歌星 A"].ToString(); - string artistB = reader["歌星 B"].ToString(); - string artistACategory = reader["歌星A分類"].ToString(); - string artistBCategory = reader["歌星B分類"].ToString(); - DateTime addedTime; - - try - { - addedTime = DateTime.ParseExact(reader["新增日期"].ToString(), "yyyy-MM-dd", CultureInfo.InvariantCulture); - } - catch (System.FormatException) - { - addedTime = DateTime.Now; - } - - string basePathHost1 = reader["路徑 1"].ToString(); - string basePathHost2 = reader["路徑 2"].ToString(); - string fileName = reader["歌曲檔名"].ToString(); - string songFilePathHost1 = Path.Combine(basePathHost1, fileName); - string songFilePathHost2 = Path.Combine(basePathHost2, fileName); - string phoneticNotation = reader["歌曲注音"].ToString(); - string pinyinNotation = reader["歌曲拼音"].ToString(); - string artistAPhonetic = reader["歌星A注音"].ToString(); - string artistBPhonetic = reader["歌星B注音"].ToString(); - string artistASimplified = reader["歌星A簡體"].ToString(); - string artistBSimplified = reader["歌星B簡體"].ToString(); - string songSimplified = reader["歌名簡體"].ToString(); - string songGenre = reader["分類"].ToString(); - string artistAPinyin = reader["歌星A拼音"].ToString(); - string artistBPinyin = reader["歌星B拼音"].ToString(); - int humanVoice = Convert.ToInt32(reader["人聲"]); - - favoriteSongs.Add(new SongData( - songNumber, category, song, plays, artistA, artistB, - artistACategory, artistBCategory, addedTime, songFilePathHost1, - songFilePathHost2, phoneticNotation, pinyinNotation, - artistAPhonetic, artistBPhonetic, artistASimplified, - artistBSimplified, songSimplified, songGenre, - artistAPinyin, artistBPinyin, humanVoice)); - } - } - } - - connection.Close(); - } - catch (Exception ex) - { - Console.WriteLine("Failed to load favorite songs from SQLite database: " + ex.Message); - } - } - - return favoriteSongs; - } - */ } } \ No newline at end of file diff --git a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.cs b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.cs index 72da610..730b727 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.cs @@ -252,7 +252,7 @@ namespace DualScreenDemo } private string SetQueryforSQL(string contains){ - string query = $"SELECT * FROM SongLibrary WHERE `分類` LIKE '%{contains}%' ORDER BY `點播次數` DESC"; + string query = $"SELECT * FROM song_library_cache WHERE situation LIKE '%{contains}%' ORDER BY `song_id` DESC"; return query; } } diff --git a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.GuoYu.cs b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.GuoYu.cs index 21cdd51..9ff85a5 100644 --- a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.GuoYu.cs +++ b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.GuoYu.cs @@ -14,7 +14,7 @@ namespace DualScreenDemo /*guoYuSongs = allSongs.Where(song => song.Category == "國語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團")) .OrderByDescending(song => song.Plays) .ToList();*/ - String query = "SELECT * FROM SongLibrary WHERE `語別` = '國語' AND (`歌星A分類` = '團' OR `歌星B分類` = '團') ORDER BY `點播次數` DESC"; + string query = "SELECT * FROM song_library_cache WHERE language_name = '國語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC"; var guoYuSongs = SearchSongs_Mysql(query); currentPage = 0; currentSongList = guoYuSongs; diff --git a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.HanYu.cs b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.HanYu.cs index cfb6612..de1d60a 100644 --- a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.HanYu.cs +++ b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.HanYu.cs @@ -14,7 +14,7 @@ namespace DualScreenDemo /*hanYuSongs = allSongs.Where(song => song.Category == "韓語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團")) .OrderByDescending(song => song.Plays) .ToList();*/ - String query = "SELECT * FROM SongLibrary WHERE `語別` = '韓語' AND (`歌星A分類` = '團' OR `歌星B分類` = '團') ORDER BY `點播次數` DESC"; + string query = "SELECT * FROM song_library_cache WHERE language_name = '韓語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC"; var hanYuSongs = SearchSongs_Mysql(query); currentPage = 0; currentSongList = hanYuSongs; diff --git a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.RiYu.cs b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.RiYu.cs index 583a941..edf1a08 100644 --- a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.RiYu.cs +++ b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.RiYu.cs @@ -14,7 +14,8 @@ namespace DualScreenDemo /*riYuSongs = allSongs.Where(song => song.Category == "日語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團")) .OrderByDescending(song => song.Plays) .ToList();*/ - String query = "SELECT * FROM SongLibrary WHERE `語別` = '日語' AND (`歌星A分類` = '團' OR `歌星B分類` = '團') ORDER BY `點播次數` DESC"; + + string query = "SELECT * FROM song_library_cache WHERE language_name = '日語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC"; var riYuSongs = SearchSongs_Mysql(query); currentPage = 0; currentSongList = riYuSongs; diff --git a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.TaiYu.cs b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.TaiYu.cs index 69e9982..348a8ef 100644 --- a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.TaiYu.cs +++ b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.TaiYu.cs @@ -14,7 +14,7 @@ namespace DualScreenDemo /*taiYuSongs = allSongs.Where(song => song.Category == "台語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團")) .OrderByDescending(song => song.Plays) .ToList();*/ - String query = "SELECT * FROM SongLibrary WHERE `語別` = '台語' AND (`歌星A分類` = '團' OR `歌星B分類` = '團') ORDER BY `點播次數` DESC"; + string query = "SELECT * FROM song_library_cache WHERE language_name = '台語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC"; var taiYuSongs = SearchSongs_Mysql(query); currentPage = 0; currentSongList = taiYuSongs; diff --git a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YingYu.cs b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YingYu.cs index ffffadb..cca8e17 100644 --- a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YingYu.cs +++ b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YingYu.cs @@ -14,7 +14,7 @@ namespace DualScreenDemo /*yingWenSongs = allSongs.Where(song => song.Category == "英文" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團")) .OrderByDescending(song => song.Plays) .ToList();*/ - String query = "SELECT * FROM SongLibrary WHERE `語別` = '英文' AND (`歌星A分類` = '團' OR `歌星B分類` = '團') ORDER BY `點播次數` DESC"; + string query = "SELECT * FROM song_library_cache WHERE language_name = '英文' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC"; var yingWenSongs = SearchSongs_Mysql(query); currentPage = 0; currentSongList = yingWenSongs; diff --git a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YueYu.cs b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YueYu.cs index 6e0eff4..0e75cda 100644 --- a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YueYu.cs +++ b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YueYu.cs @@ -14,7 +14,8 @@ namespace DualScreenDemo /*yueYuSongs = allSongs.Where(song => song.Category == "粵語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團")) .OrderByDescending(song => song.Plays) .ToList();*/ - String query = "SELECT * FROM SongLibrary WHERE `語別` = '粵語' AND (`歌星A分類` = '團' OR `歌星B分類` = '團') ORDER BY `點播次數` DESC"; + + string query = "SELECT * FROM song_library_cache WHERE language_name = '粵語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC"; var yueYuSongs = SearchSongs_Mysql(query); currentPage = 0; currentSongList = yueYuSongs; diff --git a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.cs b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.cs index a0937bf..2fa3546 100644 --- a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.cs +++ b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.cs @@ -131,7 +131,7 @@ namespace DualScreenDemo /*guoYuSongs = allSongs.Where(song => song.Category == "國語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團")) .OrderByDescending(song => song.Plays) .ToList();*/ - String query = "SELECT * FROM SongLibrary WHERE `語別` = '國語' AND (`歌星A分類` = '團' OR `歌星B分類` = '團') ORDER BY `點播次數` DESC"; + string query = "SELECT * FROM song_library_cache WHERE language_name = '國語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC"; var guoYuSongs = SearchSongs_Mysql(query); currentPage = 0; currentSongList = guoYuSongs; diff --git a/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs b/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs index d1ac97b..4de5e94 100644 --- a/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs +++ b/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs @@ -62,7 +62,7 @@ namespace DualScreenDemo isOnOrderedSongsPage = false; int songLimit = ReadHotSongLimit(); - string query = $"SELECT * FROM SongLibrary WHERE `語別` = '國語' ORDER BY `點播次數` DESC LIMIT {songLimit}"; + string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `song_id` DESC LIMIT {songLimit}"; var guoYuSongs = SearchSongs_Mysql(query); UpdateSongList(guoYuSongs); @@ -92,7 +92,7 @@ namespace DualScreenDemo UpdateHotSongButtons(activeButton, activeBackground); int songLimit = ReadHotSongLimit(); - string query = $"SELECT * FROM SongLibrary WHERE `語別` = '{category}' ORDER BY `點播次數` DESC LIMIT {songLimit}"; + string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY `song_id` DESC LIMIT {songLimit}"; var selectedSongs = SearchSongs_Mysql(query); UpdateSongList(selectedSongs); diff --git a/PrimaryFormParts/HotSong/PrimaryForm.HotSongMandarinNew.cs b/PrimaryFormParts/HotSong/PrimaryForm.HotSongMandarinNew.cs index 8334b15..13b574f 100644 --- a/PrimaryFormParts/HotSong/PrimaryForm.HotSongMandarinNew.cs +++ b/PrimaryFormParts/HotSong/PrimaryForm.HotSongMandarinNew.cs @@ -8,8 +8,7 @@ namespace DualScreenDemo UpdateHotSongButtons(guoYuNewSongButtonHotSong, guoYuNewSongHotSongActiveBackground); int songLimit = ReadHotSongLimit(); - - string query = $"SELECT * FROM SongLibrary WHERE `語別` = '國語' ORDER BY `新增日期` DESC ,`點播次數` DESC LIMIT {songLimit}"; + string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `add_date` DESC LIMIT {songLimit}"; var selectedSongs = PrimaryForm.Instance.SearchSongs_Mysql(query); currentPage = 0; diff --git a/PrimaryFormParts/HotSong/PrimaryForm.HotSongTaiwaneseNew.cs b/PrimaryFormParts/HotSong/PrimaryForm.HotSongTaiwaneseNew.cs index 2c36775..b0751ca 100644 --- a/PrimaryFormParts/HotSong/PrimaryForm.HotSongTaiwaneseNew.cs +++ b/PrimaryFormParts/HotSong/PrimaryForm.HotSongTaiwaneseNew.cs @@ -9,7 +9,7 @@ namespace DualScreenDemo int songLimit = ReadHotSongLimit(); - string query = $"SELECT * FROM SongLibrary WHERE `語別` = '台語' ORDER BY `新增日期` DESC ,`點播次數` DESC LIMIT {songLimit}"; + string query = $"SELECT * FROM song_library_cache WHERE language_name = '台語' ORDER BY `add_date` DESC LIMIT {songLimit}"; var selectedSongs = SearchSongs_Mysql(query); currentPage = 0; diff --git a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs index f9486a1..4c6ccba 100644 --- a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs +++ b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs @@ -73,7 +73,8 @@ namespace DualScreenDemo hanYuButton.BackgroundImage = hanYuNormalBackground; keYuButton.BackgroundImage = keYuNormalBackground; - string query = $"SELECT * FROM SongLibrary WHERE `語別` = '國語' ORDER BY `點播次數` DESC LIMIT 100;"; + + string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY song_id DESC LIMIT 100"; var guoYuSongs = SearchSongs_Mysql(query); currentPage = 0; currentSongList = guoYuSongs; @@ -121,7 +122,7 @@ namespace DualScreenDemo activeButton.BackgroundImage = activeBackground; - string query = $"SELECT * FROM SongLibrary WHERE `語別` = '{category}' ORDER BY `點播次數` DESC LIMIT 100;"; + string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY song_id DESC LIMIT 100"; var selectedSongs = SearchSongs_Mysql(query); /*var selectedSongs = allSongs.Where(song => song.Category == category) .OrderByDescending(song => song.Plays) diff --git a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs index b0c3170..a666493 100644 --- a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs +++ b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs @@ -251,7 +251,8 @@ namespace DualScreenDemo return 100; } private string setQueryforNewSong(string category){ - string query = $"SELECT * FROM SongLibrary WHERE `語別` = '{category}' ORDER BY `新增日期` DESC LIMIT {ReadNewSongLimit()}"; + string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY add_date DESC LIMIT {ReadNewSongLimit()}"; + return query; } } diff --git a/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs b/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs index 94efa2f..e34cfa9 100644 --- a/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs +++ b/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs @@ -324,7 +324,7 @@ namespace DualScreenDemo { string searchText = artistLabel.Text; // 取得輸入內容 // 歌星 轉 歌曲 - string query = $"SELECT * FROM SongLibrary WHERE `歌星 A` = '{searchText}' OR `歌星 B` = '{searchText}'"; + string query = $"SELECT * FROM song_library_cache WHERE artistA ='{searchText}' OR artistB='{searchText}' "; var searchResults = PrimaryForm.Instance.SearchSongs_Mysql(query); // 重置分頁 PrimaryForm.Instance.currentPage = 0; @@ -426,6 +426,7 @@ namespace DualScreenDemo (!string.IsNullOrEmpty(song.SongSimplified) ? song.SongSimplified : song.Song) : song.Song; + // 歌手名稱設置點 string artistText = IsSimplified ? (!string.IsNullOrEmpty(song.ArtistASimplified) ? song.ArtistASimplified : song.ArtistA) : song.ArtistA; diff --git a/PrimaryFormParts/PrimaryForm.SQLSearch.cs b/PrimaryFormParts/PrimaryForm.SQLSearch.cs index 939da8f..0c69e54 100644 --- a/PrimaryFormParts/PrimaryForm.SQLSearch.cs +++ b/PrimaryFormParts/PrimaryForm.SQLSearch.cs @@ -1,6 +1,5 @@ using MySqlConnector; using DBObj; -using System.Globalization; using System.IO; using System.Diagnostics; @@ -9,12 +8,12 @@ namespace DualScreenDemo{ { public bool isLoggedIn = false; public string userPhone = string.Empty; - public List SearchSongs_Mysql(string query) + public List SearchSongs_Mysql(string query) { List searchResults = new List(); Console.WriteLine(query); string connectionString = "Server=192.168.11.4;Port=3306;Database=Karaoke-Kingpin;User=Karaoke-Kingpin;Password=ESM7yTPMnavFmbBH;"; - + using (var connection = new MySqlConnection(connectionString)) { Stopwatch stopwatch = new Stopwatch(); @@ -32,17 +31,17 @@ namespace DualScreenDemo{ { while (reader.Read()) { - string songNumber = reader["歌曲編號"].ToString(); - string song = reader["歌曲名稱"].ToString(); - string artistA = reader["歌星 A"].ToString(); - string artistB = reader["歌星 B"].ToString(); - string fileName = reader["歌曲檔名"].ToString(); + string songNumber = reader["song_id"].ToString(); + string song = reader["song_name"].ToString(); + string artistA = reader["artistA"].ToString(); + string artistB = reader["artistB"].ToString(); + string fileName = reader["song_filename"].ToString(); string songFilePathHost1 = Path.Combine(@"\\SVR01\DISK05", fileName); // \SVR01\DISK01\ string songFilePathHost2 = Path.Combine(@"\\SVR02\DISK01", fileName); // \SVR02\DISK01\ - string artistASimplified = reader["歌星A簡體"].ToString(); - string artistBSimplified = reader["歌星B簡體"].ToString(); - string songSimplified = reader["歌名簡體"].ToString(); - int humanVoice = Convert.ToInt32(reader["人聲"]); + string artistASimplified = reader["artistA_simplified"].ToString(); + string artistBSimplified = reader["artistB_simplified"].ToString(); + string songSimplified = reader["song_simplified"].ToString(); + int humanVoice = Convert.ToInt32(reader["vocal"]); searchResults.Add(new SongData( songNumber, song, artistA, artistB, @@ -126,14 +125,9 @@ namespace DualScreenDemo{ } public string SearchFavoriteSongs_Mysql(){ string query = $"SELECT " + - "sl.歌曲編號, sl.語別, sl.歌曲名稱, sl.點播次數, " + - "sl.`歌星 A`, sl.`歌星 B`, sl.新增日期, " + - "sl.`路徑 1`, sl.`路徑 2`, sl.歌曲檔名, sl.歌曲注音, sl.歌曲拼音, " + - "sl.歌星A分類, sl.歌星B分類, sl.歌星A注音, sl.歌星B注音, " + - "sl.歌星A簡體, sl.歌星B簡體, sl.歌名簡體, sl.分類, " + - "sl.歌星A拼音, sl.歌星B拼音, sl.人聲 " + + "sl.*"+ "FROM FavoriteSongs fs " + - "JOIN SongLibrary sl ON fs.SongNumber = sl.歌曲編號 " + + "JOIN song_library_cache sl ON fs.SongNumber = sl.song_id " + $"WHERE fs.Phonenumber = '{userPhone}';"; return query; diff --git a/PrimaryFormParts/PrimaryForm.VodScreen.cs b/PrimaryFormParts/PrimaryForm.VodScreen.cs index 4eab3ef..f1b9c9e 100644 --- a/PrimaryFormParts/PrimaryForm.VodScreen.cs +++ b/PrimaryFormParts/PrimaryForm.VodScreen.cs @@ -133,7 +133,7 @@ namespace DualScreenDemo private void AlbumButton_Click(object sender, EventArgs e) { string name = currentSelectedSong.ArtistA; - string query = $"SELECT * FROM SongLibrary WHERE `歌星 A` = '{name}' ORDER BY `新增日期` DESC"; + string query = $"SELECT * FROM song_library_cache WHERE artistA = '{name}' ORDER BY add_date DESC"; var selectedSongs = SearchSongs_Mysql(query); /*var selectedSongs = allSongs.Where(song => song.ArtistA == currentSelectedSong.ArtistA) .OrderByDescending(song => song.AddedTime) diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs index 6ba5763..1195a13 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs @@ -309,11 +309,12 @@ namespace DualScreenDemo string searchText = inputBoxZhuYinSongs.Text; // 在這裡添加搜尋歌曲的邏輯 // 例如:根據輸入框的內容搜尋歌曲 + string query = string.IsNullOrWhiteSpace(searchText) - ? "SELECT * FROM SongLibrary ORDER BY `點播次數` DESC LIMIT 200;" - : $"SELECT * FROM SongLibrary WHERE `歌曲注音` LIKE '{searchText}%' ORDER BY `點播次數` DESC;"; + ? "SELECT * FROM song_library_cache ORDER BY `song_id` DESC LIMIT 200;" + : $"SELECT * FROM song_library_cache WHERE `phonetic_abbr` LIKE '{searchText}%' ORDER BY `song_id`;"; - var searchResults = SearchSongs_Mysql(query); + var searchResults = SearchSongs_Mysql(query); // 重置分頁 currentPage = 0; currentSongList = searchResults; diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.EnglishSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.EnglishSearch.cs index 33040e0..b1f0008 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.EnglishSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.EnglishSearch.cs @@ -230,8 +230,8 @@ namespace DualScreenDemo string searchText = inputBoxEnglishSongs.Text; // 檢查是否為空字串或空白字元 string query = string.IsNullOrWhiteSpace(searchText) - ? "SELECT * FROM SongLibrary ORDER BY `點播次數` DESC LIMIT 200;" - : $"SELECT * FROM SongLibrary WHERE `歌曲名稱` LIKE '{searchText}%' ORDER BY `點播次數` DESC;"; + ? "SELECT * FROM song_library_cache ORDER BY song_id DESC LIMIT 200;" + : $"SELECT * FROM song_library_cache WHERE song_name LIKE '{searchText}%' ORDER BY song_id DESC;"; var searchResults = SearchSongs_Mysql(query); // 重置分頁 diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.HandwritingSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.HandwritingSearch.cs index 52b1df6..d2f323d 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.HandwritingSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.HandwritingSearch.cs @@ -287,8 +287,8 @@ namespace DualScreenDemo // 在這裡添加搜尋歌曲的邏輯 // 例如:根據輸入框的內容搜尋歌曲 string query = string.IsNullOrWhiteSpace(searchText) - ? "SELECT * FROM SongLibrary ORDER BY `點播次數` DESC LIMIT 200;" - : $"SELECT * FROM SongLibrary WHERE `歌曲名稱` LIKE '{searchText}%' ORDER BY `點播次數` DESC;"; + ? "SELECT * FROM song_library_cache ORDER BY song_id DESC LIMIT 200;" + : $"SELECT * FROM song_library_cache WHERE song_name LIKE '{searchText}%' ORDER BY song_id DESC;"; var searchResults = SearchSongs_Mysql(query); diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.NumberSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.NumberSearch.cs index f596e91..04965de 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.NumberSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.NumberSearch.cs @@ -550,7 +550,7 @@ namespace DualScreenDemo // 如果輸入框為空,則不進行搜尋 return; } - string query = $"SELECT * FROM SongLibrary WHERE `歌曲編號` = '{searchText}' "; + string query = $"SELECT * FROM song_library_cache WHERE `song_id` = '{searchText}' "; var searchResults = SearchSongs_Mysql(query); // 重置分頁 diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.PinyinSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.PinyinSearch.cs index 1639fb7..0b58c23 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.PinyinSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.PinyinSearch.cs @@ -266,8 +266,8 @@ namespace DualScreenDemo // 在這裡添加搜尋歌曲的邏輯 // 例如:根據輸入框的內容搜尋歌曲 string query = string.IsNullOrWhiteSpace(searchText) - ? "SELECT * FROM SongLibrary ORDER BY `點播次數` DESC LIMIT 200;" - : $"SELECT * FROM SongLibrary WHERE `歌曲拼音` LIKE '{searchText}%' ORDER BY `點播次數` DESC;"; + ? "SELECT * FROM song_library_cache ORDER BY song_id DESC LIMIT 200;" + : $"SELECT * FROM song_library_cache WHERE pinyin_abbr LIKE '{searchText}%' ORDER BY `song_id` DESC;"; var searchResults = SearchSongs_Mysql(query); // 重置分頁 currentPage = 0; @@ -276,8 +276,6 @@ namespace DualScreenDemo // 更新多頁面面板的內容 multiPagePanel.currentPageIndex = 0; multiPagePanel.LoadSongs(currentSongList); - - } /// /// 初始化拼音輸入框 (RichTextBox),並從 config.ini 讀取相關設定。 diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.WordCountSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.WordCountSearch.cs index 8c7c3a2..aeca583 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.WordCountSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.WordCountSearch.cs @@ -477,7 +477,7 @@ namespace DualScreenDemo string query; if (int.TryParse(searchText, out int length)) { - query = $"SELECT * FROM SongLibrary WHERE CHAR_LENGTH(歌曲名稱) = {length} "; + query = $"SELECT * FROM song_library_cache WHERE CHAR_LENGTH(song_name) = {length} "; } else {