Exemplo n.º 1
0
        public static WixDirectory FromPath(string id, string directoryPath)
        {
            WixDirectory result = FromPath(directoryPath);

            result.Id = id;
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets the target contents to the files and folder found in the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <exception cref="InvalidOperationException"></exception>
        public void SetTargetContents(string path)
        {
            WixDirectory dir = WixDirectory.FromPath(path);

            dir.Name = string.Empty;
            dir.Id   = MergeRedirectFolder;
            XElement targetDirElement = _xDocument.Descendants().FirstOrDefault(el => (string)el.Attribute("Id") == TargetDir);

            if (targetDirElement == null)
            {
                throw new InvalidOperationException(string.Format("Directory element with Id \"TARGETDIR\" was not found in the specified document: ({0})", path));
            }
            targetDirElement.RemoveNodes();
            XNamespace defaultNamespace = "http://schemas.microsoft.com/wix/2006/wi";
            XElement   components       = dir.ToXElement(defaultNamespace);

            targetDirElement.Add(components);
            _xDocument.Save(Path);
        }
Exemplo n.º 3
0
        private static WixDirectory Traverse(DirectoryInfo dir, string root = null)
        {
            root = root ?? dir.FullName;
            if (!root.EndsWith("\\"))
            {
                root += "\\";
            }
            WixDirectory current = new WixDirectory {
                Name = dir.Name
            };

            foreach (FileInfo file in dir.GetFiles())
            {
                current.AddComponent(file.FullName.Replace(root, ""));
            }
            foreach (DirectoryInfo subDir in dir.GetDirectories())
            {
                current.AddDirectory(Traverse(subDir, root));
            }
            return(current);
        }
Exemplo n.º 4
0
 public void AddDirectory(WixDirectory directory)
 {
     _directories.Add(directory);
 }