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

58 lines
1.4 KiB
C#
Raw Normal View History

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.Proto.Party;
2019-07-05 18:17:09 +00:00
namespace Aurora.Executors
2019-06-03 14:57:05 +00:00
{
public abstract class BaseExecutor
{
protected BaseExecutor()
2019-06-03 14:57:05 +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; }
public static BaseExecutor CreateExecutor<T>()
2019-06-03 14:57:05 +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
{
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
}
return executor;
2019-06-03 14:57:05 +00:00
}
2019-07-06 19:52:28 +00:00
public abstract void Connect(string hostname);
public abstract void Close();
2019-07-05 21:37:10 +00:00
public abstract ObservableCollection<PartyMember> GetMembers();
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
}
}