public object MakeFromConstraint(Type targetType, string propertyName, DeterministicRandom random)
        {
            //
            ConstrainedDataSource source = constraintsTable.Get(TargetTypeAttribute.FindTarget(targetType), propertyName);

            return(source.GetData(random));
        }
 private static string GetFullNameFromAttr(AppFriend app, Type type, TargetTypeAttribute attr)
 {
     if (IsGeneric(attr.FullName))
     {
         List<string> genericArguments = new List<string>();
         foreach (var element in type.GetGenericArguments())
         {
             string innerType = GetFullName(app, element);
             if (string.IsNullOrEmpty(innerType))
             {
                 return string.Empty;
             }
             genericArguments.Add(innerType);
         }
         return MakeGenericTypeFullName(app, attr.FullName, genericArguments.ToArray());
     }
     else if (IsArray(attr.FullName))
     {
         var innerTypes = type.GetGenericArguments();
         if (innerTypes.Length != 1)
         {
             return string.Empty;
         }
         string arrayCoreType = GetFullName(app, innerTypes[0]);
         if (string.IsNullOrEmpty(arrayCoreType))
         {
             return string.Empty;
         }
         return arrayCoreType + attr.FullName;
     }
     else
     {
         return attr.FullName;
     }
 }
Exemple #3
0
    public PatchDefinition(TargetTypeAttribute targetType, BasePatcher instance, MethodInfo methodInfo)
    {
        TargetType = targetType;
        Instance   = instance;
        MethodInfo = methodInfo;

        FullName =
            $"{MethodInfo.DeclaringType.FullName}/{MethodInfo.Name} -> {TargetType.TargetAssembly}/{TargetType.TargetType}";
    }