コード例 #1
0
        /// <summary>
        /// Loads the Searches described in the MDG file into the includable scripts
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="mdgXmlContent">the string content of the MDG file</param>
        static void LoadMdgSearches(EA.Repository rep, string mdgXmlContent)
        {
            try
            {
                var mdg  = XElement.Parse(mdgXmlContent);


                // get MDG data (ID, Name) 

                string id = "My EA Searches";
                //string name = "";
                //string notes = "";
                XElement documentation = mdg.Element("Documentation");
                // Not part of a MDG
                if (documentation != null)
                {
                    id = documentation.Attribute("id").Value;
                    //name = documentation.Attribute("name").Value;
                    //notes = documentation.Attribute("notes").Value;
                    // check if Technology is enabled
                    if (rep.IsTechnologyEnabled(id) == false && rep.IsTechnologyLoaded(id)) return;

                }

                //----------------------------------------
                // Get all searches
                var searches = from search in mdg.Descendants("Search")
                    select search;
                foreach (XElement search in searches)
                {
                    string searchName = search.Attribute("Name").Value;
                    _staticAllSearches.Add(new EaSearchItem(id, searchName));
                }


            }
            catch (Exception e)
            {
                MessageBox.Show(@"", @"Error in loadMDGScripts: " + e.Message);
            }
        }