Exemple #1
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="cfg">初始化使用的配置</param>
        private void Initialize(Config cfg)
        {
            if (_isInitialized)
            {
                throw new InvalidOperationException("already initialized.");
            }

            System.Diagnostics.Debug.WriteLine("IPMClient 开始初始化...端口:" + cfg.Port.ToString());

            _context = SynchronizationContext.Current;
            SynchronizationContext = SynchronizationContext.Current;

            LocalAddresses = Helper.GetLocalAddresses();

            this.Config = cfg;

            if (cfg.BindedIP == null)
            {
                cfg.BindedIP = IPAddress.Any;
            }


            //开始构造对象
            Commander = new CommandExecutor(this);
            Commander.Init();

            //初始化插件
            InitializeServiceProvider();

            //初始化调试器
            Debugger = new Debug.DebugHelper();
            Debugger.AttachHelperAuto(this);

            this._isInitialized = Commander.IsInitialized;
        }
Exemple #2
0
		/// <summary>
		/// 初始化
		/// </summary>
		/// <param name="cfg">初始化使用的配置</param>
		private void Initialize(Config cfg)
		{
			if (_isInitialized) throw new InvalidOperationException("already initialized.");

			System.Diagnostics.Debug.WriteLine("IPMClient 开始初始化...端口:" + cfg.Port.ToString());

			_context = SynchronizationContext.Current;
			SynchronizationContext = SynchronizationContext.Current;

			LocalAddresses = Helper.GetLocalAddresses();

			this.Config = cfg;

			if (cfg.BindedIP == null) cfg.BindedIP = IPAddress.Any;


			//开始构造对象
			Commander = new CommandExecutor(this);
			Commander.Init();

			//初始化插件
			InitializeServiceProvider();

			//初始化调试器
			Debugger = new Debug.DebugHelper();
			Debugger.AttachHelperAuto(this);

			this._isInitialized = Commander.IsInitialized;
		}