예제 #1
0
        public override void Register(RegistrationContext context)
        {
            using (Key key = context.CreateKey(_ClsidRegKey))
            {
                if (ObjectType != null)
                {
                    key.SetValue(string.Empty, ObjectType.FullName);
                    key.SetValue("Class", ObjectType.FullName);
                }

                if (!string.IsNullOrEmpty(context.InprocServerPath))
                {
                    key.SetValue("InprocServer32", context.InprocServerPath);
                }

                if (context.RegistrationMethod !=
                    RegistrationMethod.Default)
                {
                    RegisterUsing = context.RegistrationMethod;
                }

                switch (RegisterUsing)
                {
                case RegistrationMethod.Default:
                case RegistrationMethod.Assembly:
                    if (ObjectType != null)
                    {
                        key.SetValue("Assembly", ObjectType.Assembly.FullName);
                    }
                    break;

                case RegistrationMethod.CodeBase:
                    key.SetValue("CodeBase", context.CodeBase);
                    break;
                }

                if (!string.IsNullOrEmpty(RuntimeVersion))
                {
                    key.SetValue("RuntimeVersion", RuntimeVersion);
                }

                if (ThreadingModel == ComThreadingModel.NotSpecified)
                {
                    ThreadingModel = ComThreadingModel.Both;
                }

                key.SetValue("ThreadingModel", ThreadingModel.ToString());
            }
        }
        public override void Register( RegistrationContext context )
        {
            using ( Key key = context.CreateKey( _ClsidRegKey ) )
            {
                if ( ObjectType != null )
                {
                    key.SetValue( string.Empty, ObjectType.FullName );
                    key.SetValue("Class", ObjectType.FullName);
                }

                if (!string.IsNullOrEmpty(context.InprocServerPath))
                {
                    key.SetValue( "InprocServer32", context.InprocServerPath );
                }

                if ( context.RegistrationMethod !=
                     RegistrationMethod.Default )
                {
                    RegisterUsing = context.RegistrationMethod;
                }

                switch ( RegisterUsing )
                {
                    case RegistrationMethod.Default:
                    case RegistrationMethod.Assembly:
                        if (ObjectType != null)
                        {
                            key.SetValue( "Assembly", ObjectType.Assembly.FullName );
                        }
                        break;

                    case RegistrationMethod.CodeBase:
                        key.SetValue( "CodeBase", context.CodeBase );
                        break;
                }

                if ( !string.IsNullOrEmpty( RuntimeVersion ) )
                {
                    key.SetValue( "RuntimeVersion", RuntimeVersion );
                }

                if ( ThreadingModel == ComThreadingModel.NotSpecified )
                {
                    ThreadingModel = ComThreadingModel.Both;
                }

                key.SetValue( "ThreadingModel", ThreadingModel.ToString() );
            }
        }