mirror of
https://github.com/tonytins/tomas.git
synced 2025-06-25 18:14:42 -04:00
Switched to BSD 3-Cluase license
- Use global usings in main kernal project
This commit is contained in:
parent
7c16857c9a
commit
7b47f7afd8
17 changed files with 217 additions and 819 deletions
|
@ -1,42 +1,42 @@
|
|||
// I license this project under the GPL 3.0 license.
|
||||
// I license this project under the BSD 3-Clause license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
using System;
|
||||
|
||||
namespace Tomas.Terminal
|
||||
{
|
||||
class Program
|
||||
class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
var shell = new Shell();
|
||||
var command = shell.ReadLine;
|
||||
var programs = shell.Programs;
|
||||
|
||||
if (!programs.TryGetValue(command, out var program))
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
var shell = new Shell();
|
||||
var command = shell.ReadLine;
|
||||
var programs = shell.Programs;
|
||||
|
||||
if (!programs.TryGetValue(command, out var program))
|
||||
{
|
||||
Console.WriteLine("Command Not Found.");
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var start = program.Run(shell);
|
||||
switch (start)
|
||||
{
|
||||
case true:
|
||||
continue;
|
||||
case false:
|
||||
Console.WriteLine("Program closed unexpectedly.");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Console.WriteLine(err.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine("Command Not Found.");
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var start = program.Run(shell);
|
||||
switch (start)
|
||||
{
|
||||
case true:
|
||||
continue;
|
||||
case false:
|
||||
Console.WriteLine("Program closed unexpectedly.");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Console.WriteLine(err.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// I license this project under the GPL 3.0 license.
|
||||
// I license this project under the BSD 3-Clause license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
using System;
|
||||
using Tomas.Common;
|
||||
|
@ -6,13 +6,13 @@ using Tomas.Interface;
|
|||
|
||||
namespace Tomas.Terminal.Programs
|
||||
{
|
||||
public class About : IProgram
|
||||
{
|
||||
public bool Run(IShell shell)
|
||||
{
|
||||
Console.WriteLine($"{ComConsts.NAME} Terminal Emulator v{ComConsts.VersionGit}{Environment.NewLine}"
|
||||
+ "TOMAS (Tony's Managed Operating System) is a operating system written in C# using the COSMOS framework.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public class About : IProgram
|
||||
{
|
||||
public bool Run(IShell shell)
|
||||
{
|
||||
Console.WriteLine($"{ComConsts.NAME} Terminal Emulator v{ComConsts.VersionGit}{Environment.NewLine}"
|
||||
+ "TOMAS (Tony's Managed Operating System) is a operating system written in C# using the COSMOS framework.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// I license this project under the GPL 3.0 license.
|
||||
// I license this project under the BSD 3-Clause license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -8,11 +8,11 @@ using Tomas.Terminal.Programs;
|
|||
|
||||
namespace Tomas.Terminal
|
||||
{
|
||||
public class Shell : IShell
|
||||
{
|
||||
const char SYMBOL = '$';
|
||||
public class Shell : IShell
|
||||
{
|
||||
const char SYMBOL = '$';
|
||||
|
||||
public Dictionary<string, IProgram> Programs => new Dictionary<string, IProgram>()
|
||||
public Dictionary<string, IProgram> Programs => new Dictionary<string, IProgram>()
|
||||
{
|
||||
{"about", new About()},
|
||||
{"fensay", new FenSay()},
|
||||
|
@ -20,14 +20,14 @@ namespace Tomas.Terminal
|
|||
{"commands", new Commands()}
|
||||
};
|
||||
|
||||
public string ReadLine
|
||||
{
|
||||
get
|
||||
{
|
||||
Console.Write(SYMBOL);
|
||||
var readl = Console.ReadLine();
|
||||
return readl;
|
||||
}
|
||||
}
|
||||
}
|
||||
public string ReadLine
|
||||
{
|
||||
get
|
||||
{
|
||||
Console.Write(SYMBOL);
|
||||
var readl = Console.ReadLine();
|
||||
return readl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue