Inheritance: BaseProtocolFactory
示例#1
0
 public MainWindow()
 {
     InitializeComponent();
     IOHandlerManager.Initialize();
     var protocolFactory = new DefaultProtocolFactory();
     protocolFactory.RegisterProtocolFactory();
     ClientApp.RegisterApplication();
     listBox.ItemsSource = DownloadList;
     var _speedTimer = new DispatcherTimer(TimeSpan.FromSeconds(1),DispatcherPriority.Normal, _speedTimer_Elapsed, Dispatcher);
     _speedTimer.Start();
     ClientApp.RegisterAppProtocolHandler(ProtocolTypes.PT_OUTBOUND_RTMP,new BaseRTMPAppProtocolHandler(Variant.Get()));
 }
示例#2
0
        private static bool Initialize()
        {
            LoggingExtensions.Logging.Log.InitializeWith<LoggingExtensions.log4net.Log4NetLog>();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            _configFile.Log().Info("Server Start!");
            if (!_configFile.LoadConfigFile())
            {
                Logger.FATAL("Unable to load ConfigFile!");
                return false;
            }

            Logger.INFO("Initialize I/O handlers manager");
            IOHandlerManager.Initialize();
            if (!_configFile.ConfigModules())
            {
                Logger.FATAL("Unable to configure modules");
                return false;
            }
            Logger.INFO("Plug in the default protocol factory");
            _protocolFactory = new DefaultProtocolFactory();
            if (!_protocolFactory.RegisterProtocolFactory())
            {
                Logger.FATAL("Unable to register default protocols factory");
                return false;
            }
            Logger.INFO("Configure factories");
            if (!_configFile.ConfigFactories())
            {
                Logger.FATAL("Unable to configure factories");
                return false;
            }
            Logger.INFO("Configure acceptors");
            if (!_configFile.ConfigAcceptors())
            {
                Logger.FATAL("Unable to configure acceptors");
                return false;
            }

            Logger.INFO("Configure instances");
            if (!_configFile.ConfigInstances())
            {
                Logger.FATAL("Unable to configure instances");
                return false;
            }

            Logger.INFO("Start I/O handlers manager");
            IOHandlerManager.Start();

            Logger.INFO("Configure applications");
            if (!_configFile.ConfigApplications())
            {
                Logger.FATAL("Unable to configure applications");
                return false;
            }

            //Logger.INFO("Install the quit signal");
            //installQuitSignal(QuitSignalHandler);

            return true;
        }