Пример #1
0
        public virtual ProjectConfiguration Clone(string newName)
        {
            // We don't want to call the constructor here because we may actually be a subclass
            // instead of a pure ProjectConfiguration.
            ProjectConfiguration clonedCopy = (ProjectConfiguration)this.MemberwiseClone();

            // These two member are usually set in the constructor so we'll set them here to
            // simulate the constructor.
            clonedCopy.project = this.Project;
            clonedCopy.name    = newName;

            // Finish the cloning operation.
            this.CloneInto(clonedCopy);

            return(clonedCopy);
        }
Пример #2
0
 public int IndexOf(string name)
 {
     // Do a liner search. We could create a new ProjectConfiguration object and then call
     // InnerList.IndexOf(config), but that means we'd have to have the parent Project in
     // this collection. There will never be more than a few (Debug and Release are the default)
     // configurations anyway, so performance is not an issue.
     for (int i = 0; i < this.Count; i++)
     {
         ProjectConfiguration config = this[i];
         if (String.Equals(name, config.Name, StringComparison.CurrentCultureIgnoreCase))
         {
             return(i);
         }
     }
     return(-1);
 }
		int IVsCfgProvider2.AddCfgsOfCfgName(string pszCfgName, string pszCloneCfgName, int fPrivate)
		{
			Tracer.VerifyStringArgument(pszCfgName, "pszCfgName");

			// If we need to clone, then get the configurtaions to clone.
			if (pszCloneCfgName != null && pszCloneCfgName.Length > 0 && this.ProjectConfigurations.Contains(pszCloneCfgName))
			{
				ProjectConfiguration source = this.ProjectConfigurations[pszCloneCfgName];
				ProjectConfiguration clonedConfig = source.Clone(pszCfgName);
				this.ProjectConfigurations.Add(clonedConfig);
			}
			else
			{
				// Create a new configuration, since there was nothing to clone.
				ProjectConfiguration newConfig = new ProjectConfiguration(this.Project, pszCfgName);
				this.ProjectConfigurations.Add(newConfig);
			}

			return NativeMethods.S_OK;
		}
Пример #4
0
            /// <summary>
            /// Compares two <see cref="ProjectConfiguration"/> objects.
            /// </summary>
            /// <param name="x">The first object to compare.</param>
            /// <param name="y">The second object to compare.</param>
            /// <returns>A negative number if <paramref name="x"/> &lt; <paramref name="y"/>; a positive
            /// number if <paramref name="x"/> &gt; <paramref name="y"/>; zero if <paramref name="x"/>
            /// is equal to <paramref name="y"/>.</returns>
            public int Compare(object x, object y)
            {
                // Null checks
                if (x == null && y == null)
                {
                    return(0);
                }

                if (x != null && y == null)
                {
                    return(-1);
                }

                if (x == null && y != null)
                {
                    return(1);
                }

                // Cast and compare.
                ProjectConfiguration config1 = (ProjectConfiguration)x;
                ProjectConfiguration config2 = (ProjectConfiguration)y;

                return(String.Compare(config1.Name, config2.Name, StringComparison.CurrentCultureIgnoreCase));
            }
        int IVsCfgProvider2.AddCfgsOfCfgName(string pszCfgName, string pszCloneCfgName, int fPrivate)
        {
            Tracer.VerifyStringArgument(pszCfgName, "pszCfgName");

            // If we need to clone, then get the configurtaions to clone.
            if (pszCloneCfgName != null && pszCloneCfgName.Length > 0 && this.ProjectConfigurations.Contains(pszCloneCfgName))
            {
                ProjectConfiguration source = this.ProjectConfigurations[pszCloneCfgName];
                ProjectConfiguration clonedConfig = source.Clone(pszCfgName);
                this.ProjectConfigurations.Add(clonedConfig);
            }
            else
            {
                // Create a new configuration, since there was nothing to clone.
                ProjectConfiguration newConfig = new ProjectConfiguration(this.Project, pszCfgName);
                this.ProjectConfigurations.Add(newConfig);
            }

            return NativeMethods.S_OK;
        }
 //==========================================================================================
 // Constructors
 //==========================================================================================
 public BuildableProjectConfiguration(ProjectConfiguration projectConfiguration)
 {
     Tracer.VerifyNonNullArgument(projectConfiguration, "projectConfiguration");
     this.projectConfiguration = projectConfiguration;
 }
        //==========================================================================================
        // Constructors
        //==========================================================================================

        public BuildableProjectConfiguration(ProjectConfiguration projectConfiguration)
        {
            Tracer.VerifyNonNullArgument(projectConfiguration, "projectConfiguration");
            this.projectConfiguration = projectConfiguration;
        }
Пример #8
0
 /// <summary>
 /// Writes the &lt;Configuration&gt; node for the specified configuration.
 /// </summary>
 /// <param name="writer">The <see cref="ProjectFileXmlWriter"/> to use.</param>
 /// <param name="configuration">The project configuration to write.</param>
 protected void WriteConfigurationNode(ProjectFileXmlWriter writer, ProjectConfiguration configuration)
 {
     writer.WriteStartElement(ElementNames.Configuration);
     writer.WriteAttributeString(AttributeNames.Name, configuration.Name);
     writer.WriteAttributeString(AttributeNames.RelativeOutputDirectory, configuration.RelativeOutputDirectory);
     writer.WriteAttributeString(AttributeNames.RelativeIntermediateDirectory, configuration.RelativeIntermediateDirectory);
     writer.WriteEndElement();
 }
 protected override void CloneInto(ProjectConfiguration clonedCopy)
 {
     Tracer.Assert(clonedCopy is WixProjectConfiguration, "We shouldn't be cloning something we're not.");
     base.CloneInto(clonedCopy);
     WixProjectConfiguration wixClonedCopy = clonedCopy as WixProjectConfiguration;
     if (wixClonedCopy != null)
     {
         wixClonedCopy.candleSettings = (CandleSettings)this.candleSettings.Clone();
         wixClonedCopy.lightSettings = (LightSettings)this.lightSettings.Clone();
     }
 }
Пример #10
0
 /// <summary>
 /// Reads the &lt;Configuration&gt; node's children.
 /// </summary>
 /// <param name="configurationNode">The parent &lt;Configuration&gt; <see cref="XmlNode"/> to read.</param>
 /// <param name="projectConfiguration">The <see cref="ProjectConfiguration"/> to use.</param>
 /// <returns>true if the node was read correctly; otherwise, false.</returns>
 protected virtual bool ReadConfigurationChildrenNodes(XmlNode configurationNode, ProjectConfiguration projectConfiguration)
 {
     return true;
 }
 /// <summary>
 /// Reads the &lt;Configuration&gt; node's children.
 /// </summary>
 /// <param name="configurationNode">The parent &lt;Configuration&gt; <see cref="XmlNode"/> to read.</param>
 /// <returns>true if the node was read correctly; otherwise, false.</returns>
 protected override bool ReadConfigurationChildrenNodes(XmlNode configurationNode, ProjectConfiguration projectConfiguration)
 {
     // TODO: Read the candle and light settings.
     return base.ReadConfigurationChildrenNodes(configurationNode, projectConfiguration);
 }
Пример #12
0
 /// <summary>
 /// Reads the &lt;Configuration&gt; node's children.
 /// </summary>
 /// <param name="configurationNode">The parent &lt;Configuration&gt; <see cref="XmlNode"/> to read.</param>
 /// <param name="projectConfiguration">The <see cref="ProjectConfiguration"/> to use.</param>
 /// <returns>true if the node was read correctly; otherwise, false.</returns>
 protected virtual bool ReadConfigurationChildrenNodes(XmlNode configurationNode, ProjectConfiguration projectConfiguration)
 {
     return(true);
 }
        //==========================================================================================
        // Methods
        //==========================================================================================
        /// <summary>
        /// Adds a <see cref="ProjectConfiguration"/> to the collection.
        /// </summary>
        /// <param name="configuration">The <see cref="ProjectConfiguration"/> to add to the collection.</param>
        public void Add(ProjectConfiguration configuration)
        {
            Tracer.VerifyNonNullArgument(configuration, "configuration");

            // TODO: Finish
            this.InnerList.Add(configuration);
        }
        /// <summary>
        /// Provides a way for subclasses to pass in an already-created, more specific <see cref="ProjectConfiguration"/> to clone.
        /// </summary>
        /// <param name="clonedCopy">The <see cref="ProjectConfiguration"/> to clone into.</param>
        protected virtual void CloneInto(ProjectConfiguration clonedCopy)
        {
            clonedCopy.buildableProjectConfiguration = null;
            clonedCopy.relativeOutputDirectory = this.relativeOutputDirectory;

            if (this.IsDirty)
            {
                clonedCopy.MakeDirty();
            }
            else
            {
                clonedCopy.ClearDirty();
            }
        }