private static String GetIdentity(IConfigureListeners configuration) { Verify.NotNull(configuration, "configuration"); Verify.True(configuration.HasExtendedProperty("identity"), "configuration", "Listener mising configuration attribute 'identity'.\r\nName: " + configuration.Binding); return(configuration.GetExtendedProperty("identity")); }
private static IPEndPoint GetEndPoint(IConfigureListeners configuration) { var uri = new Uri(configuration.Binding.Replace("+", "any")); if (uri.Scheme != "udp") throw new NotSupportedException("Not suppoerted protocol: " + uri.Scheme); var ipAddress = uri.Host == "any" ? IPAddress.Any : IPAddress.Parse(uri.Host); return new IPEndPoint(ipAddress, uri.Port); }
private static Mutex GetMutex(IConfigureListeners configuration) { Verify.NotNull(configuration, "configuration"); return(new Mutex(false, configuration.Mutex)); }
private static String GetSource(IConfigureListeners configuration) { Verify.NotNull(configuration, "configuration"); return(configuration.Binding); }
public OutputDebugStringListener(IProcessMessages messageProcessor, IConfigureListeners configuration) : this(GetSource(configuration), messageProcessor, new SharedMemoryBuffer(GetSource(configuration), OutputDebugString.BufferSize), GetMutex(configuration)) { }
public PipeMessageListener(IProcessMessages messageProcessor, IConfigureListeners configuration) : this(GetSource(configuration), messageProcessor, new NamedPipeServerBuffer(GetSource(configuration), GetIdentity(configuration)), GetMutex(configuration)) { }
/// <summary> /// Gets the named pipe binding configuration (i.e., source). /// </summary> /// <param name="configuration">The underlying listener configuration.</param> private static String GetSource(IConfigureListeners configuration) { Verify.NotNull(configuration, "configuration"); return configuration.Binding; }
/// <summary> /// Get or create the mutex instance used to singal that one or more listeners are active. /// </summary> /// <param name="configuration">The underlying listener configuration.</param> private static Mutex GetMutex(IConfigureListeners configuration) { Verify.NotNull(configuration, "configuration"); return CreateMutex(configuration.Mutex); }
/// <summary> /// Creates a new instance of <see cref="OutputDebugStringListener"/>. /// </summary> /// <param name="messageProcessor">The underlying message processor instance.</param> /// <param name="configuration">The named pipe message listener configuration.</param> public OutputDebugStringListener(IProcessMessages messageProcessor, IConfigureListeners configuration) : this(GetSource(configuration), messageProcessor, new SharedMemoryBuffer(GetSource(configuration), OutputDebugString.BufferSize), GetMutex(configuration)) { }
public UdpMessageListener(IProcessMessages messageProcessor, IConfigureListeners configuration) : this(GetSource(configuration), messageProcessor, new UdpServerMessageBuffer(GetSource(configuration), GetEndPoint(configuration))) { }
/// <summary> /// Creates a new instance of <see cref="PipeMessageListener"/>. /// </summary> /// <param name="messageProcessor">The underlying message processor instance.</param> /// <param name="configuration">The named pipe message listener configuration.</param> public PipeMessageListener(IProcessMessages messageProcessor, IConfigureListeners configuration) : this(GetSource(configuration), messageProcessor, new NamedPipeServerBuffer(GetSource(configuration)), GetMutex(configuration)) { }