Reorganization
This commit is contained in:
57
Aurora/Executors/BaseExecutor.cs
Normal file
57
Aurora/Executors/BaseExecutor.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
|
||||
namespace Aurora.Executors
|
||||
{
|
||||
public abstract class BaseExecutor
|
||||
{
|
||||
protected BaseExecutor()
|
||||
{
|
||||
}
|
||||
|
||||
public Type ExecutorType { get; protected set; }
|
||||
|
||||
public static BaseExecutor CreateExecutor<T>()
|
||||
{
|
||||
|
||||
BaseExecutor executor = null;
|
||||
if (typeof(T) == typeof(HostExecutor))
|
||||
{
|
||||
executor = new HostExecutor();
|
||||
executor.ExecutorType = typeof(HostExecutor);
|
||||
}
|
||||
else if (typeof(T) == typeof(ClientExecutor))
|
||||
{
|
||||
executor = new ClientExecutor();
|
||||
executor.ExecutorType = typeof(ClientExecutor);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("Cannot create an executor of type: " + nameof(T));
|
||||
}
|
||||
|
||||
return executor;
|
||||
}
|
||||
|
||||
public abstract void Initialize();
|
||||
|
||||
public abstract void Run();
|
||||
|
||||
public abstract void Close();
|
||||
|
||||
public abstract void GetMembers();
|
||||
|
||||
public abstract void GetQueue();
|
||||
|
||||
public abstract void AddToQueue();
|
||||
|
||||
public abstract void RemoveFromQueue();
|
||||
}
|
||||
|
||||
public enum ExecutorType
|
||||
{
|
||||
Server,
|
||||
Client
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user