Exemple #1
0
        private static void otherException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            if (e.Exception.Source.Trim() != "Infragistics.Win.UltraWinGrid.v3.2")
            {
                ApplicationRun.GetInfoForm().Add("$CS_System_Error:" + e.Exception.Message);

                UserControl.FileLog.FileLogOut("Client.log", e.Exception.Message);
            }
        }
Exemple #2
0
        private void InitMsg()
        {
            if (AgentInfo.Module != null && AgentInfo.Module != string.Empty)
            {
                UserControl.Messages msgs = new UserControl.Messages();

                msgs.Add(new UserControl.Message(UserControl.MessageType.Success, string.Format("MES {0} Agent 启动", AgentInfo.Module)));
                msgs.Add(new UserControl.Message(UserControl.MessageType.Success, string.Format("MES {0} Agent 监控目录为 {1}", AgentInfo.Module, AgentInfo.DirectoryPath)));
                msgs.Add(new UserControl.Message(" "));

                ApplicationRun.GetInfoForm().Add(msgs);
            }
        }
Exemple #3
0
        private void AgentRun()
        {
            CollectExcute collect = new CollectExcute(_domainDataProvider);

            try
            {
                if (AgentInfo.RunStatus == "TRUE")
                {
                    string[] fileList = this.GetFiles(AgentInfo.DirectoryPath);
                    if (fileList != null && fileList.Length > 0)
                    {
                        foreach (string filePath in fileList)
                        {
                            UserControl.Messages collectMessage = collect.Excute(AgentInfo.Module, filePath, AgentInfo.FileEncoding);
                            ApplicationRun.GetInfoForm().Add(collectMessage);                                   //采集信息显示

                            DealFile(filePath);                                                                 //文件处理
                        }
                    }
                }
            }
            catch
            {}
        }
Exemple #4
0
        private void LoadConfigXML()
        {
            try
            {
                //获取当前Agent的类型
                //获取监控文件夹路径
                //获取文件Parser
                //获取文件编码
                string strFile             = Application.StartupPath + "\\WatchFile.xml";
                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                doc.Load(strFile);

                System.Xml.XmlNode node = doc.SelectSingleNode(string.Format("//WatchFile"));
                if (node != null)
                {
                    System.Xml.XmlNodeList selectNodes = node.SelectNodes("WatchFileInfo");
                    if (selectNodes != null && selectNodes.Count > 0)
                    {
                        foreach (System.Xml.XmlNode _childnode in selectNodes)
                        {
                            AgentInfo.RunStatus     = _childnode.Attributes["RunStatus"].Value.Trim().ToUpper();                                        //是否运行
                            AgentInfo.Module        = _childnode.Attributes["Module"].Value.Trim().ToUpper();                                           //模块
                            AgentInfo.DirectoryPath = _childnode.Attributes["DirectoryPath"].Value.Trim();                                              //搜索的文件路径
                            try
                            {
                                int pinterval = int.Parse(_childnode.Attributes["Interval"].Value.Trim());
                                AgentInfo.Interval = pinterval;                                                                 //循环执行的间隔,毫秒(默认值为1000)
                            }
                            catch
                            {
                            }
                            AgentInfo.FileEncoding = _childnode.Attributes["FileEncoding"].Value.Trim();                                        //文件的编码格式

                            // Added by Icyer 2006/08/03
                            if (_childnode.Attributes["SMTLoadItem"] != null)
                            {
                                AgentInfo.SMTLoadItem = (_childnode.Attributes["SMTLoadItem"].Value.Trim().ToUpper() == "TRUE");
                            }

                            // Added by Icyer 2006/08/03
                            if (_childnode.Attributes["AllowGoToMO"] != null)
                            {
                                AgentInfo.AllowGoToMO = (_childnode.Attributes["AllowGoToMO"].Value.Trim().ToUpper() == "TRUE");
                            }
                            // Added end

                            if (AgentInfo.RunStatus == "TRUE")
                            {
                                //获取运行的module
                                break;
                            }
                        }
                    }
                }
                node = null;
            }
            catch
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(UserControl.MessageType.Error, "未找到 WatchFile.xml 配置文件"));
            }
        }