修正API response
This commit is contained in:
parent
08dc3539e6
commit
b3261306eb
11
TCPServer.cs
11
TCPServer.cs
@ -153,7 +153,7 @@ namespace DualScreenDemo
|
|||||||
{
|
{
|
||||||
PrimaryForm.Instance.ShowSendOffScreen();
|
PrimaryForm.Instance.ShowSendOffScreen();
|
||||||
Console.WriteLine("開始設置新的播放列表");
|
Console.WriteLine("開始設置新的播放列表");
|
||||||
|
|
||||||
|
|
||||||
string closePath = @"D:\video\CLOSE.MPG";
|
string closePath = @"D:\video\CLOSE.MPG";
|
||||||
if (File.Exists(closePath))
|
if (File.Exists(closePath))
|
||||||
@ -197,6 +197,7 @@ namespace DualScreenDemo
|
|||||||
{
|
{
|
||||||
Console.WriteLine($"錯誤: 找不到檔案 {closePath}");
|
Console.WriteLine($"錯誤: 找不到檔案 {closePath}");
|
||||||
}
|
}
|
||||||
|
OverlayForm.Instance.ResetMarqueeTextToWelcomeMessage();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -219,7 +220,8 @@ namespace DualScreenDemo
|
|||||||
PrimaryForm.Instance.HotPlayButton_Click(null, EventArgs.Empty);
|
PrimaryForm.Instance.HotPlayButton_Click(null, EventArgs.Empty);
|
||||||
UpdateStateFile(stateFilePath, "OPEN");
|
UpdateStateFile(stateFilePath, "OPEN");
|
||||||
PrimaryForm.Instance.HideSendOffScreen();
|
PrimaryForm.Instance.HideSendOffScreen();
|
||||||
|
|
||||||
|
OverlayForm.Instance.ResetMarqueeTextToWelcomeMessage();
|
||||||
|
|
||||||
byte[] okResponse = Encoding.UTF8.GetBytes("OK\n");
|
byte[] okResponse = Encoding.UTF8.GetBytes("OK\n");
|
||||||
stream.Write(okResponse, 0, okResponse.Length);
|
stream.Write(okResponse, 0, okResponse.Length);
|
||||||
@ -251,14 +253,13 @@ namespace DualScreenDemo
|
|||||||
string message = request.Trim();
|
string message = request.Trim();
|
||||||
string pattern = @"^(全部|\d{4})\((白色|紅色|綠色|黑色|藍色)\)-";
|
string pattern = @"^(全部|\d{4})\((白色|紅色|綠色|黑色|藍色)\)-";
|
||||||
Match match = Regex.Match(message, pattern);
|
Match match = Regex.Match(message, pattern);
|
||||||
|
|
||||||
_ = SafeInvoke(OverlayForm.MainForm, () =>
|
_ = SafeInvoke(OverlayForm.MainForm, () =>
|
||||||
{
|
{
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
{
|
{
|
||||||
string marqueeMessage = message.Substring(match.Value.Length).Trim();
|
string marqueeMessage = message.Substring(match.Value.Length).Trim();
|
||||||
Color textColor = GetColorFromString(match.Groups[2].Value);
|
Color textColor = GetColorFromString(match.Groups[2].Value);
|
||||||
OverlayForm.MainForm.UpdateMarqueeText(marqueeMessage, OverlayForm.MarqueeStartPosition.Middle, textColor);
|
OverlayForm.MainForm.UpdateMarqueeText(marqueeMessage, OverlayForm.MarqueeStartPosition.Right, textColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -266,6 +267,8 @@ namespace DualScreenDemo
|
|||||||
OverlayForm.MainForm.UpdateMarqueeTextSecondLine(marqueeMessage);
|
OverlayForm.MainForm.UpdateMarqueeTextSecondLine(marqueeMessage);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
byte[] okResponse = Encoding.UTF8.GetBytes("OK\n");
|
||||||
|
stream.Write(okResponse, 0, okResponse.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.Trim().Equals("exit", StringComparison.OrdinalIgnoreCase))
|
if (request.Trim().Equals("exit", StringComparison.OrdinalIgnoreCase))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user