Some more narrowing down of bug..

This commit is contained in:
mterwoord_cp 2008-01-03 11:19:38 +00:00
parent ac36e87438
commit 2d900cbfeb
2 changed files with 51 additions and 50 deletions

View file

@ -21,9 +21,10 @@ namespace Cosmos.Shell.Console {
System.Console.ForegroundColor = ConsoleColor.White;
stages.Run();
System.Console.WriteLine("Success.");
System.Console.Write("Testing Prompter now:");
new Prompter();
System.Console.WriteLine("Hello World!!!");
//while (true) ;
while (true) ;
stages.Teardown();

View file

@ -14,65 +14,65 @@ namespace Cosmos.Shell.Console {
}
}
private List<Commands.CommandBase> _commands;
//private List<Commands.CommandBase> _commands;
private bool running = true;
//private bool running = true;
public void Stop()
{
running = false;
//running = false;
}
public override void Initialize() {
_commands = new List<Cosmos.Shell.Console.Commands.CommandBase>();
_commands.Add(new Commands.ClsCommand());
_commands.Add(new Commands.DirCommand());
_commands.Add(new Commands.EchoCommand());
//_commands.Add(new Commands.ExitCommand(Stop)); // TODO: Fix this.
_commands.Add(new Commands.HelpCommand(_commands));
_commands.Add(new Commands.TypeCommand());
_commands.Add(new Commands.MatthijsCommand());
//_commands = new List<Cosmos.Shell.Console.Commands.CommandBase>();
//_commands.Add(new Commands.ClsCommand());
//_commands.Add(new Commands.DirCommand());
//_commands.Add(new Commands.EchoCommand());
////_commands.Add(new Commands.ExitCommand(Stop)); // TODO: Fix this.
//_commands.Add(new Commands.HelpCommand(_commands));
//_commands.Add(new Commands.TypeCommand());
//_commands.Add(new Commands.MatthijsCommand());
while (running)
{
System.Console.Write("/> ");
string line = System.Console.ReadLine();
int index = line.IndexOf(' ');
string command;
string param;
if (index == -1)
{
command = line;
param = "";
}
else
{
command = line.Substring(0, index);
param = line.Substring(index + 1);
}
//while (running)
//{
// System.Console.Write("/> ");
// string line = System.Console.ReadLine();
// int index = line.IndexOf(' ');
// string command;
// string param;
// if (index == -1)
// {
// command = line;
// param = "";
// }
// else
// {
// command = line.Substring(0, index);
// param = line.Substring(index + 1);
// }
bool found = false;
for (int i = 0; i < _commands.Count; i++)
{
if (_commands[i].Name.CompareTo(command) == 0)
{
found = true;
_commands[i].Execute(param);
break;
}
}
// bool found = false;
// for (int i = 0; i < _commands.Count; i++)
// {
// if (_commands[i].Name.CompareTo(command) == 0)
// {
// found = true;
// _commands[i].Execute(param);
// break;
// }
// }
if (!found)
{
System.Console.ForegroundColor = ConsoleColor.Red;
System.Console.Write("The command ");
System.Console.Write(command);
System.Console.WriteLine(" is not supported. Please type help for more information.");
System.Console.ForegroundColor = ConsoleColor.White;
System.Console.WriteLine();
}
}
// if (!found)
// {
// System.Console.ForegroundColor = ConsoleColor.Red;
// System.Console.Write("The command ");
// System.Console.Write(command);
// System.Console.WriteLine(" is not supported. Please type help for more information.");
// System.Console.ForegroundColor = ConsoleColor.White;
// System.Console.WriteLine();
// }
//}
}
public override void Teardown()