public ProcessWatcher(string args, string _pipeName) { DeamonBase.Instance().CreatePipe(_pipeName); DeamonBase.Instance().StartMonitor(); try { //读取监控进程全路径 string strProcessAddress = args;//ConfigurationManager.AppSettings["ProcessAddress"].ToString(); if (strProcessAddress.Trim() != "") { this._processAddress = strProcessAddress.Split(','); } else { throw new Exception("读取配置档ProcessAddress失败,ProcessAddress为空!"); } //创建日志目录 this._logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "WatcherLog"); if (!Directory.Exists(_logPath)) { Directory.CreateDirectory(_logPath); } } catch (Exception ex) { this.SaveLog("Watcher()初始化出错!错误描述为:" + ex.Message.ToString()); } }
public static DeamonBase Instance() { if (m_instance == null) { m_instance = new DeamonBase(); } return(m_instance); }