예제 #1
0
        public BuildPropertyStorage(IVsHierarchy hierarchy, string configName = null, bool commitChangesImmediately = true)
        {
            this.configName = configName;
            this.commitChangesImmediately = commitChangesImmediately;

            project = new JoinableLazy <Project>(() =>
            {
                var dteProject = hierarchy.AsDteProject();

                if (dteProject != null)
                {
                    return(ProjectCollection.GlobalProjectCollection.GetLoadedProjects(dteProject.FullName).FirstOrDefault());
                }

                return(null);
            }, executeOnMainThread: true);

            projectNode = new JoinableLazy <IProjectNode>(() =>
            {
                var dteProject = hierarchy.AsDteProject();

                if (dteProject != null)
                {
                    return(dteProject.AsProjectNode());
                }

                return(null);
            }, executeOnMainThread: true);

            if (!string.IsNullOrEmpty(configName))
            {
                var values = configName.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (values.Any())
                {
                    configurationName = values[0].Trim();
                }
                if (values.Length > 1)
                {
                    platformName = values[1].Trim();
                }
            }
        }