commands overhaul

This commit is contained in:
Andrea
2025-10-02 08:34:35 +02:00
parent b0c4dba54b
commit 8bea85a5b1
6 changed files with 94 additions and 141 deletions

View File

@@ -72,7 +72,7 @@
this.kryptonPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.kryptonPanel1.Location = new System.Drawing.Point(0, 0);
this.kryptonPanel1.Name = "kryptonPanel1";
this.kryptonPanel1.Size = new System.Drawing.Size(423, 386);
this.kryptonPanel1.Size = new System.Drawing.Size(427, 374);
this.kryptonPanel1.TabIndex = 0;
//
// logList
@@ -89,18 +89,18 @@
this.kryptonStatusStrip1.Font = new System.Drawing.Font("Segoe UI", 9F);
this.kryptonStatusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.statusLabel});
this.kryptonStatusStrip1.Location = new System.Drawing.Point(0, 364);
this.kryptonStatusStrip1.Location = new System.Drawing.Point(0, 352);
this.kryptonStatusStrip1.Name = "kryptonStatusStrip1";
this.kryptonStatusStrip1.ProgressBars = null;
this.kryptonStatusStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.ManagerRenderMode;
this.kryptonStatusStrip1.Size = new System.Drawing.Size(423, 22);
this.kryptonStatusStrip1.Size = new System.Drawing.Size(427, 22);
this.kryptonStatusStrip1.TabIndex = 3;
this.kryptonStatusStrip1.Text = "kryptonStatusStrip1";
//
// statusLabel
//
this.statusLabel.Name = "statusLabel";
this.statusLabel.Size = new System.Drawing.Size(103, 17);
this.statusLabel.Size = new System.Drawing.Size(105, 17);
this.statusLabel.Text = "STATUS: Server Off";
//
// menuStrip1
@@ -111,7 +111,7 @@
this.helpToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(423, 24);
this.menuStrip1.Size = new System.Drawing.Size(427, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
@@ -126,7 +126,7 @@
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(93, 22);
this.exitToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
@@ -141,7 +141,7 @@
// infoToolStripMenuItem2
//
this.infoToolStripMenuItem2.Name = "infoToolStripMenuItem2";
this.infoToolStripMenuItem2.Size = new System.Drawing.Size(180, 22);
this.infoToolStripMenuItem2.Size = new System.Drawing.Size(107, 22);
this.infoToolStripMenuItem2.Text = "About";
this.infoToolStripMenuItem2.Click += new System.EventHandler(this.infoToolStripMenuItem2_Click);
//
@@ -192,7 +192,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(423, 386);
this.ClientSize = new System.Drawing.Size(427, 374);
this.Controls.Add(this.kryptonPanel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));

View File

@@ -40,16 +40,13 @@ namespace SamaPager_Server
IPEndPoint receiveEndPoint = ServerEndPoint;
byte[] receivedBytes = UdpServer.Receive(ref receiveEndPoint);
string receivedMessage = Encoding.UTF8.GetString(receivedBytes);
byte[] bytesToSend;
switch (receivedMessage)
{
case "!time":
byte[] bytesToSend = Encoding.UTF8.GetBytes($"Hi, it's {DateTime.Now.Hour}:{DateTime.Now.Minute}:{DateTime.Now.Second}");
case "!getDateTime":
bytesToSend = Encoding.UTF8.GetBytes($"Hi, it's {DateTime.Now}");
this.UdpServer.Send(bytesToSend, bytesToSend.Length, receiveEndPoint);
return $"Time command received by {receiveEndPoint}, sent local server time";
case "!date":
byte[] bytesToSendDate = Encoding.UTF8.GetBytes($"Hi, it's");
this.UdpServer.Send(bytesToSendDate, bytesToSend.Length, receiveEndPoint);
return $"Time command received by {receiveEndPoint}, sent local server time";
default:
return $"[{DateTime.Now}] {receiveEndPoint}: {receivedMessage}";
}