Archive for the Category Uncategorized

 
 

XP Burn Component

The XP Burn Component allows your .NET applications to burn files to CDR/W discs on a Window XP or Windows 2003 Server system. This component does not work for systems which have a different OS installed; though it will detect that case and give a reasonable error message. This component talks directly to the system IMAPI interfaces and does not use the Windows XP CD burning wizard, so its possible to create your own snazzy UI for burning CDs.

Though the component is a UserControl, I wouldn’t recommend that you put it in the toolbox. Instead, simply reference it and use it like you would use any other framework type (the constructor can potentially throw exceptions, so for robust handling you should wrap it in a try& catch). The documentation and source for the component is included in the download.

Download

XP Burn Component, Documentation and Source
Download and run the MSI for this component to install the documentation, source code and assembly.

Transform RSS feed to HTML using XSLT stylesheet

This code reads the RSS feed and transform it to HTML using XSLT

(Based on VFP code from Calvin Hsia’s WebLog)

Download XSLT stylesheet

 

try
{
    string rssUrl = "http://blogs.msdn.com/MainFeed.aspx";
    string pathname = @"D:\result.html";
 
    XPathDocument myXPathDoc = new XPathDocument(rssUrl);
    XslTransform myXslTrans = new XslTransform();
 
    // load XSLT stylesheet
    myXslTrans.Load(@"D:\pr.xslt");
    XmlTextWriter myWriter = new XmlTextWriter(pathname, null);
    myXslTrans.Transform(myXPathDoc, null, myWriter, null);
    myWriter.Close();
 
    // read html file after XSL transform
    TextReader textReader = File.OpenText(pathname);
    string content = textReader.ReadToEnd();
    textReader.Close();
 
    // convert html file that has been HTML encoded
    StreamWriter streamWriter = new StreamWriter(pathname, false);
    streamWriter.Write(HttpUtility.HtmlDecode(content));
    streamWriter.Close();
}
catch (Exception e)
{
    Console.Write(e);
}