Welcome to mirror list, hosted at ThFree Co, Russian Federation.

fixup-config.cs « System.ServiceModel « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d1ff541bf4fdf095f07349320cbca2d75da31ede (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Xml;

public class FixupXml
{
	public static void Main (string [] args)
	{
		if (args.Length == 0) {
			Console.WriteLine ("pass path-to-machine.config.");
			return;
		}
		XmlDocument doc = new XmlDocument ();
		doc.Load (args [0]);
		XmlElement el = doc.SelectSingleNode ("/configuration/configSections") as XmlElement;
		XmlElement old = el.SelectSingleNode ("sectionGroup[@name='system.serviceModel']") as XmlElement;
		XmlNode up = doc.ReadNode (new XmlTextReader ("fixup-config.xml"));
		if (old != null)
			el.RemoveChild (old);
		el.InsertAfter (up, null);
		XmlTextWriter w = new XmlTextWriter (args [0], null);
		w.Formatting = Formatting.Indented;
		w.IndentChar = '\t';
		w.Indentation = 1;
		doc.Save (w);
		w.Close ();
	}
}