mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-10 02:05:08 +00:00
Attempt at modifying device factory mechanism
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the basic needs for an EssentialsDevice to enable it to be build by an IDeviceFactory class
|
||||
/// </summary>
|
||||
public abstract class EssentialsDevice : Device
|
||||
{
|
||||
public EssentialsDevice(string key)
|
||||
: base(key)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public abstract class Factory : IDeviceFactory
|
||||
{
|
||||
#region IDeviceFactory Members
|
||||
|
||||
public List<string> TypeNames { get; protected set; }
|
||||
|
||||
public virtual void LoadTypeFactories()
|
||||
{
|
||||
foreach (var typeName in TypeNames)
|
||||
{
|
||||
DeviceFactory.AddFactoryForType(typeName, BuildDevice);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public abstract IKeyed BuildDevice(DeviceConfig dc);
|
||||
|
||||
public Factory()
|
||||
{
|
||||
TypeNames = new List<string>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user