Beginning stages for party executors
This commit is contained in:
38
Aurora/Backend/Executors/BaseExecutor.cs
Normal file
38
Aurora/Backend/Executors/BaseExecutor.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
|
||||
namespace Aurora.Backend.Executors
|
||||
{
|
||||
public abstract class BaseExecutor
|
||||
{
|
||||
public BaseExecutor()
|
||||
{
|
||||
}
|
||||
|
||||
public static BaseExecutor CreateExecutor<T>(ExecutorType executorType) where T : BaseExecutor
|
||||
{
|
||||
MethodInfo method = typeof(T).GetMethod("Create");
|
||||
if (method == null)
|
||||
{
|
||||
throw new InvalidOperationException("Executor must include a 'create' method.");
|
||||
}
|
||||
|
||||
return method.Invoke(null, new object[] { executorType }) as BaseExecutor;
|
||||
|
||||
// var types = typeof(T).Assembly.GetTypes();
|
||||
|
||||
// foreach (Type type in types)
|
||||
// {
|
||||
// MethodInfo genericMethod = method.MakeGenericMethod(type);
|
||||
// genericMethod.Invoke(null, null); // No target, no arguments
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
public enum ExecutorType
|
||||
{
|
||||
Server,
|
||||
Client
|
||||
}
|
||||
}
|
58
Aurora/Backend/Executors/BasePartyExecutor.cs
Normal file
58
Aurora/Backend/Executors/BasePartyExecutor.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using Aurora.Backend.Server.Party;
|
||||
using Aurora.Backend.Client.Party;
|
||||
|
||||
namespace Aurora.Backend.Executors
|
||||
{
|
||||
public abstract class BasePartyExecutor : BaseExecutor
|
||||
{
|
||||
public BasePartyExecutor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static BasePartyExecutor Create(ExecutorType type)
|
||||
{
|
||||
BasePartyExecutor executor = null;
|
||||
switch (type)
|
||||
{
|
||||
case ExecutorType.Client:
|
||||
{
|
||||
executor = new ClientPartyExecutor();
|
||||
break;
|
||||
}
|
||||
case ExecutorType.Server:
|
||||
{
|
||||
executor = new HostPartyExecutor();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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 abstract void Play();
|
||||
|
||||
public abstract void Pause();
|
||||
|
||||
public abstract void Stop();
|
||||
|
||||
public abstract void Next();
|
||||
|
||||
public abstract void Previous();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user