This repository has been archived on 2020-12-20. You can view files and clone it, but cannot push or open issues or pull requests.
aurora-sharp-desktop/Aurora/Backend/Executors/BaseExecutor.cs

57 lines
1.3 KiB
C#

using System;
using System.Reflection;
using System.Linq;
namespace Aurora.Backend.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
}
}