Esempio n. 1
0
        //Extensions for UAOOI
        internal static ModelDesign.Parameter ExportArgument(this Parameter argument, Action <TraceMessage> traceEvent)
        {
            bool _ValueRankSpecified = false;

            ModelDesign.ValueRank _ValueRank = argument.ValueRank.GetValueRank(x => _ValueRankSpecified = x, traceEvent);
            return(new ModelDesign.Parameter()
            {
                DataType = argument.DataType,
                Description = argument.Descriptions == null || argument.Descriptions.Count == 0 ? null : new ModelDesign.LocalizedText()
                {
                    Key = argument.Descriptions[0].Locale, Value = argument.Descriptions[0].Text
                },
                Identifier = 0,
                IdentifierSpecified = false,
                Name = argument.Name,
                ValueRank = _ValueRank,
            });
        }
Esempio n. 2
0
 /// <summary>
 /// Gets the value rank.
 /// </summary>
 /// <param name="valueRank">The value rank.</param>
 /// <param name="specified">if set to <c>true</c> the parameter is specified.</param>
 /// <param name="traceEvent">An <see cref="Action"/> delegate is used to trace event as the <see cref="TraceMessage"/>.</param>
 /// <returns>Returns value of <see cref="ModelDesign.ValueRank" />.</returns>
 internal static ModelDesign.ValueRank GetValueRank(this int?valueRank, Action <bool> specified, Action <TraceMessage> traceEvent)
 {
     ModelDesign.ValueRank _vr = ModelDesign.ValueRank.Scalar;
     if (!valueRank.HasValue)
     {
         specified(false);
         return(_vr);
     }
     specified(true);
     if (valueRank < -2)
     {
         traceEvent(TraceMessage.BuildErrorTraceMessage(BuildError.WrongValueRank, String.Format("The value {0} is not supported", valueRank)));
     }
     else if (valueRank == -3)
     {
         traceEvent(TraceMessage.BuildErrorTraceMessage(BuildError.WrongValueRank, String.Format("The value {0} is not supported", valueRank)));
     }
     //_vr = ModelDesign.ValueRank.ScalarOrOneDimension;
     else if (valueRank == -2)
     {
         _vr = ModelDesign.ValueRank.ScalarOrArray;
     }
     else if (valueRank == -1)
     {
         _vr = ModelDesign.ValueRank.Scalar;
         specified(false);
     }
     else if (valueRank == 0)
     {
         _vr = ModelDesign.ValueRank.OneOrMoreDimensions;
     }
     else if (valueRank == 1)
     {
         _vr = ModelDesign.ValueRank.Array;
     }
     else
     {
         _vr = ModelDesign.ValueRank.OneOrMoreDimensions;
     }
     return(_vr);
 }