internal ListenerInfo(String name, String details, SafeNameValueCollection objParams, IReflectInsightListener listener) { Id = RIUtils.GetStringHash(name); Name = name; Details = details; Params = objParams; Listener = listener; Disposed = false; }
static public ListenerInfo CreateListenerInfo(String listenerName, SafeNameValueCollection objParams) { if (listenerName == null) { throw new ArgumentNullException("listenerName"); } listenerName = listenerName.Trim(); // Ensure that Listener Name has no spaces. If so, raise exception if (listenerName.IndexOf(' ') > 0 || listenerName.Length == 0) { throw new ReflectInsightException(String.Format("'{0}' is not a proper listener name.", listenerName)); } ListenerInfo listener = null; IReflectInsightListener iListener = ListenerLoader.Get(listenerName); try { if (objParams == null) { objParams = new SafeNameValueCollection(); } listener = new ListenerInfo(listenerName, ReconstructDetailString(listenerName, objParams), objParams, iListener); } catch (Exception ex) { iListener.DisposeObject(); throw new ReflectInsightException(String.Format("Listener '{0}' caused an exception during the ReconstructDetailString section for method CreateListenerInfo() .", listenerName), ex); } // update % parameters if any try { iListener.UpdateParameterVariables(listener); } catch (Exception ex) { listener.DisposeObject(); throw new ReflectInsightException(String.Format("Listener '{0}' caused an exception during the UpdateParameterVariables() method.", listenerName), ex); } return(listener); }