Пример #1
0
        public void CanCreateFromType(Type type, string assemblyName, string className)
        {
            var result = new ReflectionType(type);

              Assert.That(result.AssemblyName.StartsWith(assemblyName));
              Assert.AreEqual(className, result.ClassName);
        }
Пример #2
0
        public void CanCreateInstanceReturningSpecificType()
        {
            var      type   = new ReflectionType("Utility.Test.TestType");
            TestType result = type.CreateObject <TestType>();

            Assert.That(result, Is.InstanceOf <TestType>());
        }
        public void SetPropertyFlashReflection([NotNull] object obj)
        {
            ReflectionType     type     = ReflectionCache.Instance.GetReflectionType(obj.GetType());
            ReflectionProperty property = type.Properties[UIntArrayPropertyName];

            property?.SetValue(obj, ValueToSet);
        }
Пример #4
0
        protected void Initialize()
        {
            LoadName(TypeInfo);

            if (ReflectionType.HasFlag(ReflectionType.StandardConstants))
            {
                LoadConstants(TypeInfo);
            }

            if (ReflectionType.HasFlag(ReflectionType.StandardMethods))
            {
                LoadMethods(TypeInfo);
            }

            if (ExtensionsTypeInfo is not null)
            {
                if (ReflectionType.HasFlag(ReflectionType.ExtensionConstants))
                {
                    LoadConstants(ExtensionsTypeInfo);
                }

                if (ReflectionType.HasFlag(ReflectionType.ExtensionMethods))
                {
                    LoadMethods(ExtensionsTypeInfo);
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Create from a DbManager node containing a type
        ///
        /// <DbManager type="assembly.class, assembly">
        ///   <DbDescription type="assembly.class, assembly>
        ///     <!-- see DbDescription.cs -->
        ///   </DbDescription>
        /// </DbManager>
        ///
        /// </summary>
        /// <param name="xmlRoot"></param>
        /// <returns></returns>
        public static IDbManager Create(string xmlRoot, string baseDirectory = null)
        {
            if (string.IsNullOrWhiteSpace(xmlRoot))
            {
                throw new ArgumentException("xmlRoot is invalid", "xmlRoot");
            }


            var root = XElement.Parse(xmlRoot);

            var typeAttribute = root.Attribute("type");

            if (typeAttribute == null)
            {
                throw new ArgumentException("Root element is missing the required 'type' attribute", "xmlRoot");
            }

            IDbManager dbManager;

            try
            {
                dbManager = new ReflectionType(typeAttribute.Value).CreateObject <IDbManager>();
            }
            catch (Exception e)
            {
                throw new ArgumentException(string.Format("Could not create database manager type '{0}'", typeAttribute.Value), "xmlRoot", e);
            }

            dbManager.Description = DbDescription.Create(root.FirstNode.ToString(), baseDirectory);

            return(dbManager);
        }
Пример #6
0
        public void CanCreateType(string fullName, Type expectedType)
        {
            var type   = new ReflectionType(fullName);
            var result = type.CreateType();

            Assert.AreEqual(expectedType, result);
        }
Пример #7
0
        public object GetPropertyFlashReflection([NotNull] object obj)
        {
            ReflectionType     type     = ReflectionCache.Instance.GetReflectionType(obj.GetType());
            ReflectionProperty property = type.Properties[UIntArrayPropertyName];

            return(property?.GetValue(obj));
        }
Пример #8
0
        public void CanCreateFromFullName(string fullName, string assemblyName, string className)
        {
            var result = new ReflectionType(fullName);

            Assert.AreEqual(assemblyName, result.AssemblyName);
            Assert.AreEqual(className, result.ClassName);
        }
Пример #9
0
        public void CanCreateFromType(Type type, string assemblyName, string className)
        {
            var result = new ReflectionType(type);

            Assert.That(result.AssemblyName.StartsWith(assemblyName));
            Assert.AreEqual(className, result.ClassName);
        }
Пример #10
0
        /// <summary>
        /// Deserializes the Frame to a .NET object.
        /// </summary>
        /// <typeparam name="T">The type of the object to deserialize to.</typeparam>
        /// <param name="frame">The Frame to deserialize.</param>
        /// <param name="reflection">Reflection information for the Object to deserialize</param>
        /// <returns>The deserialized object from the Frame.</returns>
        private static List <T> InternalDeserializeV2 <T>(PackageV2 frame, ReflectionType reflection)
        {
            //get group attribute
            PackageGroupAttribute PackageGroupAttribute = reflection.GetCustomAttribute <PackageGroupAttribute>();

            if (PackageGroupAttribute == null)
            {
                throw new Exception(String.Format("Type {0} does not contain FrameGroup attribute!", reflection.Type.Name));
            }

            //create collection
            List <T> collection = new List <T>();

            //each objects
            foreach (PackageGroupItem group in frame.Groups)
            {
                //check group address for this type
                if (group.Address == PackageGroupAttribute.Address)
                {
                    //intiailize object
                    T result = PackageHelper.InternalDeserializeV2 <T>(group, reflection);

                    //create objet to collection
                    collection.Add(result);
                }
            }

            //return result
            return(collection);
        }
Пример #11
0
        public void CanCreateInstanceReturningSpecificType()
        {
            var type = new ReflectionType("Utility.Test.TestType");
              TestType result = type.CreateObject<TestType>();

              Assert.That(result, Is.InstanceOf<TestType>());
        }
Пример #12
0
        public Point Reflect(ReflectionType reflType)
        {
            Point res;

            switch (reflType)
            {
            case ReflectionType.X:
            {
                res = new Point(Xcoordinate, Ycoordinate * (-1));
                break;
            }

            case ReflectionType.Y:
            {
                res = new Point(Xcoordinate * (-1), Ycoordinate);
                break;
            }

            case ReflectionType.Origin:
            {
                res = new Point(Xcoordinate * (-1), Ycoordinate * (-1));
                break;
            }

            default:
            {
                res = new Point();
                break;
            }
            }

            return(res);
        }
Пример #13
0
        public void CanCreateType(string fullName, Type expectedType)
        {
            var type = new ReflectionType(fullName);
              var result = type.CreateType();

              Assert.AreEqual(expectedType, result);
        }
Пример #14
0
        public Mirror(int x, int y)
            : base(x, y, 1, 1, MediaRepository.Textures["Mirror_NE"])
        {
            reflection = ReflectionType.NorthEast;

            Initialize();
        }
Пример #15
0
        public void CanCreateFromFullName(string fullName, string assemblyName, string className)
        {
            var result = new ReflectionType(fullName);

              Assert.AreEqual(assemblyName, result.AssemblyName);
              Assert.AreEqual(className, result.ClassName);
        }
Пример #16
0
        public void CreateTypeThrowsWhenTypeCannotBeCreated(string fullName)
        {
            var type = new ReflectionType(fullName);
            var e    = Assert.Throws <ApplicationException>(() => type.CreateType());

            Console.WriteLine(e.Message);
        }
Пример #17
0
 static FrameDebuggerUtility()
 {
     reflectionCache       = new ReflectionCache();
     frameDebuggeUtil      = reflectionCache.GetTypeObject("UnityEditorInternal.FrameDebuggerUtility");
     framePositionProperty = frameDebuggeUtil.GetPropertyInfo("limit");
     frameEventData        = reflectionCache.GetTypeObject("UnityEditorInternal.FrameDebuggerEventData");
 }
Пример #18
0
 public void Reflect(ReflectionType reflType)
 {
     if (reflType == ReflectionType.Bottom || reflType == ReflectionType.Top)
     {
         int temp = PosLimDown;
         PosLimDown = PosLimUp;
         PosLimUp   = temp;
         if (Dir == DirType.Down)
         {
             Dir = DirType.Up;
         }
         else
         {
             Dir = DirType.Down;
         }
     }
     else if (reflType == ReflectionType.Left || reflType == ReflectionType.Right)
     {
         int temp = PosLimRight;
         PosLimRight = PosLimLeft;
         PosLimLeft  = temp;
         if (Dir == DirType.Left)
         {
             Dir = DirType.Right;
         }
         else
         {
             Dir = DirType.Left;
         }
     }
 }
Пример #19
0
 public Sphere(double radius, Vec position, Vec emission, Vec color, ReflectionType reflection)
 {
     this.Radius     = radius;
     this.Position   = position;
     this.Emission   = emission;
     this.Color      = color;
     this.Reflection = reflection;
 }
Пример #20
0
 // --- Public Constructors ---
 public Sphere(double radius, Point position, Vector emission, Color color, ReflectionType reflectionType)
 {
     this.radius = radius;
     this.position = position;
     this.emission = emission;
     this.color = color;
     this.reflectionType = reflectionType;
 }
Пример #21
0
        public ReflectionLibraryBase(Type type, ReflectionType reflectionType, Type extensions)
        {
            ReflectionType     = reflectionType;
            TypeInfo           = type?.GetTypeInfo() ?? throw new ArgumentNullException(nameof(type));
            ExtensionsTypeInfo = extensions?.GetTypeInfo();

            Initialize();
        }
 protected FacetFactoryAbstract(int numericOrder, ILoggerFactory loggerFactory, FeatureType featureTypes,
                                ReflectionType reflectionType = ReflectionType.ObjectOriented)
 {
     NumericOrder    = numericOrder;
     LoggerFactory   = loggerFactory;
     FeatureTypes    = featureTypes;
     ReflectionTypes = reflectionType;
 }
Пример #23
0
 /// <summary>
 /// 反射棋子
 /// </summary>
 /// <param name="type">反射类型</param>
 public RowCoordinate reflect(ReflectionType type)
 {
     if ((type & ReflectionType.VerticalReflection)
         != ReflectionType.VerticalReflection)
     {
         return(new RowCoordinate(this._row_num));
     }
     return(new RowCoordinate(9 - this._row_num));
 }
Пример #24
0
        public void gamestart(ChessColour colour)
        {
            this.initialize_pieces();
            ReflectionType reflection = colour == ChessColour.RED ?
                                        ReflectionType.None : ReflectionType.PointReflection;

            reflect(this.reflection ^ reflection);
            this.lobby_player = colour;
        }
Пример #25
0
 /// <summary>
 /// 反射棋子
 /// </summary>
 /// <param name="type">反射类型</param>
 public ColumnCoordinate reflect(ReflectionType type)
 {
     if ((type & ReflectionType.HorizontalReflection)
         != ReflectionType.HorizontalReflection)
     {
         return(new ColumnCoordinate(this._col_num));
     }
     return(new ColumnCoordinate(8 - this._col_num));
 }
Пример #26
0
        public void CanCreateInstanceWith0Parameters()
        {
            var type   = new ReflectionType("Utility.Test.TestType");
            var result = type.CreateObject();

            Assert.IsInstanceOf(typeof(TestType), result);
            Assert.IsNull(((TestType)result).P1);
            Assert.IsNull(((TestType)result).P2);
        }
Пример #27
0
        public void CanCreateInstanceWith2Parameters()
        {
            var type   = new ReflectionType("Utility.Test.TestType");
            var result = type.CreateObject("Parameter1", "Parameter2");

            Assert.IsInstanceOf(typeof(TestType), result);
            Assert.AreEqual("Parameter1", ((TestType)result).P1);
            Assert.AreEqual("Parameter2", ((TestType)result).P2);
        }
Пример #28
0
        public void CanCreateInstanceWith2Parameters()
        {
            var type = new ReflectionType("Utility.Test.TestType");
              var result = type.CreateObject("Parameter1", "Parameter2");

              Assert.IsInstanceOf(typeof(TestType), result);
              Assert.AreEqual("Parameter1", ((TestType)result).P1);
              Assert.AreEqual("Parameter2", ((TestType)result).P2);
        }
Пример #29
0
        public void CanCreateInstanceWith0Parameters()
        {
            var type = new ReflectionType("Utility.Test.TestType");
              var result = type.CreateObject();

              Assert.IsInstanceOf(typeof(TestType), result);
              Assert.IsNull(((TestType)result).P1);
              Assert.IsNull(((TestType)result).P2);
        }
Пример #30
0
        public ReflectionLibraryBase(object instance, ReflectionType reflectionType, Type extensions)
        {
            ReflectionType     = reflectionType;
            Instance           = instance ?? throw new ArgumentNullException(nameof(instance));
            TypeInfo           = instance.GetType().GetTypeInfo();
            ExtensionsTypeInfo = extensions?.GetTypeInfo();

            Initialize();
        }
Пример #31
0
 public void Reflect(ReflectionType reflType)
 {
     if (reflType == ReflectionType.Bottom || reflType == ReflectionType.Top)
     {
         DY = -DY;
     }
     else if (reflType == ReflectionType.Left || reflType == ReflectionType.Right)
     {
         DX = -DX;
     }
 }
Пример #32
0
        /// <summary>
        /// Deserializes the Frame to a .NET object.
        /// </summary>
        /// <typeparam name="T">The type of the object to deserialize to.</typeparam>
        /// <param name="frame">The Frame to deserialize.</param>
        /// <returns>The deserialized object from the Frame.</returns>
        private static List <T> InternalDeserializeV2 <T>(PackageV2 frame)
        {
            //get the object reglection
            ReflectionType reflection = ReflectionHelper.GetType(typeof(T));

            if (reflection != null)
            {
                return(PackageHelper.InternalDeserializeV2 <T>(frame, reflection));
            }
            return(default(List <T>));
        }
Пример #33
0
        /// <summary>
        /// This function serializes object to frame group
        /// </summary>
        /// <typeparam name="T">Data type</typeparam>
        /// <param name="data">Data object</param>
        /// <returns>Group collection</returns>
        private static List <PackageGroupItem> InternalSerializeV2ToGroup <T>(List <T> data)
        {
            //get the object reglection
            ReflectionType reflection = ReflectionHelper.GetType(typeof(T));

            if (reflection != null)
            {
                return(PackageHelper.InternalSerializeV2ToGroup <T>(data, reflection));
            }
            return(null);
        }
Пример #34
0
        /// <summary>
        /// Deserializes the Group to a .NET object.
        /// </summary>
        /// <typeparam name="T">The type of the object to deserialize to.</typeparam>
        /// <param name="group">The Group to deserialize.</param>
        /// <returns>The deserialized object from the Group.</returns>
        private static T InternalDeserializeV2 <T>(PackageGroupItem group)
        {
            //get the object reglection
            ReflectionType reflection = ReflectionHelper.GetType(typeof(T));

            if (reflection != null)
            {
                return(PackageHelper.InternalDeserializeV2 <T>(group, reflection));
            }
            return(default(T));
        }
Пример #35
0
        /// <summary>
        /// Serializes the specified Object to Frame
        /// </summary>
        /// <typeparam name="T">The type of the object to serialize to.</typeparam>
        /// <param name="obj">The object to serialize.</param>
        /// <param name="frame">Frame</param>
        /// <returns>Frame | null</returns>
        private static Package InternalSerialize <T>(T obj, Package frame)
        {
            //get the object reglection
            ReflectionType reflection = ReflectionHelper.GetType(typeof(T));

            if (reflection != null)
            {
                return(PackageHelper.InternalSerialize <T>(obj, frame, reflection));
            }
            return(null);
        }
Пример #36
0
 private void chessboard_reflect(ReflectionType reflection)
 {
     if (chessboard_container.InvokeRequired)
     {
         ReflectionTypeArgReturningVoidDelegate d =
             new ReflectionTypeArgReturningVoidDelegate(
                 chessboard_reflect);
         this.Invoke(d, new object[] { reflection });
     }
     else
     {
         this.chessboard_container.reflect(reflection);
     }
 }
Пример #37
0
        /// <summary>
        /// This function serializes object to frame group
        /// </summary>
        /// <typeparam name="T">Data type</typeparam>
        /// <param name="data">Data object</param>
        /// <param name="reflection">reflection info for this data type</param>
        /// <returns>Group | null</returns>
        private static PackageGroupItem InternalSerializeV2ToGroup <T>(T data, ReflectionType reflection)
        {
            //get group attribute
            PackageGroupAttribute PackageGroupAttribute = reflection.GetCustomAttribute <PackageGroupAttribute>();

            //check group attribute
            if (PackageGroupAttribute != null)
            {
                //serialize data
                return(InternalSerializeV2ToGroup <T>(data, reflection, PackageGroupAttribute));
            }

            //no data
            return(null);
        }
        public void Can_serialize_POCO_with_Type()
        {
            var dto = new ReflectionType {
                Type         = typeof(ReflectionType),
                MethodInfo   = typeof(ReflectionType).GetMethod(nameof(ReflectionType.Method)),
                PropertyInfo = typeof(ReflectionType).GetProperty(nameof(ReflectionType.PropertyInfo)),
                FieldInfo    = typeof(ReflectionType).GetPublicFields().FirstOrDefault(),
                MemberInfo   = typeof(ReflectionType).GetMembers().FirstOrDefault(),
            };

            dto.Name.Print();
            dto.ToJson().Print();
            dto.ToJsv().Print();
            dto.PrintDump();
        }
Пример #39
0
        /// <summary>
        /// Create from a DbManager node containing a type
        /// 
        /// <DbManager type="assembly.class, assembly">
        ///   <DbDescription type="assembly.class, assembly>
        ///     <!-- see DbDescription.cs -->
        ///   </DbDescription>
        /// </DbManager>
        /// 
        /// </summary>
        /// <param name="xmlRoot"></param>
        /// <returns></returns>
        public static IDbManager Create(string xmlRoot, string baseDirectory = null)
        {
            if (string.IsNullOrWhiteSpace(xmlRoot)) throw new ArgumentException("xmlRoot is invalid", "xmlRoot");

            var root = XElement.Parse(xmlRoot);

            var typeAttribute = root.Attribute("type");
            if (typeAttribute == null) throw new ArgumentException("Root element is missing the required 'type' attribute", "xmlRoot");

            IDbManager dbManager;
            try
            {
                dbManager = new ReflectionType(typeAttribute.Value).CreateObject<IDbManager>();
            }
            catch (Exception e)
            {
                throw new ArgumentException(string.Format("Could not create database manager type '{0}'", typeAttribute.Value), "xmlRoot", e);
            }

            dbManager.Description = DbDescription.Create(root.FirstNode.ToString(), baseDirectory);

            return dbManager;
        }
Пример #40
0
 public Sphere(double rad_, Vec3 pos_, Vec3 emission_, Vec3 color_, ReflectionType refltype_)
 {
     rad = rad_; pos = pos_; reflType = refltype_; emission = emission_; color = color_;
 }
Пример #41
0
        private double CalcReflectionGain(ReflectionType type, WWRoom room, int speakerCh, Point3D hitPos, Vector3D rayDir, Vector3D hitSurfaceNormal)
        {
            if (type == ReflectionType.Diffuse) {
                // Lambert's cosine law
                return Vector3D.DotProduct(-rayDir, hitSurfaceNormal);
            }

            // specular
            var reflectionDir = SpecularReflection(rayDir, hitSurfaceNormal);
            var speakerDir = room.SpeakerPos(speakerCh) - hitPos;
            speakerDir.Normalize();
            var dot = Vector3D.DotProduct(reflectionDir, speakerDir);
            return Math.Pow(Saturate0to1(dot), SPECULAR_HARDNESS);
        }
Пример #42
0
        /// <summary>
        ///  スピーカーから耳に届く音がたどる経路を調べる。
        /// </summary>
        /// <param name="room"></param>
        /// <param name="earCh">耳 0:左耳, 1:右耳</param>
        public void Trace(WWRoom room, ReflectionType reflectionType, int earCh)
        {
            var route = new WWRoute(earCh);

            // 耳の位置
            var rayPos = room.ListenerEarPos(earCh);
            var earDir = room.ListenerEarDir(earCh);

            Vector3D rayDir = RayGen(earDir);
            //耳からrayが発射して、部屋の壁に当たる

            // 音が耳に向かう方向。
            Vector3D soundDir = -rayDir;
            var accumReflectionGain = new double[] {1.0, 1.0};

            for (int i = 0; i < MaxReflectionCount; ++i) {
                Point3D hitPos;
                Vector3D hitSurfaceNormal;
                double rayLength;
                if (!room.RayIntersection(rayPos, rayDir, out hitPos, out hitSurfaceNormal, out rayLength)) {
                    // 終わり。
                    break;
                }

                // 1.0 - 反射率の確率で、計算を打ち切る。
                // たとえば反射率0.8の壁にRayが10本入射すると、8本のRayが強度を100%保ったまま反射する。
                if (WallReflectionRatio < NextDouble()) {
                    break;
                }

                // スピーカーから耳への道のりを計算する。
                var lineSegment = new WWLineSegment(rayPos, rayDir, rayLength, 1.0f /* 仮 Intensity */ );

                {
                    int speakerCh = earCh;
                    var distance = CalcRouteDistance(room, speakerCh, route, lineSegment, hitPos);
                    double gain = CalcReflectionGain(reflectionType, room, speakerCh, hitPos, rayDir, hitSurfaceNormal);
                    accumReflectionGain[0] *= gain;
                    var coeffS = new WWFirCoefficient(distance / SoundSpeed, soundDir, accumReflectionGain[0] / distance, false);
                    lineSegment.Intensity = coeffS.Gain;

                    if (1.0 / distance < SMALL_GAIN_THRESHOLD) {
                        break;
                    }

                    if (SMALL_GAIN_THRESHOLD <= coeffS.Gain) {
                        StoreCoeff(earCh, earCh, coeffS);
                    }
                }

                {
                    int speakerCh = (earCh == 0) ? 1 : 0;
                    var distance = CalcRouteDistance(room, speakerCh, route, lineSegment, hitPos);
                    double gain = CalcReflectionGain(reflectionType, room, speakerCh, hitPos, rayDir, hitSurfaceNormal);
                    accumReflectionGain[1] *= gain;
                    var coeffD = new WWFirCoefficient(distance / SoundSpeed, soundDir, accumReflectionGain[1] / distance, false);

                    if (SMALL_GAIN_THRESHOLD <= coeffD.Gain) {
                        StoreCoeff(earCh, speakerCh, coeffD);
                    }
                }

                route.Add(lineSegment);
                rayPos = hitPos;

                // 反射後の出射方向rayDir
                switch (reflectionType) {
                case ReflectionType.Diffuse:
                    rayDir = RayGen(hitSurfaceNormal);
                    break;
                case ReflectionType.Specular:
                    rayDir = SpecularReflection(rayDir, hitSurfaceNormal);
                    break;
                default:
                    System.Diagnostics.Debug.Assert(false);
                    break;
                }
            }

            // routeの中に、1つもlineSegmentが入っていないことがある。
            mRouteList.Add(route);
            Interlocked.Increment(ref mRouteCount[earCh]);
        }
Пример #43
0
 public void Reflect(ReflectionType reflType) 
 {
     if (reflType == ReflectionType.Bottom || reflType == ReflectionType.Top) DY = -DY;
     else if (reflType == ReflectionType.Left || reflType == ReflectionType.Right) DX = -DX;
 }
Пример #44
0
 public void Reflect(ReflectionType reflType)
 {
     WalkType.Reflect(reflType);
 }
Пример #45
0
    /// <summary>
    /// Create from a DbDescription node containing a type
    /// 
    /// &lt;DbDescription type="assembly.class, assembly"&gt;
    ///   ...
    /// &lt;/DbDescription&gt;
    /// 
    /// If the DbDescription element does not have an explicit 'type' attribute, Utility.Database.DbDescription is used
    /// </summary>
    /// <param name="xmlRoot"></param>
    /// <returns></returns>
    public static IDbDescription Create(string xmlRoot, string baseDirectory = null)
    {
      if (string.IsNullOrWhiteSpace(xmlRoot)) throw new ArgumentException("xmlRoot is invalid", "xmlRoot");

      var root = XElement.Parse(xmlRoot);

      DbDescription dbDescription;

      var typeAttribute = root.Attribute("type");
      if (typeAttribute == null)
      {
        dbDescription = new DbDescription();
      }
      else
      {
        try
        {
          dbDescription = new ReflectionType(typeAttribute.Value).CreateObject<DbDescription>();
        }
        catch (Exception e)
        {
          throw new ArgumentException(string.Format("Could not create database description type '{0}'", typeAttribute.Value), "xmlRoot", e);
        }
      }

      dbDescription.XmlRoot = xmlRoot;
      if(baseDirectory != null)
      {
        dbDescription.baseDirectory = baseDirectory;
      }

      return dbDescription;
    }
Пример #46
0
 public void CreateTypeThrowsWhenTypeCannotBeCreated(string fullName)
 {
     var type = new ReflectionType(fullName);
       var e = Assert.Throws<ApplicationException>(() => type.CreateType());
       Console.WriteLine(e.Message);
 }
Пример #47
0
        public void Run(IDbConnectionInfo connectionInfo)
        {
            if (ScriptType != ScriptType.Runnable) throw new ArgumentException(string.Format("ScriptType is not runnable : {0}", ScriptType), "ScriptType");

            try
            {
                var rType = new ReflectionType(ScriptValue);
                var runMethod = rType.CreateType().GetMethod("Run");
                if (runMethod == null)
                    throw new ArgumentException(string.Format("Could not find a method named 'Run' for ScriptValue : {0}", ScriptValue), "ScriptValue");
                if (runMethod.ReturnType != typeof (void))
                    throw new ArgumentException(string.Format("Run method does not have return type 'void' for ScriptValue : {0}", ScriptValue), "ScriptValue");
                var parameters = runMethod.GetParameters();
                if (parameters.Length != 1 || parameters[0].ParameterType != typeof (IDbConnectionInfo))
                    throw new ArgumentException(
                        string.Format("Run method does not have a single parameter of type 'IDbConnectionInfo' for ScriptValue : {0}", ScriptValue), "ScriptValue");

                runMethod.Invoke(rType.CreateObject(), BindingFlags.InvokeMethod, null, new object[] {connectionInfo}, null);
            }
            catch (Exception e)
            {
                if (e.GetType() == typeof (ArgumentException)) throw;
                throw new ArgumentException(string.Format("ScriptValue could not be run : {0} : {1} : {2}", ScriptValue, e.GetType(), e.Message), "ScriptValue", e);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DeferredEMReflectiveShader"/> class.
 /// </summary>
 /// <param name="texName">Name of the tex.</param>
 /// <param name="type">The type.</param>
 public DeferredEMReflectiveShader(String texName , ReflectionType type  )
 {            
     this.rType = type;
     this.texName = texName;            
 }