Inheritance: IVsCfg, IVsProjectCfg, IVsProjectCfg2, IVsProjectFlavorCfg, IVsDebuggableProjectCfg, ISpecifyPropertyPages, IVsSpecifyProjectDesignerPages, IVsCfgBrowseObject
コード例 #1
0
        public ProjectConfigProperties(ProjectConfig projectConfig)
        {
            if (projectConfig == null)
                throw new ArgumentNullException("projectConfig");

            this._projectConfig = projectConfig;
        }
コード例 #2
0
ファイル: OutputGroup.cs プロジェクト: ldematte/BlenXVSP
        /// <summary>
        /// Constructor for IVSOutputGroup2 implementation
        /// </summary>
        /// <param name="outputName">Name of the output group. See VS_OUTPUTGROUP_CNAME_Build in vsshell.idl for the list of standard values</param>
        /// <param name="msBuildTargetName">MSBuild target name</param>
        /// <param name="projectManager">Project that produce this output</param>
        /// <param name="configuration">Configuration that produce this output</param>
        public OutputGroup(string outputName, string msBuildTargetName, ProjectNode projectManager, ProjectConfig configuration)
        {
            if(outputName == null)
                throw new ArgumentNullException("outputName");
            if(msBuildTargetName == null)
                throw new ArgumentNullException("outputName");
            if(projectManager == null)
                throw new ArgumentNullException("projectManager");
            if(configuration == null)
                throw new ArgumentNullException("configuration");

            name = outputName;
            targetName = msBuildTargetName;
            project = projectManager;
            projectCfg = configuration;
        }
コード例 #3
0
ファイル: OutputGroup.cs プロジェクト: yuva2achieve/dot42
        /// <summary>
        /// Constructor for IVSOutputGroup2 implementation
        /// </summary>
        /// <param name="outputName">Name of the output group. See VS_OUTPUTGROUP_CNAME_Build in vsshell.idl for the list of standard values</param>
        /// <param name="msBuildTargetName">MSBuild target name</param>
        /// <param name="projectManager">Project that produce this output</param>
        /// <param name="configuration">Configuration that produce this output</param>
        public OutputGroup(string outputName, string msBuildTargetName, ProjectNode projectManager, ProjectConfig configuration)
        {
            if (outputName == null)
            {
                throw new ArgumentNullException("outputName");
            }
            if (msBuildTargetName == null)
            {
                throw new ArgumentNullException("outputName");
            }
            if (projectManager == null)
            {
                throw new ArgumentNullException("projectManager");
            }
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            name       = outputName;
            targetName = msBuildTargetName;
            project    = projectManager;
            projectCfg = configuration;
        }
コード例 #4
0
 public NodeBuildableProjectConfig(ProjectConfig config)
     : base(config)
 {
 }
コード例 #5
0
 public NemerleProjectConfigProperties(ProjectConfig projectConfig)
 {
     _projectConfig = projectConfig;
 }
コード例 #6
0
ファイル: ProjectConfig.cs プロジェクト: rsdn/nemerle
 public BuildableProjectConfig(ProjectConfig config)
 {
     this.config = config;
     this.buildManagerAccessor = (IVsBuildManagerAccessor)this.config.ProjectMgr.GetService(typeof(SVsBuildManagerAccessor));
 }
コード例 #7
0
        /// <summary>
        /// The environment calls this to set the currently selected objects that the property page should show.
        /// </summary>
        /// <param name="cObjects">The count of elements in <paramref name="ppunk"/>.</param>
        /// <param name="ppunk">An array of <b>IUnknown</b> objects to show in the property page.</param>
        /// <remarks>We are supposed to cache these objects until we get another call with
        /// <paramref name="cObjects"/> = 0.  Also, the environment is supposed to call this before calling
        /// <see cref="IPropertyPage.Activate"/>, but don't count on it.</remarks>
        void IPropertyPage.SetObjects(uint cObjects, object[] ppunk)
        {
            if(cObjects == 0)
            {
                this.ProjectMgr = null;
                return;
            }

            if(ppunk[0] is ProjectConfig)
            {
                List<ProjectConfig> configs = new List<ProjectConfig>();

                for(int i = 0; i < cObjects; i++)
                {
                    ProjectConfig config = (ProjectConfig)ppunk[i];

                    if(this.ProjectMgr == null)
                        this.ProjectMgr = config.ProjectMgr;

                    configs.Add(config);
                }

                this.ProjectConfigs = new ReadOnlyCollection<ProjectConfig>(configs);
            }
            else
                if(ppunk[0] is NodeProperties)
                {
                    if(this.ProjectMgr == null)
                        this.ProjectMgr = (ppunk[0] as NodeProperties).Node.ProjectMgr;

                    Dictionary<string, ProjectConfig> configsMap = new Dictionary<string, ProjectConfig>();

                    for(int i = 0; i < cObjects; i++)
                    {
                        NodeProperties property = (NodeProperties)ppunk[i];
                        IVsCfgProvider provider;
                        ErrorHandler.ThrowOnFailure(property.Node.ProjectMgr.GetCfgProvider(out provider));
                        uint[] expected = new uint[1];
                        ErrorHandler.ThrowOnFailure(provider.GetCfgs(0, null, expected, null));

                        if(expected[0] > 0)
                        {
                            ProjectConfig[] configs = new ProjectConfig[expected[0]];
                            uint[] actual = new uint[1];
                            provider.GetCfgs(expected[0], configs, actual, null);

                            foreach(ProjectConfig config in configs)
                                if(!configsMap.ContainsKey(config.ConfigName))
                                    configsMap.Add(config.ConfigName, config);
                        }
                    }

                    if(configsMap.Count > 0)
                        this.ProjectConfigs = new ReadOnlyCollection<ProjectConfig>(configsMap.Values.ToArray());
                }

            if(!this.IsDisposed && this.ProjectMgr != null)
            {
                this.BindProperties(this.Controls);
                this.IsDirty = false;
            }
        }
コード例 #8
0
ファイル: ProjectConfig.cs プロジェクト: Rfvgyhn/Boo-Plugin
 public BuildableProjectConfig(ProjectConfig config)
 {
     this.config = config;
 }
コード例 #9
0
 private void SetProjectConfig()
 {
     object[] ppUnk = new object[2];
     ProjectConfig config = new ProjectConfig(projectNode, "manualSetConfig", "manualSetPlatform");
     ppUnk[0] = config;
     generalPropertyPage.SetObjects(1, ppUnk);
 }
コード例 #10
0
ファイル: CustomPropertyPage.cs プロジェクト: Orvid/Cosmos
    void IPropertyPage.SetObjects(uint count, object[] punk) {
      if (count > 0) {
        if (punk[0] is ProjectConfig) {
          ArrayList configs = new ArrayList();
          for (int i = 0; i < count; i++) {
            ProjectConfig config = (ProjectConfig)punk[i];
            if (_projectMgr == null) {
              _projectMgr = config.ProjectMgr;
            }
            configs.Add(config);
          }
          _projectConfigs = (ProjectConfig[])configs.ToArray(typeof(ProjectConfig));

          // For ProjectNodes we will get one of these
        } else if (punk[0] is NodeProperties) {
          if (_projectMgr == null) {
            _projectMgr = (punk[0] as NodeProperties).Node.ProjectMgr;
          }

          Dictionary<string, ProjectConfig> configsMap = new Dictionary<string, ProjectConfig>();

          for (int i = 0; i < count; i++) {
            NodeProperties property = (NodeProperties)punk[i];
            IVsCfgProvider provider;
            ErrorHandler.ThrowOnFailure(property.Node.ProjectMgr.GetCfgProvider(out provider));
            uint[] expected = new uint[1];
            ErrorHandler.ThrowOnFailure(provider.GetCfgs(0, null, expected, null));
            if (expected[0] > 0) {
              ProjectConfig[] configs = new ProjectConfig[expected[0]];
              uint[] actual = new uint[1];
              provider.GetCfgs(expected[0], configs, actual, null);

              foreach (ProjectConfig config in configs) {
                if (!configsMap.ContainsKey(config.ConfigName)) {
                  configsMap.Add(config.ConfigName, config);
                }
              }
            }
          }

          if (configsMap.Count > 0) {
            if (_projectConfigs == null) {
              _projectConfigs = new ProjectConfig[configsMap.Keys.Count];
            }
            configsMap.Values.CopyTo(_projectConfigs, 0);
          }
        }
      } else {
        _projectMgr = null;
      }

      /* This code calls FillProperties without Initialize call
      if (_projectMgr != null)
      {
          FillProperties();
      }
      */

      if ((_projectMgr != null) && (_project == null)) {
        _project = new Microsoft.VisualStudio.Project.Automation.OAProject(_projectMgr);
      }
    }
コード例 #11
0
 public DartBuildableProjectConfig(ProjectConfig config)
     : base(config)
 {
 }
コード例 #12
0
 public ProjectProperties( ProjectNode project, ProjectConfig[] configs )
 {
     this.project = project;
     this.projectConfigs = configs;
 }
コード例 #13
0
 public BuildableProjectConfig(ProjectConfig config)
 {
     this.config = config;
 }
コード例 #14
0
        /// <summary>
        /// Assigns a new name to a configuration.
        /// </summary>
        /// <param name="old">The old name of the target configuration.</param>
        /// <param name="newname">The new name of the target configuration.</param>
        /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
        public virtual int RenameCfgsOfCfgName(string old, string newname)
        {
            this.project.BuildProject.ReevaluateIfNecessary();
            foreach (ProjectPropertyGroupElement current in this.project.BuildProject.Xml.PropertyGroups)
            {
                if (string.IsNullOrEmpty(current.Condition))
                {
                    continue;
                }

                var cfgNameAndPlatform = ProjectConfig.ConfigAndPlatformOfCondition(current.Condition);

                if (ProjectConfig.Eq(ProjectConfig.GetConfigName(cfgNameAndPlatform), old))
                {
                    //ConfigCanonicalName key2 = new ConfigCanonicalName(newname, key.Platform);
                    current.Condition = ProjectConfig.MakeMSBuildCondition(newname, cfgNameAndPlatform.Item2);

                    var outputPath = current.Properties.Where(p => p.Name == "OutputPath").FirstOrDefault();

                    if (outputPath != null && outputPath.Value != null)
                    {
                        string path = this.ProjectMgr.OutputBaseRelativePath;
                        if (path.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal))
                        {
                            path = Path.GetDirectoryName(path);
                        }

                        if (string.Equals(Path.Combine(path, old), outputPath.Value, StringComparison.OrdinalIgnoreCase))
                        {
                            current.SetProperty("OutputPath", Path.Combine(path, newname));
                        }
                    }

                    var oldKey = ProjectConfig.MakeConfigKey(cfgNameAndPlatform);

                    if (this.configurationsList.ContainsKey(oldKey))
                    {
                        ProjectConfig projectConfig = this.configurationsList[oldKey];
                        this.configurationsList.Remove(oldKey);
                        this.configurationsList.Add(ProjectConfig.MakeConfigKey(newname, cfgNameAndPlatform.Item2), projectConfig);
                        projectConfig.ConfigurationName = newname;
                    }
                }
            }

            this.NotifyOnCfgNameRenamed(old, newname);
            //// First create the condition that represent the configuration we want to rename
            //string condition = String.Format(CultureInfo.InvariantCulture, configString, old).Trim();

            //foreach (ProjectPropertyGroupElement config in this.project.BuildProject.Xml.PropertyGroups)
            //{
            //  // Only care about conditional property groups
            //  if (config.Condition == null || config.Condition.Length == 0)
            //    continue;

            //  // Skip if it isn't the group we want
            //  if (String.Compare(config.Condition.Trim(), condition, StringComparison.OrdinalIgnoreCase) != 0)
            //    continue;

            //  // Change the name
            //  config.Condition = String.Format(CultureInfo.InvariantCulture, configString, newname);
            //  // Update the name in our config list
            //  if (configurationsList.ContainsKey(old))
            //  {
            //    ProjectConfig configuration = configurationsList[old];
            //    configurationsList.Remove(old);
            //    configurationsList.Add(newname, configuration);
            //    // notify the configuration of its new name
            //    configuration.ConfigurationName = newname;
            //  }

            //  NotifyOnCfgNameRenamed(old, newname);
            //}

            return(VSConstants.S_OK);
        }
コード例 #15
0
        /// <summary>
        /// Returns the per-configuration objects for this object.
        /// </summary>
        /// <param name="celt">Number of configuration objects to be returned or zero, indicating a request for an unknown number of objects.</param>
        /// <param name="a">On input, pointer to an interface array or a null reference. On output, this parameter points to an array of IVsCfg interfaces belonging to the requested configuration objects.</param>
        /// <param name="actual">The number of configuration objects actually returned or a null reference, if this information is not necessary.</param>
        /// <param name="flags">Flags that specify settings for project configurations, or a null reference (Nothing in Visual Basic) if no additional flag settings are required. For valid prgrFlags values, see __VSCFGFLAGS.</param>
        /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
        public virtual int GetCfgs(uint celt, IVsCfg[] a, uint[] actual, uint[] flags)
        {
            if (celt == 1)
            {
                Debug.WriteLine("GetCfgs(celt=1, ...)");
            }

            if (flags != null)
            {
                flags[0] = 0;
            }

            int i = 0;

            string[] configList   = GetPropertiesConditionedOn(ProjectFileConstants.Configuration);
            string[] platformList = GetPlatformsFromProject();

            if (configList.Length == 0)
            {
                configList = new string[] { "Debug" }
            }
            ;
            if (platformList.Length == 0)
            {
                platformList = new string[] { "AnyCPU" }
            }
            ;

            if (a != null)
            {
                foreach (string configName in configList)
                {
                    foreach (string platform in platformList)
                    {
                        a[i] = this.GetProjectConfiguration(ProjectConfig.MakeConfigKey(configName, platform));

                        i++;
                        if (i == celt)
                        {
                            break;
                        }
                    }

                    if (i == celt)
                    {
                        break;
                    }
                }
            }
            else
            {
                i = configList.Length * platformList.Length;
            }

            if (actual != null)
            {
                actual[0] = (uint)i;
            }

            return(VSConstants.S_OK);
        }
コード例 #16
0
        /// <summary>
        /// Returns the configuration associated with a specified configuration or platform name.
        /// </summary>
        /// <param name="name">The name of the configuration to be returned.</param>
        /// <param name="platName">The name of the platform for the configuration to be returned.</param>
        /// <param name="cfg">The implementation of the IVsCfg interface.</param>
        /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
        public virtual int GetCfgOfName(string name, string platName, out IVsCfg cfg)
        {
            cfg = this.GetProjectConfiguration(ProjectConfig.MakeConfigKey(name, platName));

            return(VSConstants.S_OK);
        }
コード例 #17
0
        /// <summary>
        /// Copies an existing platform name or creates a new one.
        /// </summary>
        /// <param name="platformName">The name of the new platform.</param>
        /// <param name="clonePlatformName">The name of the platform to copy, or a null reference, indicating that AddCfgsOfPlatformName should create a new platform.</param>
        /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
        public virtual int AddCfgsOfPlatformName(string platformName, string clonePlatformName)
        {
            var msbuildPlatform = ProjectConfig.ToMSBuildPlatform(platformName);

            clonePlatformName = ProjectConfig.ToMSBuildPlatform(clonePlatformName);

            if (!this.ProjectMgr.QueryEditProjectFile(false))
            {
                throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED);                 //0x8004000c
            }
            ProjectMgr.BuildProject.ReevaluateIfNecessary();
            var propertyGroups = new List <ProjectPropertyGroupElement>(this.project.BuildProject.Xml.PropertyGroups);
            var dictionary     = new Dictionary <string, ProjectPropertyGroupElement>(StringComparer.Ordinal);

            if (clonePlatformName != null)
            {
                foreach (ProjectPropertyGroupElement propertyGroup in propertyGroups)
                {
                    if (!string.IsNullOrEmpty(propertyGroup.Condition))
                    {
                        var cfgNameAndPlatform = ProjectConfig.ConfigAndPlatformOfCondition(propertyGroup.Condition);
                        var cfgNme             = ProjectConfig.GetConfigName(cfgNameAndPlatform);
                        if (ProjectConfig.EqPlatform(cfgNameAndPlatform.Item2, clonePlatformName) && !dictionary.ContainsKey(cfgNme))
                        {
                            dictionary.Add(cfgNme, propertyGroup);
                        }
                    }
                }
            }

            string[] propertiesConditionedOn = this.GetPropertiesConditionedOn("Configuration");

            if (propertiesConditionedOn.Length == 0)
            {
                return(VSConstants.E_FAIL);
            }

            foreach (string configName in propertiesConditionedOn)
            {
                if (dictionary.Count <= 0 || dictionary.ContainsKey(configName))
                {
                    ProjectPropertyGroupElement newConfig = null;
                    if (dictionary.ContainsKey(configName))
                    {
                        newConfig = this.project.ClonePropertyGroup(dictionary[configName]);

                        foreach (ProjectPropertyElement property in newConfig.Properties)
                        {
                            if (ProjectConfig.Eq(property.Name, "PlatformTarget") || ProjectConfig.Eq(property.Name, "Platform"))
                            {
                                property.Parent.RemoveChild(property);
                            }
                        }
                    }
                    else
                    {
                        this.PopulateEmptyConfig(ref newConfig);
                        this.AddOutputPath(newConfig, configName);
                    }
                    newConfig.AddProperty("PlatformTarget", msbuildPlatform);
                    newConfig.AddProperty("Platform", msbuildPlatform);
                    newConfig.Condition = ProjectConfig.MakeMSBuildCondition(configName, msbuildPlatform);
                }
            }

            NotifyOnPlatformNameAdded(platformName);

            return(VSConstants.S_OK);
        }
コード例 #18
0
        /// <summary>
        /// Copies an existing configuration name or creates a new one.
        /// </summary>
        /// <param name="name">The name of the new configuration.</param>
        /// <param name="cloneName">the name of the configuration to copy, or a null reference, indicating that AddCfgsOfCfgName should create a new configuration.</param>
        /// <param name="fPrivate">Flag indicating whether or not the new configuration is private. If fPrivate is set to true, the configuration is private. If set to false, the configuration is public. This flag can be ignored.</param>
        /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code. </returns>
        public virtual int AddCfgsOfCfgName(string name, string cloneName, int fPrivate)
        {
            // We need to QE/QS the project file
            if (!this.ProjectMgr.QueryEditProjectFile(false))
            {
                throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED);
            }

            ProjectMgr.BuildProject.ReevaluateIfNecessary();

            var list       = new List <ProjectPropertyGroupElement>(this.project.BuildProject.Xml.PropertyGroups);
            var dictionary = new Dictionary <string, ProjectPropertyGroupElement>(StringComparer.Ordinal);

            if (cloneName != null)
            {
                foreach (ProjectPropertyGroupElement element in list)
                {
                    if (!string.IsNullOrEmpty(element.Condition))
                    {
                        var cfgNameAndPlatform = ProjectConfig.ConfigAndPlatformOfCondition(element.Condition);
                        //ConfigCanonicalName name2 = ConfigCanonicalName.OfCondition(element.Condition);
                        var platformName = ProjectConfig.GetPlatformName(cfgNameAndPlatform);
                        if ((string.Compare(ProjectConfig.GetConfigName(cfgNameAndPlatform), cloneName, StringComparison.OrdinalIgnoreCase) == 0) && !dictionary.ContainsKey(platformName))
                        {
                            dictionary.Add(platformName, element);
                        }
                    }
                }
            }
            string[] platformsFromProject = this.GetPlatformsFromProject();
            if (platformsFromProject.Length == 0)
            {
                platformsFromProject = new [] { string.Empty }
            }
            ;

            foreach (string latform in platformsFromProject)
            {
                if (dictionary.Count <= 0 || dictionary.ContainsKey(latform))
                {
                    //ConfigCanonicalName name3 = new ConfigCanonicalName(name, latform);
                    ProjectPropertyGroupElement newConfig = null;
                    if (dictionary.ContainsKey(latform))
                    {
                        newConfig = this.project.ClonePropertyGroup(dictionary[latform]);
                        foreach (ProjectPropertyElement element3 in newConfig.Properties)
                        {
                            if (element3.Name.Equals("OutputPath", StringComparison.OrdinalIgnoreCase))
                            {
                                element3.Parent.RemoveChild(element3);
                            }
                        }
                    }
                    else
                    {
                        var msbuildPlatform = ProjectConfig.ToMSBuildPlatform(latform);
                        this.PopulateEmptyConfig(ref newConfig);
                        if (!string.IsNullOrEmpty(msbuildPlatform))
                        {
                            newConfig.AddProperty("PlatformTarget", msbuildPlatform);
                        }
                    }

                    this.AddOutputPath(newConfig, name);
                    newConfig.Condition = ProjectConfig.MakeMSBuildCondition(name, latform);
                }
            }

            NotifyOnCfgNameAdded(name);
            return(VSConstants.S_OK);
        }
コード例 #19
0
        void IPropertyPage.SetObjects(uint cObjects, object[] ppunk)
        {
            if (cObjects == 0)
            {
                if (_project != null)
                {
                    //_project.CurrentOutputTypeChanging -= new PropertyChangingEventHandler( HandleOutputTypeChanging );
                    _project = null;
                }
                return;
            }

            if (ppunk[0] is ProjectConfig)
            {
                List<ProjectConfig> configs = new List<ProjectConfig>();

                for (int i = 0; i < cObjects; i++)
                {
                    ProjectConfig config = (ProjectConfig)ppunk[i];
                    if (_project == null)
                    {
                        _project = config.ProjectManager as DartProjectNode;
                        //_project.CurrentOutputTypeChanging += new PropertyChangingEventHandler( HandleOutputTypeChanging );
                    }

                    configs.Add(config);
                }

                _projectConfigs = configs.ToArray();
            }
            else if (ppunk[0] is NodeProperties)
            {
                if (_project == null)
                {
                    _project = (ppunk[0] as NodeProperties).Node.ProjectManager as DartProjectNode;
                    //_project.CurrentOutputTypeChanging += new PropertyChangingEventHandler( HandleOutputTypeChanging );
                }

                Dictionary<string, ProjectConfig> configsMap = new Dictionary<string, ProjectConfig>();

                for (int i = 0; i < cObjects; i++)
                {
                    NodeProperties property = (NodeProperties)ppunk[i];
                    IVsCfgProvider provider;
                    ErrorHandler.ThrowOnFailure(property.Node.ProjectManager.GetCfgProvider(out provider));
                    uint[] expected = new uint[1];
                    ErrorHandler.ThrowOnFailure(provider.GetCfgs(0, null, expected, null));
                    if (expected[0] > 0)
                    {
                        ProjectConfig[] configs = new ProjectConfig[expected[0]];
                        uint[] actual = new uint[1];
                        int hr = provider.GetCfgs(expected[0], configs, actual, null);
                        if (hr != VSConstants.S_OK)
                            Marshal.ThrowExceptionForHR(hr);

                        foreach (ProjectConfig config in configs)
                        {
                            string key = string.Format("{0}|{1}", config.ConfigName, config.Platform);
                            if (!configsMap.ContainsKey(key))
                                configsMap.Add(key, config);
                        }
                    }
                }

                if (configsMap.Count > 0)
                {
                    if (_projectConfigs == null)
                        _projectConfigs = new ProjectConfig[configsMap.Keys.Count];

                    configsMap.Values.CopyTo(_projectConfigs, 0);
                }
            }

            if (_active && _project != null)
            {
                BindProperties();
                IsDirty = false;
            }
        }
コード例 #20
0
ファイル: ProjectConfig.cs プロジェクト: ugurak/nemerle
 public BuildableProjectConfig(ProjectConfig config)
 {
     this.config = config;
     this.buildManagerAccessor = (IVsBuildManagerAccessor)this.config.ProjectMgr.GetService(typeof(SVsBuildManagerAccessor));
 }
コード例 #21
0
ファイル: CommonOutputGroup.cs プロジェクト: TerabyteX/main
 public CommonOutputGroup(string outputName, string msBuildTargetName, ProjectNode projectManager, ProjectConfig configuration)
     : base(outputName, msBuildTargetName, projectManager, configuration)
 {
 }
コード例 #22
0
        public virtual void SetObjects(uint count, object[] punk)
        {
            if (punk == null)
            {
                return;
            }

            if (count > 0)
            {
                if (punk[0] is ProjectConfig)
                {
                    ArrayList configs = new ArrayList();

                    for (int i = 0; i < count; i++)
                    {
                        ProjectConfig config = (ProjectConfig)punk[i];

                        if (this.project == null || (this.project != (punk[0] as ProjectConfig).ProjectMgr))
                        {
                            this.project = config.ProjectMgr;
                        }

                        configs.Add(config);
                    }

                    this.projectConfigs = (ProjectConfig[])configs.ToArray(typeof(ProjectConfig));
                }
                else if (punk[0] is NodeProperties)
                {
                    if (this.project == null || (this.project != (punk[0] as NodeProperties).Node.ProjectMgr))
                    {
                        this.project = (punk[0] as NodeProperties).Node.ProjectMgr;
                    }

                    System.Collections.Generic.Dictionary <string, ProjectConfig> configsMap = new System.Collections.Generic.Dictionary <string, ProjectConfig>();

                    for (int i = 0; i < count; i++)
                    {
                        NodeProperties property = (NodeProperties)punk[i];
                        IVsCfgProvider provider;
                        ErrorHandler.ThrowOnFailure(property.Node.ProjectMgr.GetCfgProvider(out provider));
                        uint[] expected = new uint[1];
                        ErrorHandler.ThrowOnFailure(provider.GetCfgs(0, null, expected, null));
                        if (expected[0] > 0)
                        {
                            ProjectConfig[] configs = new ProjectConfig[expected[0]];
                            uint[]          actual  = new uint[1];
                            ErrorHandler.ThrowOnFailure(provider.GetCfgs(expected[0], configs, actual, null));

                            foreach (ProjectConfig config in configs)
                            {
                                if (!configsMap.ContainsKey(config.ConfigName))
                                {
                                    configsMap.Add(config.ConfigName, config);
                                }
                            }
                        }
                    }

                    if (configsMap.Count > 0)
                    {
                        if (this.projectConfigs == null)
                        {
                            this.projectConfigs = new ProjectConfig[configsMap.Keys.Count];
                        }
                        configsMap.Values.CopyTo(this.projectConfigs, 0);
                    }
                }
            }
            else
            {
                this.project = null;
            }

            if (this.active && this.project != null)
            {
                UpdateObjects();
            }
        }
コード例 #23
0
 public ProjectConfigProperties(ProjectConfig projectConfig)
 {
     this.projectConfig = projectConfig;
 }
コード例 #24
0
        /// <summary>
        /// Constructor for IVSOutputGroup2 implementation
        /// </summary>
        /// <param name="outputName">Name of the output group. See VS_OUTPUTGROUP_CNAME_Build in vsshell.idl for the list of standard values</param>
        /// <param name="msBuildTargetName">MSBuild target name</param>
        /// <param name="projectManager">Project that produce this output</param>
        /// <param name="configuration">Configuration that produce this output</param>
        protected internal OutputGroup(string outputName, string msBuildTargetName, ProjectNode projectManager, ProjectConfig configuration)
        {
            Utilities.ArgumentNotNull("outputName", outputName);
            Utilities.ArgumentNotNull("msBuildTargetName", msBuildTargetName);
            Utilities.ArgumentNotNull("projectManager", projectManager);
            Utilities.ArgumentNotNull("configuration", configuration);

            _name       = outputName;
            _targetName = msBuildTargetName;
            _project    = projectManager;
            _projectCfg = configuration;
        }
コード例 #25
0
        public virtual void SetObjects(uint count, object[] punk)
        {
            if (punk == null)
                return;

            if(count > 0)
            {
                if(punk[0] is ProjectConfig)
                {
                    ArrayList configs = new ArrayList();

                    for(int i = 0; i < count; i++)
                    {
                        ProjectConfig config = (ProjectConfig)punk[i];

                        if(this.project == null || (this.project != (punk[0] as ProjectConfig).ProjectMgr))
                        {
                            this.project = config.ProjectMgr;
                        }

                        configs.Add(config);
                    }

                    this.projectConfigs = (ProjectConfig[])configs.ToArray(typeof(ProjectConfig));
                }
                else if(punk[0] is NodeProperties)
                {
                    if (this.project == null || (this.project != (punk[0] as NodeProperties).Node.ProjectMgr))
                        this.project = (punk[0] as NodeProperties).Node.ProjectMgr;

                    System.Collections.Generic.Dictionary<string, ProjectConfig> configsMap = new System.Collections.Generic.Dictionary<string, ProjectConfig>();

                    for(int i = 0; i < count; i++)
                    {
                        NodeProperties property = (NodeProperties)punk[i];
                        IVsCfgProvider provider;
                        ErrorHandler.ThrowOnFailure(property.Node.ProjectMgr.GetCfgProvider(out provider));
                        uint[] expected = new uint[1];
                        ErrorHandler.ThrowOnFailure(provider.GetCfgs(0, null, expected, null));
                        if(expected[0] > 0)
                        {
                            ProjectConfig[] configs = new ProjectConfig[expected[0]];
                            uint[] actual = new uint[1];
                            ErrorHandler.ThrowOnFailure(provider.GetCfgs(expected[0], configs, actual, null));

                            foreach(ProjectConfig config in configs)
                            {
                                if(!configsMap.ContainsKey(config.ConfigName))
                                {
                                    configsMap.Add(config.ConfigName, config);
                                }
                            }
                        }
                    }

                    if(configsMap.Count > 0)
                    {
                        if(this.projectConfigs == null)
                        {
                            this.projectConfigs = new ProjectConfig[configsMap.Keys.Count];
                        }
                        configsMap.Values.CopyTo(this.projectConfigs, 0);
                    }
                }
            }
            else
            {
                this.project = null;
            }

            if(this.active && this.project != null)
            {
                UpdateObjects();
            }
        }
コード例 #26
0
 public ProjectConfigProperties(ProjectConfig projectConfig)
 {
     this.projectConfig = projectConfig;
 }