skyscraper8/GUIs/skyscraper5.UI/StreamAcquisition/StreamAcquirerListItem.cs
feyris-tan ef86554f9a Import
2025-05-12 22:09:16 +02:00

53 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace skyscraper5.UI.StreamAcquisition
{
internal class StreamAcquirerListItem : ListViewItem
{
public StreamAcquirerListItem(IStreamAcquirer wrapped)
{
Wrapped = wrapped;
WrappedAttribute = (StreamAcquirerAttribute)Wrapped.GetType().GetCustomAttribute(typeof(StreamAcquirerAttribute));
Text = GetName();
SubItems.Add(GetDescription());
}
public IStreamAcquirer Wrapped { get; }
public StreamAcquirerAttribute WrappedAttribute { get; }
public bool Hidden
{
get
{
if (WrappedAttribute == null)
return true;
return WrappedAttribute.Hidden;
}
}
public string GetName()
{
if (WrappedAttribute == null)
return Wrapped.GetType().Name;
return WrappedAttribute.Name;
}
public string GetDescription()
{
if (WrappedAttribute == null)
return "???";
return WrappedAttribute.Description;
}
}
}