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