2025-07-08 13:37:12 +08:00
|
|
|
|
using DualScreenDemo;
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
2025-04-07 16:54:10 +08:00
|
|
|
|
namespace DBObj
|
|
|
|
|
{
|
|
|
|
|
public class SongData
|
|
|
|
|
{
|
2025-07-08 13:37:12 +08:00
|
|
|
|
public string SongNumber { get; set; }
|
2025-04-07 16:54:10 +08:00
|
|
|
|
public string Song { get; set; }
|
|
|
|
|
public string ArtistA { get; set; }
|
|
|
|
|
public string ArtistB { get; set; }
|
2025-05-21 10:29:18 +08:00
|
|
|
|
public string FileName { get; set; }
|
2025-07-08 13:37:12 +08:00
|
|
|
|
public string ArtistASimplified { get; set; }
|
|
|
|
|
public string ArtistBSimplified { get; set; }
|
|
|
|
|
public string SongSimplified { get; set; }
|
2025-05-21 10:29:18 +08:00
|
|
|
|
public int HumanVoice { get; set; }
|
2025-07-08 13:37:12 +08:00
|
|
|
|
public bool isPublicSong { get; set; }
|
|
|
|
|
|
|
|
|
|
public PlayState state;
|
2025-04-07 16:54:10 +08:00
|
|
|
|
|
2025-04-21 11:33:31 +08:00
|
|
|
|
/*
|
2025-04-07 16:54:10 +08:00
|
|
|
|
public SongData(string songNumber, string category, string song, double plays, string artistA, string artistB, string artistACategory, string artistBCategory, DateTime addedTime, string songFilePathHost1, string songFilePathHost2, string phoneticNotation, string pinyinNotation, string artistAPhonetic, string artistBPhonetic, string artistASimplified, string artistBSimplified, string songSimplified, string songGenre, string artistAPinyin, string artistBPinyin, int humanVoice)
|
|
|
|
|
{
|
|
|
|
|
SongNumber = songNumber;
|
2025-04-21 11:33:31 +08:00
|
|
|
|
// Category = category;
|
2025-04-07 16:54:10 +08:00
|
|
|
|
Song = song;
|
2025-04-21 11:33:31 +08:00
|
|
|
|
// Plays = plays;
|
2025-04-07 16:54:10 +08:00
|
|
|
|
ArtistA = artistA;
|
|
|
|
|
ArtistB = artistB;
|
2025-04-21 11:33:31 +08:00
|
|
|
|
//ArtistACategory = artistACategory;
|
|
|
|
|
//ArtistBCategory = artistBCategory;
|
|
|
|
|
//AddedTime = addedTime;
|
|
|
|
|
SongFilePathHost1 = songFilePathHost1;
|
|
|
|
|
SongFilePathHost2 = songFilePathHost2;
|
|
|
|
|
//PhoneticNotation = phoneticNotation;
|
|
|
|
|
//PinyinNotation = pinyinNotation;
|
|
|
|
|
//ArtistAPhonetic = artistAPhonetic;
|
|
|
|
|
//ArtistBPhonetic = artistBPhonetic;
|
|
|
|
|
ArtistASimplified = artistASimplified;
|
|
|
|
|
ArtistBSimplified = artistBSimplified;
|
|
|
|
|
SongSimplified = songSimplified;
|
|
|
|
|
//SongGenre = songGenre;
|
|
|
|
|
//ArtistAPinyin = artistAPinyin;
|
|
|
|
|
//ArtistBPinyin = artistBPinyin;
|
|
|
|
|
HumanVoice = humanVoice;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
2025-07-08 13:37:12 +08:00
|
|
|
|
public SongData(string songNumber, string song, string filename, int humanVoice, bool isPublic)
|
2025-07-04 18:19:41 +08:00
|
|
|
|
{
|
|
|
|
|
SongNumber = songNumber;
|
|
|
|
|
Song = song;
|
|
|
|
|
FileName = filename;
|
|
|
|
|
HumanVoice = 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
|
|
|
|
{
|
|
|
|
|
SongNumber = songNumber;
|
|
|
|
|
Song = song;
|
|
|
|
|
ArtistA = artistA;
|
2025-05-21 10:29:18 +08:00
|
|
|
|
ArtistB = artistB;
|
2025-07-08 13:37:12 +08:00
|
|
|
|
FileName = FindExistingPath(filename);
|
2025-04-07 16:54:10 +08:00
|
|
|
|
ArtistASimplified = artistASimplified;
|
|
|
|
|
ArtistBSimplified = artistBSimplified;
|
|
|
|
|
SongSimplified = songSimplified;
|
2025-07-04 18:19:41 +08:00
|
|
|
|
HumanVoice = humanVoice;
|
2025-07-08 13:37:12 +08:00
|
|
|
|
isPublicSong = false;
|
|
|
|
|
}
|
|
|
|
|
private string FindExistingPath(string filename)
|
|
|
|
|
{
|
|
|
|
|
var servers = new[] { @"\\svr01\", @"\\svr02\", @"\\svr01\e", @"\\svr02\e" };
|
|
|
|
|
foreach (var server in servers){
|
|
|
|
|
string fullPath = Path.Combine(server, filename);
|
|
|
|
|
if (File.Exists(fullPath)) return fullPath;
|
|
|
|
|
}
|
|
|
|
|
return filename; // 找不到就回原本的 filename,不加路徑
|
|
|
|
|
}
|
|
|
|
|
public void SetState(PlayState s) => state = s;
|
|
|
|
|
|
|
|
|
|
public PlayState GetState()
|
|
|
|
|
{
|
|
|
|
|
return state;
|
2025-04-07 16:54:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
2025-07-08 13:37:12 +08:00
|
|
|
|
|
2025-04-07 16:54:10 +08:00
|
|
|
|
return !string.IsNullOrWhiteSpace(ArtistB)
|
|
|
|
|
? String.Format("{0} - {1} - {2}", ArtistA, ArtistB, Song)
|
|
|
|
|
: String.Format("{0} - {1}", ArtistA, Song);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|