示例#1
0
        public WixProject([NotNull] Solution solution, [NotNull] EnvDTE.Project project)
            : base(solution, project)
        {
            _configurationFileProjectItem = GetConfigurationFileProjectItem();

            var configurationText = _configurationFileProjectItem.GetContent();

            _configuration = configurationText.Deserialize <ProjectConfiguration>();

            Regex excludedItemsFilter = null;

            try
            {
                if (!string.IsNullOrEmpty(_configuration.ExcludedProjectItems))
                {
                    excludedItemsFilter = new Regex(_configuration.ExcludedProjectItems);
                }
            }
            catch
            {
                // filter is corrupt, go with no filter.
            }

            _sourceFiles = GetAllProjectItems()
                           .Where(item => _wixFileExtensions.Contains(Path.GetExtension(item.Name) ?? string.Empty, StringComparer.OrdinalIgnoreCase))
                           .Where(item => excludedItemsFilter == null || !excludedItemsFilter.IsMatch(item.Name))
                           .OrderByDescending(item => Path.GetExtension(item.Name), StringComparer.OrdinalIgnoreCase)
                           .Select(item => new WixSourceFile(this, item))
                           .ToList().AsReadOnly();
        }
示例#2
0
        public static XDocument GetXmlContent([NotNull] this EnvDTE.ProjectItem projectItem, LoadOptions loadOptions)
        {
            Contract.Requires(projectItem != null);
            Contract.Ensures(Contract.Result <XDocument>() != null);

            return(XDocument.Parse(projectItem.GetContent(), loadOptions));
        }
示例#3
0
        private void SaveProjectConfiguration()
        {
            var configurationText = _configuration.Serialize();

            if (configurationText != _configurationFileProjectItem.GetContent())
            {
                _configurationFileProjectItem.SetContent(configurationText);
            }
        }
示例#4
0
        public WixProject([NotNull] Solution solution, [NotNull] EnvDTE.Project project)
            : base(solution, project)
        {
            _configurationFileProjectItem = GetConfigurationFileProjectItem();

            var configurationText = _configurationFileProjectItem.GetContent();

            _configuration = configurationText.Deserialize <ProjectConfiguration>();

            _sourceFiles = GetAllProjectItems()
                           .Where(item => _wixFileExtensions.Contains(Path.GetExtension(item.Name) ?? string.Empty, StringComparer.OrdinalIgnoreCase))
                           .OrderByDescending(item => Path.GetExtension(item.Name), StringComparer.OrdinalIgnoreCase)
                           .Select(item => new WixSourceFile(this, item))
                           .ToList().AsReadOnly();
        }
示例#5
0
 public static XDocument GetXmlContent(this EnvDTE.ProjectItem projectItem, LoadOptions loadOptions)
 {
     return(XDocument.Parse(projectItem.GetContent(), loadOptions));
 }