This commit is contained in:
kudzu_cp 2008-05-06 22:44:52 +00:00
parent b8da96730b
commit c8ea6b2608
5 changed files with 3 additions and 143 deletions

View file

@ -84,6 +84,9 @@
<ItemGroup> <ItemGroup>
<None Include="Cosmos.snk" /> <None Include="Cosmos.snk" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Old\Staging\Stages\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View file

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using Cosmos.Kernel.Staging.Stages;
namespace Cosmos.Kernel.Staging {
public class DefaultStageQueue : StageQueue {
public DefaultStageQueue()
: base () {
Enqueue (new Cosmos.Kernel.Staging.Stages.KernelStage ());
}
}
}

View file

@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Cosmos.Kernel.Staging {
/// <summary>
/// Represents a kernel stage.
/// </summary>
public abstract class StageBase {
/// <summary>
/// Gets the name of the stage.
/// </summary>
public abstract string Name {
get;
}
/// <summary>
/// Initializes the stage.
/// </summary>
public abstract void Initialize();
/// <summary>
/// Tears the stage down.
/// </summary>
public abstract void Teardown();
public override string ToString() {
return Name;
}
}
}

View file

@ -1,70 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Cosmos.Kernel.Staging {
/// <summary>
/// Represents a stage queue.
/// </summary>
public class StageQueue {
/// <summary>
/// The list of initialize stages.
/// </summary>
private Queue<StageBase> _initialize = new Queue<StageBase>(16);
/// <summary>
/// The list of teardown stages.
/// </summary>
private Stack<StageBase> _teardown = new Stack<StageBase>(16);
private StageBase _current;
/// <summary>
/// Gets the current kernel stage.
/// </summary>
public StageBase Current {
get {
return _current;
}
}
/// <summary>
/// Enqueues a stage.
/// </summary>
/// <param name="stage"></param>
public void Enqueue(StageBase stage) {
_initialize.Enqueue(stage);
}
/// <summary>
/// Runs the tasks.
/// </summary>
public void Run() {
while (_initialize.Count != 0) {
_current = (StageBase)_initialize.Dequeue();
Console.Write("Entering stage ");
System.Diagnostics.Debugger.Break();
Console.Write(Current.Name);
Console.WriteLine(".");
_current.Initialize();
_teardown.Push(Current);
}
}
/// <summary>
/// Runs the teardown.
/// </summary>
public void Teardown() {
while (_teardown.Count != 0) {
_current = (StageBase)_teardown.Pop();
Console.Write("Leaving stage ");
Console.Write(Current.Name);
Console.WriteLine(".");
_current.Teardown();
}
}
}
}

View file

@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Cosmos.Kernel.Staging.Stages {
public class KernelStage : StageBase {
#region IStage Members
public override string Name {
get {
return "Kernel";
}
}
public override void Initialize() {
System.Console.Clear();
System.Console.BackgroundColor = ConsoleColor.Black;
System.Console.ForegroundColor = ConsoleColor.Red;
System.Console.WriteLine("Cosmos Kernel. Copyright 2007-2008 The Cosmos Project.");
System.Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
System.Console.ForegroundColor = ConsoleColor.White;
}
public override void Teardown() {
}
#endregion
}
}