Пример #1
0
		public string GetXml(WixTextWriter wixWriter)
		{
			StringBuilder xml = new StringBuilder();
			StringWriter stringWriter = new StringWriter(xml);
			using (XmlWriter xmlWriter = wixWriter.Create(stringWriter)) {
				WriteTo(xmlWriter);
			}
			return RemoveWixNamespace(xml.ToString());
		}
Пример #2
0
        public string GetXml(WixTextWriter wixWriter)
        {
            StringBuilder xml          = new StringBuilder();
            StringWriter  stringWriter = new StringWriter(xml);

            using (XmlWriter xmlWriter = wixWriter.Create(stringWriter)) {
                WriteTo(xmlWriter);
            }
            return(RemoveWixNamespace(xml.ToString()));
        }
		public void Init()
		{
			WixProject project = WixBindingTestsHelper.CreateEmptyWixProject();
			document = new WixDocument(project, new DefaultFileLoader());
			string xml = "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'><Product Name='MySetup'></Product></Wix>";
			document.LoadXml(xml);
			
			MockTextEditorOptions options = new MockTextEditorOptions();
			options.ConvertTabsToSpaces = false;
			options.IndentationSize = 1;
			
			WixTextWriter wixWriter = new WixTextWriter(options);
			xmlBuilder = new StringBuilder();
			xmlWriter = wixWriter.Create(new StringWriter(xmlBuilder));
			document.Save(xmlWriter);
		}
Пример #4
0
        public void Write(WixDocument document)
        {
            ITextEditor openTextEditor = openTextEditors.FindTextEditorForDocument(document);

            if (openTextEditor != null)
            {
                UpdateOpenTextEditor(openTextEditor, document);
            }
            else
            {
                using (XmlWriter xmlWriter = wixTextWriter.Create(document.FileName)) {
                    document.Save(xmlWriter);
                }
                FileUtility.RaiseFileSaved(new FileNameEventArgs(document.FileName));
            }
            packageFilesControl.IsDirty = false;
        }
Пример #5
0
		public void XmlWriterSettingsIndentCharsIsTabTakenFromSaveMethod()
		{
			int indentLength = 3;
			string indent = " ".PadRight(indentLength);
			
			MockTextEditorOptions options = new MockTextEditorOptions();
			options.ConvertTabsToSpaces = true;
			options.IndentationSize = indentLength;
			
			WixTextWriter wixWriter = new WixTextWriter(options);
			xmlWriter = wixWriter.Create(new StringWriter(new StringBuilder()));
			
			Assert.AreEqual(indent, xmlWriter.Settings.IndentChars);
		}