HamBook – Rev 46
?pathlinks?
using Org.BouncyCastle.Crypto.Tls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace HamBook.Radios.Generic
{
[XmlRoot(Namespace = "Generic")]
[XmlInclude(typeof(Radios.Yaesu.FT_891.MemoryRadioMode))]
public abstract class MemoryRadioMode
{
[XmlIgnore]
public abstract char Code { get; set; }
[XmlIgnore]
public abstract string Name { get; set; }
public MemoryRadioMode()
{
}
public abstract string CodeToName(char code);
public abstract char NameToCode(string name);
public static MemoryRadioMode Create(string radio, params object[] param)
{
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
foreach (var type in assembly.GetTypes())
{
if (typeof(MemoryRadioMode).IsAssignableFrom(type))
{
var radioAttribute = type.GetCustomAttribute<RadioAttribute>();
if (radioAttribute != null && radioAttribute.Radio == radio)
{
return (MemoryRadioMode)Activator.CreateInstance(type, param);
}
}
}
}
return null;
}
}
}