Mike Swanson

October, 2006

  • Mike Swanson's Blog

    Another Adobe Illustrator to XAML Exporter


    When it rains, it pours. If you're following along, you'll remember that the WPF/XAML Conversion Tool Contest officially ended this past Friday at midnight. And while I haven't yet had the time to review the submissions (which doesn't include a couple that were sent in via e-mail), a friend of mine mentioned that he had heard about "another Illustrator exporter." So, tonight I did a quick search on Windows Live, and whaddya know? It popped-up fourth on the list.

    This is awesome news! You see, I haven't had the time to add any new functionality to my Illustrator plug-in, and I'd begun to worry about how much time I'd be able to dedicate in the future. So not only was I excited to hear about a new exporter, but I was completely thrilled to read that it's written in C#! And if that isn't enough, the source code has been checked-in to CodePlex! Okay, I need a few more exclamation points!!!!! :-)

    On to the important stuff. Here's the CodePlex project where you can download the bits. Read Pavan Podila's post announcing the exporter and a follow-up with a little more information.

    I couldn't find any installation or usage instructions, but I was able to figure out one way to use the tool (perhaps there are more):

    • Download the bits and extract them to a folder of your choice.
    • Start Adobe Illustrator and load some artwork (like the Crystal.ai sample file that ships with Illustrator).
    • From the folder where you extracted the bits, launch Exporter.UI.exe.
    • Click the Export XAML button in the tool and wait...and wait. I'm guessing that the delay is due to scripting, and frankly, if it provides all of the flexibility mentioned above (C#, CodePlex, etc.), it's easily worth it.
    • Eventually, you'll see a XAML representation of the Illustrator drawing in the top half of the window and a WPF rendering in the bottom. A lot like XamlPad. Beautiful.

    If you can't tell, I'm quite excited about this tool. A huge thank you to Pavan Podila for his great work! I can't wait to see where this goes.

    Oh...I added it to my WPF Tools and Controls page too.

  • Mike Swanson's Blog

    SyncToy v1.4 Released


    With over 33,000 total views, my August 9, 2005 announcement about the release of SyncToy is one of my more popular posts. According to Sean Kelley, your comments to that post helped drive some of the fixes, features, and enhancements that have gone into more recent versions. If you ask me, this is a great example of direct community engagement via blogs.

    Yesterday, we released version 1.4 of SyncToy with improved Windows Vista compatibility. If you're looking for a free and easy way to intelligently backup and synchronize your mountain of digital files, check this one out.

    The team continues to ask for your feedback to enhance future versions. Of course, you can always leave feedback on my blog, but the Windows XP Photos newsgroup and the online feedback survey (available from the SyncToy Help menu) are probably a bit more direct.

  • Mike Swanson's Blog

    Example C# Code for Reading Flash (SWF) Files


    Wow! it's been about 2 1/2 weeks since I last posted, and it seems like forever. In the meantime, I've upgraded my machines to Windows Vista RC2, and I'm not looking back. I had to do some work on my wife's computer the other day, and she's still running Windows XP. Well, not for long. :) Anyway...

    Ever since my post about Converting Flash Shapes to WPF, I've been asked about the BitReader class that I mentioned. That class has since been replaced by a much more specialized class called SWFReader. As you can probably tell by the name, it's job is to make it easier to read Adobe/Macromedia Flash (SWF) files and their associated data types. If you're unfamiliar with the contents of a SWF file, you should check out A Concise Guide to the SWF File Format and Alexis' SWF Reference. Both are excellent resources.

    To get going, first download my C# sample code: FlashTools.zip (10KB). This Visual Studio 2005 solution contains two projects:

    • The FlashTools project contains four classes: Rect.cs implements the Flash rectangle/RECT type, SWFFile.cs encapsulates logic to open a SWF file and read its contents, SWFReader.cs makes it easy to read common data types from a SWF file, and Tag.cs doesn't do much other than read and identify the various Flash tags.
    • The SWFInfo project is a very simple command-line client that routes tracing information to the console to display SWF header and tag information.

    It's important to note that most modern Flash files use ZLIB compression (explained in RFCs 1950, 1951, and 1952). You could certainly implement your own "inflate" logic, but it's already been done by a number of folks. I chose to use the fully managed SharpZipLib. You'll need to download the assembly and add a reference to it from the FlashTools project to successfully compile my sample code.

    To examine the contents of a SWF file in detail, the Dump Flash Decompiler is an invaluable tool. SWF Tools is another good one to check out (especially SWFDump). Both of these are useful for validating the data that you're reading from the SWF file.

    Last, this is sample code, so swim at your own risk. There's no error checking, unit tests, performance optimizations, or guarantees. If you're going to build a more robust solution, this code will only give you enough guidance to get going. If you have any questions, feel free to contact me directly. Otherwise, party on!

Page 1 of 1 (3 items)