Example #1
0
        public static void Start(string root, bool auto)
        {
            PrepareErrorHandle();

            Directory.CreateDirectory(root);
            //配置初始化
            log4net.Config.XmlConfigurator.Configure();
            //特化的log
            var log = new Log4NetLogger(log4net.LogManager.GetLogger(typeof(Program)));

            Program._log = new AgentHandlerLog(log);

            _loader = new AppDomainLoader(root, Program._log, auto);
            WriteTip("开始扫描发布目录:" + root, true);
            if (!Program._single)
            {
                _loader.Scan();
            }
            else
            {
                _loader.LoadFrom(root);
            }
            WriteTip("扫描完毕", true);

            if (!Convert.ToBoolean(ConfigurationManager.AppSettings["appAgent_enable"]))
            {
                return;
            }

            //激活AppAgent
            WriteTip("启用AppAgent", true);
            new DefaultAgent(log
                             , ConfigurationManager.AppSettings["appAgent_master"]
                             , ConfigurationManager.AppSettings["appAgent_name"]
                             , ConfigurationManager.AppSettings["appAgent_description"]
                             , new CommandHandle())
            .Run();
        }