/// <summary>
 /// Tries to find a root directory or root directory ref in the specified
 /// document.
 /// </summary>
 FindRootDirectoryResult FindRootDirectory(WixDocument currentDocument)
 {
     if (currentDocument.HasProduct)
     {
         WixDirectoryElement rootDirectory = currentDocument.GetRootDirectory();
         if (rootDirectory != null)
         {
             view.AddDirectories(rootDirectory.GetDirectories());
         }
         document = currentDocument;
         return(FindRootDirectoryResult.RootDirectoryFound);
     }
     else
     {
         WixDirectoryRefElement rootDirectoryRef = currentDocument.GetRootDirectoryRef();
         if (rootDirectoryRef != null)
         {
             view.AddDirectories(rootDirectoryRef.GetDirectories());
             document = currentDocument;
             usingRootDirectoryRef = true;
             return(FindRootDirectoryResult.RootDirectoryRefFound);
         }
     }
     return(FindRootDirectoryResult.NoMatch);
 }
		public void SetUpFixture()
		{
			WixDocument doc = new WixDocument();
			doc.FileName = @"C:\Projects\Setup\Setup.wxs";
			doc.LoadXml(GetWixXml());
			WixPackageFilesDiff diff = new WixPackageFilesDiff(this);
			diffResults = diff.Compare(doc.GetRootDirectory());
		}
 /// <summary>
 /// Gets the root directory element being used in the document.
 /// Takes into account whether the WixDocument is using a
 /// DirectoryRef element.
 /// </summary>
 WixDirectoryElementBase GetRootDirectoryElement()
 {
     if (usingRootDirectoryRef)
     {
         return(document.GetRootDirectoryRef());
     }
     return(document.GetRootDirectory());
 }
		public void SetUpFixture()
		{
			WixDocument doc = new WixDocument();
			doc.LoadXml(GetWixXml());
			WixDirectoryElement rootDirectory = doc.GetRootDirectory();
			WixDirectoryElement[] rootChildDirectories = rootDirectory.GetDirectories();
			WixDirectoryElement programFilesDirectory = rootChildDirectories[0];
			WixDirectoryElement[] programFilesChildDirectories = programFilesDirectory.GetDirectories();
			WixDirectoryElement myAppDirectory = programFilesChildDirectories[0];
			childComponents = myAppDirectory.GetComponents();
		}
		public void SetUpFixture()
		{
			WixBindingTestsHelper.RegisterResourceStringsWithSharpDevelopResourceManager();
			
			WixDocument doc = new WixDocument();
			doc.LoadXml(GetWixXml());
			rootDirectory = doc.GetRootDirectory();
			rootChildDirectories = rootDirectory.GetDirectories();
			programFilesDirectory = rootChildDirectories[0];
			programFilesChildDirectories = programFilesDirectory.GetDirectories();
			myAppDirectory = programFilesChildDirectories[0];
			testDirectory = rootChildDirectories[1];
		}
		public void SetUpFixture()
		{
			doc = new WixDocument();
			doc.FileName = @"C:\Projects\Setup\Setup.wxs";
			doc.LoadXml(GetWixXml());
			WixDirectoryElement rootDirectory = doc.GetRootDirectory();
			WixDirectoryElement[] rootChildDirectories = rootDirectory.GetDirectories();
			WixDirectoryElement programFilesDirectory = rootChildDirectories[0];
			WixDirectoryElement[] programFilesChildDirectories = programFilesDirectory.GetDirectories();
			WixDirectoryElement myAppDirectory = programFilesChildDirectories[0];
			WixComponentElement[] childComponents = myAppDirectory.GetComponents();
			WixComponentElement coreComponent = childComponents[0];
			files = coreComponent.GetFiles();
		}
Exemplo n.º 7
0
        void UpdateOpenTextEditorWithRootDirectoryChanges(ITextEditor textEditor, WixDocument document)
        {
            WixDirectoryElement rootDirectory = document.GetRootDirectory();
            string xml = rootDirectory.GetXml(wixTextWriter);

            WixDocumentEditor documentEditor = new WixDocumentEditor(textEditor);
            DomRegion         region         = documentEditor.ReplaceElement(rootDirectory.Id, WixDirectoryElement.DirectoryElementName, xml);

            if (!region.IsEmpty)
            {
                return;
            }

            Location location = FindProductElementEndLocation(textEditor, document);

            if (!location.IsEmpty)
            {
                documentEditor.InsertIndented(location, String.Concat(xml, "\r\n"));
            }
        }
Exemplo n.º 8
0
		void UpdateOpenTextEditorWithRootDirectoryChanges(ITextEditor textEditor, WixDocument document)
		{
			WixDirectoryElement rootDirectory = document.GetRootDirectory();
			string xml = rootDirectory.GetXml(wixTextWriter);
			
			WixDocumentEditor documentEditor = new WixDocumentEditor(textEditor);
			DomRegion region = documentEditor.ReplaceElement(rootDirectory.Id, WixDirectoryElement.DirectoryElementName, xml);
			if (!region.IsEmpty) {
				return;
			}
			
			TextLocation location = FindProductElementEndLocation(textEditor, document);
			if (!location.IsEmpty) {
				documentEditor.InsertIndented(location, String.Concat(xml, "\r\n"));
			}
		}
		public void SetUpFixture()
		{
			WixDocument doc = new WixDocument();
			doc.LoadXml(GetWixXml());
			directory = doc.GetRootDirectory();
		}
		public void NoDirectory()
		{
			WixDocument doc = new WixDocument();
			doc.LoadXml(GetWixXml());
			Assert.IsNull(doc.GetRootDirectory());
		}
Exemplo n.º 11
0
		/// <summary>
		/// Tries to find a root directory or root directory ref in the specified
		/// document.
		/// </summary>
		FindRootDirectoryResult FindRootDirectory(WixDocument currentDocument)
		{
			if (currentDocument.HasProduct) {
				WixDirectoryElement rootDirectory = currentDocument.GetRootDirectory();
				if (rootDirectory != null) {
					view.AddDirectories(rootDirectory.GetDirectories());
				}
				document = currentDocument;
				return FindRootDirectoryResult.RootDirectoryFound;
			} else {
				WixDirectoryRefElement rootDirectoryRef = currentDocument.GetRootDirectoryRef();
				if (rootDirectoryRef != null) {
					view.AddDirectories(rootDirectoryRef.GetDirectories());
					document = currentDocument;
					usingRootDirectoryRef = true;
					return FindRootDirectoryResult.RootDirectoryRefFound;
				}
			}
			return FindRootDirectoryResult.NoMatch;
		}