2019-06-03 14:57:05 +00:00
|
|
|
using System;
|
|
|
|
using System.Reflection;
|
|
|
|
using System.Linq;
|
2019-07-05 21:37:10 +00:00
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using Aurora.Models;
|
2019-06-03 14:57:05 +00:00
|
|
|
|
2019-07-05 18:17:09 +00:00
|
|
|
namespace Aurora.Executors
|
2019-06-03 14:57:05 +00:00
|
|
|
{
|
|
|
|
public abstract class BaseExecutor
|
|
|
|
{
|
2019-07-05 15:37:44 +00:00
|
|
|
protected BaseExecutor()
|
2019-06-03 14:57:05 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-07-05 15:37:44 +00:00
|
|
|
public Type ExecutorType { get; protected set; }
|
2019-06-26 01:17:52 +00:00
|
|
|
|
2019-07-05 21:37:10 +00:00
|
|
|
public abstract ObservableCollection<PartyMember> PartyMembers { get; }
|
|
|
|
|
2019-07-05 15:37:44 +00:00
|
|
|
public static BaseExecutor CreateExecutor<T>()
|
2019-06-03 14:57:05 +00:00
|
|
|
{
|
2019-07-05 15:37:44 +00:00
|
|
|
|
|
|
|
BaseExecutor executor = null;
|
|
|
|
if (typeof(T) == typeof(HostExecutor))
|
|
|
|
{
|
|
|
|
executor = new HostExecutor();
|
|
|
|
executor.ExecutorType = typeof(HostExecutor);
|
|
|
|
}
|
|
|
|
else if (typeof(T) == typeof(ClientExecutor))
|
2019-06-03 14:57:05 +00:00
|
|
|
{
|
2019-07-05 15:37:44 +00:00
|
|
|
executor = new ClientExecutor();
|
|
|
|
executor.ExecutorType = typeof(ClientExecutor);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
throw new InvalidOperationException("Cannot create an executor of type: " + nameof(T));
|
2019-06-03 14:57:05 +00:00
|
|
|
}
|
|
|
|
|
2019-07-05 15:37:44 +00:00
|
|
|
return executor;
|
2019-06-03 14:57:05 +00:00
|
|
|
}
|
2019-07-05 15:37:44 +00:00
|
|
|
|
|
|
|
public abstract void Initialize();
|
|
|
|
|
|
|
|
public abstract void Run();
|
|
|
|
|
|
|
|
public abstract void Close();
|
|
|
|
|
2019-07-05 21:37:10 +00:00
|
|
|
public abstract ObservableCollection<PartyMember> GetMembers();
|
2019-07-05 15:37:44 +00:00
|
|
|
|
|
|
|
public abstract void GetQueue();
|
|
|
|
|
|
|
|
public abstract void AddToQueue();
|
|
|
|
|
|
|
|
public abstract void RemoveFromQueue();
|
2019-06-03 14:57:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public enum ExecutorType
|
|
|
|
{
|
|
|
|
Server,
|
|
|
|
Client
|
|
|
|
}
|
|
|
|
}
|