Example #1
0
 internal static TypeModel BuildTypeModel(XmlNode node, string documentUri)
 {
     return(new TypeModel
     {
         Name = XmlNodeHelper.GetNodeAttributeValue(node, "Name"),
         Kind = (Kinds)Enum.Parse(typeof(Kinds), XmlNodeHelper.GetNodeAttributeValue(node, "Kind")),
         Accessibility = (Accessibilities)Enum.Parse(typeof(Accessibilities), XmlNodeHelper.GetNodeAttributeValue(node, "Accessibility")),
         ExternallyVisible = Convert.ToBoolean(XmlNodeHelper.GetNodeAttributeValue(node, "ExternallyVisible"))
     });
 }
Example #2
0
        internal static void BuildMessageModel(MessageModel messageModel, XmlNode node)
        {
            messageModel.Id          = XmlNodeHelper.GetNodeAttributeValue(node, "Id");
            messageModel.Category    = XmlNodeHelper.GetNodeAttributeValue(node, "Category");
            messageModel.CheckId     = XmlNodeHelper.GetNodeAttributeValue(node, "CheckId");
            messageModel.TypeName    = XmlNodeHelper.GetNodeAttributeValue(node, "TypeName");
            messageModel.FixCategory = (FixCategories)Enum.Parse(typeof(FixCategories), XmlNodeHelper.GetNodeAttributeValue(node, "FixCategory"));
            messageModel.Status      = (Statuses)Enum.Parse(typeof(Statuses), XmlNodeHelper.GetNodeAttributeValue(node, "Status"));

            messageModel.Issue = IssueModelHelper.BuildIssueModel(messageModel, node.FirstChild);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="messageModel"></param>
        /// <param name="issue"></param>
        /// <returns></returns>
        internal static IssueModel BuildIssueModel(MessageModel messageModel, XmlNode issue)
        {
            var issueModel = new IssueModel(messageModel)
            {
                Certainty = Convert.ToInt32(XmlNodeHelper.GetNodeAttributeValue(issue, "Certainty")),
                Level     = (Levels)Enum.Parse(typeof(Levels), XmlNodeHelper.GetNodeAttributeValue(issue, "Level") ?? "None"),
                Name      = XmlNodeHelper.GetNodeAttributeValue(issue, "Name") ?? "No Issue Name",
                Path      = XmlNodeHelper.GetNodeAttributeValue(issue, "Path"),
                File      = XmlNodeHelper.GetNodeAttributeValue(issue, "File"),
                Line      = Convert.ToInt32(XmlNodeHelper.GetNodeAttributeValue(issue, "Line") ?? "0"),
                Text      = issue?.InnerText
            };

            return(issueModel);
        }
        /// <summary>
        /// Generates the list of "TargetModels" for the tree view "Target" for the specified document
        /// </summary>
        /// <param name="xmlDocument">The xml document that has the list of data</param>
        /// <param name="count"></param>
        internal static List <MessageModel> GenerateTargetTreeList(XmlDocument xmlDocument, ref int count)
        {
            var messageModels = new List <MessageModel>();
            var targets       = xmlDocument.GetElementsByTagName("Target");

            foreach (XmlNode target in targets)
            {
                foreach (XmlNode module in target.SelectNodes("Modules/Module"))
                {
                    messageModels.AddRange(XmlNodeHelper.NodeListHelper(module, ref count));
                }
            }

            return(messageModels);
        }
        internal static IReadOnlyCollection <MessageModel> SetupNamespaceList(XmlNodeList namespaces, ref int count)
        {
            var messageModels = new List <MessageModel>(namespaces.Count);

            foreach (XmlNode @namespace in namespaces)
            {
                var namespaceModel = new NamespaceModel
                {
                    Name = XmlNodeHelper.GetNodeAttributeValue(@namespace, "Name")
                };

                // Get the list of messages
                messageModels.AddRange(MessageModelHelper.BuildListOfMessages(@namespace, namespaceModel, ref count));

                var list = XmlNodeHelper.NodeListHelper(@namespace, ref count);

                messageModels.AddRange(list);
            }

            return(messageModels);
        }