Martijn's blog - E-Commerce, EAI, BizTalk and .NET


[offtopic] Windows Media Center 2005 - configuring more then 2 tuners

Fyi, this Green Button Community article on installing more then 2 tuners in Media Center 2005 works. However, when trying it, I bumped onto the reply the forum moderator gave (Posted 5/2/2005 7:29 PM).

It turns out, Media Center recognizes all tuners automatically, at least in my case. Just starting up the Registry editor and copying the "User Settings" hive from a configured device under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Service\Video\Tuners\{A799A800-A46D-11D0-A18C-00A02401DCD4} to the unconfigured device, altering it's properties (UserDefName, [RecordOrder]) and it worked :-D.



It seems this little gem is hidden as almost no one I talk to knows of it's existence.

Within the Microsoft.BizTalk.XPath namespace in the (GAC) assembly Microsoft.BizTalk.XPathReader.dll, a class is contained called XPathReader. Relying on this reader it's possible to match XPath expressions in a streaming fashion. This information is out on the web and discussed on many occasions.

However, within the Microsoft.BizTalk.Streaming namespace in the (GAC) assembly Microsoft.BizTalk.Streaming.dll, another class named XPathMutatorStream is defined. The class does what it's name implies, it allows for a callback to alter the value of specified XPathExpressions (hence the reference to XPathReader first). A basic implementation could look like this:


MemoryStream stream = new MemoryStream();

StreamWriter sw = new StreamWriter(stream);

string xmldocInstance = "bla";

stream.Position = 0;

XPathCollection queries = new XPathCollection();

queries.Add(new XPathExpression("/*[local-name()='Order']/*[local-name()='OrderLines']/*[local-name()='OrderLine']"));

ValueMutator mutator = new ValueMutator(this.XPathCallBack);

XPathMutatorStream mutatorStream = new XPathMutatorStream(stream, queries, mutator);

XmlTextReader reader = new XmlTextReader(mutatorStream);

while (reader.Read());


private void XPathCallBack(
 int matchIdx,
 XPathExpression matchExpr,
 string origVal,
 ref string finalVal)

 finalVal = "bli";