2509031637

Env config路徑改自本地
升降調label顯示邏輯修改
This commit is contained in:
jasonchenwork 2025-09-03 16:38:39 +08:00
parent 4ca6594561
commit 403e3c9606
7 changed files with 56 additions and 35 deletions

View File

@ -128,31 +128,39 @@ namespace DualScreenDemo
SafeInvokeAction("A275A4",() => OverlayForm.MainForm.ShowTopRightLabelTime(" 調色 ")); SafeInvokeAction("A275A4",() => OverlayForm.MainForm.ShowTopRightLabelTime(" 調色 "));
break; break;
case "A283A4": case "A283A4":
SafeInvokeAction("A283A4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↑升4調 ")); SafeInvokeAction("A283A4",() => OverlayForm.MainForm.ShowTopRightLabel("↑升4調 "));
OverlayForm.Instance.topRightTimer.Stop();
break; break;
case "A282A4": case "A282A4":
SafeInvokeAction("A282A4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↑升3調 ")); SafeInvokeAction("A282A4",() => OverlayForm.MainForm.ShowTopRightLabel("↑升3調 "));
OverlayForm.Instance.topRightTimer.Stop();
break; break;
case "A281A4": case "A281A4":
SafeInvokeAction("A281A4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↑升2調 ")); SafeInvokeAction("A281A4",() => OverlayForm.MainForm.ShowTopRightLabel("↑升2調 "));
OverlayForm.Instance.topRightTimer.Stop();
break; break;
case "A280A4": case "A280A4":
SafeInvokeAction("A280A4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↑升1調 ")); SafeInvokeAction("A280A4",() => OverlayForm.MainForm.ShowTopRightLabel("↑升1調 "));
OverlayForm.Instance.topRightTimer.Stop();
break; break;
case "A27FA4": case "A27FA4":
SafeInvokeAction("A27FA4",() => OverlayForm.MainForm.ShowTopRightLabelTime(" 標準調 ")); SafeInvokeAction("A27FA4",() => OverlayForm.MainForm.ShowTopRightLabelTime(" 標準調 "));
break; break;
case "A27EA4": case "A27EA4":
SafeInvokeAction("A27EA4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↓降1調 ")); SafeInvokeAction("A27EA4",() => OverlayForm.MainForm.ShowTopRightLabel("↓降1調 "));
OverlayForm.Instance.topRightTimer.Stop();
break; break;
case "A27DA4": case "A27DA4":
SafeInvokeAction("A27EA4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↓降2調 ")); SafeInvokeAction("A27EA4",() => OverlayForm.MainForm.ShowTopRightLabel("↓降2調 "));
OverlayForm.Instance.topRightTimer.Stop();
break; break;
case "A27CA4": case "A27CA4":
SafeInvokeAction("A27CA4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↓降3調 ")); SafeInvokeAction("A27CA4",() => OverlayForm.MainForm.ShowTopRightLabel("↓降3調 "));
OverlayForm.Instance.topRightTimer.Stop();
break; break;
case "A27BA4": case "A27BA4":
SafeInvokeAction("A27BA4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↓降4調 ")); SafeInvokeAction("A27BA4",() => OverlayForm.MainForm.ShowTopRightLabel("↓降4調 "));
OverlayForm.Instance.topRightTimer.Stop();
break; break;
case "A266A4": case "A266A4":
SafeInvokeAction("A266A4",() => OverlayForm.MainForm.ShowTopRightLabel("服務鈴")); SafeInvokeAction("A266A4",() => OverlayForm.MainForm.ShowTopRightLabel("服務鈴"));

View File

@ -107,9 +107,13 @@ namespace DBObj
return null; // 找不到就回原本的 filename不加路徑 return null; // 找不到就回原本的 filename不加路徑
} }
public Uri getFileUrl() public Uri getFileUrl()
{
if (!isPublicSong)
{ {
return GetUri(basic.getFileName()); return GetUri(basic.getFileName());
} }
return null;
}
private Uri GetUri(string filename) private Uri GetUri(string filename)
{ {
@ -118,12 +122,13 @@ namespace DBObj
var check = IsFtpUriReachable(new Uri(server).ToString()); var check = IsFtpUriReachable(new Uri(server).ToString());
if (!string.IsNullOrWhiteSpace(server) && check != false) if (!string.IsNullOrWhiteSpace(server) && check != false)
{ {
return new Uri(new Uri(server), filename); Console.WriteLine(new Uri(new Uri(server), filename));
if (IsFtpUriReachable(new Uri(new Uri(server), filename).ToString())) return new Uri(new Uri(server), filename);
} }
} }
// throw new InvalidOperationException("No valid server found."); // throw new InvalidOperationException("No valid server found.");
Console.WriteLine("No valid server found."); if (!isPublicSong) Console.WriteLine("No valid server found.");
return null; return null;
} }
@ -146,7 +151,7 @@ namespace DBObj
{ {
return String.Format("{0} {1}", basic.getName(), state.GetDescription()); return String.Format("{0} {1}", basic.getName(), state.GetDescription());
} }
public static bool IsFtpUriReachable(string ftpUri) public bool IsFtpUriReachable(string ftpUri)
{ {
try try
{ {
@ -177,5 +182,11 @@ namespace DBObj
return false; return false;
} }
} }
public static bool IsFtpUri(Uri uri)
{
return uri != null && uri.Scheme == Uri.UriSchemeFtp;
}
} }
} }

14
Env.cs
View File

@ -9,7 +9,8 @@ namespace Utils
{ {
public static class Env public static class Env
{ {
private static string KtvPath = ""; // private static string KtvPath = "";
private static string KtvPath = @"\\sshost\KTVSuperstar";
private static readonly List<string> KtvPaths = new() private static readonly List<string> KtvPaths = new()
{ {
@"\\sshost\KTVSuperstar", @"\\sshost\KTVSuperstar",
@ -21,14 +22,15 @@ namespace Utils
static Env() static Env()
{ {
foreach (var path in KtvPaths) // foreach (var path in KtvPaths)
{ // {
// var path = Application.StartupPath; var path = Application.StartupPath;
var configPath = Path.Combine(path, "config.ini"); var configPath = Path.Combine(path, "config.ini");
if (File.Exists(configPath)) if (File.Exists(configPath))
{ {
KtvPath = path; // KtvPath = path;
Console.WriteLine("找到設定檔:" + configPath); Console.WriteLine("找到設定檔:" + configPath);
foreach (var line in File.ReadAllLines(configPath)) foreach (var line in File.ReadAllLines(configPath))
{ {
@ -49,7 +51,7 @@ namespace Utils
return; // 找到一份 config 就跳出 return; // 找到一份 config 就跳出
} }
} // }
Console.WriteLine("所有指定目錄都找不到 config.ini"); Console.WriteLine("所有指定目錄都找不到 config.ini");
} }

View File

@ -13,7 +13,7 @@ namespace OverlayFormObj
public Label muteLabel; // New mute label public Label muteLabel; // New mute label
public Label topLeftLabel; public Label topLeftLabel;
public Label topRightLabel; public Label topRightLabel;
private System.Windows.Forms.Timer topRightTimer = new System.Windows.Forms.Timer(); public System.Windows.Forms.Timer topRightTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer secondLineDisplayTimer = new System.Windows.Forms.Timer(); private System.Windows.Forms.Timer secondLineDisplayTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer qrCodeTimer = new System.Windows.Forms.Timer(); private System.Windows.Forms.Timer qrCodeTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer delayTimer = new System.Windows.Forms.Timer(); private System.Windows.Forms.Timer delayTimer = new System.Windows.Forms.Timer();

View File

@ -91,32 +91,31 @@ namespace DualScreenDemo
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolGain"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolGain"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolGain"])), null); new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolGain"])), null);
this.syncVolumeUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↑ ","a2 b3 a4"); }; this.syncVolumeUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabelTime("音量 ↑ ","a2 b3 a4"); };
this.syncVolumeUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };
ConfigureButton(this.syncVolumeDownButton, 1218, 616, 205, 55, ConfigureButton(this.syncVolumeDownButton, 1218, 616, 205, 55,
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolDown"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolDown"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolDown"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolDown"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolDown"])), null); new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolDown"])), null);
this.syncVolumeDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↓ ","a2 b4 a4");}; this.syncVolumeDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabelTime("音量 ↓ ","a2 b4 a4");};
this.syncVolumeDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel();};
ConfigureButton(this.syncMicUpButton, 1218, 686, 205, 56, ConfigureButton(this.syncMicUpButton, 1218, 686, 205, 56,
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolGain"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolGain"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolGain"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolGain"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolGain"])), null); new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolGain"])), null);
this.syncMicUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↑ ","a2 b5 a4");}; this.syncMicUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabelTime("麥克風 ↑ ","a2 b5 a4");};
this.syncMicUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };
ConfigureButton(this.syncMicDownButton, 1218, 756, 205, 56, ConfigureButton(this.syncMicDownButton, 1218, 756, 205, 56,
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolDown"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolDown"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolDown"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolDown"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolDown"])), null); new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolDown"])), null);
this.syncMicDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↓ ","a2 b6 a4");}; this.syncMicDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabelTime("麥克風 ↓ ","a2 b6 a4");};
this.syncMicDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };

View File

@ -59,7 +59,7 @@ namespace DualScreenDemo
public Button muteButton; public Button muteButton;
private Button maleKeyButton; private Button maleKeyButton;
private Button femaleKeyButton; private Button femaleKeyButton;
private Button standardKeyButton; public Button standardKeyButton;
private Button soundEffectButton; private Button soundEffectButton;
private Button pitchUpButton; private Button pitchUpButton;
private Button pitchDownButton; private Button pitchDownButton;
@ -87,7 +87,7 @@ namespace DualScreenDemo
public VideoView videoView1 = new VideoView() { Dock = DockStyle.Fill }; public VideoView videoView1 = new VideoView() { Dock = DockStyle.Fill };
// string serverPath = Utils.Env.GetPath("", ""); // string serverPath = Utils.Env.GetPath("", "");
string serverPath = Application.StartupPath; public string serverPath = Application.StartupPath;
public List<Control> _StartupcontrolsTop= new List<Control>(); public List<Control> _StartupcontrolsTop= new List<Control>();
public List<Control> _StartupcontrolsBottom= new List<Control>(); public List<Control> _StartupcontrolsBottom= new List<Control>();
//async Task<Bitmap> GetBitmapFromUriAsync(Uri uri) //async Task<Bitmap> GetBitmapFromUriAsync(Uri uri)

View File

@ -365,6 +365,7 @@ namespace DualScreenDemo
Task.Run(() => Thread.Sleep(100)); Task.Run(() => Thread.Sleep(100));
if (isSyncToPrimaryMonitor) SyncToPrimaryMonitor(); if (isSyncToPrimaryMonitor) SyncToPrimaryMonitor();
if (url == null&&!song.isPublicSong) PlayNextSong(); if (url == null&&!song.isPublicSong) PlayNextSong();
PrimaryForm.Instance.standardKeyButton.PerformClick();
return Task.CompletedTask; return Task.CompletedTask;
} }
catch (Exception ex) catch (Exception ex)