Make it workie

This commit is contained in:
2025-12-09 15:21:29 +01:00
parent c4468ee686
commit 06aaa40f26
6 changed files with 82 additions and 5 deletions

View File

@@ -11,6 +11,7 @@ namespace ConsoleApp1
private string name;
private string version;
private string sn;
private bool isOn = false;
public System(string name, string version, string sn)
{
@@ -25,7 +26,41 @@ namespace ConsoleApp1
public override string ToString()
{
return $"Name: {this.name}\nVersion: {this.version}";
return $" - Name: {this.name}\n - Version: {this.version}";
}
public bool Start()
{
if (this.isOn) return false;
Console.WriteLine($"System starting...");
this.isOn = true;
return true;
}
public void Restart()
{
Console.WriteLine("System restarting in:");
for (int i = 3; i > 0; i--)
{
Console.WriteLine(i);
Thread.Sleep(1000);
}
this.Quit();
this.Start();
}
public bool Quit()
{
if (!this.isOn) return false;
Console.WriteLine($"System quiting...");
this.isOn = false;
return true;
}
}
}