2509041235

This commit is contained in:
jasonchenwork 2025-09-04 12:35:22 +08:00
parent 655112dc8c
commit 5f401f2158
2 changed files with 41 additions and 24 deletions

View File

@ -76,16 +76,18 @@ namespace DBObj
try
{
var check = IsFtpUriReachable(new Uri(new Uri(server), basic.getFileName()).ToString());
// string fullPath = Path.Combine(server, basic.getFileName());
Uri fullUri = new Uri(new Uri(server), basic.getFileName());
// if (File.Exists(fullPath))
// {
// Console.WriteLine($"找到檔案: {fullPath}");
//string fullPath = Path.Combine(server, basic.getFileName());
//string fileName = Path.GetFileName(basic.getFileName());
//if (File.Exists(fullPath))
//{
// //Console.WriteLine($"找到檔案: {fullPath}");
// //if (!File.Exists(Application.StartupPath + fileName)) File.Copy(fullPath, Application.StartupPath + fileName);
// return true;
// }
//}
if (check)
{
Console.WriteLine($"找到檔案: {new Uri(new Uri(server), basic.getFileName())}");
// Console.WriteLine($"找到檔案: {new Uri(new Uri(server), basic.getFileName())}");
return true;
}
}
@ -126,9 +128,9 @@ namespace DBObj
foreach (var server in Utils.Env.GetSongServers())
{
if (!string.IsNullOrWhiteSpace(server)&&FileExistsInServers())
if (!string.IsNullOrWhiteSpace(server))
{
// Console.WriteLine(new Uri(new Uri(server), filename));
Console.WriteLine($"找到檔案: {new Uri(new Uri(server), filename)}");
return new Uri(new Uri(server), filename);
}
}
@ -161,9 +163,9 @@ namespace DBObj
{
try
{
#pragma warning disable SYSLIB0014 // 類型或成員已經過時
#pragma warning disable SYSLIB0014 // 類型或成員已經過時
var request = (FtpWebRequest)WebRequest.Create(ftpUri);
#pragma warning restore SYSLIB0014 // 類型或成員已經過時
#pragma warning restore SYSLIB0014 // 類型或成員已經過時
request.Method = WebRequestMethods.Ftp.ListDirectory; // Lightweight check
// request.Credentials = new NetworkCredential("svr", "svr"); // Replace with actual username/password
request.Timeout = 5000;

View File

@ -105,6 +105,8 @@ namespace DualScreenDemo
// ================================
private async Task HandleRoomCommand(string request ,NetworkStream stream)
{
var commandHandler = new CommandHandler(Program.songListManager);
string[] parts = request.Split(',', 3); // 最多拆三段
string cmdPrefix = parts[0].Trim();
string cmd = parts[1].Trim().ToLowerInvariant();
@ -129,51 +131,63 @@ namespace DualScreenDemo
break;
case "pause":
TogglePause();
// TogglePause();
commandHandler.ProcessData("A26DA4");
break;
case "volume_up":
OverlayForm.MainForm.Invoke(() => OverlayForm.MainForm.ShowTopRightLabelTime("音量 ↑", "a2 b3 a4"));
// OverlayForm.MainForm.Invoke(() => OverlayForm.MainForm.ShowTopRightLabelTime("音量 ↑", "a2 b3 a4"));
commandHandler.ProcessData("A2B3A4");
break;
case "volume_down":
OverlayForm.MainForm.Invoke(() => OverlayForm.MainForm.ShowTopRightLabelTime("音量 ↓", "a2 b4 a4"));
// OverlayForm.MainForm.Invoke(() => OverlayForm.MainForm.ShowTopRightLabelTime("音量 ↓", "a2 b4 a4"));
commandHandler.ProcessData("A2B4A4");
break;
case "mic_up":
OverlayForm.MainForm.Invoke(() => OverlayForm.MainForm.ShowTopRightLabelTime("麥克風 ↑", "a2 b5 a4"));
// OverlayForm.MainForm.Invoke(() => OverlayForm.MainForm.ShowTopRightLabelTime("麥克風 ↑", "a2 b5 a4"));
commandHandler.ProcessData("A2B5A4");
break;
case "mic_down":
OverlayForm.MainForm.Invoke(() => OverlayForm.MainForm.ShowTopRightLabelTime("麥克風 ↓", "a2 b6 a4"));
// OverlayForm.MainForm.Invoke(() => OverlayForm.MainForm.ShowTopRightLabelTime("麥克風 ↓", "a2 b6 a4"));
commandHandler.ProcessData("A2B6A4");
break;
case "mute":
ToggleMute();
// ToggleMute();
commandHandler.ProcessData("A276A4");
break;
case "original_song":
PrimaryForm.Instance.Invoke(() => PrimaryForm.Instance.videoPlayerForm.ToggleVocalRemoval());
// PrimaryForm.Instance.Invoke(() => PrimaryForm.Instance.videoPlayerForm.ToggleVocalRemoval());
commandHandler.ProcessData("A26CA4");
break;
case "service":
OverlayForm.MainForm.Invoke(() => OverlayForm.MainForm.ShowTopRightLabel("服務鈴", "a2 53 a4"));
// OverlayForm.MainForm.Invoke(() => OverlayForm.MainForm.ShowTopRightLabel("服務鈴", "a2 53 a4"));
commandHandler.ProcessData("A266A4");
break;
case "replay":
PrimaryForm.Instance.Invoke(() => PrimaryForm.Instance.videoPlayerForm.ReplayCurrentSong());
// PrimaryForm.Instance.Invoke(() => PrimaryForm.Instance.videoPlayerForm.ReplayCurrentSong());
commandHandler.ProcessData("A269A4");
break;
case "male_key":
SendSerialCommand(new byte[] { 0xA2, 0x7F, 0xA4 }, new byte[] { 0xA2, 0xB2, 0xA4 }, 2);
// SendSerialCommand(new byte[] { 0xA2, 0x7F, 0xA4 }, new byte[] { 0xA2, 0xB2, 0xA4 }, 2);
commandHandler.ProcessData("A27DA4");
break;
case "female_key":
SendSerialCommand(new byte[] { 0xA2, 0x7F, 0xA4 }, new byte[] { 0xA2, 0xB1, 0xA4 }, 2);
// SendSerialCommand(new byte[] { 0xA2, 0x7F, 0xA4 }, new byte[] { 0xA2, 0xB1, 0xA4 }, 2);
commandHandler.ProcessData("A281A4");
break;
case "cut":
PrimaryForm.Instance.Invoke(() => PrimaryForm.Instance.videoPlayerForm.PlayNextSong());
// PrimaryForm.Instance.Invoke(() => PrimaryForm.Instance.videoPlayerForm.PlayNextSong());
commandHandler.ProcessData("A267A4");
break;
case "lower_key":
@ -181,7 +195,8 @@ namespace DualScreenDemo
break;
case "standard_key":
SendSerialCommand(new byte[] { 0xA2, 0x7F, 0xA4 });
// SendSerialCommand(new byte[] { 0xA2, 0x7F, 0xA4 });
commandHandler.ProcessData("A27FA4");
break;
case "raise_key":