示例#1
0
        public Reflector(string assemblyPath)
        {
            AppDomainSetup setup = new AppDomainSetup();

            setup.ApplicationBase = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            this.assemblyPath     = assemblyPath;
            this.reflectingDomain = AppDomain.CreateDomain(assemblyPath + " reflecting domain", null, setup);

            try
            {
                object remote_object = this.reflectingDomain.CreateInstanceAndUnwrap(
                    Assembly.GetExecutingAssembly().FullName,
                    typeof(RemoteReflector).FullName,
                    false,
                    BindingFlags.Default,
                    null,
                    new object[] { assemblyPath },
                    null,
                    null,
                    null);

                this.remoteReflector = (RemoteReflector)remote_object;
            }
            catch (Exception)
            {
                Dispose();
                throw;
            }
        }
示例#2
0
        public MethodDescriptor(RemoteReflector reflector, MethodInfo info, TypeDescriptor declaringType, Guid id)
            : base(reflector, id)
        {
            this.DeclaringType    = declaringType;
            this.MethodName       = info.Name;
            this.MethodAttributes = info.Attributes;

            // signature is null - will be created when first needed

            StringBuilder sb = new StringBuilder();

            TypeToString(sb, info.ReturnType);

            sb.Append('(');
            ParameterInfo[] parameters = info.GetParameters();
            for (int i = 0; i < parameters.Length; i++)
            {
                if (i > 0)
                {
                    sb.Append(',');
                }
                TypeToString(sb, parameters[i].ParameterType);
            }
            sb.Append(')');

            this.MethodSigString = sb.ToString();
        }
示例#3
0
        public readonly TypeDescriptor DeclaringType; // non-null for nested types only

        #endregion

        #region Construction

        public TypeDescriptor(RemoteReflector reflector, TypeDescriptor declaringType, Type type, Guid id)
            : base(reflector, id)
        {
            this.DeclaringType  = declaringType;
            this.TypeName       = type.FullName;
            this.IsValueType    = type.IsValueType;
            this.IsDelegate     = typeof(Delegate).IsAssignableFrom(type);
            this.TypeAttributes = type.Attributes;
        }
示例#4
0
        public readonly string MethodSigString; // return type : (parameter types)

        #endregion Fields

        #region Constructors

        public MethodDescriptor(RemoteReflector reflector, MethodInfo info, TypeDescriptor declaringType, Guid id)
            : base(reflector, id)
        {
            this.DeclaringType = declaringType;
            this.MethodName = info.Name;
            this.MethodAttributes = info.Attributes;

            // signature is null - will be created when first needed

            var sb = new StringBuilder();

            TypeToString(sb, info.ReturnType);

            sb.Append('(');
            ParameterInfo[] parameters = info.GetParameters();
            for (int i = 0; i < parameters.Length; i++)
            {
                if (i > 0) sb.Append(',');
                TypeToString(sb, parameters[i].ParameterType);
            }
            sb.Append(')');

            this.MethodSigString = sb.ToString();
        }
示例#5
0
 public TypeDescriptor(RemoteReflector reflector, Type type, Guid id)
     : this(reflector, null, type, id)
 {
 }
示例#6
0
 public TypeDescriptor(RemoteReflector reflector, TypeDescriptor declaringType, Type type, Guid id)
     : base(reflector, id)
 {
     this.DeclaringType = declaringType;
     this.TypeName = type.FullName;
     this.IsValueType = type.IsValueType;
     this.IsDelegate = typeof(Delegate).IsAssignableFrom(type);
     this.TypeAttributes = type.Attributes;
 }
示例#7
0
 public ItemDescriptor(RemoteReflector reflector, Guid id)
 {
     this.reflector = reflector;
     this.id = id;
 }
示例#8
0
        public Reflector(string assemblyPath)
        {
            var setup = new AppDomainSetup();
            setup.ApplicationBase = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            this.assemblyPath = assemblyPath;
            this.reflectingDomain = AppDomain.CreateDomain(assemblyPath + " reflecting domain", null, setup);

            try
            {
                object remote_object = this.reflectingDomain.CreateInstanceAndUnwrap(
                    Assembly.GetExecutingAssembly().FullName,
                    typeof(RemoteReflector).FullName,
                    false,
                    BindingFlags.Default,
                    null,
                    new object[] { assemblyPath },
                    null,
                    null,
                    null);

                this.remoteReflector = (RemoteReflector)remote_object;
            }
            catch (Exception)
            {
                Dispose();
                throw;
            }
        }
示例#9
0
 public TypeDescriptor(RemoteReflector reflector, Type type, Guid id)
     : this(reflector, null, type, id)
 {
 }
示例#10
0
 public ItemDescriptor(RemoteReflector reflector, Guid id)
 {
     this.reflector = reflector;
     this.id        = id;
 }