Example #1
0
 private void CreateMethod(Type aType, Classifier aCls, MethodBase aMethod, PdOOM.BasePackage aPckg, Operation anOper, InfluenceTable anInfTable)
 {
     Operation operation;
     if (anOper != null)
     {
         operation = anOper;
     }
     else
     {
         operation = (Operation) aCls.CreateObject(0x18112066, "", -1, true);
     }
     operation.Static = aMethod.IsStatic;
     operation.Visibility = GetMethodVisibility(aMethod);
     operation.Final = aMethod.IsFinal;
     if (aMethod.IsGenericMethod)
     {
         operation.Generic = true;
         foreach (TypeParameter parameter in operation.TypeParameters)
         {
             parameter.delete();
         }
         foreach (Type type in aMethod.GetGenericArguments())
         {
             TypeParameter parameter2 = (TypeParameter) operation.CreateObject(0x1811207d, "", -1, true);
             this.ProcessType(type, false);
             TypeMapping mapping = TypeMapping.Retrieve(type);
             parameter2.Name = parameter2.Code = mapping.Name;
             operation.TypeParameters.Add(parameter2);
         }
     }
     if (aMethod.IsVirtual)
     {
         if (LZ.Reverse.Info._bVBNet)
         {
             operation.SetExtendedAttribute("VB.NET.Overridable", "true");
         }
         else
         {
             operation.SetExtendedAttribute("C#.virtual", "true");
         }
     }
     if (aMethod.IsAbstract)
     {
         operation.Abstract = true;
     }
     new CustomHandlerMethod(aMethod, operation).Convert();
     if (anOper == null)
     {
         foreach (ParameterInfo info in aMethod.GetParameters())
         {
             this.AddParameter(operation, info, aPckg);
         }
     }
     bool flag = aMethod.IsConstructor || aMethod.GetType().IsSubclassOf(typeof(ConstructorInfo));
     if (!flag)
     {
         MethodInfo info2 = (MethodInfo) aMethod;
         Type returnType = info2.ReturnType;
         if (returnType.IsArray)
         {
             operation.Array = true;
             returnType = returnType.GetElementType();
         }
         this.ProcessType(returnType, false);
         TypeMapping mapping2 = TypeMapping.Retrieve(returnType);
         if (mapping2.HasClassifier())
         {
             PdOOM.BaseObject obj2 = ProperRef.Link(NamespaceMapping.Retrieve(aPckg), mapping2);
             operation.UseQualifiedDataType = false;
             operation.ReturnTypeObject = obj2;
         }
         else
         {
             operation.ReturnType = mapping2.Name;
         }
         if ((anInfTable != null) && anInfTable.Contains(info2))
         {
             anInfTable.Impact(info2, operation);
         }
         if (LZ.Reverse.Info._bVBNet)
         {
             new CustomHandlerReturn(info2, anOper).Convert();
         }
         bool flag2 = false;
         if (!info2.IsHideBySig && info2.GetBaseDefinition().Equals(info2))
         {
             string name = info2.Name;
             if (!aType.BaseType.Equals(aType))
             {
                 BindingFlags bindingAttr = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly;
                 bool flag3 = false;
                 foreach (MethodInfo info3 in aType.GetMethods(bindingAttr))
                 {
                     if (info3.Name == name)
                     {
                         flag3 = true;
                         break;
                     }
                 }
                 if (flag3)
                 {
                     flag2 = true;
                 }
             }
         }
         if (info2.GetBaseDefinition().Equals(info2))
         {
             if (flag2)
             {
                 if (LZ.Reverse.Info._bVBNet)
                 {
                     operation.SetExtendedAttribute("VB.NET.Shadowing", "Shadows");
                 }
                 else
                 {
                     operation.SetExtendedAttribute("C#.new", "true");
                 }
             }
             else if (aMethod.IsHideBySig && LZ.Reverse.Info._bVBNet)
             {
                 operation.SetExtendedAttribute("VB.NET.Shadowing", "Overloads");
             }
         }
         else if (LZ.Reverse.Info._bVBNet)
         {
             operation.SetExtendedAttribute("VB.NET.Overrides", "true");
         }
         else
         {
             operation.SetExtendedAttribute("C#.override", "true");
         }
     }
     if (flag)
     {
         operation.Stereotype = "Constructor";
         operation.ReturnType = "";
         operation.InfluentObject = aCls;
         operation.Automatic = true;
         try
         {
             if (LZ.Reverse.Info._bVBNet)
             {
                 operation.Name = operation.Code = "New";
             }
             else
             {
                 operation.Name = operation.Code = TypeInfoHelper.GetTypeName(aType);
             }
             return;
         }
         catch (COMException)
         {
             if (LZ.Reverse.Info._bDebug)
             {
                 LZ.Reverse.Info.Write(new string[] { "*** exception while naming the operation \"{1}\" on the type \"{0}\"", aType.FullName, aMethod.Name });
             }
             return;
         }
     }
     if (anOper == null)
     {
         string aName = aMethod.Name;
         if (!LZ.Reverse.Info._bVBNet && ShortenOperator(aMethod.GetParameters().Length, ref aName))
         {
             operation.Stereotype = "Operator";
         }
         try
         {
             operation.Name = operation.Code = aName;
         }
         catch (COMException)
         {
             if (LZ.Reverse.Info._bDebug)
             {
                 LZ.Reverse.Info.Write(new string[] { "*** exception while naming the operation \"{1}\" on the type \"{0}\"", aType.FullName, aMethod.Name });
             }
         }
     }
 }
 public CustomHandlerField(FieldInfo aField, PdOOM.Attribute anAttr) : base(aField.GetCustomAttributes(false), aField.DeclaringType + "." + aField.Name, anAttr)
 {
     this._through = false;
     base.ProcessAttrs();
 }
Example #3
0
 private void CreateEvent(Type aType, Classifier aCls, EventInfo anEvent, PdOOM.BasePackage aPckg, ref AttributeTable aAttrTable, ref MethodTable aMthTable, ref InfluenceTable aInfTable)
 {
     if (!LZ.Reverse.Info._bVBNet)
     {
         bool flag;
         bool flag2;
         if (aType.GetField(anEvent.Name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly) != null)
         {
             flag = false;
             flag2 = false;
         }
         else
         {
             flag = true;
             flag2 = true;
         }
         if (flag)
         {
             PdOOM.Attribute anObject = (PdOOM.Attribute) aCls.CreateObject(0x18112065, "", -1, true);
             anObject.Stereotype = "Event";
             try
             {
                 anObject.Name = anObject.Code = anEvent.Name;
             }
             catch (COMException)
             {
                 if (LZ.Reverse.Info._bDebug)
                 {
                     LZ.Reverse.Info.Write(new string[] { "*** exception while naming the event \"{1}\" on the type \"{0}\"", aType.FullName, anEvent.Name });
                 }
             }
             Type eventHandlerType = anEvent.EventHandlerType;
             this.ProcessType(eventHandlerType, false);
             TypeMapping mapping = TypeMapping.Retrieve(eventHandlerType);
             anObject.DataType = mapping.Name;
             if (!mapping.Delegate && LZ.Reverse.Info._bDebug)
             {
                 LZ.Reverse.Info.Write(new string[] { "*** invalid delegate mapping for \"{0}\"", eventHandlerType.FullName });
             }
             MethodInfo addMethod = anEvent.GetAddMethod(true);
             anObject.Visibility = GetMethodVisibility(addMethod);
             if (flag2)
             {
                 aInfTable.Add(addMethod, anObject, "EventAdd");
                 addMethod = anEvent.GetRemoveMethod(true);
                 aInfTable.Add(addMethod, anObject, "EventRemove");
             }
         }
         if (!flag2)
         {
             MethodInfo aMethod = anEvent.GetAddMethod(true);
             aMthTable.Add(aMethod);
             aMethod = anEvent.GetRemoveMethod(true);
             aMthTable.Add(aMethod);
         }
     }
 }
Example #4
0
 private void CreateGeneralization(PdOOM.BaseObject obj, Type aParentType, PdOOM.BasePackage aPckg)
 {
     this.ProcessType(aParentType, false);
     if (aParentType.IsGenericType && !aParentType.IsGenericTypeDefinition)
     {
         aParentType = aParentType.GetGenericTypeDefinition();
     }
     TypeMapping aType = TypeMapping.Retrieve(aParentType);
     PdOOM.BaseObject obj2 = ProperRef.Link(NamespaceMapping.Retrieve(aPckg), aType);
     Generalization generalization = (Generalization) aPckg.CreateObject(0x18112067, "", -1, true);
     generalization.ParentObject = obj2;
     generalization.ChildObject = obj;
 }
Example #5
0
 private void AddParameter(Operation aMethod, ObjectInfo aParam, PdOOM.BasePackage aPckg)
 {
     Parameter aPrm = (Parameter)aMethod.CreateObject(0x1811206d, "", -1, true);
     string str = "I";    // aParam.IsOut ? "O" : "I";
     ////Type parameterType = aParam.Type;
     ////if (parameterType.IsGenericType && !parameterType.IsGenericTypeDefinition)
     ////{
     ////    parameterType = parameterType.GetGenericTypeDefinition();
     ////}
     ////if (parameterType.IsByRef)
     ////{
     ////    if (str == "I")
     ////    {
     ////        str = "IO";
     ////    }
     ////    parameterType = parameterType.GetElementType();
     ////}
     ////if (parameterType.IsArray)
     ////{
     ////    aPrm.Array = true;
     ////    parameterType = parameterType.GetElementType();
     ////}
     ////this.ProcessType(parameterType, false);
     ////TypeMapping aType = TypeMapping.Retrieve(aParam.Type);
     ////if (aType.HasClassifier())
     ////{
     ////    PdOOM.BaseObject obj2 = ProperRef.Link(NamespaceMapping.Retrieve(aPckg), aParam.Type);
     ////    aPrm.UseQualifiedDataType = false;
     ////    aPrm.DataTypeObject = obj2;
     ////}
     ////else
     {
         aPrm.DataType = aParam.Name;
     }
     aPrm.ParameterType = str;
     aPrm.Name = aPrm.Code = aParam.Name;
     CustomHandlerParam param = new CustomHandlerParam(aParam, aPrm);
     param.Convert();
     if (param.Params)
     {
         aPrm.SetExtendedAttribute("C#.params", "true");
     }
 }
Example #6
0
 private void CreateAttribute(TypeInfo ti, Classifier aCls, AttributeInfo aField, PdOOM.BasePackage aPckg)
 {
     CustomHandlerField field = new CustomHandlerField(aField, null);
     if (!field.ThroughProperty)
     {
         PdOOM.Attribute attribute = (PdOOM.Attribute)aCls.CreateObject(0x18112065, "", -1, true);
         if (aField.IsStatic)
         {
             attribute.Static = true;
         }
         try
         {
             attribute.Name = attribute.Code = aField.Name;
         }
         catch (COMException)
         {
             if (LZ.Reverse.Info._bDebug)
             {
                 LZ.Reverse.Info.Write(new string[] { "*** exception while naming the attribute \"{1}\" on the type \"{0}\"", aField.Code, aField.Name });
             }
         }
         attribute.Visibility = GetTypeVisibility(aField.Modifier);
         //attribute.Persistent = !aField.IsNotSerialized;
         field.PdObj = attribute;
         field.Convert();
         ////Type fieldType = aField.FieldType;
         ////if (fieldType.IsArray)
         ////{
         ////    attribute.Multiplicity = "*";
         ////    fieldType = fieldType.GetElementType();
         ////}
         ////if (fieldType.IsGenericType && !fieldType.IsGenericTypeDefinition)
         ////{
         ////    fieldType = fieldType.GetGenericTypeDefinition();
         ////}
         ////this.ProcessType(fieldType, false);
         ////TypeMapping mapping = TypeMapping.Retrieve(fieldType);
         ////if (mapping.HasClassifier())
         ////{
         ////    PdOOM.BaseObject obj2 = ProperRef.Link(NamespaceMapping.Retrieve(aPckg), mapping);
         ////    attribute.UseQualifiedDataType = false;
         ////    attribute.DataTypeObject = obj2;
         ////}
         ////else
         {
             attribute.DataType = ti.Code;   // mapping.Name;
         }
     }
 }
Example #7
0
 public void Add(MethodInfo aMethod, PdOOM.BaseObject anObject)
 {
     this.Add(aMethod, anObject, null);
 }
Example #8
0
        private void AddParameter(Operation aMethod, ObjectInfo aParam, PdOOM.BasePackage aPckg)
        {
            Parameter aPrm = (Parameter)aMethod.CreateObject(0x1811206d, "", -1, true);
            string str = "I";    // aParam.IsOut ? "O" : "I";
            ////Type parameterType = aParam.Type;
            ////if (parameterType.IsGenericType && !parameterType.IsGenericTypeDefinition)
            ////{
            ////    parameterType = parameterType.GetGenericTypeDefinition();
            ////}
            if (aParam.IsConst)
            {
                aPrm.SetExtendedAttribute("C++.const", "true");
            }
            if (aParam.IsByRef)
            {
                aPrm.SetExtendedAttribute("C++.ref", "true");
            }
            if (!aParam.IsConst && (aParam.IsByRef || aParam.IsPointer))
            {
                str = "IO";
            }
            if (aParam.IsArray)
            {
                aPrm.Array = true;
            }
            aPrm.SetExtendedAttribute("C++.init", aParam.Default);

            TypeInfo tiField = new TypeInfo();
            tiField.Code = tiField.Name = aParam.Type;
            tiField.IsClass = true;
            tiField.Comment = ((PdOOM.NamedObject)aMethod.Parent).Comment;
            this.AddClassifier(tiField, false);
            bool bCreate = true;
            TypeMapping aType = TypeMapping.Retrieve(tiField, ref bCreate);
            if (aType.HasClassifier())
            {
                PdOOM.BaseObject obj2 = ProperRef.Link(NamespaceMapping.Retrieve(aPckg), aType);
                aPrm.UseQualifiedDataType = false;
                aPrm.DataTypeObject = obj2;
            }
            aPrm.ParameterType = str;
            aPrm.DataType = aParam.FullType;
            aPrm.Name = aPrm.Code = aParam.Name;
            CustomHandlerParam param = new CustomHandlerParam(aParam, aPrm);
            param.Convert();
            if (param.Params)
            {
                aPrm.SetExtendedAttribute("C++.params", "true");
            }
        }
Example #9
0
 private void CreateProperty(Type aType, Classifier aCls, PropertyInfo aProperty, PdOOM.BasePackage aPckg, ref MethodTable aTable)
 {
     bool flag = aProperty.GetIndexParameters().GetLength(0) != 0;
     PdOOM.Attribute anAttr = (PdOOM.Attribute) aCls.CreateObject(0x18112065, "", -1, true);
     if (aProperty.CanRead)
     {
         if (aProperty.CanWrite)
         {
             anAttr.Frozen = "C";
         }
         else
         {
             anAttr.Frozen = "R";
         }
     }
     else
     {
         anAttr.Frozen = "A";
     }
     anAttr.Stereotype = LZ.Reverse.Info._bVBNet ? "Property" : (flag ? "Indexer" : "Property");
     Operation anOper = null;
     Operation operation2 = null;
     foreach (PdOOM.BaseObject obj2 in anAttr.DependentObjects)
     {
         if (obj2.ClassKind == 0x18112065)
         {
             obj2.delete();
         }
         else if (obj2.ClassKind == 0x18112066)
         {
             Operation operation3 = (Operation) obj2;
             if (operation3.Stereotype == "Setter")
             {
                 operation2 = operation3;
                 continue;
             }
             if (operation3.Stereotype == "Getter")
             {
                 anOper = operation3;
             }
         }
     }
     if (aProperty.CanRead)
     {
         anAttr.Visibility = GetMethodVisibility(aProperty.GetGetMethod(true));
     }
     else if (aProperty.CanWrite)
     {
         anAttr.Visibility = GetMethodVisibility(aProperty.GetSetMethod(true));
     }
     else
     {
         anAttr.Visibility = "-";
     }
     Type propertyType = aProperty.PropertyType;
     if (propertyType.IsArray)
     {
         anAttr.Multiplicity = "*";
         propertyType = propertyType.GetElementType();
     }
     this.ProcessType(propertyType, false);
     TypeMapping mapping = TypeMapping.Retrieve(propertyType);
     if (mapping.HasClassifier())
     {
         PdOOM.BaseObject obj3 = ProperRef.Link(NamespaceMapping.Retrieve(aPckg), mapping);
         anAttr.UseQualifiedDataType = false;
         anAttr.DataTypeObject = obj3;
     }
     else
     {
         anAttr.DataType = mapping.Name;
     }
     try
     {
         anAttr.Name = anAttr.Code = aProperty.Name;
     }
     catch (COMException)
     {
         if (LZ.Reverse.Info._bDebug)
         {
             LZ.Reverse.Info.Write(new string[] { "*** exception while naming the property \"{1}\" on the type \"{0}\"", aType.FullName, aProperty.Name });
         }
     }
     if (aProperty.CanRead)
     {
         if (anOper != null)
         {
             MethodInfo getMethod = aProperty.GetGetMethod(true);
             aTable.Add(getMethod);
             this.CreateMethod(aType, aCls, getMethod, aPckg, anOper, null);
         }
         else if (LZ.Reverse.Info._bDebug)
         {
             LZ.Reverse.Info.Write(new string[] { "*** exception around the setter for the property \"{1}\" on the type \"{0}\"", aType.FullName, aProperty.Name });
         }
     }
     if (aProperty.CanWrite)
     {
         if (operation2 != null)
         {
             MethodInfo setMethod = aProperty.GetSetMethod(true);
             aTable.Add(setMethod);
             this.CreateMethod(aType, aCls, setMethod, aPckg, operation2, null);
         }
         else if (LZ.Reverse.Info._bDebug)
         {
             LZ.Reverse.Info.Write(new string[] { "*** exception around the setter for the property \"{1}\" on the type \"{0}\"", aType.FullName, aProperty.Name });
         }
     }
     CustomHandlerProperty property = new CustomHandlerProperty(aProperty, anAttr);
     property.Convert();
     if (LZ.Reverse.Info._bVBNet && property.Default)
     {
         anAttr.SetExtendedAttribute("VB.NET.Default", "true");
     }
     bool flag2 = false;
     if (LZ.Reverse.Info._bVBNet)
     {
         bool flag3 = false;
         if (aProperty.CanRead && aProperty.GetGetMethod(true).IsHideBySig)
         {
             flag3 = true;
         }
         else if (aProperty.CanWrite && aProperty.GetSetMethod(true).IsHideBySig)
         {
             flag3 = true;
         }
         if (flag3 && !flag2)
         {
             anAttr.SetExtendedAttribute("VB.NET.Shadowing", "Overloads");
         }
     }
 }
Example #10
0
 private void CreateRealization(PdOOM.BaseObject obj, Type aParentType, PdOOM.BasePackage aPckg)
 {
     this.ProcessType(aParentType, false);
     if (aParentType.IsGenericType && !aParentType.IsGenericTypeDefinition)
     {
         aParentType = aParentType.GetGenericTypeDefinition();
     }
     TypeMapping aType = TypeMapping.Retrieve(aParentType);
     PdOOM.BaseObject obj2 = ProperRef.Link(NamespaceMapping.Retrieve(aPckg), aType);
     Realization realization = (Realization) aPckg.CreateObject(0x18112068, "", -1, true);
     realization.Interface = obj2;
     realization.Class = obj;
 }
Example #11
0
        private void CreateMethod(TypeInfo aType, Classifier aCls, MethordInfo aMethod, PdOOM.BasePackage aPckg, Operation anOper, InfluenceTable anInfTable)
        {
            Operation operation;
            if (anOper != null)
            {
                operation = anOper;
            }
            else
            {
                operation = (Operation)aCls.CreateObject(0x18112066, "", -1, true);
            }
            operation.Static = aMethod.IsStatic;
            operation.Visibility = GetTypeVisibility(aMethod.Modifier);
            operation.ReturnType = aMethod.Type;
            //operation.Final = aMethod.IsFinal;
            if (aMethod.IsGenericMethod)
            {
                operation.Generic = true;
                foreach (TypeParameter parameter in operation.TypeParameters)
                {
                    parameter.delete();
                }
                ////foreach (Type type in aMethod.GetGenericArguments())
                ////{
                ////    TypeParameter parameter2 = (TypeParameter)operation.CreateObject(0x1811207d, "", -1, true);
                ////    this.ProcessType(type, false);
                ////    TypeMapping mapping = TypeMapping.Retrieve(type);
                ////    parameter2.Name = parameter2.Code = mapping.Name;
                ////    operation.TypeParameters.Add(parameter2);
                ////}
            }
            if (aMethod.IsVirtual)
            {
                operation.SetExtendedAttribute("C++.virtual", "true");
            }
            if (aMethod.IsAbstract)
            {
                operation.Abstract = true;
            }
            try
            {
                operation.Code = aMethod.Code;
                operation.Name = aMethod.Name;
            }
            catch (COMException)
            {
                if (LZ.Reverse.Info._bDebug)
                {
                    LZ.Reverse.Info.Write(new string[] { "*** exception while naming the operation \"{1}\" on the type \"{0}\"", aType.Code, aMethod.Name });
                }
            }

            new CustomHandlerMethod(aMethod, operation).Convert();
            // 添加参数
            foreach (ObjectInfo type in aMethod.Parameters)
            {
                AddParameter(operation, type, aPckg);
            }

            // 防止有重载方法前面改名失败
            if (aMethod.Parameters.Count > 0 && operation.Code != aMethod.Code)
            {
                try
                {
                    operation.Code = aMethod.Code;
                    operation.Name = aMethod.Name;
                }
                catch (COMException)
                {
                    if (LZ.Reverse.Info._bDebug)
                    {
                        LZ.Reverse.Info.Write(new string[] { "*** exception while naming the operation \"{1}\" on the type \"{0}\"", aType.Code, aMethod.Name });
                    }
                }
            }
        }
Example #12
0
        private void CreateGeneralization(PdOOM.NamedObject obj, TypeInfo aParentType, PdOOM.BasePackage aPckg)
        {
            this.AddClassifier(aParentType, false);
            ////if (aParentType.IsGenericType && !aParentType.IsGenericTypeDefinition)
            ////{
            ////    aParentType = aParentType.GetGenericTypeDefinition();
            ////}
            bool bCreate = true;
            TypeMapping aType = TypeMapping.Retrieve(aParentType, ref bCreate);
            PdOOM.BaseObject objParent = ProperRef.Link(NamespaceMapping.Retrieve(aPckg), aType);
            Generalization generalization = (Generalization)aPckg.CreateObject(0x18112067, "", -1, true);
            generalization.ParentObject = objParent;
            generalization.ChildObject = obj;

            try
            {
                generalization.Name = generalization.Code = string.Format("gen_{0}_2_{1}", obj.Code, aParentType.Code); // TypeInfoHelper.GetTypeName(aType);
            }
            catch (COMException)
            {
                if (LZ.Reverse.Info._bDebug)
                {
                    LZ.Reverse.Info.Write(new string[] { "*** exception while naming the Generalization \"{0}\"", generalization.Name });
                }
            }

        }
Example #13
0
        private void CreateAttribute(TypeInfo ti, Classifier aCls, AttributeInfo aField, PdOOM.BasePackage aPckg)
        {
            CustomHandlerField field = new CustomHandlerField(aField, null);
            if (!field.ThroughProperty)
            {
                PdOOM.Attribute attribute = (PdOOM.Attribute)aCls.CreateObject(0x18112065, "", -1, true);
                if (aField.IsStatic)
                {
                    attribute.Static = true;
                }
                try
                {
                    attribute.Name = attribute.Code = aField.Name;
                }
                catch (COMException)
                {
                    if (LZ.Reverse.Info._bDebug)
                    {
                        LZ.Reverse.Info.Write(new string[] { "*** exception while naming the attribute \"{1}\" on the type \"{0}\"", aField.Code, aField.Name });
                    }
                }
                attribute.Visibility = GetTypeVisibility(aField.Modifier);
                //attribute.Persistent = !aField.IsNotSerialized;
                attribute.Volatile = aField.IsVolatile;
                if (aField.IsPointer)
                {
                    attribute.Multiplicity = "*";
                }
                field.PdObj = attribute;
                field.Convert();

                TypeInfo tiField = new TypeInfo();
                ////System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex("[a-zA-Z_][a-zA-Z_0-9]*");
                ////System.Text.RegularExpressions.Match m = reg.Match(aField.Type.Replace("unsigned",""));
                tiField.Code = tiField.Name = aField.Type;
                tiField.IsClass = true;
                tiField.Comment = aCls.Comment;
                this.AddClassifier(tiField, false);
                bool bCreate = true;
                TypeMapping mapping = TypeMapping.Retrieve(tiField, ref bCreate);
                if (mapping.HasClassifier())
                {
                    PdOOM.NamedObject objClassB = (PdOOM.NamedObject)ProperRef.Link(NamespaceMapping.Retrieve(aPckg), mapping);
                    PdOOM.NamedObject objClassA = (PdOOM.NamedObject)attribute.Parent;
                    attribute.UseQualifiedDataType = false;
                    attribute.DataTypeObject = objClassA;

                    Association ass = (Association)aPckg.CreateObject((int)PdOOM_Classes.cls_Association, "", -1, true);
                    ass.ClassA = objClassA;
                    ass.ClassB = objClassB;
                    try
                    {
                        ass.Name = ass.Code = string.Format("ass_{0}_2_{1}_{2}", objClassA.Code, objClassB.Code, attribute.Code);
                        if (tiField.Code == aField.FullType)
                        {
                            ass.RoleBMultiplicity = "1..1";
                            ass.RoleAIndicator = aField.IsPointer ? "A" : "C";
                        }
                        ass.RoleAMultiplicity = "";
                        ass.RoleBName = aField.Name;
                        ass.RoleANavigability = false;
                        ass.RoleBNavigability = false;
                    }
                    catch (COMException)
                    {
                        if (LZ.Reverse.Info._bDebug)
                        {
                            LZ.Reverse.Info.Write(new string[] { "*** exception while naming the attribute \"{1}\" on the type \"{0}\"", aField.Code, aField.Name });
                        }
                    }

                }
                ////else
                {
                    attribute.DataType = aField.FullType;   // mapping.Name;
                }
            }
        }
 public CustomHandlerField(AttributeInfo aField, PdOOM.Attribute anAttr)
     : base(null, aField.Name, anAttr)
 {
     this._through = false;
     base.ProcessAttrs();
 }
Example #15
0
 public void Add(MethodInfo aMethod, PdOOM.BaseObject anObject, string aStereo)
 {
     if ((aMethod != null) && (aMethod != null))
     {
         if (this._store == null)
         {
             this._store = new Hashtable();
         }
         else if (this._store.Contains(aMethod))
         {
             return;
         }
         Info info = new Info();
         info._obj = anObject;
         info._stereo = aStereo;
         this._store.Add(aMethod, info);
     }
 }
 public CustomHandlerProperty(PropertyInfo aProperty, PdOOM.Attribute anAttr) : base(aProperty.GetCustomAttributes(false), aProperty.DeclaringType + "." + aProperty.Name, anAttr)
 {
     base.ProcessAttrs();
 }
Example #17
0
 public static TypeMapping DefineExtraType(string aName, PdOOM.Classifier aCls)
 {
     if (aName == "")
     {
         return null;
     }
     if (aCls == null)
     {
         return null;
     }
     if (_tabCheck.Contains(aName))
     {
         return (TypeMapping) _tabCheck[aName];
     }
     TypeMapping mapping = new TypeMapping(aName);
     mapping.Classifier = aCls;
     return mapping;
 }