From a00c2afaaf7e149a4d7b92e507c50e18c416316e Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Tue, 24 Nov 2015 16:47:10 +0100 Subject: [PATCH] Closes #15 --- Lawo.EmberPlusSharp/Model/IParameter.cs | 2 ++ Lawo.EmberPlusSharp/Model/ParameterBase.cs | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Lawo.EmberPlusSharp/Model/IParameter.cs b/Lawo.EmberPlusSharp/Model/IParameter.cs index 2a4291a4..712da28c 100644 --- a/Lawo.EmberPlusSharp/Model/IParameter.cs +++ b/Lawo.EmberPlusSharp/Model/IParameter.cs @@ -48,6 +48,8 @@ public interface IParameter : IElementWithSchemas object DefaultValue { get; } /// Gets type. + /// The type is not available. This can only happen for a parameter + /// where equals false. ParameterType Type { get; } /// Gets streamIdentifier (not yet supported). diff --git a/Lawo.EmberPlusSharp/Model/ParameterBase.cs b/Lawo.EmberPlusSharp/Model/ParameterBase.cs index 744b3384..6c0af205 100644 --- a/Lawo.EmberPlusSharp/Model/ParameterBase.cs +++ b/Lawo.EmberPlusSharp/Model/ParameterBase.cs @@ -375,14 +375,19 @@ private void SetFinalTytpe(ParameterType? valueType, ParameterType? enumType, Pa var finalType = this.type ?? (typeType == ParameterType.Trigger ? typeType : null) ?? enumType ?? valueType ?? typeType; - if (!finalType.HasValue) + if (finalType.HasValue) { - const string Format = - "No enumeration, enumMap, value or type field is available for the parameter with the path {0}."; - throw new ModelException(string.Format(CultureInfo.InvariantCulture, Format, this.GetPath())); + this.Type = finalType.Value; + } + else + { + if (this.IsOnline) + { + const string Format = + "No enumeration, enumMap, value or type field is available for the parameter with the path {0}."; + throw new ModelException(string.Format(CultureInfo.InvariantCulture, Format, this.GetPath())); + } } - - this.Type = finalType.Value; } private static List> ReadEnumeration(EmberReader reader)