Example #1
0
        public static IEnumOut CreateEnumOutput(this IPluginHost host, OutputAttribute attribute, Type type)
        {
            if (!typeof(EnumEntry).IsAssignableFrom(type))
            {
                var entries  = Enum.GetNames(type);
                var defEntry = !string.IsNullOrEmpty(attribute.DefaultEnumEntry) ? attribute.DefaultEnumEntry : entries[0];
                host.UpdateEnum(type.FullName, defEntry, entries);
            }

            IEnumOut result = null;

            host.CreateEnumOutput(attribute.Name, (TSliceMode)attribute.SliceMode, (TPinVisibility)attribute.Visibility, out result);
            if (!typeof(EnumEntry).IsAssignableFrom(type))
            {
                result.SetSubType(type.FullName);
            }
            else
            {
                result.SetSubType(attribute.EnumName);
            }
            result.Order = attribute.Order;
            return(result);
        }
Example #2
0
        public static IEnumOut CreateEnumOutput(this IPluginHost host, OutputAttribute attribute, Type type)
        {
            //this creates and sets the default for a .NET enum
            if (!typeof(EnumEntry).IsAssignableFrom(type))
            {
                var entries = Enum.GetNames(type);
                host.UpdateEnum(type.FullName, entries[0], entries);
            }

            IEnumOut result = null;

            host.CreateEnumOutput(attribute.Name, (TSliceMode)attribute.SliceMode, (TPinVisibility)attribute.Visibility, out result);
            if (!typeof(EnumEntry).IsAssignableFrom(type))
            {
                result.SetSubType(type.FullName);
            }
            else
            {
                result.SetSubType(attribute.EnumName);
            }

            SetOutputProperties(result, attribute);
            return(result);
        }