Beispiel #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();
        }
Beispiel #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));
        }
Beispiel #3
0
        private void SaveProjectConfiguration()
        {
            var configurationText = _configuration.Serialize();

            if (configurationText != _configurationFileProjectItem.GetContent())
            {
                _configurationFileProjectItem.SetContent(configurationText);
            }
        }
Beispiel #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();
        }
Beispiel #5
0
 public static XDocument GetXmlContent(this EnvDTE.ProjectItem projectItem, LoadOptions loadOptions)
 {
     return(XDocument.Parse(projectItem.GetContent(), loadOptions));
 }