Exemple #1
0
        private void ReadProcesses(XmlDocument doc)
        {
            XmlNodeList nodes = doc.GetElementsByTagName("Process");
            foreach (XmlNode node in nodes)
            {
                try
                {
                    string name = node.Attributes["Name"].Value;
                    string[] type = node.Attributes["Type"].Value.Split(',');
                    bool suspend = false;
                    if (node.Attributes["Suspend"] != null)
                        suspend = Convert.ToBoolean(node.Attributes["Suspend"].Value);

                    ProcessConfig processConfig = new ProcessConfig(name, type[0].Trim(), type[1].Trim(), suspend);

                    foreach (XmlNode itemNode in node.ChildNodes)
                    {
                        string serviceName = itemNode.Attributes["ServiceName"].Value;
                        string itemName = itemNode.Attributes["ItemName"].Value;
                        processConfig.Items.Add(new ProcessItemConfig(serviceName, itemName));
                    }

                    processes.Add(processConfig);
                }
                catch (Exception e)
                {
                    throw new MCPException("��ʼ��Processes�ڳ�������������ļ���\nԭ��" + e.Message);
                }
            }
        }