Skip to content

Commit

Permalink
Restrict possible driver values
Browse files Browse the repository at this point in the history
  • Loading branch information
bparks13 committed Aug 26, 2024
1 parent 67f250d commit 07e0753
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions OpenEphys.Onix1/ContextDriverConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.ComponentModel;

namespace OpenEphys.Onix1
{
internal class ContextDriverConverter : StringConverter
{
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}

public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return true;
}

public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(new[]
{
"riffa"
});
}
}
}
1 change: 1 addition & 0 deletions OpenEphys.Onix1/CreateContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class CreateContext
/// </summary>
[Description("Specifies the device driver used to communicate with hardware.")]
[Category(DeviceFactory.ConfigurationCategory)]
[TypeConverter(typeof(ContextDriverConverter))]
public string Driver { get; set; } = ContextTask.DefaultDriver;

/// <summary>
Expand Down

0 comments on commit 07e0753

Please sign in to comment.