display info in script block

This commit is contained in:
Firq 2023-04-08 14:20:23 +02:00
parent 13dab24311
commit fc9a15e87a
Signed by: Firq
GPG key ID: 3ACC61C8CEC83C20

View file

@ -22,9 +22,16 @@ public void Main(string args) {
collectorGroup.GetBlocksOfType(collectors); collectorGroup.GetBlocksOfType(collectors);
int iceamount = getCurrentIceAmount(); int iceamount = getCurrentIceAmount();
collectorState = collectors[0].Enabled ? "Active" : "Inactive"; collectorState = collectors[0].Enabled ? "Active" : "Inactive";
Echo($"Current Ice Amount: {iceamount}");
Echo($"Collectors are {collectorState}");
var msg = string.Format("\n\nIce Manager by Firq\n----------------------------\nCurrent Time: {0}\n----------------------------\nCollectors are {1}\nIce Amount: {2}M",
DateTime.UtcNow.ToLocalTime().ToLongTimeString(), collectorState, Math.Round((iceamount / 1000000.0), 2));
var screen = Me.GetSurface(0);
screen.ContentType = ContentType.TEXT_AND_IMAGE;
screen.Alignment = TextAlignment.CENTER;
screen.WriteText(msg, false);
Echo(msg);
if(iceamount > upperThreshold) { if(iceamount > upperThreshold) {
toggleCollectors(false); toggleCollectors(false);
Echo($"Collectors are OFF"); Echo($"Collectors are OFF");
@ -32,13 +39,6 @@ public void Main(string args) {
toggleCollectors(true); toggleCollectors(true);
Echo($"Collectors are ON"); Echo($"Collectors are ON");
} }
var msg = string.Format("\n\nIce Manager by Firq\n----------------------------\nCurrent Time: {0}\n----------------------------\nCollectors are {1}\nIce Amount: {2}M",
DateTime.UtcNow.ToLocalTime().ToLongTimeString(), collectorState, Math.Round((iceamount / 1000000.0), 2));
var screen = Me.GetSurface(0);
screen.ContentType = ContentType.TEXT_AND_IMAGE;
screen.Alignment = TextAlignment.CENTER;
screen.WriteText(msg, false);
} }
public int getCurrentIceAmount() { public int getCurrentIceAmount() {