예제 #1
0
        public IXDListener GetListenerForMode(XDTransportMode transportMode)
        {
            var listener = GetListenerForModeInternal(transportMode);
            if (transportMode == XDTransportMode.RemoteNetwork)
            {
                return listener;
            }

            var networkListener = CreateNetworkListener(new MachineNameIdentityProvider());
            if (networkListener == null || !networkListener.IsAlive)
            {
                return listener;
            }

            var networkBroadcaster = client.Broadcasters.GetBroadcasterForMode(transportMode);
            listener = new NetworkRelayListener(networkBroadcaster, listener, networkListener, transportMode);

            return listener;
        }
예제 #2
0
 public IXDListener GetListenerForMode(XDTransportMode transportMode)
 {
     var listener = Container.Resolve<IXDListener>(Convert.ToString(transportMode));
     if (listener == null)
     {
         throw new NotSupportedException(
             string.Format(
                 "No concrete IXDListener for mode {0} could be loaded. Install the {0} assembly in the program directory.",
                 transportMode));
     }
     if (transportMode != XDTransportMode.RemoteNetwork)
     {
         var networkListener = Container.Use<IIdentityProvider, MachineNameIdentityProvider>()
             .Resolve<IXDListener>(Convert.ToString(XDTransportMode.RemoteNetwork));
         if (networkListener != null && networkListener.IsAlive)
         {
             var networkBroadcaster = client.Broadcasters.GetBroadcasterForMode(transportMode, false);
             listener = new NetworkRelayListener(networkBroadcaster, listener, networkListener, transportMode);
         }
     }
     return listener;
 }