Microsoft.VisualStudio.Project.SettingsPage.SetObjects C# (CSharp) Method

SetObjects() public method

public SetObjects ( uint count, object punk ) : void
count uint
punk object
return void
        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.ProjectManager == null || (this.ProjectManager != (punk[0] as ProjectConfig).ProjectManager))
                        {
                            throw new InvalidOperationException();
                        }

                        configs.Add(config);
                    }

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

                    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.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];
                            ErrorHandler.ThrowOnFailure(provider.GetCfgs(expected[0], configs, actual, null));

                            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(this.projectConfigs == null)
                        {
                            this.projectConfigs = new ProjectConfig[configsMap.Keys.Count];
                        }
                        configsMap.Values.CopyTo(this.projectConfigs, 0);
                    }
                }
            }
            else
            {
                //this.ProjectManager = null;
            }

            if(this.active && this.ProjectManager != null)
            {
                UpdateObjects();
            }
        }