2025-07-08 13:37:12 +08:00
|
|
|
|
using DualScreenDemo;
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
2025-07-14 18:08:12 +08:00
|
|
|
|
using System.Windows.Markup;
|
2025-04-07 16:54:10 +08:00
|
|
|
|
namespace DBObj
|
|
|
|
|
{
|
|
|
|
|
public class SongData
|
|
|
|
|
{
|
2025-07-14 18:08:12 +08:00
|
|
|
|
private Song basic;
|
|
|
|
|
private Artist A ;
|
|
|
|
|
private Artist B ;
|
2025-07-08 13:37:12 +08:00
|
|
|
|
public bool isPublicSong { get; set; }
|
|
|
|
|
|
|
|
|
|
public PlayState state;
|
|
|
|
|
public SongData(string songNumber, string song, string filename, int humanVoice, bool isPublic)
|
2025-07-04 18:19:41 +08:00
|
|
|
|
{
|
2025-07-14 18:08:12 +08:00
|
|
|
|
basic=new(songNumber,song,"",filename,humanVoice);
|
2025-07-08 13:37:12 +08:00
|
|
|
|
isPublicSong = isPublic;
|
2025-07-04 18:19:41 +08:00
|
|
|
|
}
|
|
|
|
|
public SongData(string songNumber, string song, string artistA, string artistB, string filename, string artistASimplified, string artistBSimplified, string songSimplified, int humanVoice)
|
2025-04-21 11:33:31 +08:00
|
|
|
|
{
|
2025-07-14 18:08:12 +08:00
|
|
|
|
basic=new(songNumber,song,songSimplified,filename,humanVoice);
|
|
|
|
|
A= new Artist(artistA, artistASimplified);
|
|
|
|
|
if(artistB!=null){
|
|
|
|
|
B= new Artist(artistB, artistBSimplified);
|
|
|
|
|
}
|
2025-07-08 13:37:12 +08:00
|
|
|
|
isPublicSong = false;
|
|
|
|
|
}
|
2025-07-14 18:08:12 +08:00
|
|
|
|
public string getNumber() {return basic.getNumber();}
|
|
|
|
|
public string getName(bool IsSimplified=false) { return basic.getName(IsSimplified); }
|
|
|
|
|
public string getName() { return basic.getName();}
|
|
|
|
|
public string getArtist_A(bool IsSimplified) { return A.getName(IsSimplified); }
|
|
|
|
|
public string getArtist_A() { return A.getName();}
|
|
|
|
|
public string getArtist_B(bool IsSimplified) { return B.getName(IsSimplified); }
|
|
|
|
|
public string getArtist_B() { return B.getName();}
|
|
|
|
|
public int getNameLength() { return basic.getName().Length; }
|
|
|
|
|
public string getFileName() {return basic.getFileName();}
|
2025-07-08 18:13:36 +08:00
|
|
|
|
public string next_artist_text()
|
|
|
|
|
{
|
2025-07-14 18:08:12 +08:00
|
|
|
|
return B!=null
|
|
|
|
|
? String.Format("下一首:{0} {1} {2}", A.getName(false), B.getName(false), basic.getName(false))
|
|
|
|
|
: String.Format("下一首:{0} {1}", A.getName(false), basic.getName(false));
|
2025-07-08 18:13:36 +08:00
|
|
|
|
}
|
|
|
|
|
public string artist_text()
|
|
|
|
|
{
|
2025-07-14 18:08:12 +08:00
|
|
|
|
return B!=null
|
|
|
|
|
? $"{A.getName(false)} - {B.getName(false)}"
|
|
|
|
|
: A.getName(false);
|
2025-07-08 18:13:36 +08:00
|
|
|
|
}
|
|
|
|
|
public string name_text()
|
|
|
|
|
{
|
2025-07-14 18:08:12 +08:00
|
|
|
|
return B!=null
|
|
|
|
|
? String.Format("{0} - {1} - {2}", A.getName(false), B.getName(false), basic.getName(false))
|
|
|
|
|
: String.Format("{0} - {1}", A.getName(false), basic.getName(false));
|
2025-07-08 18:13:36 +08:00
|
|
|
|
}
|
2025-07-14 18:08:12 +08:00
|
|
|
|
|
2025-07-08 18:13:36 +08:00
|
|
|
|
public string getFile()
|
|
|
|
|
{
|
2025-07-14 18:08:12 +08:00
|
|
|
|
return FindExistingPath(basic.getFileName());
|
2025-07-08 18:13:36 +08:00
|
|
|
|
}
|
2025-07-08 13:37:12 +08:00
|
|
|
|
private string FindExistingPath(string filename)
|
|
|
|
|
{
|
2025-07-16 18:25:56 +08:00
|
|
|
|
foreach (var server in Utils.Env.GetSongServers())
|
2025-07-08 18:13:36 +08:00
|
|
|
|
{
|
2025-07-16 18:25:56 +08:00
|
|
|
|
Console.WriteLine($"伺服器路徑: '{server}'");
|
2025-07-08 13:37:12 +08:00
|
|
|
|
string fullPath = Path.Combine(server, filename);
|
|
|
|
|
if (File.Exists(fullPath)) return fullPath;
|
|
|
|
|
}
|
2025-07-08 18:13:36 +08:00
|
|
|
|
return null; // 找不到就回原本的 filename,不加路徑
|
2025-07-08 13:37:12 +08:00
|
|
|
|
}
|
2025-07-14 18:08:12 +08:00
|
|
|
|
public Color GetStateColor(){
|
|
|
|
|
Color c = Color.White;
|
|
|
|
|
if (state == PlayState.Played){
|
|
|
|
|
c = Color.Gray;//Color.FromArgb(200, 75, 125); // 播畢顏色:紫紅色
|
|
|
|
|
}else if (state == PlayState.Playing){
|
|
|
|
|
c = Color.LimeGreen;
|
|
|
|
|
}else if (state == PlayState.InsertPlayback){
|
|
|
|
|
c = Color.Gold;
|
|
|
|
|
}
|
|
|
|
|
return c;
|
|
|
|
|
}
|
|
|
|
|
public string GetStateTxt(bool IsSimplified){
|
|
|
|
|
string txt = string.Empty;
|
|
|
|
|
if (state == PlayState.Played) {
|
|
|
|
|
txt = IsSimplified ? "(播毕)" : "(播畢)";
|
|
|
|
|
} else if (state == PlayState.Playing) {
|
|
|
|
|
txt = IsSimplified ? "(播放中)" : "(播放中)";
|
|
|
|
|
} else if (state == PlayState.InsertPlayback) {
|
|
|
|
|
txt = IsSimplified ? "(插播)" : "(插播)";
|
|
|
|
|
}
|
|
|
|
|
return txt;
|
|
|
|
|
}
|
2025-07-08 13:37:12 +08:00
|
|
|
|
public void SetState(PlayState s) => state = s;
|
|
|
|
|
|
|
|
|
|
public PlayState GetState()
|
|
|
|
|
{
|
|
|
|
|
return state;
|
2025-04-07 16:54:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
2025-07-14 18:08:12 +08:00
|
|
|
|
public int getHumanVoice() { return basic.getHumanVoice(); }
|
2025-04-07 16:54:10 +08:00
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
2025-07-08 13:37:12 +08:00
|
|
|
|
|
2025-07-14 18:08:12 +08:00
|
|
|
|
return B!=null
|
|
|
|
|
? String.Format("{0} - {1} - {2} - {3}", state, A.getName(), B.getName(), basic.getName())
|
|
|
|
|
: String.Format("{0} - {1} - {2}", state, A.getName(), basic.getName());
|
2025-04-07 16:54:10 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|