Make it workie
This commit is contained in:
BIN
.gitignore
vendored
BIN
.gitignore
vendored
Binary file not shown.
@@ -8,13 +8,19 @@ EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|ARM32 = Debug|ARM32
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|ARM32 = Release|ARM32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0199A106-1CC7-4407-BE8C-1308445FA97D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0199A106-1CC7-4407-BE8C-1308445FA97D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0199A106-1CC7-4407-BE8C-1308445FA97D}.Debug|ARM32.ActiveCfg = Debug|ARM32
|
||||
{0199A106-1CC7-4407-BE8C-1308445FA97D}.Debug|ARM32.Build.0 = Debug|ARM32
|
||||
{0199A106-1CC7-4407-BE8C-1308445FA97D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0199A106-1CC7-4407-BE8C-1308445FA97D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0199A106-1CC7-4407-BE8C-1308445FA97D}.Release|ARM32.ActiveCfg = Release|ARM32
|
||||
{0199A106-1CC7-4407-BE8C-1308445FA97D}.Release|ARM32.Build.0 = Release|ARM32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>AnyCPU;ARM32</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -6,10 +6,14 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace ConsoleApp1
|
||||
{
|
||||
internal interface ISystem
|
||||
public interface ISystem
|
||||
{
|
||||
string Name { get; }
|
||||
string Version { get; }
|
||||
string SN { get; }
|
||||
|
||||
bool Start();
|
||||
void Restart();
|
||||
void Quit();
|
||||
bool Quit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,33 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
Console.WriteLine("Hello, World!");
|
||||
using ConsoleApp1;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
ISystem system1 = new ConsoleApp1.System("YouLikeToBreakYourSystemDontYa? Linux", "v1.0.0", "SN123");
|
||||
|
||||
Program.SystemTest(system1);
|
||||
}
|
||||
|
||||
static void SystemTest(ISystem sys)
|
||||
{
|
||||
Program.Advertise(sys);
|
||||
|
||||
if (sys.Start())
|
||||
{
|
||||
Console.WriteLine("[TEST] System running!");
|
||||
}
|
||||
|
||||
sys.Restart();
|
||||
|
||||
if (sys.Quit())
|
||||
{
|
||||
Console.WriteLine("[TEST] System quit!");
|
||||
}
|
||||
}
|
||||
|
||||
static void Advertise(ISystem sys)
|
||||
{
|
||||
Console.WriteLine($"Behold! The '{sys.Name}' is coming!");
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user