<commit_before>// <copyright file="ProjectTool.cs" company="<NAME>">
//  Opus package
// </copyright>
// <summary>VSSolutionBuilder package</summary>
// <author><NAME></author>
namespace VSSolutionBuilder
{
    public sealed class ProjectTool
    {
        System.Collections.Generic.Dictionary<string, string> attributes = new System.Collections.Generic.Dictionary<string, string>();

        public ProjectTool(string name)
        {
            this.attributes.Add("Name", name);
        }

        public string Name
        {
            get
            {
                return this.attributes["Name"];
            }
        }

        public string this[string key]
        {
            get
            {
                return this.attributes[key];
            }

            set
            {
                this.attributes[key] = value;
            }
        }

        public void AddAttribute(string name, string value)
        {
            this.attributes.Add(name, value);
        }

        public bool HasAttribute(string name)
        {
            bool hasAttribute = this.attributes.ContainsKey(name);
            return hasAttribute;
        }

        public int AttributeCount
        {
            get
            {
                int count = this.attributes.Count;
                return count;
            }
        }

        public override bool Equals(object o)
        {
            ProjectTool tool = o as ProjectTool;

            if (this.attributes.Count != tool.attributes.Count)
            {
                // this can happen when source files are excluded from a configuration
                return false;
            }

            foreach (System.Collections.Generic.KeyValuePair<string, string> attribute in this.attributes)
            {
                if (!tool.HasAttribute(attribute.Key))
                {
                    //Core.Log.Message("Attribute '{0}' is not present in both ProjectTools '{1}'", attribute.Key, this.Name);
                    return false;
                }

                if (attribute.Value != tool[attribute.Key])
                {
                    //Core.Log.Message("Attribute '{0}' is different: '{1}' vs '{2}'", attribute.Key, attribute.Value, tool[attribute.Key]);
                    return false;
                }
            }

            return true;
        }

        // need to override this because Equals is overridden
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public System.Xml.XmlElement Serialize(System.Xml.XmlDocument document, ProjectConfiguration configuration, System.Uri projectUri)
        {
            string projectName = configuration.Project.Name;
            string outputDirectory = configuration.OutputDirectory;
            string intermediateDirectory = configuration.IntermediateDirectory;

            System.Xml.XmlElement toolElement = document.CreateElement("Tool");

            foreach (System.Collections.Generic.KeyValuePair<string, string> attribute in this.attributes)
            {
                if (System.String.IsNullOrEmpty(attribute.Value))
                {
                    continue;
                }

                // TODO: need to fix the ObjectFileName reference so that it's per object file
                string value = VSSolutionBuilder.RefactorPathForVCProj(attribute.Value, outputDirectory, intermediateDirectory, projectName, projectUri);
                toolElement.SetAttribute(attribute.Key, value);
            }

            return toolElement;
        }

        public System.Xml.XmlElement Serialize(System.Xml.XmlDocument document, ProjectFileConfiguration configuration, System.Uri projectUri, ProjectTool parent)
        {
            string projectName = configuration.Configuration.Project.Name;
            string outputDirectory = configuration.Configuration.OutputDirectory;
            string intermediateDirectory = configuration.Configuration.IntermediateDirectory;

            System.Xml.XmlElement toolElement = document.CreateElement("Tool");

            foreach (System.Collections.Generic.KeyValuePair<string, string> attribute in this.attributes)
            {
                // this is necessary in case the parent (from the ProjectConfiguration) is
                // a C interface, while the ProjectFileConfiguration tool is C++
                if ((parent != null) && (parent.HasAttribute(attribute.Key)))
                {
                    string thisValue = attribute.Value;
                    string parentValue = parent[attribute.Key];

                    if ("Name" == attribute.Key || thisValue != parentValue)
                    {
                        thisValue = VSSolutionBuilder.RefactorPathForVCProj(thisValue, outputDirectory, intermediateDirectory, projectName, projectUri);
                        toolElement.SetAttribute(attribute.Key, thisValue);
                    }
                }
                else
                {
                    string value = VSSolutionBuilder.RefactorPathForVCProj(attribute.Value, outputDirectory, intermediateDirectory, projectName, projectUri);
                    toolElement.SetAttribute(attribute.Key, value);
                }
            }

            return toolElement;
        }

        public void SerializeMSBuild(MSBuildItemDefinitionGroup itemDefGroup, ProjectConfiguration configuration, System.Uri projectUri)
        {
            string projectName = configuration.Project.Name;
            string outputDirectory = configuration.OutputDirectory;
            string intermediateDirectory = configuration.IntermediateDirectory;

            string toolElementName = null;
            switch (this.Name)
            {
                case "VCCLCompilerTool":
                    toolElementName = "ClCompile";
                    break;

                case "VCLibrarianTool":
                    toolElementName = "Lib";
                    break;

                case "VCLinkerTool":
                    toolElementName = "Link";<commit_msg>[trunk] Temporarily do not output the ObjectFile attribute to a vcproj tool. Otherwise, you send up with all source files writing to the same object file. There needs to be some more work done on the VSSolutionBuilder's intersected option collections<commit_after>// <copyright file="ProjectTool.cs" company="<NAME>">
//  Opus package
// </copyright>
// <summary>VSSolutionBuilder package</summary>
// <author><NAME></author>
namespace VSSolutionBuilder
{
    public sealed class ProjectTool
    {
        System.Collections.Generic.Dictionary<string, string> attributes = new System.Collections.Generic.Dictionary<string, string>();

        public ProjectTool(string name)
        {
            this.attributes.Add("Name", name);
        }

        public string Name
        {
            get
            {
                return this.attributes["Name"];
            }
        }

        public string this[string key]
        {
            get
            {
                return this.attributes[key];
            }

            set
            {
                this.attributes[key] = value;
            }
        }

        public void AddAttribute(string name, string value)
        {
            this.attributes.Add(name, value);
        }

        public bool HasAttribute(string name)
        {
            bool hasAttribute = this.attributes.ContainsKey(name);
            return hasAttribute;
        }

        public int AttributeCount
        {
            get
            {
                int count = this.attributes.Count;
                return count;
            }
        }

        public override bool Equals(object o)
        {
            ProjectTool tool = o as ProjectTool;

            if (this.attributes.Count != tool.attributes.Count)
            {
                // this can happen when source files are excluded from a configuration
                return false;
            }

            foreach (System.Collections.Generic.KeyValuePair<string, string> attribute in this.attributes)
            {
                if (!tool.HasAttribute(attribute.Key))
                {
                    //Core.Log.Message("Attribute '{0}' is not present in both ProjectTools '{1}'", attribute.Key, this.Name);
                    return false;
                }

                if (attribute.Value != tool[attribute.Key])
                {
                    //Core.Log.Message("Attribute '{0}' is different: '{1}' vs '{2}'", attribute.Key, attribute.Value, tool[attribute.Key]);
                    return false;
                }
            }

            return true;
        }

        // need to override this because Equals is overridden
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public System.Xml.XmlElement Serialize(System.Xml.XmlDocument document, ProjectConfiguration configuration, System.Uri projectUri)
        {
            string projectName = configuration.Project.Name;
            string outputDirectory = configuration.OutputDirectory;
            string intermediateDirectory = configuration.IntermediateDirectory;

            System.Xml.XmlElement toolElement = document.CreateElement("Tool");

            foreach (System.Collections.Generic.KeyValuePair<string, string> attribute in this.attributes)
            {
                if (System.String.IsNullOrEmpty(attribute.Value))
                {
                    continue;
                }

                // TODO: need to fix the ObjectFileName reference so that it's per object file
                if ("ObjectFile" == attribute.Key)
                {
                    continue;
                }

                string value = VSSolutionBuilder.RefactorPathForVCProj(attribute.Value, outputDirectory, intermediateDirectory, projectName, projectUri);
                toolElement.SetAttribute(attribute.Key, value);
            }

            return toolElement;
        }

        public System.Xml.XmlElement Serialize(System.Xml.XmlDocument document, ProjectFileConfiguration configuration, System.Uri projectUri, ProjectTool parent)
        {
            string projectName = configuration.Configuration.Project.Name;
            string outputDirectory = configuration.Configuration.OutputDirectory;
            string intermediateDirectory = configuration.Configuration.IntermediateDirectory;

            System.Xml.XmlElement toolElement = document.CreateElement("Tool");

            foreach (System.Collections.Generic.KeyValuePair<string, string> attribute in this.attributes)
            {
                if (System.String.IsNullOrEmpty(attribute.Value))
                {
                    continue;
                }

                // No ObjectFile either, as this will be in the common area
                if (("Name" != attribute.Key) &&
                    ("ObjectFile" != attribute.Key))
                {
                    string value = attribute.Value;
                    value = VSSolutionBuilder.RefactorPathForVCProj(value, outputDirectory, intermediateDirectory, projectName, projectUri);
                    toolElement.SetAttribute(attribute.Key, value);
                }
            }

            return toolElement;
        }

        public void SerializeMSBuild(MSBuildItemDefinitionGroup itemDefGroup, ProjectConfiguration configuration, System.Uri projectUri)
        {
            string projectName = configuration.Project.Name;
            string outputDirectory = configuration.OutputDirectory;
            string intermediateDirectory = configuration.IntermediateDirectory;

            string toolElementName = null;
            switch (this.Name)
            {
                case "VCCLCompilerTool":
                    toolElementName = "ClCompile";
                    break;

                case "VCLibrarianTool":
                    toolElementName = "Lib";
                    break;

                case "VCLinkerTool":
                    toolElementName = "Link";
{'fraction_non_alphanumeric': 0.07871021083092186, 'fraction_numerical': 0.0008267879288962381, 'mean_word_length': 1.6666666666666667, 'pattern_counts': {'":': 6, '<': 29, '<?xml version=': 0, '>': 29, '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': '4550648', 'n_tokens_mistral': 2739, 'n_tokens_neox': 2578, 'n_words': 657}