<commit_before>﻿using System;
using System.Collections.Generic;
using System.Xml;

namespace ModAnalyzer.Domain {
    /// <summary>
    /// TODO
    /// </summary>
    public class FomodPlugin {
        public string GroupType { get; set; }
        public int SiblingCount { get; set; }
        public string Name { get; set; }
        public List<FomodFile> Files { get; }
        public List<FomodFlag> Flags { get; }

        public FomodPlugin(XmlNode node) {
            XmlNode groupNode = node.ParentNode.ParentNode;
            if (groupNode != null) {
                XmlAttribute typeAttribute = groupNode.Attributes["type"];
                if (typeAttribute != null) {
                    GroupType = typeAttribute.Value;
                }
                SiblingCount = groupNode.ChildNodes.Count - 1;
            }

            XmlAttribute nameAttribute = node.Attributes["name"];
            if (nameAttribute != null) {
                Name = nameAttribute.Value;
            }

            XmlNode filesNode = node["files"];
            Files = (filesNode == null) ? new List<FomodFile>() : FomodFile.FromNodes(filesNode.ChildNodes);

            XmlNode flagsNode = node["conditionFlags"];
            Flags = (flagsNode == null) ? new List<FomodFlag>() : FomodFlag.FromNodes(flagsNode.ChildNodes);
        }

        public static List<FomodPlugin> FromDocument(XmlDocument doc) {
            List<FomodPlugin> plugins = new List<FomodPlugin>();
            foreach (XmlNode node in doc.GetElementsByTagName("plugin")) {
                plugins.Add(new FomodPlugin(node));
            }
            return plugins;
        }

        public bool HasSiblings() {<commit_msg>now appending group name to fomod option names<commit_after>﻿using System;
using System.Collections.Generic;
using System.Xml;

namespace ModAnalyzer.Domain {
    /// <summary>
    /// TODO
    /// </summary>
    public class FomodPlugin {
        public string GroupType { get; set; }
        public int SiblingCount { get; set; }
        public string Name { get; set; }
        public List<FomodFile> Files { get; }
        public List<FomodFlag> Flags { get; }

        public FomodPlugin(XmlNode node) {
            XmlAttribute nameAttribute = node.Attributes["name"];
            if (nameAttribute != null) {
                Name = nameAttribute.Value;
            }

            XmlNode groupNode = node.ParentNode.ParentNode;
            if (groupNode != null) {
                // parse group information for determining whether or not the mod option is default
                XmlAttribute typeAttribute = groupNode.Attributes["type"];
                if (typeAttribute != null) {
                    GroupType = typeAttribute.Value;
                }
                SiblingCount = node.ParentNode.ChildNodes.Count - 1;

                // append group name to plugin name
                nameAttribute = groupNode.Attributes["name"];
                if (nameAttribute != null) {
                    Name = nameAttribute.Value + " - " + Name;
                }
            }

            XmlNode filesNode = node["files"];
            Files = (filesNode == null) ? new List<FomodFile>() : FomodFile.FromNodes(filesNode.ChildNodes);

            XmlNode flagsNode = node["conditionFlags"];
            Flags = (flagsNode == null) ? new List<FomodFlag>() : FomodFlag.FromNodes(flagsNode.ChildNodes);
        }

        public static List<FomodPlugin> FromDocument(XmlDocument doc) {
            List<FomodPlugin> plugins = new List<FomodPlugin>();
            foreach (XmlNode node in doc.GetElementsByTagName("plugin")) {
                plugins.Add(new FomodPlugin(node));
            }
            return plugins;
        }

        public bool HasSiblings() {
{'fraction_non_alphanumeric': 0.1009028146574615, 'fraction_numerical': 0.0005310674455655868, 'mean_word_length': 1.9156346749226005, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2865713', 'n_tokens_mistral': 1009, 'n_tokens_neox': 940, 'n_words': 242}