Пример #1
0
            t_field_type_2 ITypeConverter <t_field_type_2> .ConvertFrom_t_field_type_display(t_field_type value)
            {
                META_VAR("TypeConversionAction", "conversion_action", "$t_field_type_2->get_type_conversion_action($t_field_type)");
                IF("%conversion_action == TypeConversionAction::TC_ASSIGN");
                return((t_field_type_2)value);

                ELIF("%conversion_action == TypeConversionAction::TC_TOSTRING");
                return(Serializer.ToString(value));

                ELIF("%conversion_action == TypeConversionAction::TC_PARSESTRING");
                {
                    #region String parse
                    t_field_type_2 intermediate_result;
                    bool           conversion_success;
                    IF("data_type_need_external_parser($t_field_type_2)");
                    {
                        conversion_success = ExternalParser.TryParse_t_field_type_2_display(value, out intermediate_result);
                    }
                    ELSE();
                    {
                        conversion_success = t_field_type_2.TryParse(value, out intermediate_result);
                    }
                    END();
                    if (!conversion_success)
                    {
                        IF("$t_field_type_2->is_list()");
                        try
                        {
                            t_field_type_2_element_type element = TypeConverter <t_field_type_2_element_type> .ConvertFrom_t_field_type_display(value);

                            intermediate_result = new t_field_type_2();
                            intermediate_result.Add(element);
                        }
                        catch
                        {
                            throw new ArgumentException("Cannot parse \"" + value + "\" into either 't_field_type_2' or 't_field_type_2_element_type'.");
                        }
                        ELSE();
                        Throw.cannot_parse(value, "t_field_type_2");
                        END();
                    }
                    return(intermediate_result);

                    #endregion
                }
                ELIF("%conversion_action == TypeConversionAction::TC_TOBOOL");
                return(value != 0);

                ELIF("%conversion_action == TypeConversionAction::TC_CONVERTLIST");
                {
                    t_field_type_2 intermediate_result = new t_field_type_2();
                    foreach (var element in value)
                    {
                        intermediate_result.Add(TypeConverter <t_field_type_2_element_type> .ConvertFrom_t_field_type_element_type_display(element));
                    }
                    return(intermediate_result);
                }
                ELIF("%conversion_action == TypeConversionAction::TC_WRAPINLIST");
                {
                    t_field_type_2 intermediate_result = new t_field_type_2();
                    intermediate_result.Add(TypeConverter <t_field_type_2_element_type> .ConvertFrom_t_field_type_display(value));
                    return(intermediate_result);
                }
                ELIF("%conversion_action == TypeConversionAction::TC_ARRAYTOLIST");
                return(TypeConverter <t_field_type> .Enumerate_t_field_type_2_element_type_display(value).ToList());

                ELIF("%conversion_action == TypeConversionAction::TC_EXTRACTNULLABLE");
                return(TypeConverter <t_field_type_2> .ConvertFrom_t_field_type_remove_nullable(value.Value));

                ELSE();
                throw new InvalidCastException("Invalid cast from '[META_OUTPUT($t_field_type)]' to '[META_OUTPUT($t_field_type_2)]'.");
                END();
            }
 internal static bool TryParse_t_field_type_2_element_type_display(t_field_type_list_element_type element, out t_field_type_2_element_type intermediate_result)
 {
     throw new NotImplementedException();
 }
 internal static unsafe bool TryParse(Trinity.TSL.t_field_type value, out t_field_type_2_element_type intermediate_result)
 {
     throw new NotImplementedException();
 }