Beispiel #1
0
        public ConstantTypeSet(IEnumerable <DynamicEnumerationData> dynamicEnumerations, IEnumerable <LocalDynamicEnumerationData> localDynamicEnumerations, IEnumerable <EnumerationData> enumerations, IEnumerable <DecimalData> decimals, IEnumerable <IntegerData> integers, IEnumerable <LocalizedStringData> localizedStrings, IEnumerable <Tuple <ParameterType, string, ParameterGenerator> > others)
        {
            foreach (var other in others)
            {
                m_types.Add(other.Item1, new TypeData(other.Item3, other.Item2));
            }

            //Types must be generated before Nodes and can be generated before NodeTypes
            foreach (var td in dynamicEnumerations)
            {
                var typeData = td;
                m_dynamicEnums.Add(typeData.TypeId, typeData);
                m_types.Add(typeData.TypeId, new TypeData((a, b, c, document) => typeData.Make(a, b, c, GetDynamicEnumSource(typeData.TypeId)), typeData.Name));
            }

            foreach (var td in localDynamicEnumerations)
            {
                var typeData = td;
                m_localDynamicEnums.Add(typeData.TypeId, typeData);
                m_types.Add(typeData.TypeId, new TypeData((name, id, defaultValue, document) => typeData.Make(name, id, defaultValue, GetLocalDynamicEnumSource(typeData.TypeId, document)), typeData.Name));
            }

            foreach (var td in enumerations)
            {
                var typeData = td;
                var enumType = typeData.TypeId;
                var setType  = ParameterType.ValueSetType.Of(enumType);

                var elements = typeData.Elements.Select(e => Tuple.Create(e.Guid, e.Name));
                ImmutableEnumeration enumeration = new ImmutableEnumeration(elements, enumType, "");
                m_enums.Add(enumType, Tuple.Create(typeData.Name, enumeration));
                m_types.Add(enumType, new TypeData((a, b, c, d) => m_enums[enumType].Item2.ParameterEnum(a, b, c), typeData.Name));
                m_types.Add(setType, new TypeData((a, b, c, d) => m_enums[enumType].Item2.ParameterSet(a, b, c), "Set of " + typeData.Name));
            }

            foreach (var td in decimals)
            {
                var typeData = td;
                m_decimals.Add(typeData.TypeId, typeData);
                m_types.Add(typeData.TypeId, new TypeData((name, id, defaultValue, document) => new DecimalParameter(name, id, typeData.TypeId, m_decimals[typeData.TypeId].Definition(), defaultValue), typeData.Name));
            }

            foreach (var td in integers)
            {
                var typeData = td;
                m_integers.Add(typeData.TypeId, typeData);
                m_types.Add(typeData.TypeId, new TypeData((name, id, defaultValue, document) => new IntegerParameter(name, id, typeData.TypeId, m_integers[typeData.TypeId].Definition(), defaultValue), typeData.Name));
            }

            foreach (var td in localizedStrings)
            {
                var typeData = td;
                m_localizedStrings.Add(typeData.TypeId, typeData);
                m_types.Add(typeData.TypeId, new TypeData((name, id, defaultValue, document) => new LocalizedStringParameter(name, id, typeData.TypeId), typeData.Name));
            }
        }
Beispiel #2
0
        public static EnumParameter MakeParameter()
        {
            IEnumeration enumeration = new ImmutableEnumeration(new[] { Top.Tuple, Bottom.Tuple, Left.Tuple, Right.Tuple }, EnumId, Bottom.m_guid);

            return(new EnumParameter("Position", ParameterId, enumeration, null));
        }