コード例 #1
0
        /// <summary>
        /// Gets a instance of postprocessor
        /// </summary>
        /// <param name="postProcessorName">Postprocessor name</param>
        /// <returns>Instance of postprocessor</returns>
        public IPostProcessor GetPostProcessorInstance(string postProcessorName)
        {
            IPostProcessor postProcessor;

            lock (_postProcessorsPoolSynchronizer)
            {
                if (_postProcessorsPool.ContainsKey(postProcessorName))
                {
                    postProcessor = _postProcessorsPool[postProcessorName];
                }
                else
                {
                    if (postProcessorName == Constants.PostProcessorName.NullPostProcessor)
                    {
                        postProcessor = new NullPostProcessor();
                    }
                    else
                    {
                        PostProcessorRegistration postProcessorRegistration = _assetConfig.PostProcessors[postProcessorName];

                        if (postProcessorRegistration == null)
                        {
                            throw new PostProcessorNotFoundException(
                                      string.Format(Strings.Configuration_PostProcessorNotRegistered,
                                                    OutputCodeType, postProcessorName));
                        }

                        string postProcessorFullTypeName = postProcessorRegistration.Type;

                        postProcessor = Utils.CreateInstanceByFullTypeName <IPostProcessor>(postProcessorFullTypeName);
                        postProcessor.UseInDebugMode = postProcessorRegistration.UseInDebugMode;
                    }

                    _postProcessorsPool.Add(postProcessorName, postProcessor);
                }
            }

            return(postProcessor);
        }
コード例 #2
0
		/// <summary>
		/// Gets a instance of postprocessor
		/// </summary>
		/// <param name="postProcessorName">Postprocessor name</param>
		/// <returns>Instance of postprocessor</returns>
		public IPostProcessor GetPostProcessorInstance(string postProcessorName)
		{
			IPostProcessor postProcessor;

			lock (_postProcessorsPoolSynchronizer)
			{
				if (_postProcessorsPool.ContainsKey(postProcessorName))
				{
					postProcessor = _postProcessorsPool[postProcessorName];
				}
				else
				{
					if (postProcessorName == Constants.PostProcessorName.NullPostProcessor)
					{
						postProcessor = new NullPostProcessor();
					}
					else
					{
						PostProcessorRegistration postProcessorRegistration = _assetConfig.PostProcessors[postProcessorName];

						if (postProcessorRegistration == null)
						{
							throw new PostProcessorNotFoundException(
								string.Format(Strings.Configuration_PostProcessorNotRegistered,
									OutputCodeType, postProcessorName));
						}

						string postProcessorFullTypeName = postProcessorRegistration.Type;

						postProcessor = Utils.CreateInstanceByFullTypeName<IPostProcessor>(postProcessorFullTypeName);
						postProcessor.UseInDebugMode = postProcessorRegistration.UseInDebugMode;
					}

					_postProcessorsPool.Add(postProcessorName, postProcessor);
				}
			}

			return postProcessor;
		}