Ejemplo n.º 1
0
        protected Conversion(T Color1, U Color2)
        {
            this.Color1 = Color1;
            this.Color2 = Color2;

            var types = Assembly.GetAssembly(typeof(ConversionPath)).GetTypes();
            var paths = (from t in types
                         where t.IsSubclassOf(typeof(ConversionPath)) && !t.IsAbstract
                         select t).ToArray();

            int c = 0;

            for (int i = 0; i < paths.Length; i++)
            {
                var args = paths[i].BaseType.GetGenericArguments();
                if (args.Length == 2)
                {
                    if (args[0] == typeof(U) && args[1] == typeof(T))
                    {
                        ConvToT = GetDelegate(paths[i]);
                        if (ConvToT == null)
                        {
                            ConvToTEx      = GetDelegateEx(paths[i]);
                            IsConversionEx = true;
                        }
                        c++;
                    }
                    else if (args[0] == typeof(T) && args[1] == typeof(U))
                    {
                        ConvToU = GetDelegate(paths[i]);
                        if (ConvToU == null)
                        {
                            ConvToUEx      = GetDelegateEx(paths[i]);
                            IsConversionEx = true;
                        }
                        c++;
                    }

                    if (c == 2)
                    {
                        break;
                    }
                }
            }

            if (IsConversionEx && (ConvToUEx == null || ConvToTEx == null))
            {
                throw new MissingMethodException();
            }
            else if (!IsConversionEx && (ConvToU == null || ConvToT == null))
            {
                throw new MissingMethodException();
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new instance of the <see cref="CC_ExecuteMethod"/> class
 /// </summary>
 /// <param name="method">The method to execute</param>
 /// <param name="data">The data that is used for the method</param>
 public CC_ExecuteMethod(ConversionExDelegate method, double[][] data)
 {
     if (method == null)
     {
         throw new ArgumentNullException(nameof(method));
     }
     if (data == null)
     {
         throw new ArgumentNullException(nameof(data));
     }
     MethodCE     = method;
     MethodCEData = data;
 }
Ejemplo n.º 3
0
 public PathCheckData(Color inColor, Color outColor, ConversionExDelegate conversion,
                      double[] inValues, double[] outValues, double[][] additionalData)
     : this(inColor, outColor, inValues, outValues)
 {
     if (conversion == null)
     {
         throw new ArgumentNullException(nameof(conversion));
     }
     if (conversion == null)
     {
         throw new ArgumentNullException(nameof(additionalData));
     }
     conversionEx        = conversion;
     this.additionalData = additionalData;
 }