/// <summary>
        /// Creates an MSBuild ProjectElement for a file.
        /// </summary>
        /// <param name="file">The path to the file.</param>
        /// <returns>An instance of the <see cref="ProjectElement"/> class.</returns>
        protected override ProjectElement AddFileToMsBuild(string file)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }

            string itemPath = PackageUtilities.MakeRelativeIfRooted(file, this.BaseURI);

            if (Path.IsPathRooted(itemPath))
            {
                throw new ArgumentException("Cannot add item with full path.", "file");
            }

            ProjectElement newItem = this.CreateMsBuildFileItem(itemPath, ProjectFileConstants.Content);

            if (MultiverseInterfaceProjectNode.IsPythonFile(itemPath))
            {
                newItem.SetMetadata(ProjectFileConstants.SubType, MultiverseInterfaceSubType.Code);
            }
            else if (MultiverseInterfaceProjectNode.IsFrameXmlFile(itemPath))
            {
                newItem.SetMetadata(ProjectFileConstants.SubType, MultiverseInterfaceSubType.Frame);
            }
            else if (MultiverseInterfaceProjectNode.IsTableOfContentsFile(itemPath))
            {
                newItem.SetMetadata(ProjectFileConstants.SubType, MultiverseInterfaceSubType.TableOfContents);
            }

            return(newItem);
        }
        /// <summary>
        /// Creates a WoW project node.
        /// </summary>
        /// <returns>An instance of the <see cref="MultiverseInterfaceProjectNode"/> class.</returns>
        protected override ProjectNode CreateProject()
        {
            // Create the project node instance
            MultiverseInterfaceProjectNode projectNode = new MultiverseInterfaceProjectNode(this.Package as MultiverseInterfaceProjectPackage);

            // Site the project node using the package's service provider
            projectNode.SetSite((IOleServiceProvider)((IServiceProvider)this.Package).GetService(typeof(IOleServiceProvider)));

            // Return the project node
            return projectNode;
        }
Beispiel #3
0
        /// <summary>
        /// Creates a WoW project node.
        /// </summary>
        /// <returns>An instance of the <see cref="MultiverseInterfaceProjectNode"/> class.</returns>
        protected override ProjectNode CreateProject()
        {
            // Create the project node instance
            MultiverseInterfaceProjectNode projectNode = new MultiverseInterfaceProjectNode(this.Package as MultiverseInterfaceProjectPackage);

            // Site the project node using the package's service provider
            projectNode.SetSite((IOleServiceProvider)((IServiceProvider)this.Package).GetService(typeof(IOleServiceProvider)));

            // Return the project node
            return(projectNode);
        }
        /// <summary>
        /// Adds the new file node to hierarchy.
        /// </summary>
        /// <param name="parentNode">The parent node.</param>
        /// <param name="fileName">Name of the file.</param>
        protected override void AddNewFileNodeToHierarchy(HierarchyNode parentNode, string path)
        {
            // If a lua file is being added, try to find a related FrameXML node
            if (MultiverseInterfaceProjectNode.IsPythonFile(path))
            {
                // Try to find a FrameXML node with a matching relational name
                string        fileName  = Path.GetFileNameWithoutExtension(path);
                HierarchyNode childNode = this.FirstChild;

                // Iterate through the children
                while (childNode != null)
                {
                    // If this child is an XML node and its relational name matches, break out of the loop
                    if (childNode is MultiverseInterfaceXmlFileNode && String.Compare(childNode.GetRelationalName(), fileName, StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        parentNode = childNode;
                        break;
                    }

                    // Move over to the next sibling
                    childNode = childNode.NextSibling;
                }
            }

            HierarchyNode child;

            if (this.CanFileNodesHaveChilds && (parentNode is FileNode || parentNode is DependentFileNode))
            {
                child = this.CreateDependentFileNode(path);
                child.ItemNode.SetMetadata(ProjectFileConstants.DependentUpon, parentNode.ItemNode.GetMetadata(ProjectFileConstants.Include));

                // Make sure to set the HasNameRelation flag on the dependent node if it is related to the parent by name
                if (String.Compare(child.GetRelationalName(), parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0)
                {
                    child.HasParentNodeNameRelation = true;
                }
            }
            else
            {
                //Create and add new filenode to the project
                child = this.CreateFileNode(path);
            }

            parentNode.AddChild(child);

            this.Tracker.OnItemAdded(path, VSADDFILEFLAGS.VSADDFILEFLAGS_NoFlags);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="MultiverseInterfaceProjectNodeProperties"/> class.
 /// </summary>
 /// <param name="projectNode">The project node.</param>
 public MultiverseInterfaceProjectNodeProperties(MultiverseInterfaceProjectNode projectNode)
     : base(projectNode)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MultiverseInterfaceProjectNodeProperties"/> class.
 /// </summary>
 /// <param name="projectNode">The project node.</param>
 public MultiverseInterfaceProjectNodeProperties(MultiverseInterfaceProjectNode projectNode)
     : base(projectNode)
 {
 }
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OAWowProject"/> class.
 /// </summary>
 /// <param name="projectNode">The project node.</param>
 internal OAWowProject(MultiverseInterfaceProjectNode projectNode)
     : base(projectNode)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="OAWowProject"/> class.
 /// </summary>
 /// <param name="projectNode">The project node.</param>
 internal OAWowProject(MultiverseInterfaceProjectNode projectNode)
     : base(projectNode)
 {
 }