コード例 #1
0
        private CrawlWaveServerProxy(ICrawlWaveServerSettingsProvider provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException();
            }

            IChannel channel;

            switch (provider.ChannelType)
            {
            case "http":
                channel = (IChannel)(new HttpChannel());                        //(provider.Port));
                break;

            case "ipc":
                channel = (IChannel)(new IpcChannel(string.Format("{0}:{1}", provider.Hostname, provider.Port)));
                break;

            case "tcp":
                channel = (IChannel)(new TcpChannel());                        //(provider.Port));
                break;

            default:
                throw new ArgumentException();
                break;
            }

            ChannelServices.RegisterChannel(channel, true);

            proxy = (ICrawlWaveServer)Activator.GetObject(
                typeof(ICrawlWaveServer),
                string.Format("{0}://{1}:{2}/CrawlWaveServer.rem", provider.ChannelType, provider.Hostname, provider.Port));
        }
コード例 #2
0
        private CrawlWaveServerProxy(ICrawlWaveServerSettingsProvider provider)
        {
            if (provider == null)
                throw new ArgumentNullException();

            IChannel channel;

            switch (provider.ChannelType)
            {
                case "http":
                    channel = (IChannel)(new HttpChannel());//(provider.Port));
                    break;

                case "ipc":
                    channel = (IChannel)(new IpcChannel(string.Format("{0}:{1}", provider.Hostname, provider.Port)));
                    break;

                case "tcp":
                    channel = (IChannel)(new TcpChannel());//(provider.Port));
                    break;

                default:
                    throw new ArgumentException();
                    break;
            }

            ChannelServices.RegisterChannel(channel, true);

            proxy = (ICrawlWaveServer)Activator.GetObject(
                typeof(ICrawlWaveServer),
                string.Format("{0}://{1}:{2}/CrawlWaveServer.rem", provider.ChannelType, provider.Hostname, provider.Port));
        }
コード例 #3
0
 public static ICrawlWaveServer Instance(ICrawlWaveServerSettingsProvider provider)
 {
     if (instance == null)
     {
         instance = new CrawlWaveServerProxy(provider);
     }
     return(proxy);
 }
コード例 #4
0
 public static ICrawlWaveServer Instance(ICrawlWaveServerSettingsProvider provider)
 {
     if (instance == null)
     {
         instance = new CrawlWaveServerProxy(provider);
     }
     return proxy;
 }