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/Executors/BaseExecutor.cs
2019-07-05 17:37:10 -04:00

61 lines
1.4 KiB
C#

using System;
using System.Reflection;
using System.Linq;
using System.Collections.ObjectModel;
using Aurora.Models;
namespace Aurora.Executors
{
public abstract class BaseExecutor
{
protected BaseExecutor()
{
}
public Type ExecutorType { get; protected set; }
public abstract ObservableCollection<PartyMember> PartyMembers { get; }
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 ObservableCollection<PartyMember> GetMembers();
public abstract void GetQueue();
public abstract void AddToQueue();
public abstract void RemoveFromQueue();
}
public enum ExecutorType
{
Server,
Client
}
}