調整 字串顯示重復 20250708
This commit is contained in:
parent
7500f6b8fa
commit
b207fbef36
@ -5,14 +5,14 @@ namespace DBObj
|
|||||||
{
|
{
|
||||||
public class SongData
|
public class SongData
|
||||||
{
|
{
|
||||||
public string SongNumber { get; set; }
|
public string Number { get; set; }
|
||||||
public string Song { get; set; }
|
public string Name { get; set; }
|
||||||
public string ArtistA { get; set; }
|
public string Artist_A { get; set; }
|
||||||
public string ArtistB { get; set; }
|
private string Artist_B { get; set; }
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
public string ArtistASimplified { get; set; }
|
public string Artist_A_Simplified { get; set; }
|
||||||
public string ArtistBSimplified { get; set; }
|
public string Artist_B_Simplified { get; set; }
|
||||||
public string SongSimplified { get; set; }
|
public string Name_Simplified { get; set; }
|
||||||
public int HumanVoice { get; set; }
|
public int HumanVoice { get; set; }
|
||||||
public bool isPublicSong { get; set; }
|
public bool isPublicSong { get; set; }
|
||||||
|
|
||||||
@ -48,33 +48,72 @@ namespace DBObj
|
|||||||
*/
|
*/
|
||||||
public SongData(string songNumber, string song, string filename, int humanVoice, bool isPublic)
|
public SongData(string songNumber, string song, string filename, int humanVoice, bool isPublic)
|
||||||
{
|
{
|
||||||
SongNumber = songNumber;
|
Number = songNumber;
|
||||||
Song = song;
|
Name = song;
|
||||||
FileName = filename;
|
FileName = filename;
|
||||||
HumanVoice = humanVoice;
|
HumanVoice = humanVoice;
|
||||||
isPublicSong = isPublic;
|
isPublicSong = isPublic;
|
||||||
}
|
}
|
||||||
public SongData(string songNumber, string song, string artistA, string artistB, string filename, string artistASimplified, string artistBSimplified, string songSimplified, int humanVoice)
|
public SongData(string songNumber, string song, string artistA, string artistB, string filename, string artistASimplified, string artistBSimplified, string songSimplified, int humanVoice)
|
||||||
{
|
{
|
||||||
SongNumber = songNumber;
|
Number = songNumber;
|
||||||
Song = song;
|
Name = song;
|
||||||
ArtistA = artistA;
|
Artist_A = artistA;
|
||||||
ArtistB = artistB;
|
Artist_B = artistB;
|
||||||
FileName = FindExistingPath(filename);
|
FileName = filename;
|
||||||
ArtistASimplified = artistASimplified;
|
Artist_A_Simplified = artistASimplified;
|
||||||
ArtistBSimplified = artistBSimplified;
|
Artist_B_Simplified = artistBSimplified;
|
||||||
SongSimplified = songSimplified;
|
Name_Simplified = songSimplified;
|
||||||
HumanVoice = humanVoice;
|
HumanVoice = humanVoice;
|
||||||
isPublicSong = false;
|
isPublicSong = false;
|
||||||
}
|
}
|
||||||
|
public string getName(bool IsSimplified=false)
|
||||||
|
{
|
||||||
|
return IsSimplified ? Name_Simplified : Name;
|
||||||
|
}
|
||||||
|
public int getNameLength()
|
||||||
|
{
|
||||||
|
return Name.Length;
|
||||||
|
}
|
||||||
|
public string next_artist_text()
|
||||||
|
{
|
||||||
|
return !string.IsNullOrWhiteSpace(Artist_B)
|
||||||
|
? String.Format("下一首:{0} {1} {2}", Artist_A, Artist_B, Name)
|
||||||
|
: String.Format("下一首:{0} {1}", Artist_A, Name);
|
||||||
|
}
|
||||||
|
public string artist_text()
|
||||||
|
{
|
||||||
|
return !string.IsNullOrWhiteSpace(Artist_B)
|
||||||
|
? $"{Artist_A} - {Artist_B}"
|
||||||
|
: Artist_A;
|
||||||
|
}
|
||||||
|
public string name_text()
|
||||||
|
{
|
||||||
|
return !string.IsNullOrWhiteSpace(Artist_B)
|
||||||
|
? String.Format("{0} - {1} - {2}", Artist_A, Artist_B, Name)
|
||||||
|
: String.Format("{0} - {1}", Artist_A, Name);
|
||||||
|
}
|
||||||
|
public string getArtist_A(bool IsSimplified)
|
||||||
|
{
|
||||||
|
return IsSimplified ? Artist_A_Simplified : Artist_A;
|
||||||
|
}
|
||||||
|
public string getArtist_B(bool IsSimplified)
|
||||||
|
{
|
||||||
|
return IsSimplified ? Artist_B_Simplified : Artist_B;
|
||||||
|
}
|
||||||
|
public string getFile()
|
||||||
|
{
|
||||||
|
return FindExistingPath(FileName);
|
||||||
|
}
|
||||||
private string FindExistingPath(string filename)
|
private string FindExistingPath(string filename)
|
||||||
{
|
{
|
||||||
var servers = new[] { @"\\svr01\", @"\\svr02\", @"\\svr01\e", @"\\svr02\e" };
|
var servers = new[] { @"\\svr01\", @"\\svr02\", @"\\svr01\e", @"\\svr02\e" };
|
||||||
foreach (var server in servers){
|
foreach (var server in servers)
|
||||||
|
{
|
||||||
string fullPath = Path.Combine(server, filename);
|
string fullPath = Path.Combine(server, filename);
|
||||||
if (File.Exists(fullPath)) return fullPath;
|
if (File.Exists(fullPath)) return fullPath;
|
||||||
}
|
}
|
||||||
return filename; // 找不到就回原本的 filename,不加路徑
|
return null; // 找不到就回原本的 filename,不加路徑
|
||||||
}
|
}
|
||||||
public void SetState(PlayState s) => state = s;
|
public void SetState(PlayState s) => state = s;
|
||||||
|
|
||||||
@ -83,12 +122,13 @@ namespace DBObj
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
|
|
||||||
return !string.IsNullOrWhiteSpace(ArtistB)
|
return !string.IsNullOrWhiteSpace(Artist_B)
|
||||||
? String.Format("{0} - {1} - {2}", ArtistA, ArtistB, Song)
|
? String.Format("{0} - {1} - {2}", Artist_A, Artist_B, Name)
|
||||||
: String.Format("{0} - {1}", ArtistA, Song);
|
: String.Format("{0} - {1}", Artist_A, Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -708,7 +708,7 @@ namespace DualScreenDemo
|
|||||||
Console.WriteLine("Played Songs History Count: " + PrimaryForm.playedSongsHistory.Count);
|
Console.WriteLine("Played Songs History Count: " + PrimaryForm.playedSongsHistory.Count);
|
||||||
foreach (var song in PrimaryForm.playedSongsHistory)
|
foreach (var song in PrimaryForm.playedSongsHistory)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Song: {song.Song}, ArtistA: {song.ArtistA}");
|
Console.WriteLine($"Song: {song.Name}, ArtistA: {song.Artist_A}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据播放历史确定每首歌的播放状态
|
// 根据播放历史确定每首歌的播放状态
|
||||||
@ -784,8 +784,8 @@ namespace DualScreenDemo
|
|||||||
{
|
{
|
||||||
return new
|
return new
|
||||||
{
|
{
|
||||||
song.Song,
|
song.Name,
|
||||||
song.ArtistA,
|
song.Artist_A,
|
||||||
song.FileName,
|
song.FileName,
|
||||||
PlayState = playState.HasValue ? (playState.Value == PlayState.Playing ? "播放中" : "播放完畢") : null // 如果状态为 null,不返回状态信息
|
PlayState = playState.HasValue ? (playState.Value == PlayState.Playing ? "播放中" : "播放完畢") : null // 如果状态为 null,不返回状态信息
|
||||||
};
|
};
|
||||||
@ -810,7 +810,7 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
if (song != null)
|
if (song != null)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Ordering Song: {song.Song} by {song.ArtistA}");
|
Console.WriteLine($"Ordering Song: {song.Name} by {song.Artist_A}");
|
||||||
// 这里可以添加处理逻辑,例如将歌曲加入到播放列表或数据库中
|
// 这里可以添加处理逻辑,例如将歌曲加入到播放列表或数据库中
|
||||||
OverlayForm.MainForm.AddSongToPlaylist(song);
|
OverlayForm.MainForm.AddSongToPlaylist(song);
|
||||||
|
|
||||||
@ -849,7 +849,7 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
if (song != null)
|
if (song != null)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Inserting Song: {song.Song} by {song.ArtistA}");
|
Console.WriteLine($"Inserting Song: {song.Name} by {song.Artist_A}");
|
||||||
// 这里可以添加插播歌曲的处理逻辑
|
// 这里可以添加插播歌曲的处理逻辑
|
||||||
OverlayForm.MainForm.InsertSongToPlaylist(song);
|
OverlayForm.MainForm.InsertSongToPlaylist(song);
|
||||||
|
|
||||||
@ -1114,12 +1114,12 @@ namespace DualScreenDemo
|
|||||||
favoriteSongList = searchResults
|
favoriteSongList = searchResults
|
||||||
.Select(song => new
|
.Select(song => new
|
||||||
{
|
{
|
||||||
song.Song,
|
song.Name,
|
||||||
song.ArtistA,
|
song.Artist_A,
|
||||||
song.SongNumber,
|
song.Number,
|
||||||
song.ArtistASimplified,
|
song.Artist_A_Simplified,
|
||||||
song.ArtistBSimplified,
|
song.Artist_B_Simplified,
|
||||||
song.SongSimplified,
|
song.Name_Simplified,
|
||||||
song.HumanVoice,
|
song.HumanVoice,
|
||||||
song.FileName
|
song.FileName
|
||||||
})
|
})
|
||||||
|
@ -624,11 +624,9 @@ public void UpdateNextSongLabelFromPlaylist(bool isUserPlaylistPlaying, SongData
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SongData nextSong = currentPlaylist[currentSongIndex + 1];
|
SongData nextSong = currentPlaylist[currentSongIndex + 1];
|
||||||
if (!string.IsNullOrEmpty(nextSong.ArtistA) && !string.IsNullOrEmpty(nextSong.Song))
|
if (!string.IsNullOrEmpty(nextSong.Artist_A))
|
||||||
{
|
{
|
||||||
nextSongLabel.Text = !string.IsNullOrWhiteSpace(nextSong.ArtistB)
|
nextSongLabel.Text = nextSong.next_artist_text();
|
||||||
? String.Format("下一首:{0} {1} {2}", nextSong.ArtistA, nextSong.ArtistB, nextSong.Song)
|
|
||||||
: String.Format("下一首:{0} {1}", nextSong.ArtistA, nextSong.Song);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1004,7 +1004,7 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
|
|||||||
if (songIndex >= 0 && songIndex < totalSongs)
|
if (songIndex >= 0 && songIndex < totalSongs)
|
||||||
{
|
{
|
||||||
selectedSong = LanguageSongList[songIndex];
|
selectedSong = LanguageSongList[songIndex];
|
||||||
Console.WriteLine("Adding song to playlist: " + LanguageSongList[songIndex].Song + " " + selectedSong.FileName);
|
Console.WriteLine("Adding song to playlist: " + LanguageSongList[songIndex].Name + " " + selectedSong.FileName);
|
||||||
|
|
||||||
|
|
||||||
// DisplayActionWithSong(currentPage, songIndex, "點播");
|
// DisplayActionWithSong(currentPage, songIndex, "點播");
|
||||||
@ -1036,7 +1036,7 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
|
|||||||
if (songIndex < totalSongs)
|
if (songIndex < totalSongs)
|
||||||
{
|
{
|
||||||
selectedSong = LanguageSongList[songIndex];
|
selectedSong = LanguageSongList[songIndex];
|
||||||
Console.WriteLine("Adding song to playlist: " + LanguageSongList[songIndex].Song + " " + selectedSong.FileName );
|
Console.WriteLine("Adding song to playlist: " + LanguageSongList[songIndex].Name + " " + selectedSong.FileName );
|
||||||
|
|
||||||
|
|
||||||
// DisplayActionWithSong(currentPage, songIndex, "插播");
|
// DisplayActionWithSong(currentPage, songIndex, "插播");
|
||||||
@ -1120,7 +1120,7 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
|
|||||||
if (songIndex < totalSongs)
|
if (songIndex < totalSongs)
|
||||||
{
|
{
|
||||||
selectedSong = LanguageSongList[songIndex];
|
selectedSong = LanguageSongList[songIndex];
|
||||||
Console.WriteLine("Adding song to playlist C: " + LanguageSongList[songIndex].Song + " " + selectedSong.FileName);
|
Console.WriteLine("Adding song to playlist C: " + LanguageSongList[songIndex].Name + " " + selectedSong.FileName);
|
||||||
|
|
||||||
|
|
||||||
DisplaySongsWithArrows(currentPage, songIndex);
|
DisplaySongsWithArrows(currentPage, songIndex);
|
||||||
@ -1257,7 +1257,7 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 建立顯示的歌曲文字,例如 "1. 我的歌"
|
// 建立顯示的歌曲文字,例如 "1. 我的歌"
|
||||||
string songText = $"{i + 1}. {song.Song}";
|
string songText = $"{i + 1}. {song.Name}";
|
||||||
Font songFont = new Font("Microsoft JhengHei", 50, FontStyle.Bold);
|
Font songFont = new Font("Microsoft JhengHei", 50, FontStyle.Bold);
|
||||||
|
|
||||||
// 將歌名轉成圖片
|
// 將歌名轉成圖片
|
||||||
@ -1531,11 +1531,9 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//var filePath1 = songData.SongFilePathHost1;
|
|
||||||
//var filePath2 = songData.SongFilePathHost2;
|
|
||||||
// 之後還要設計成本地的資料夾位置
|
// 之後還要設計成本地的資料夾位置
|
||||||
string pathToPlay = songData.FileName;
|
string pathToPlay = songData.getFile();
|
||||||
if (File.Exists(pathToPlay))
|
if (!string.IsNullOrEmpty(pathToPlay))
|
||||||
{
|
{
|
||||||
bool wasEmpty = PrimaryForm.userRequestedSongs.Count == 0;
|
bool wasEmpty = PrimaryForm.userRequestedSongs.Count == 0;
|
||||||
|
|
||||||
@ -1555,7 +1553,7 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
|
|||||||
PrimaryForm.PrintPlayingSongList();
|
PrimaryForm.PrintPlayingSongList();
|
||||||
|
|
||||||
// 點播次數+1
|
// 點播次數+1
|
||||||
PrimaryForm.Instance.AddSongCount(songData.SongNumber);
|
PrimaryForm.Instance.AddSongCount(songData.Number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -1571,10 +1569,10 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 從 songData 中取得兩個可能的檔案路徑(主機1與主機2)
|
// 從 songData 中取得兩個可能的檔案路徑(主機1與主機2)
|
||||||
var pathToPlay = songData.FileName;
|
var pathToPlay = songData.getFile();
|
||||||
|
|
||||||
// 檢查兩個主機上的檔案是否皆不存在
|
// 檢查兩個主機上的檔案是否皆不存在
|
||||||
if (File.Exists(pathToPlay))
|
if (!string.IsNullOrEmpty(pathToPlay))
|
||||||
{
|
{
|
||||||
// 若其中一個存在,就用第一個存在的那個檔案
|
// 若其中一個存在,就用第一個存在的那個檔案
|
||||||
|
|
||||||
@ -1683,10 +1681,8 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
|
|||||||
|
|
||||||
for (int i = startIndex; i < endIndex; i++)
|
for (int i = startIndex; i < endIndex; i++)
|
||||||
{
|
{
|
||||||
string songText = $"{i - startIndex + 1}. {LanguageSongList[i].Song}";
|
string songText = $"{i - startIndex + 1}. {LanguageSongList[i].Name}";
|
||||||
string artistText = !string.IsNullOrWhiteSpace(LanguageSongList[i].ArtistB)
|
string artistText = LanguageSongList[i].artist_text();
|
||||||
? $"{LanguageSongList[i].ArtistA} - {LanguageSongList[i].ArtistB}"
|
|
||||||
: LanguageSongList[i].ArtistA;
|
|
||||||
|
|
||||||
maxSongLength = Math.Max(maxSongLength, songText.Length);
|
maxSongLength = Math.Max(maxSongLength, songText.Length);
|
||||||
maxArtistLength = Math.Max(maxArtistLength, artistText.Length);
|
maxArtistLength = Math.Max(maxArtistLength, artistText.Length);
|
||||||
@ -1705,10 +1701,8 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
|
|||||||
// 計算行高
|
// 計算行高
|
||||||
for (int i = startIndex; i < endIndex; i++)
|
for (int i = startIndex; i < endIndex; i++)
|
||||||
{
|
{
|
||||||
string songText = $"{i - startIndex + 1}. {LanguageSongList[i].Song}";
|
string songText = $"{i - startIndex + 1}. {LanguageSongList[i].Name}";
|
||||||
string artistText = !string.IsNullOrWhiteSpace(LanguageSongList[i].ArtistB)
|
string artistText = LanguageSongList[i].artist_text();
|
||||||
? $"{LanguageSongList[i].ArtistA} - {LanguageSongList[i].ArtistB}"
|
|
||||||
: LanguageSongList[i].ArtistA;
|
|
||||||
|
|
||||||
Font songFont = new Font("Microsoft JhengHei", songFontSize, FontStyle.Bold);
|
Font songFont = new Font("Microsoft JhengHei", songFontSize, FontStyle.Bold);
|
||||||
Font artistFont = new Font("Microsoft JhengHei", artistFontSize, FontStyle.Bold);
|
Font artistFont = new Font("Microsoft JhengHei", artistFontSize, FontStyle.Bold);
|
||||||
@ -1724,10 +1718,8 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
|
|||||||
{
|
{
|
||||||
int songNumber = i - startIndex + 1;
|
int songNumber = i - startIndex + 1;
|
||||||
|
|
||||||
string songText = $"{songNumber}. {LanguageSongList[i].Song}";
|
string songText = $"{songNumber}. {LanguageSongList[i].Name}";
|
||||||
string artistText = !string.IsNullOrWhiteSpace(LanguageSongList[i].ArtistB)
|
string artistText = LanguageSongList[i].artist_text();
|
||||||
? $"{LanguageSongList[i].ArtistA} - {LanguageSongList[i].ArtistB}"
|
|
||||||
: LanguageSongList[i].ArtistA;
|
|
||||||
|
|
||||||
Font songFont = new Font("Microsoft JhengHei", songFontSize, FontStyle.Bold);
|
Font songFont = new Font("Microsoft JhengHei", songFontSize, FontStyle.Bold);
|
||||||
Font artistFont = new Font("Microsoft JhengHei", artistFontSize, FontStyle.Bold);
|
Font artistFont = new Font("Microsoft JhengHei", artistFontSize, FontStyle.Bold);
|
||||||
@ -1799,10 +1791,8 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
|
|||||||
int maxArtistLength = 0;
|
int maxArtistLength = 0;
|
||||||
for (int i = startIndex; i < endIndex; i++)
|
for (int i = startIndex; i < endIndex; i++)
|
||||||
{
|
{
|
||||||
string songText = $"{i - startIndex + 1}. {LanguageSongList[i].Song}";
|
string songText = $"{i - startIndex + 1}. {LanguageSongList[i].Name}";
|
||||||
string artistText = !string.IsNullOrWhiteSpace(LanguageSongList[i].ArtistB)
|
string artistText = LanguageSongList[i].artist_text();
|
||||||
? $"{LanguageSongList[i].ArtistA} - {LanguageSongList[i].ArtistB}"
|
|
||||||
: LanguageSongList[i].ArtistA;
|
|
||||||
|
|
||||||
maxSongLength = Math.Max(maxSongLength, songText.Length);
|
maxSongLength = Math.Max(maxSongLength, songText.Length);
|
||||||
maxArtistLength = Math.Max(maxArtistLength, artistText.Length);
|
maxArtistLength = Math.Max(maxArtistLength, artistText.Length);
|
||||||
@ -1817,10 +1807,8 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
|
|||||||
int rowHeight = 0;
|
int rowHeight = 0;
|
||||||
for (int i = startIndex; i < endIndex; i++)
|
for (int i = startIndex; i < endIndex; i++)
|
||||||
{
|
{
|
||||||
string songText = $"{i - startIndex + 1}. {LanguageSongList[i].Song}";
|
string songText = $"{i - startIndex + 1}. {LanguageSongList[i].Name}";
|
||||||
string artistText = !string.IsNullOrWhiteSpace(LanguageSongList[i].ArtistB)
|
string artistText = LanguageSongList[i].artist_text();
|
||||||
? $"{LanguageSongList[i].ArtistA} - {LanguageSongList[i].ArtistB}"
|
|
||||||
: LanguageSongList[i].ArtistA;
|
|
||||||
|
|
||||||
Font tempSongFont = new Font("Microsoft JhengHei", songFontSize, FontStyle.Bold);
|
Font tempSongFont = new Font("Microsoft JhengHei", songFontSize, FontStyle.Bold);
|
||||||
Font tempArtistFont = new Font("Microsoft JhengHei", artistFontSize, FontStyle.Bold);
|
Font tempArtistFont = new Font("Microsoft JhengHei", artistFontSize, FontStyle.Bold);
|
||||||
@ -1836,10 +1824,8 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
|
|||||||
{
|
{
|
||||||
int songNumber = i - startIndex + 1;
|
int songNumber = i - startIndex + 1;
|
||||||
|
|
||||||
string songText = $"{songNumber}. {LanguageSongList[i].Song}";
|
string songText = $"{songNumber}. {LanguageSongList[i].Name}";
|
||||||
string artistText = !string.IsNullOrWhiteSpace(LanguageSongList[i].ArtistB)
|
string artistText = LanguageSongList[i].artist_text();
|
||||||
? $"{LanguageSongList[i].ArtistA} - {LanguageSongList[i].ArtistB}"
|
|
||||||
: LanguageSongList[i].ArtistA;
|
|
||||||
|
|
||||||
// 設定顏色,選中的索引顯示為亮綠色
|
// 設定顏色,選中的索引顯示為亮綠色
|
||||||
Color songColor = (i == highlightIndex) ? Color.LimeGreen : Color.White;
|
Color songColor = (i == highlightIndex) ? Color.LimeGreen : Color.White;
|
||||||
|
@ -445,16 +445,12 @@ namespace DualScreenDemo
|
|||||||
songLabel.ForeColor = Color.White;
|
songLabel.ForeColor = Color.White;
|
||||||
statusText = string.Empty;
|
statusText = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根據簡繁體設置選擇要顯示的文字
|
// 根據簡繁體設置選擇要顯示的文字
|
||||||
string songText = IsSimplified ?
|
string songText = song.getName(IsSimplified);
|
||||||
(!string.IsNullOrEmpty(song.SongSimplified) ? song.SongSimplified : song.Song) :
|
|
||||||
song.Song;
|
|
||||||
|
|
||||||
// 歌手名稱設置點
|
// 歌手名稱設置點
|
||||||
string artistText = IsSimplified ?
|
string artistText = song.getArtist_A(IsSimplified);
|
||||||
(!string.IsNullOrEmpty(song.ArtistASimplified) ? song.ArtistASimplified : song.ArtistA) :
|
|
||||||
song.ArtistA;
|
|
||||||
|
|
||||||
string fullText = songText + statusText;
|
string fullText = songText + statusText;
|
||||||
int textLength = fullText.Length;
|
int textLength = fullText.Length;
|
||||||
|
@ -133,7 +133,7 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
private void AlbumButton_Click(object sender, EventArgs e)
|
private void AlbumButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string name = currentSelectedSong.ArtistA;
|
string name = currentSelectedSong.Artist_A;
|
||||||
string query = $"SELECT * FROM song_library_cache WHERE artistA = '{name}' ORDER BY add_date DESC;";
|
string query = $"SELECT * FROM song_library_cache WHERE artistA = '{name}' ORDER BY add_date DESC;";
|
||||||
var selectedSongs = SearchSongs_Mysql(query);
|
var selectedSongs = SearchSongs_Mysql(query);
|
||||||
/*var selectedSongs = allSongs.Where(song => song.ArtistA == currentSelectedSong.ArtistA)
|
/*var selectedSongs = allSongs.Where(song => song.ArtistA == currentSelectedSong.ArtistA)
|
||||||
@ -148,7 +148,7 @@ namespace DualScreenDemo
|
|||||||
{
|
{
|
||||||
|
|
||||||
Console.WriteLine("Favorite Button Clicked");
|
Console.WriteLine("Favorite Button Clicked");
|
||||||
InsertNewFavoriteSong(currentSelectedSong.SongNumber);
|
InsertNewFavoriteSong(currentSelectedSong.Number);
|
||||||
var searchResults = SearchSongs_Mysql(SearchFavoriteSongs_Mysql());
|
var searchResults = SearchSongs_Mysql(SearchFavoriteSongs_Mysql());
|
||||||
// 重置分頁
|
// 重置分頁
|
||||||
currentPage = 0;
|
currentPage = 0;
|
||||||
|
@ -1501,12 +1501,7 @@ namespace DualScreenDemo
|
|||||||
Console.WriteLine("當前播放列表:");
|
Console.WriteLine("當前播放列表:");
|
||||||
foreach (var song in userRequestedSongs)
|
foreach (var song in userRequestedSongs)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(song.name_text());
|
||||||
string outputText = !string.IsNullOrWhiteSpace(song.ArtistB)
|
|
||||||
? String.Format("{0} - {1} - {2}", song.ArtistA, song.ArtistB, song.Song)
|
|
||||||
: String.Format("{0} - {1}", song.ArtistA, song.Song);
|
|
||||||
|
|
||||||
Console.WriteLine(outputText);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1729,11 +1724,11 @@ namespace DualScreenDemo
|
|||||||
Font font = new Font("微軟正黑體", points, FontStyle.Bold);
|
Font font = new Font("微軟正黑體", points, FontStyle.Bold);
|
||||||
// 根據文字長度設置字體大小
|
// 根據文字長度設置字體大小
|
||||||
|
|
||||||
if (songData.Song.Length > 18)
|
if (songData.getNameLength() > 18)
|
||||||
{
|
{
|
||||||
font = new Font("微軟正黑體", 17, FontStyle.Bold);
|
font = new Font("微軟正黑體", 17, FontStyle.Bold);
|
||||||
}
|
}
|
||||||
else if (songData.Song.Length > 13)
|
else if (songData.getNameLength() > 13)
|
||||||
{
|
{
|
||||||
font = new Font("微軟正黑體", 21, FontStyle.Bold);
|
font = new Font("微軟正黑體", 21, FontStyle.Bold);
|
||||||
}
|
}
|
||||||
@ -1746,7 +1741,7 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
Brush textBrush = Brushes.Black;
|
Brush textBrush = Brushes.Black;
|
||||||
|
|
||||||
string songInfo = songData.Song ?? "未提供歌曲信息";
|
string songInfo = songData.Name ?? "未提供歌曲信息";
|
||||||
|
|
||||||
g.DrawString(songInfo, font, textBrush, new PointF(201, 29));
|
g.DrawString(songInfo, font, textBrush, new PointF(201, 29));
|
||||||
|
|
||||||
|
@ -671,7 +671,7 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
public static async Task UpdateMarqueeTextForNextSong(SongData song)
|
public static async Task UpdateMarqueeTextForNextSong(SongData song)
|
||||||
{
|
{
|
||||||
string nextSongText = String.Format("下一首3:{0}", song.Song);
|
string nextSongText = String.Format("下一首3:{0}", song.Name);
|
||||||
|
|
||||||
if (overlayForm.InvokeRequired)
|
if (overlayForm.InvokeRequired)
|
||||||
{
|
{
|
||||||
@ -763,12 +763,12 @@ namespace DualScreenDemo
|
|||||||
var songToPlay = currentPlaylist[currentSongIndex];
|
var songToPlay = currentPlaylist[currentSongIndex];
|
||||||
|
|
||||||
// pathToPlay 需要調整
|
// pathToPlay 需要調整
|
||||||
var pathToPlay = songToPlay.FileName;
|
var pathToPlay = songToPlay.getFile();
|
||||||
|
|
||||||
// 若兩個 host 上都找不到檔案就直接結束
|
// 若兩個 host 上都找不到檔案就直接結束
|
||||||
if (!File.Exists(pathToPlay))
|
if (string.IsNullOrEmpty(pathToPlay))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"文件不存在:{pathToPlay}");
|
Console.WriteLine($"文件不存在:{songToPlay.Name}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -989,8 +989,8 @@ namespace DualScreenDemo
|
|||||||
List<SongData> currentPlaylist = isUserPlaylistPlaying ? playingSongList : publicPlaylist;
|
List<SongData> currentPlaylist = isUserPlaylistPlaying ? playingSongList : publicPlaylist;
|
||||||
if (!currentPlaylist.Any()) return;
|
if (!currentPlaylist.Any()) return;
|
||||||
var songToPlay = currentPlaylist[currentSongIndex];
|
var songToPlay = currentPlaylist[currentSongIndex];
|
||||||
var pathToPlay = songToPlay.FileName;
|
var pathToPlay = songToPlay.getFile();
|
||||||
if (!File.Exists(pathToPlay))
|
if (string.IsNullOrEmpty(pathToPlay))
|
||||||
{
|
{
|
||||||
MessageBox.Show("File does not exist on both hosts.");
|
MessageBox.Show("File does not exist on both hosts.");
|
||||||
return;
|
return;
|
||||||
@ -1656,7 +1656,7 @@ namespace DualScreenDemo
|
|||||||
var sameNameIndices = new List<int>();
|
var sameNameIndices = new List<int>();
|
||||||
for (int i = 0; i < PrimaryForm.playedSongsHistory.Count; i++)
|
for (int i = 0; i < PrimaryForm.playedSongsHistory.Count; i++)
|
||||||
{
|
{
|
||||||
if (PrimaryForm.playedSongsHistory[i].Song == songData.Song)
|
if (PrimaryForm.playedSongsHistory[i].Name == songData.Name)
|
||||||
{
|
{
|
||||||
sameNameIndices.Add(i);
|
sameNameIndices.Add(i);
|
||||||
}
|
}
|
||||||
@ -1727,7 +1727,7 @@ namespace DualScreenDemo
|
|||||||
var sameNameIndices = new List<int>();
|
var sameNameIndices = new List<int>();
|
||||||
for (int i = 0; i < PrimaryForm.playedSongsHistory.Count; i++)
|
for (int i = 0; i < PrimaryForm.playedSongsHistory.Count; i++)
|
||||||
{
|
{
|
||||||
if (PrimaryForm.playedSongsHistory[i].Song == songData.Song)
|
if (PrimaryForm.playedSongsHistory[i].Name == songData.Name)
|
||||||
{
|
{
|
||||||
sameNameIndices.Add(i);
|
sameNameIndices.Add(i);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user