/// <summary>
        /// Adds a new Wix Component to the directory element. The file will then be added to this
        /// component.
        /// </summary>
        WixComponentElement AddFileWithParentComponent(WixDirectoryElement directoryElement, string fileName)
        {
            WixComponentElement component = AddComponent(directoryElement, fileName);

            AddFile(component, fileName, true);
            return(component);
        }
		/// <summary>
		/// Adds a new component element to this directory element.
		/// </summary>
		public WixComponentElement AddComponent(string id)
		{
			WixComponentElement componentElement = new WixComponentElement((WixDocument)OwnerDocument);
			componentElement.GenerateNewGuid();
			componentElement.Id = id;
			return (WixComponentElement)AppendChild(componentElement);			
		}
		public void Init()
		{
			doc = new WixDocument();
			doc.FileName = @"C:\Projects\Setup\Setup.wxs";
			doc.LoadXml(GetWixXml());
			component = (WixComponentElement)doc.SelectSingleNode("//w:Component", new WixNamespaceManager(doc.NameTable));
		}
		/// <summary>
		/// Adds a new component element to this directory element.
		/// </summary>
		public WixComponentElement AddComponent(string fileName)
		{
			WixComponentElement componentElement = new WixComponentElement((WixDocument)OwnerDocument);
			componentElement.GenerateUniqueIdFromFileName(fileName);
			componentElement.GenerateNewGuid();
			AppendChild(componentElement);
			return componentElement;
		}
		public void SetUpFixture()
		{
			WixDocument doc = new WixDocument();
			doc.LoadXml(GetWixXml());
			WixComponentElement wixComponent = new WixComponentElement(doc);
			wixComponent.GenerateUniqueIdFromFileName(@"C:\Projects\My.Project\MyApp.exe");
			id = wixComponent.Id;
		}
Exemplo n.º 6
0
        /// <summary>
        /// Adds a new component element to this directory element.
        /// </summary>
        public WixComponentElement AddComponent(string id)
        {
            WixComponentElement componentElement = new WixComponentElement((WixDocument)OwnerDocument);

            componentElement.GenerateNewGuid();
            componentElement.Id = id;
            return((WixComponentElement)AppendChild(componentElement));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Adds a new Wix Component to the directory element. The file will then be added to this
        /// component.
        /// </summary>
        WixComponentElement AddFileWithParentComponent(WixDirectoryElement directoryElement, string fileName)
        {
            string id = WixComponentElement.GenerateIdFromFileName(document, fileName);
            WixComponentElement component = AddComponent(directoryElement, id);

            AddFile(component, fileName, true);
            return(component);
        }
        /// <summary>
        /// Adds a new component element to this directory element.
        /// </summary>
        public WixComponentElement AddComponent(string fileName)
        {
            WixComponentElement componentElement = new WixComponentElement((WixDocument)OwnerDocument);

            componentElement.GenerateUniqueIdFromFileName(fileName);
            componentElement.GenerateNewGuid();
            AppendChild(componentElement);
            return(componentElement);
        }
Exemplo n.º 9
0
 /// <summary>
 /// Adds a new component element to the directory element.
 /// </summary>
 /// <param name="id">The id attribute the component element will have.</param>
 WixComponentElement AddComponent(WixDirectoryElement parentElement, string id)
 {
     if (parentElement != null)
     {
         WixComponentElement element = parentElement.AddComponent(id);
         return(element);
     }
     return(null);
 }
 /// <summary>
 /// Adds a new component element to the directory element.
 /// </summary>
 WixComponentElement AddComponent(WixDirectoryElement parentDirectory, string fileName)
 {
     if (parentDirectory != null)
     {
         WixComponentElement component = parentDirectory.AddComponent(fileName);
         return(component);
     }
     return(null);
 }
		public void Init()
		{
			base.InitFixture();
			editor.AddDirectory(directory);
			
			nsManager = new WixNamespaceManager(editor.Document.NameTable);
			appDirectoryElement = (WixDirectoryElement)editor.Document.GetRootDirectory().SelectSingleNode("w:Directory[@Name='MyApp']", nsManager);
			readmeComponentElement = (WixComponentElement)appDirectoryElement.SelectSingleNode("w:Component[w:File/@Name='readme.txt']", nsManager);
			licenseComponentElement = (WixComponentElement)appDirectoryElement.SelectSingleNode("w:Component[w:File/@Name='license.txt']", nsManager);	
			exeComponentElement = (WixComponentElement)appDirectoryElement.SelectSingleNode("w:Component[w:File/@Name='MyApp.exe']", nsManager);
		}
Exemplo n.º 12
0
        /// <summary>
        /// Adds a file to the specified component element.
        /// </summary>
        WixFileElement AddFile(WixComponentElement componentElement, string fileName, bool keyPath)
        {
            WixFileElement fileElement = componentElement.AddFile(fileName);

            if (!componentElement.HasDiskId)
            {
                componentElement.DiskId = "1";
            }
            if (keyPath)
            {
                fileElement.KeyPath = "yes";
            }
            return(fileElement);
        }
Exemplo n.º 13
0
		public void SetUpFixture()
		{
			base.InitFixture();
			editor.AddDirectory(directory);
			
			WixNamespaceManager nsManager = new WixNamespaceManager(editor.Document.NameTable);
			appDirectoryElement = (WixDirectoryElement)editor.Document.GetRootDirectory().FirstChild;
			myAppExeFileComponentElement = (WixComponentElement)appDirectoryElement.SelectSingleNode("w:Component", nsManager);
			myAppExeFileElement = (WixFileElement)myAppExeFileComponentElement.LastChild;
			docsDirectoryElement = (WixDirectoryElement)appDirectoryElement.SelectSingleNode("w:Directory[@Name='docs']", nsManager);
			srcDirectoryElement = (WixDirectoryElement)appDirectoryElement.SelectSingleNode("w:Directory[@Name='src']", nsManager);
			cssDirectoryElement = (docsDirectoryElement.GetDirectories())[0];
			readmeFileElement = (WixFileElement)docsDirectoryElement.SelectSingleNode("w:Component/w:File[@Name='readme.txt']", nsManager);
		}
        /// <summary>
        /// Gets any child component elements.
        /// </summary>
        public WixComponentElement[] GetComponents()
        {
            List <WixComponentElement> components = new List <WixComponentElement>();

            foreach (XmlNode childNode in ChildNodes)
            {
                WixComponentElement childElement = childNode as WixComponentElement;
                if (childElement != null)
                {
                    components.Add(childElement);
                }
            }
            return(components.ToArray());
        }
Exemplo n.º 15
0
        /// <summary>
        /// Adds a single file to the selected component element.
        /// </summary>
        void AddFile(string fileName)
        {
            WixComponentElement componentElement = view.SelectedElement as WixComponentElement;
            WixDirectoryElement directoryElement = view.SelectedElement as WixDirectoryElement;

            if (componentElement != null)
            {
                WixFileElement fileElement = AddFile(componentElement, fileName, false);
                view.AddElement(fileElement);
                view.IsDirty = true;
            }
            else if (directoryElement != null)
            {
                componentElement = AddFileWithParentComponent(directoryElement, fileName);
                view.AddElement(componentElement);
                view.IsDirty = true;
            }
        }
Exemplo n.º 16
0
 public WixFileElement(WixComponentElement component, string fileName)
     : this((WixDocument)component.OwnerDocument)
 {
     parentComponent = component;
     Init(fileName);
 }
Exemplo n.º 17
0
		public WixComponentTreeNode(WixComponentElement element) : base(element)
		{
			SetIcon("Setup.Icons.16x16.Component");
			ContextmenuAddinTreePath = "/AddIns/WixBinding/PackageFilesView/ContextMenu/ComponentTreeNode";
			Refresh();
		}
Exemplo n.º 18
0
 public WixComponentTreeNode(WixComponentElement element) : base(element)
 {
     SetIcon("Setup.Icons.16x16.Component");
     ContextmenuAddinTreePath = "/AddIns/WixBinding/PackageFilesView/ContextMenu/ComponentTreeNode";
     Refresh();
 }
Exemplo n.º 19
0
		public WixFileElement(WixComponentElement component, string fileName) 
			: this((WixDocument)component.OwnerDocument)
		{
			parentComponent = component;
			Init(fileName);
		}
		public void Init()
		{
			component = new WixComponentElement(new WixDocument());
		}
		public void ReadmeFileComponentId()
		{
			WixComponentElement component = new WixComponentElement(new WixDocument());
			string expectedId = component.GenerateIdFromFileName("readme.rtf");
			Assert.AreEqual(expectedId, readmeFileComponentElement.GetAttribute("Id"));
		}
		public void ExeFileComponentId()
		{
			WixComponentElement component = new WixComponentElement(new WixDocument());
			string expectedId = component.GenerateIdFromFileName("TestApplication.exe");
			Assert.AreEqual(expectedId, exeFileComponentElement.GetAttribute("Id"));
		}
Exemplo n.º 23
0
		/// <summary>
		/// Adds a file to the specified component element.
		/// </summary>
		WixFileElement AddFile(WixComponentElement componentElement, string fileName, bool keyPath)
		{
			WixFileElement fileElement = componentElement.AddFile(fileName);
			if (!componentElement.HasDiskId) {
				componentElement.DiskId = "1";
			}
			if (keyPath) {
				fileElement.KeyPath = "yes";
			}
			return fileElement;
		}