Example #1
0
        private Type ExtractClassType(Mono.Cecil.MemberReference operand)
        {
            Type   type     = null;
            string typeName = operand.ToString();

            if (operand.DeclaringType != null)
            {
                typeName = operand.DeclaringType.FullName.Replace('/', '+');
            }

            type = Type.GetType(typeName);

            if (type == null)
            {
                //TODO: Not correct, the module refers to current module, not the declaring type's module
                type = Type.GetType(typeName + ", " + operand.DeclaringType.Module.Assembly.Name.ToString(), true);
            }

            return(type);
        }
Example #2
0
 public static ProductException Create(Application app, int code, bool error, Exception innerException, Mono.Cecil.MemberReference member, Instruction instruction, string message, params object [] args)
 {
     Mono.Cecil.MethodReference method = member as Mono.Cecil.MethodReference;
     if (method == null)
     {
         var property = member as Mono.Cecil.PropertyDefinition;
         if (property != null)
         {
             method = property.GetMethod;
             if (method == null)
             {
                 method = property.SetMethod;
             }
         }
     }
     return(Create(app, code, error, innerException, method == null ? null : method.Resolve(), instruction, message, args));
 }
Example #3
0
 public static ProductException CreateWarning(Application app, int code, Mono.Cecil.MemberReference member, Instruction instruction, string message, params object [] args)
 {
     return(Create(app, code, false, null, member, instruction, message, args));
 }
Example #4
0
 public static ProductException CreateError(Application app, int code, Mono.Cecil.MemberReference member, string message, params object[] args)
 {
     return(Create(app, code, true, null, member, null, message, args));
 }