void SetCustomDiag()

in DiagManager/DiagClasses/ConfigFileMgr.cs [323:375]


        void SetCustomDiag(XmlNode node)
        {

   

            // if SQL Xevent needs to be captured
            if (m_Setting[Res.CollectXEvent] == "true")
            {
                DiagCategory XEventGroup = DiagFactory.GetCustomGroup(null, @"Templates\CustomDiagnostics_Xevent.xml");
                //need to manuall handle taskname "Add File Target" for file size and file count
                DiagItem taskItem = XEventGroup.DiagEventList.Find(x => x.Name == "Add File Target"); // for CustomTask Name is the same as TaskName
                CustomTask task = taskItem as CustomTask;
                task.Cmd = task.Cmd.Replace("1024x", m_Setting[Res.XEventMaxFileSize]).Replace("5x", m_Setting[Res.XEventFileCount]);
                //manually check events for special handling
                XEventGroup.CheckEvents(true);
                m_Setting.CustomDiagCategoryList.Add(XEventGroup);
            }


            //speical handling Analysis Service (A_S)
            string customDiagxml = m_Setting.CustomDiagCategoryList.GetCategoryXml();
            if (m_Setting[Res.Feature] == "AS")
            {
                string ServerInstance = string.Empty;
                string instance = string.Empty;
                string InstanceName = m_Setting[Res.InstanceName];
                string MachineName =  m_Setting[Res.MachineName];
                string ASTraceFileName = string.Empty;


                if (!(InstanceName.ToUpper() == "MSSQLSERVER"))
                {
                    ServerInstance = MachineName + @"\" + InstanceName;
                    ASTraceFileName = MachineName + "_" + InstanceName;

                }
                else
                {
                    ServerInstance = MachineName;
                    ASTraceFileName = MachineName;
                }


                customDiagxml=customDiagxml.Replace("ASSERVERINSTANCE", ServerInstance);
                customDiagxml = customDiagxml.Replace("ASTraceFileName", ASTraceFileName);
                

            }

            node.InnerXml = customDiagxml;

            //CustomDiagnosticsNode.InnerXml = DiagTreeMgr.GetXmlText(tv_CustomDiag); 
        }