BlockLeftTop, PRELOAD BlockLeftBottom, PRELOAD BlockLeftStretch, PRELOAD BlockTop, PRELOAD BlockBottom, PRELOAD BlockStretch, PRELOAD BlockRightTop, PRELOAD BlockRightBottom, PRELOAD BlockRightStretch, PRELOAD

CR_Commenter v1.8 - Autogenerate comments with this CodeRush plugin

by Benjamin Nitschke 28. April 2008 21:10
I worked on the CR_Commenter v1.8 Update all weekend and tested it a little bit today at work. If you do not know about the CR_Commenter plugin for CodeRush yet (I originally wrote it back in 2004 and still use it every single day), please read this article of version 1.7 from 2006 or check out the original Commenter - A CodeRush plugin which helps you to comment your code article on from 2004

Here are the coolest new features in v1.8:
  • New and updated hotkeys, also made sure all of them work as advertised! You can also now switch on and off much more features and hotkeys if you like (e.g. disable Ctrl+1, Ctrl+3 or Ctrl+.). Normally the commenter will do his work every time you press '}' while coding and automatically add comments, xml blocks and the header (no need for any hotkeys during normal coding). But you can also press the following hotkeys to perform special actions:

    • Ctrl+1: Does perform the same action as closing a block with '}', but can be used anywhere inside a method or class.

    • Ctrl+2 or Ctrl+.: Adds a namespace for the current word at the cursor. Used to support automatically adding a namespace in C# 3.0 (back in v1.7), but now works the same way as VS 2008 plus saving you from pressing Enter to accept a namespace suggestion. If you like the VS2008 way better (allowing different namespaces), just disable Ctrl+. and VS will work as before.

    • Ctrl+3 or Ctrl+R: Auto generate region around the current block (method, property, constructor, etc.), for selections use Ctrl+R. You can also press Shift+Ctrl+3 to process the whole file! This feature was originally added in CodeRush v1.5, but abandoned in v1.6 and v1.7 after CodeRush supported it internally. Now the feature is back with lots of improvements, auto generating regions all over the place and producing region names for you. Can of course be disabled if you like the CodeRush way better (having to type the region name yourself).

    • Ctrl+4: Toggle collapsing and expanding current selection. This feature often caused trouble in v1.7 because it collapsed sometimes regions you were working in (e.g. method blocks with sub regions), now it will not longer disrupt your work and never close any region you are working on (except you want to with this hotkey).

    • Ctrl+5: Toggle collapsing and expanding everything at top level. Very cool to quickly check out what this file is about, use it in conjunction with first generating all region blocks (Shift+Ctrl+3).

    • Ctrl+6: Update all comments and xml blocks for the whole file. Was Ctrl+9 before and Ctrl+F9 even before that, this method is not required very often because Ctrl+1 handles most of this already. Please also note that Ctrl+7 was abondoned for now (resort language blocks and regions) because this feature is very complex and not implemented yet (see above for v2.0).

    • Ctrl+9 or Ctrl+F9: Generate all unit tests automatically for us (I use F9 to test, Ctrl+F9 makes sense to generate tests)! This will add a sub class called Tests, which contains all public methods as tests, which will all fail by default. Then all unit tests will have to be written and tested until everything is implemented correctly. Existing test methods will not be overwritten! This features is the major improvement in v1.8 for me, it will add unit tests automatically for us at the bottom of file to provide 100% code coverage (all unit tests should fail initially, add and change code to make them work).

  • Thought about auto sorting and removing namespaces for all files, but that works just fine with the new VS2008 Powertools.

  • Fixed '}' inside string or comment, even if CodeRush has not processed the whole file yet (double checking now). E.g. the following string will not longer produce any comments:
    SQL = String.Format("UPDATE GC SET Status = {0} WHERE ID = {1}", Msg, ID);

  • Added option to not update comments on } (or Ctrl+1)

  • Supporting to generate regions again, but split up function names, also suppress CodeRush region generation with Ctrl+3, Ctrl+R (also suppressing VS hotkeys now) Better support for auto generated region blocks for big methods, just press Ctrl+3 to generate region (let CR_Commenter choose the name automatically, allow editing after pressing Ctrl+3).

  • Press Shift+Ctrl+3 to generate all regions at once for the whole file! The commenter will also not longer produce regions were you already have some (even if they are different), especially if you press Ctrl+3 multiple times you will see what I mean ^^.

  • Fixed #if DEBUG in Using directives (caused trouble, was removed)

  • Also added code to always remove #if DEBUG and #endif, especially at the beginning and end of the Using directives region

  • Fixed double line #using Using directives issue when using directives got mixed up.

  • Fixed long line commenter generation, will now still work, but not longer cut of any of your code. If you have long code lines (>100 letters), you can still generate comments for them and the Commenter will not longer cut anything off (you are responsible for formating the code).

  • Fixed auto-collapsing of regions, especially when closing blocks in methods, the method should not auto-collapse!

  • Checked support with other languages (which are at least similar to C#) like Lua, Python, etc.

  • In Python/Lua, etc. we had to disable } comment generation and also use other comments (# for python, -- for lua) when using Ctrl+1 for header generation.

  • Test all other hotkeys and make sure they do not affect the code badly in CodeRush unsupported languages (note: VB is still not supported since it is very different from c# code).

  • Supports now any unit test framework, actually does not care anymore what you use, only the unit test generation code will add Xunit, but you can easily change that code if you want to.

  • Options are now available directly into Editor tree of the CodeRush options!

  • Refactored all classes, added about 4 new classes and removed 1 unused class. The source code is now much easier to read, to follow and to change.

  • Remove commented out code, cleaned up the source code a lot.

  • And finally applied the commenter to the commenter source code :)
Some cool and highly complex ideas (like the auto refactoring and resorting of all code elements in a file) did not make it into v1.8 and will probably lay on ice for a while until I start developing CR_Commenter v2.0. But other than that I'm pretty happy with the new version and both the new region generation code and the new unit test generation code is really helpful, plus the many fixes and improvements of existing features make it more enjoyable to use CR_Commenter.

Download CR_Commenter v1.8 here (free as usual, you will need DXCore, which you can download here freely):

Leaving Seattle USA and flying back to Germany - Friday (Day 7)

by Benjamin Nitschke 20. April 2008 16:08
This is the final post of my picture set (7 Days of posting pictures, uff). Nothing much happened on Friday. I just woke up in the hotel, posted the Thursday post, watched some more GOM TV StarCraft Videos and finally left to the Seattle Airport. My camera batteries were depleted and most of the pictures were not recorded because of that. From time to time I was able to shake the batteries enough to make one or two pictures ^^

I hope this is not the plane that will take me all the way back to Europe :)

After basically just walking over to the gate the plane was not there yet. I expected one or two hours of security checks and waiting like in the past, but it took maybe five or ten minutes to walk through that. Strange .. maybe it was early or just luck.

Ah, there is my plane. My laptop batteries are almost dead by now and I will read the book I brought along (Digital Fortress). Sleeping in the plane is not an option, way too uncomfortable and too noisy.

Bad weather in Frankfurt - Germany. We slided quite a bit on the water on the runway. By now it is actually Saturday because of the 10 hour flight plus the 9 hours time difference.

Cool secret underground tunnel. The airport was so packed, it took over an hour to get to the security and finally reach my gate just in time. And all that stress just to find out that my plane to Hamburg has not arrived yet and will be 30 minutes late.

Finally reaching Hamburg Airport (looks much smaller, doesn't it?). It is about 1:00 PM here now and I'm awake for 18 hours now.

Not only is Hamburg Airport much smaller, there are no train connections. You have to take a bus first and then drive all around the city. Next time I will probably take the Airport Express Bus, which drives directly to Hamburg Hauptbahnhof (main train station). It is quicker to get back home from there for me.

I hope you enjoyed my pictures. Sorry for any misspellings I might have made, just contact me to fix links or names. Most of the time I wrote the text in a bus ride or while listening to a session. Next I will probably blog a little bit about ASP.NET MVC, Silverlight and/or IronPython.

MVP Summit 2008 in Seattle USA - Thursday (Day 6)

by Benjamin Nitschke 18. April 2008 18:13
Thursday was the last day of the MVP Summit and the closing keynotes by Ray Ozzie and Steve Balmer were in the Seattle Convention Center again. Additional sessions were hold in the hotels later that day.

After eating some breakfast it was time for the final keynotes.

Ray Ozzie told us how great we are and told some not so exciting development and technology stories. Maybe it was still too early to listen to anything but jokes.

A short break and preparing the mind for the upcoming Steve Balmer speech.

The weather outside is as usual. I guess I was really lucky last Saturday, which was the nicest day wheaterwise I had all year.

Say hello to Steve Balmer.

Steve is moving so fast and always so excited about everything, it is hard to take a still picture of him.

Mr. Balmer is wondering about Microsoft's Strategy? Not really, he is just straching his head :)

Looks like he is giving up on the Online Business ^^ He was actually talking about the fact that Microsoft is only number 3 in Online Search. But as much as he wishes to change that I predict Google will be on the top for a long time to come.

Now that is a lot of products!

Time for some questions.

Poor Steve did not only have to answer 3 Sharepoint/Groove questions in a row, but then the Canadians went crazy once again and demanded that he will wear a stupid shirt like the rest of the Canadians.

Which Steve Balmer actually went along with ^^ Some questions were really stupid now, but Steve stayed cool and always had funny remarks.

More gifts for Balmer!

And this is what he looked like at the end. Well, it was a nice MVP Summit and most sessions and keynotes were exciting and fun to watch.

Time to get up and eat some lunch. But it is only 11:30, why eat lunch already .. crazy.

Still about 1700 MVPs around.

The Canadians couldn't stop making noise and drawing attention. Time for a final group photo. Other MVPs told me that this is not the first time they acted that strange and it was not funny anymore. Just stay normal guys, this is not a sporting event.

At lunch all the XNA/DirectX MVPs meet for a last time. We put 2 tables together and relaxed for a while until it was time to eat lunch.

Someone is taking a picture of us. I guess Andy Dunn will upload his pictures somewhere too, I will check out his blog later.

A lot of Asian guys were also taking pictures of themselfs :)

Saying bye to Pat and Andy Dunn and Andys Camera :)

Leaving the Conference area for the last time. Still only XNA/DirectX MVPs on this photo.

Nick Gravelyn is telling us about his next 100 game ideas.

And George Clingerman, Catalin Zima and me are listening.

And one optinoal session I attended to in the afternoon at the hotel. It was about the VS Debugger and VS 2008 SP1 and was very informative and exciting. Especially through the fact that the audience was quite loud about known bugs and issues we have every day.

Good. I made it, time for me to leave to the airport now. It will be a long trip back. It was a nice time here in Seattle, but I will be glad to be home again and not having to type on my laptop keyboard anymore :)

MVP Summit 2008 in Seattle USA - Wednesday (Day 5)

by Benjamin Nitschke 17. April 2008 23:27
Wednesday Sessions were on the Microsoft Campus again. I was most of the time this day in Building 85 (same as yesterday) and listening and participating to XNA discussions. In the evening the fun MVP Attendee Party at the Experience Music Project at the Seattle Center, which was a lot of fun.

The day started again with taking the bus to the Microsoft Campus again. Since I woke up a little bit later today I ate half of my breakfast in the bus :)

The XNA Sessions are starting and everyone is checking emails and stuff. Took like 4 years to download 1 kb of data.

After the lunch break someone suggested that we go over to Building 84 and check out the "Wall of graphic cards", which was pretty cool, but we were not allowed to take photos for some strange reason.

This is Mateusz Kierepka from Poland, another XNA MVP, who thinks like me that Silverlight and XNA should merge sooner than later :) Sadly the XNA Team is not thinking the same way yet.

Leaving Building 85 after the final session ..

And heading back to the hotels.

Once there after preparing the post from the day before I headed out for the Party at the Seattle Center park.

And I was taking the Monorail once again, which is quite a bit faster than my feet.

The Seattle Space Needle at night (or at evening). Still people driving up and down ..

At the party we were again not allowed to take any pics of the Science Fiction Museum or the History of Music exhibition. And my camera batteries being low didn't help either.

Most other pictures of today were either blurry or boring. Sorry for not much more. Hopefully the Camera will be at good enough health tomorrow. I do not have anymore replacement batteries :(

And tomorrow some pictures of the final keynotes by Ray Ozzie and Steve Balmer and some final goodbye pictures.

MVP Summit 2008 in Seattle USA - Tuesday (Day 4)

by Benjamin Nitschke 17. April 2008 02:26
Tuesday's Sessions were happening on the Microsoft Campus. Since the XNA MVP Party yesterday and waking up this morning (which is actually Wednesday) I had no time to prepare and publish this blog post. On the Microsoft Campus, especially in Building 85 (XNA Guys) there was no way I could upload this because Internet was just way too slow. So this post had to wait until I got back to the Hotel after the Attendee party.

This morning we could eat breakfast at the Hotel in this huge ballroom.

Walking out of the hotel to the bus, which will take us to the 15km distant Microsoft's Campus.

The weather is pretty much the same as on Monday or Sunday. Driving up north here until we reach the bridge over to Kirkland and Redmond.

After about a 40 minute drive we arrived at the Microsoft Conference Center (Building 33). Traffic is not going very fast over here ^^

This is how it looks inside the Microsoft Conference Center (short MSCC) at 9:00 in the morning when a conference is going on.

Instead of attending the first XNA session I decided to take a look at the Silverlight 2.0 talk by the master himself: Scott Guthrie

Until someone decided to throw down this wall, which causes quite a bit of noise and amusement.

And this was me uploading the post for Monday yesterday while listening to the sessions.

After eating some lunch and then some cake (see picture) I watched some StarCraft vods from GOM TV with the good old Nick 'Tasteless' commenting in English. This was the game with Tossgirl, which was very exciting to watch.

Shortly after that another session about ASP.NET MVC started with Scott Hanselman.

The MVC talk was very enjoyable to watch because of the many remarks Scott made.

As you can see, the MVC framework is still very much a work in progress.

Okay, let me take a look at that. Hmm, that should test the MVC routing engine. While Scott was talking about that I tried to write some MVC tests with Xunit, which worked just great (as advertised).

Setup-Code for some routes, looks complicated, but I'm not sure how to make them much easier.

I went to Building 85 now for more XNA sessions over there. It was raining quite a bit.

One of the buses traveling from building to building at the Microsoft Campus.

A few native DirectX MVPs, which probably make fun of us managed DirectX/XNA MVPs. But it is all in good fun, we all like DirectX somehow :)

Heading back to Seattle through all the traffic.

Instead of heading back to the Hotels all XNA/DirectX MVPs had a nice little dinner at Jillian's, which obviously did not have enough power to light up both parts of their logo.

Andy Dunn (The ZMan), Sean ?, Michael Klucher (from the XNA Team) and George Clingerman (Mr. standing around and discussing the physics of billiard :)

Michael Klucher, Nick Gravelyn and Niko Sumi? sitting down and discussing more XNA.

And finally heading back to the Hotel after we were thrown out from Jillian's ^^

More pictures today from the second and last day at the Microsoft Campus. Cya!

MVP Summit 2008 in Seattle USA - Monday (Day 3)

by Benjamin Nitschke 15. April 2008 18:31
Today (Monday, but it will be yesterday at the time I post this) was the first day of the MVP Summit 2008. BTW: I uploaded this post from the Microsoft Campus and it took around 2 hours to upload all the photos (2.5 MB ^^). Tomorrow I will do it from the Hotel again, no fun to do anything but a little surfing here.

After posting the blog post for Sunday (Day 2) from my hotel, the first thing I had to do was to move from my first Hotel (Renaissance) to the Seattle Conference Center and then later in the day to the Sheriton Hotel right beside it. The weather was similar to Sunday.

Several signs and banners were greeting the over 1700 MVPs and RDs that came to this event.

But before the opening welcome keynotes started it was time to eat some lunch first. The room was quite big and the food was good as usual :)

The keynotes were a little bit boring at first, but when Sean O'Driscoll came out and talked about MVPs and the evolution of Social Networking, it was very enjoyable because he is such a good speaker. You can see him on the picture above talking about Web 2.0.

After the welcome speaches the Open Space sessions started, which basically means you get together with a couple of other MVPs and everyone discusses around a given topic.

I attended the MVC and Unit Testing sessions and both were interessting, but the Testing discussion was more fruitful IMO.

This is one of the slides that were developed in the beginning of the Unit Testing session. I guess the discussion will continue somewhere on a blog or wiki somewhat soon.

The wheater outside was rainy again. I had to wait a bit until my hotel room was ready, so I walked around a bit trying to find any shopping stores that interested me. Let's just say I was not very interested at all the cloathing stores and restaurants here.

There is always construction of new sky scrappers going on here.

Still cold and raining ...

I ended up in "Little Italy" for a while, but again notthing of interest here for me.

This reminded me of a picture I took at my first trip to the US (Los Angeles in 2005).

Outside the Seattle Art Museum there was a big metal guy standing and waving his arm (or hamering something, I'm not that good at Art ^^).

Okay, and other wishes can also be satisfied here. Strange location for such a place, right next to the Seattle Art Museum.

The highway to the west and the Seattle Habour behind it.

Again the Public Libary of Seattle. This time it is open, but I'm back on my way to the hotel, my room should be ready now.

After finally checking in I had to go back to the Convention Center because the Welcome Dinner began right now and I had the chance once again to meet with the other MVPs from Germany, Switzerland and Austria.

Some other guys from Germany at the Welcome Dinner. As you can clearly see they are "Men" as it states right above their heads :)

The camera war has begun!

This is Peter Bucher in the middle, we talked quite a bit this evening. He is an ASP.NET MVP.

Some more German MVPs.

This guy had constantly problems with his camera, which was obviously better than all our other cameras combined :) He also took aprox. 10 times more pictures than everyone else at the MVP Summit combined ^^

And thats it for today. All other pictures were as blurry as my vision this evening after drinking all kinds of beer they had to offer here (I think it was Heiniken, Red Hook, MSC something, and something else, can't remember).

Tomorrow all the sessions will take place at the Microsoft Campus. Until then ..

Visiting USA Seattle 2008 - Day 2

by Benjamin Nitschke 14. April 2008 16:33
Well, most of the pictures today are still from Saturday because I made so many that day. At Sunday the weather here was like in Germany, rainy and cold. I went a little shopping and went to a movie theatre, which was very enjoyable. In the evening I went to a MVP Germany meeting, but my Camera batteries died. But many other people made photos, I will post a link as soon as I know where all the photos are going to be uploaded.

The Space Needle I visited yesterday.

Well, it is not cheap to get up there. And due the good weather a lot of people had the same thought I had.

After waiting about 30 minutes in line I finally was driving up.

The buildings on the ground are getting smaller and smaller.

Great view at the top. You can walk on the inside and the outside and view in any direction you like.

The habour south of the Space Needle.

A big ship in the south west. It probably is too big to move any closer.

The waterfountain I posted yesterday from above. Its surreal how small the people are. It was a lot of fun zooming in at people and stuff going on down there.

A lot of buildings. Reminded me a bit of Ghost Recon. The jpg compression is also not working well on this image, it is more twice the size than the other images here ^^

Lake Union in the south east. My hotel was located there last time. The good weather also has its effects on the people down there :)

And to the east there is Lake Washington (hardly visible on this image) and behind that are Kirkland, Redmond, Bellevue and so on.

And finally Seattle Downtown south of the Space Needle. The MVP Summit will be on the very lower left side ^^

Mount Rainer, the highest mountain here, was also visible this day.

The water shader effects are certainly nice to look at. After spending about an hour on top of the Space Needle I decided to go back down to where all the action is.

And this is how Seattle looks at night at the daytime if you look at some monitors displaying night time in the middle of the day. Hopefully this sounded confusing enough.

A look up the Space Needle from below again.

A big red thingy.

In the Pacific Science Center you can watch movies in 3D, but all the movies were pretty boring (only kids stuff).

More stuff for kids in the Seattle Center Center Hall (what a stupid name). I ate some icecream and went back outside for the rest of the day exploring Seattle.

Even at bright daylight, if you take a picture directly of the sun, the surrounding area looks kinda dark. Confusing again ..

At sunday the weather was bad as I said above. I did not take many pictures. Here you can see my in the elevator playing around with my camera.

At the movies .. I saw Street Kings. It was an good movie with a lot of action and twists.

The public libary looks pretty cool. It is also quite big, but it was closed at Sunday.

And finally the Bank of America Towers, the biggest building here in Seattle. The weather was getting worse and it began to rain. I went back to my hotel and went to the MVP Germany meeting a few hours later (but no pictures because of my empty camera batteries).

And today (Monday) the MVP Summit will start. I'm pretty excited about this.

Visiting USA Seattle 2008 - Day 1

by Benjamin Nitschke 14. April 2008 01:45
Since I had no internet access yesterday, this is the post from yesterday. It was great wheater here in Seattle when our plane arrived here and much hotter than in good old Germany. I took so many pictures that I will only post a few of them today and more tomorrow, but this post is still big, there are 26 pictures in here. I'm also trying to display them differently this time in a table, not sure if this is a good idea or not, but it should make the post shorter and give you a better overview about all days in case I keep up posting this much images (hehe, I love my new camera).

Starting from Hamburg - Germany at around 7 o'clock. Weather is cold as usual (have not experienced anything else because I just live there for 3 months now ^^).

After playing around with my Camera and getting more annoyed with my Zune after I installed the latest firmware yesterday (Zune software just sucks, same as any stupid iTunes stuff) at Hamburg airport and Frankfurt airport my plane to Seattle left at around 11:00 am from Frankfurt.

Germany is getting smaller and smaller and I tried to take a few shorts with maximum zoom but they all were to blurry, so I have chosen this picture instead. From now on the whole flight was above clouds and it seems like it was bad weather all over the place.

Over Greenland I some ground again, but it does look all icy and unpleasant down there ^^ The plane ride was actually quite nice, each seat had its own entertainment system, which crashed only twice during the flight (it was running Windows CE). Also my first time flying with Lufthansa to the US. As usual I could not sleep during the flight so I read a book and watched some movies and TV shows.

At around 11:30 AM we have been flying for over 9 hours but the local time tells us different. After flying over the Cascades (see picture) and later Mount Rainer we landed in Seattle. The immigration guy told me that it seems like half our plane was full of people attending the MVP Summit :)

And here we see Kirkland and Redmond where Microsoft is located. On the very left you can also see Seattle Downtown.

This is a better picture of Seattle. I zoomed in a bit because we were still kinda far away. The plane was originally approaching from the North, but after making a big curve we landed from the South. The airport seemed to be quite busy and that must be the reason for taking a bigger detour.

At the ground and after getting through all the extra security checks (well, here is your luggage, but hey, just give it back to us in a few minutes, we will check it again) I decided to take a bus to Seattle Downtown, which turned out to be the stupidest idea of the day.

Not only did the bus arrive 40 minutes behind schedule, it was also packed and the passengers were complaining how stupid the driver is. It seemed like he drove the wrong way and made stops where this bus is not supposed to stop. Next time I will take a cab again, I did not even find my hotel at first because no one seems to bother putting up street numbers anywhere on the houses. An impossibility in Germany.

But even without street numbers these buildings always amaze me. Frankfurt has some skyscrapers too, but in Hannover or Hamburg buildings do not seem to get very high and they certainly are not sitting right next to each other ^^

I finally reached my hotel and I got a nice view on the east side of Seattle, but the weather is just too nice to go to sleep now (just up for 19 hours, nothing special for a game programmer ^^).

Instead I decided to go down to steet level again and explore Seattle a little bit more. Last time I visited I skipped some attractions.

My hotel for the first two nights is this one, the Seattle Renaissance Hotel with 28 floors. I'm pretty much in the middle at floor 15. From Monday on I will stay at another Hotel sponsored by the MVP Summit :)

The sun is still high and the weather was really nice at around 18 degrees celisus, much better than in Germany and better than the last time I visited. It was nice to be able to run around with just a shirt on (ok, I had pants too).

Some flags outside a building. Can you spot the one that seems to appear twice?

On the left side you an see a church. Hmm, churches to certainly look much different in Germany.

Shadow mapping, reflection and lighting effects are working out quite nicely in this real-world-engine.

In the back you can see the Washington State Convention and Trade Center in Seattle where the MVP Summit will be held (for the most part I think).

Can you see the girl running through this waterfall?

This is ridiculous. If you want to wiretap someone, do not have a 10 meter high antenna sticking out of your car roof. No way no one did not notice this thingy.

Okay, where is the Monorail so I do not have to walk all the way over to the Seattle Center park. Ohh, I guess it is over there.

Last time I was here the ride was free, now it costs 2 dollars. Well, still better than walking and since a dollar is only 0.62 Euro cents, it is not that much ^^

For some reason I think these people are doing something wrong. It might be fun to walk down a roller coaster, but I guess there must be some other way to make it even more fun.

I took many pictures of the Space Needle and many pictures from the top, but I already posted enough pictures for today. I will post these pictures tomorrow. This is a big fountain in the middle of the Seattle Center park.

The sun decided to go to sleep, maybe I should think about it too after being up for almost 24 hours now (well, the day is not over yet).

If I had such a limousine getting back to the hotel would have been easier I guess. But instead of going back directly I went to shop a little bit. Gotta love the fact that most stores have opened up almost all the time and any day of the week.

More pictures tomorrow then (or actually later today I guess).

Flying to Seattle - USA again, this time for the MVP Summit

by Benjamin Nitschke 11. April 2008 21:09
Tomorrow morning I will fly to Seattle - USA again and make many pictures with my new camera (no cell-phone pics anymore ^^). The MVP Summit starts Monday, but it was cheaper to fly Saturday and I will have 2 days visiting Seattle again. Hopefully I will have Internet Access every day so I can upload pictures I took over there.

I have to go to sleep now, my journey starts in a few hours and sleeping in the plane never worked out great for me :)

Using Nullsofts Installer System (NSIS) to create Setups for XNA Games

by Benjamin Nitschke 10. April 2008 22:31
After updating so much on my blog the last 2 days and posting all the unfinished posts I had prepared a few weeks ago I finally reach the last important one I wanted to make. But due the fact that I will fly to the MVP summit tomorrow I better not stay away too long. Hopefully this post still contains all the vital information. Let's get started.

First of all you need the latest version of the free NSIS (Nullsoft Installer System):
There are TONS of information on that website and if you are new to the NSIS scripts be sure to read at least the quick start guide (called simple tutorials) and use the NSIS Forums search feature for more specific problems and questions.

Good, now just let us go quickly through the .nsi file I currently use for all my XNA Game Setups. Please note that this file has evolved over many years (I guess I started using NSIS in 2002) and parts might not be simple to read or even be how it is done today, but the script was always a very helpful and quick way to create Setups for me. While detecting all the requirements to make XNA work is not a piece of cake many NSIS tutorials helped me to figure all the parts out.

The following .nsi script is from the previous blog post "Loading Collada Models in XNA 2.0 and doing Skinning and Animation" and was used to build the XnaSkinningColladaModelsSetup.exe (2.2 MB) file. If you want to use it for your own XNA Game project just use a text-editor and replace "XnaSkinningColladaModels" with your own game name (it occurs many times in the file). Also create a .bmp file with the name of your game for the setup header (check MUI_HEADERIMAGE_BITMAP) or comment the 2 Header Image lines out with a ; or # if you do not want any header image. All files are grabbed from the /Release directory and will be installed to the target (make sure that you only have files in the /Release directory that you want to have deployed). This should be already enough information to make your setup work, the rest of this article will just go into the details of the script.

The XnaSkinningColladaModelsSetup.nsi file is organized in 6 parts (Initialization, onInit, File section, Optional sections, Helper functions and Uninstall):
  • Initialization: Just sets all the names, the required modules, and how the setup is displayed to the user (all the pages, see MUI_PAGE). Version information and file information are also a vital part here and you should enter some meaningful values here. Also put any language strings for different languages (this installer is just using english text) at text part of the initialization code.
    !include "MUI.nsh"
    SetCompressor /SOLID lzma
    ;Name and file
    Name "XnaSkinningColladaModels"
    OutFile "XnaSkinningColladaModelsSetup.exe"
    ;Default installation folder
    InstallDir "$PROGRAMFILES\XnaSkinningColladaModels"
    ;Get installation folder from registry if available
    InstallDirRegKey HKLM "Software\XnaSkinningColladaModels" ""
    ;Interface Settings
    !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-blue.ico"
    !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-blue.ico"
    !define MUI_HEADERIMAGE_BITMAP "XnaSkinningColladaModels.bmp"
    !define MUI_HEADERIMAGE_UNBITMAP "XnaSkinningColladaModels.bmp"
    !insertmacro MUI_PAGE_WELCOME
    !insertmacro MUI_PAGE_COMPONENTS
    !insertmacro MUI_PAGE_DIRECTORY
    !insertmacro MUI_PAGE_INSTFILES
    !insertmacro MUI_UNPAGE_CONFIRM
    !insertmacro MUI_UNPAGE_INSTFILES
    !insertmacro MUI_LANGUAGE "English"
    ;Version Information
    VIProductVersion ""
    VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "XnaSkinningColladaModels"
    VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "XnaSkinningColladaModels project, see"
    VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" ""
    VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© 2007"
    VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "XnaSkinningColladaModels"
    VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" ""
    ; The text to prompt the user to enter a directory
    ComponentText "This will install XnaSkinningColladaModels for XNA 2.0."
    UninstallText "This will remove XnaSkinningColladaModels for XNA 2.0 from your computer."
    ; New .NET Check function, we want at least v2.0
    !define DOT_MAJOR "2"
    !define DOT_MINOR "0"
    ; The text to prompt the user to enter a directory
    DirText "Please select a directory for the installation:"
    AutoCloseWindow true

  • .onInit: This method is executed before the installer is run and can perform any checks you like. I just try to find out if any c:\games directory exists in several languages, if it does, then we can use it, else just use the default c:\program files location.
    Function .onInit
        ;First try to find "Games" (eng), "Spiele" (ger), "jeux" (fr),
        ; "giochi" (ita), "jogos" (port) or "spelen" (nl) directory!
        StrCpy $R1 "C:\Games"
        IfFileExists $R1 UseIt
        StrCpy $R1 "C:\Spiele"
        IfFileExists $R1 UseIt
        StrCpy $R1 "C:\jeux"
        IfFileExists $R1 UseIt
        StrCpy $R1 "C:\giochi"
        IfFileExists $R1 UseIt
        StrCpy $R1 "C:\jogos"
        IfFileExists $R1 UseIt
        StrCpy $R1 "C:\spelen"
        IfFileExists $R1 UseIt
        Goto DontUseIt
        StrCpy $INSTDIR "$R1\XnaSkinningColladaModels"

  • File section: This is the most important section and always required because it tells the setup where the files come from (in our case from the Release sub directory) and where they should be installed (in #INSTDIR).
    ; The stuff to install
    Section "XnaSkinningColladaModels"
      SectionIn RO
      ; Set output path to the installation directory.
      SetOutPath $INSTDIR
      ; Put file there
      File /r "Release\*.*"
      ; Write the installation path into the registry
      WriteRegStr HKLM "SOFTWARE\XnaSkinningColladaModels" "Install_Dir" "$INSTDIR"
      WriteRegStr HKLM "SOFTWARE\XnaSkinningColladaModels" "Version" "v1.0"
      ; Write the uninstall keys for Windows
      WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XnaSkinningColladaModels" "DisplayName" "XnaSkinningColladaModels"
      WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XnaSkinningColladaModels" "UninstallString" "$INSTDIR\uninstall.exe $INSTDIR"
      WriteUninstaller "uninstall.exe"

  • Optional sections: These sections are optional and the user can decide not to create desktop shortcuts, not to install XNA 2.0 if it is not found, etc. I usually leave them all on by default because they make sense. Most important here are the DirectX and XNA prequisites sections, which make a lot of use of the helper functions.
    ; Optional sections
    Section "Create Start-Menu shortcuts"
      StrCpy $R1 "$SMPROGRAMS\XnaSkinningColladaModels"
      CreateDirectory "$R1"
      CreateShortCut "$R1\XnaSkinningColladaModels.lnk" "$INSTDIR\XnaSkinningColladaModels.exe" "" "$INSTDIR\XnaSkinningColladaModels.exe" 0 "" "" "XnaSkinningColladaModels"
      CreateShortCut "$R1\XnaSkinningColladaModels Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 "" "" "Uninstall XnaSkinningColladaModels."
      CreateShortCut "$R1\" "" "" "" 0 "" "" " website from the creator of this game"
    Section "Create Desktop shortcuts"
      CreateShortCut "$DESKTOP\XnaSkinningColladaModels.lnk" "$INSTDIR\XnaSkinningColladaModels.exe" "" "$INSTDIR\XnaSkinningColladaModels.exe" 0
    Section "Check for .NET 2.0 Framework (required)"
      Call IsDotNETInstalled
      Pop $0
      StrCmp $0 1 found.NETFramework no.NETFramework
    ;MessageBox MB_OK ".NET was not found .."
      ; First of all check for correct IE version!
      Call CheckForCorrectIEVersion
      ; First check if DotNetFx.exe exists
      IfFileExists "$EXEDIR\DotNetFx.exe" 0 DotNetFileNotFound
      ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" "AutoAdminLogon"
      ExecWait '"$EXEDIR\DotNetFx.exe" /q'
      StrCmp $R0 1 RestoreAutoLogon End
      WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" "AutoAdminLogon" "1"
      goto End
      ; If DotNetFx.exe was not found, try downloading online
      MessageBox MB_YESNOCANCEL|MB_ICONQUESTION ".NET Framework 2.0 was not found. XnaSkinningColladaModels will not run without it! $\r$\nWould you like to automatically download and install it? $\r$\n $\r$\nChoose Yes for an automatic download and installation. $\r$\nChoose No, you want to select the download yourself (e.g. locally if already downloaded). $\r$\nMicrosoft's .NET Framework Download page will open up! $\r$\nChoose cancel to abort any action here, you will have to install the .NET Framework (2.0) $\r$\nyourself. That can be done for example automatically by the Windows Update $\r$\n(just go to )" IDYES DL IDNO IndirectDL
      goto End
        ExecShell open "" "" SW_SHOWNORMAL
        goto End
        Call ConnectInternet ;Make an internet connection (if no connection available)
        StrCpy $2 "$TEMP\DotNetFX_Setup.exe"
        NSISdl::download $2
        Pop $0
        StrCmp $0 success success
          SetDetailsView show
          DetailPrint "download failed: $0"
          MessageBox MB_OK ".NET could not be installed, download was aborted. Please install .NET yourself! $\r$\nRest of the installation went ok, you just need .NET 2.0 to start XnaSkinningColladaModels!"
          goto End
          ; Install, in quiet mode (will do everything automatically)
          ExecWait '"$2" /q'
          Delete $2
        goto End
    ;MessageBox MB_OK ".NET is installed, very good ^^"
    Section "Check for DirectX 9.0c (November 2007) (required)"
      call IsDirectX9Installed
      pop $0
      StrCmp $R1 1 maybefound.DirectX9 notFound.DirectX9
        ; Check if managed directx december 2006 is installed!
        IfFileExists "$WINDIR\Microsoft.NET\DirectX for Managed Code\1.0.2911.0" found.DirectX9  
    ;MessageBox MB_OK "DirectX9 or better was not found!"
      ; First check if a file "dx90update_redist.exe" exists
      IfFileExists "$EXEDIR\directx_nov2007_redist.exe" 0 DX9RedistFileNotFoundTest1
      ExecWait '"$EXEDIR\directx_nov2007_redist.exe" /Q /T:"$TEMP" /C'
      ; Now install DirectX9
      ExecWait "$TEMP\dxsetup.exe"
      goto End
        ; Check again in temp folder
      IfFileExists "$TEMP\directx_nov2007_redist.exe" 0 DX9RedistFileNotFound
      ExecWait '"$TEMP\directx_nov2007_redist.exe" /Q /T:"$TEMP" /C'
      ; Now install DirectX9
      ExecWait "$TEMP\dxsetup.exe"
      goto End
      ; If that failed, ask user!
      MessageBox MB_YESNOCANCEL|MB_ICONQUESTION "DirectX9.0c November 2007 or better was not found. XnaSkinningColladaModels needs DirectX9.0c and Managed DirectX runtimes to run. $\r$\nWould you like to automatically download and install it? $\r$\n $\r$\nChoose Yes for an automatic download and installation. $\r$\nChoose No, you want to select the download yourself (e.g. in another language than english). $\r$\nMicrosoft's DirectX Download page will open up! $\r$\nChoose cancel to abort any action here, you will have to install DirectX yourself." IDYES DL IDNO IndirectDL
      goto End
      ExecShell open "" "" SW_SHOWNORMAL 
      goto End
      Call ConnectInternet ;Make an internet connection (if no connection available)
      StrCpy $2 "$TEMP\directx_nov2007_redist.exe"
      NSISdl::download $2
      Pop $0
      StrCmp $0 success success
        SetDetailsView show
        DetailPrint "download failed: $0"
        MessageBox MB_OK "DirectX could not be installed, download was aborted. Please install DirectX yourself! $\r$\nRest of the installation went ok, you just need DirectX 9.0c December 2006 to start XnaSkinningColladaModels!"
        goto End
        ; Install quietly into temp folder
        ExecWait '"$2" /Q /T:"$TEMP" /C'
        ; Now install DirectX9
        ExecWait "$TEMP\dxsetup.exe"
        ; Yeah, we made it!
        ;why delete, maybe user wants to keep it ^^ Delete $2
      goto End
    ;MessageBox MB_OK "Found DirectX9 or better .."
      goto End
    Section "Check for XNA 2.0 (December 2007) (required)"
      call IsXNAInstalled
      pop $0
      StrCmp $R1 1 found.XNA notFound.XNA
      MessageBox MB_YESNOCANCEL|MB_ICONQUESTION "XNA 2.0 (December 2007) or better was not found. The XnaSkinningColladaModels needs the XNA 2.0 runtimes to run. $\r$\nWould you like to automatically download and install it? $\r$\n $\r$\nChoose Yes for an automatic download and installation. $\r$\nChoose No, you want to select the download yourself (e.g. in another language than english). $\r$\nMicrosoft's XNA Download page will open up! $\r$\nChoose cancel to abort any action here, you will have to install XNA yourself." IDYES DL IDNO IndirectDL
      goto End
      ExecShell open "" "" SW_SHOWNORMAL 
      goto End
      Call ConnectInternet ;Make an internet connection (if no connection available)
      StrCpy $2 "$TEMP\xnafx20_redist.msi"
      NSISdl::download "" $2
      Pop $0
      StrCmp $0 success success
        SetDetailsView show
        DetailPrint "download failed: $0"
        MessageBox MB_OK "XNA 2.0 could not be installed, download was aborted. Please install XNA 2.0 yourself! $\r$\nRest of the installation went ok, you just need XNA 2.0 (December 2007) to start the XnaSkinningColladaModels!"
        goto End
        ; Install XNA, quietly does not work on vista for some reason ...
        ExecWait 'msiexec /i "$2" /q'
        ; Yeah, we made it!
        ;why delete, maybe user wants to keep it ^^ Delete $2
      goto End
    ;MessageBox MB_OK "Found XNA 2.0 or better .."
      goto End
    Section "-Ask some questions"
      MessageBox MB_YESNO|MB_ICONQUESTION "Start the XnaSkinningColladaModels now?" IDYES StartRC
      goto DontStart
      Exec "$INSTDIR\XnaSkinningColladaModels.exe"

  • Helper functions: These little helpers are the utitilies to make all the complex XNA installation steps work. They go through all the steps from making sure .NET is installed, installing it automatically for you if you like, even opening up an internet connection if you are on dialup, checking all the prequisites for installing .NET (like having at least IE 5) and then finally install all the XNA 2.0 and DirectX stuff that is required to run your game on top of that. All without ever leaving the installer and tested on many platforms. I usually do not touch this code unless I have to update some links or include a newer version of .NET, DirectX or XNA. I tried to comment my work, but understanding this script part will not be easy. Just do not expect that any changes you make here will be safe. You need to do a lot of testing in order to add additional functionality here.
    ; IsDotNETInstalled
    ; Usage:
    ;   Call IsDotNETInstalled
    ;   Pop $0
    ;   StrCmp $0 1 found.NETFramework no.NETFramework
    ;Function IsDotNETInstalled
    ;   Push $0
    ;   Push $1
    ;   Push $2
    ;   Push $3
    ;   Push $4
    ;   ReadRegStr $4 HKEY_LOCAL_MACHINE \
    ;     "Software\Microsoft\.NETFramework" "InstallRoot"
    ;   # remove trailing back slash
    ;   Push $4
    ;   Exch $EXEDIR
    ;   Exch $EXEDIR
    ;   Pop $4
    ;   # if the root directory doesn't exist .NET is not installed
    ;   IfFileExists $4 0 noDotNET
    ;   StrCpy $0 0
    ;   EnumStart:
    ;     EnumRegKey $2 HKEY_LOCAL_MACHINE \
    ;       "Software\Microsoft\.NETFramework\Policy"  $0
    ;     IntOp $0 $0 + 1
    ;     StrCmp $2 "" noDotNET
    ;     StrCpy $1 0
    ;     EnumPolicy:
    ;       EnumRegValue $3 HKEY_LOCAL_MACHINE \
    ;         "Software\Microsoft\.NETFramework\Policy\$2" $1
    ;       IntOp $1 $1 + 1
    ;        StrCmp $3 "" EnumStart
    ;         IfFileExists "$4\$2.$3" foundDotNET EnumPolicy
    ;   noDotNET:
    ;     StrCpy $0 0
    ;     Goto done
    ;   foundDotNET:
    ;     StrCpy $0 1
    ;   done:
    ;     Pop $4
    ;     Pop $3
    ;     Pop $2
    ;     Pop $1
    ;     Exch $0
    ; Call IsDotNetInstalled
    ; This function will abort the installation if the required version 
    ; or higher version of the .NETFramework is not installed.  Place it in
    ; either your .onInit function or your first install section before 
    ; other code.
    Function IsDotNETInstalled
      Push $0
      Push $1
      Push $2
      Push $3
      Push $4
      StrCpy $0 "0"
      StrCpy $1 "SOFTWARE\Microsoft\.NETFramework" ;registry entry to look in.
      StrCpy $2 0
        ;Enumerate the versions installed.
        EnumRegKey $3 HKLM "$1\policy" $2
    ;MessageBox MB_OK "EnumRegKey $3"
        ;If we don't find any versions installed, it's not here.
        StrCmp $3 "" noDotNet notEmpty
        ;We found something.
          ;Find out if the RegKey starts with 'v'.  
          ;If it doesn't, goto the next key.
          StrCpy $4 $3 1 0
          StrCmp $4 "v" +1 goNext
          StrCpy $4 $3 1 1
          ;It starts with 'v'.  Now check to see how the installed major version
          ;relates to our required major version.
          ;If it's equal check the minor version, if it's greater, 
          ;we found a good RegKey.
          IntCmp $4 ${DOT_MAJOR} +1 goNext yesDotNetReg
          ;Check the minor version.  If it's equal or greater to our requested 
          ;version then we're good.
          StrCpy $4 $3 1 3
          IntCmp $4 ${DOT_MINOR} yesDotNetReg goNext yesDotNetReg
          ;Go to the next RegKey.
          IntOp $2 $2 + 1
          goto StartEnum
    ;MessageBox MB_OK "DotNet Reg stuff was found!"
        ;Now that we've found a good RegKey, let's make sure it's actually
        ;installed by getting the install path and checking to see if the 
        ;mscorlib.dll exists.
        EnumRegValue $2 HKLM "$1\policy\$3" 0
        ;$2 should equal whatever comes after the major and minor versions 
        ;(ie, v1.1.4322)
        StrCmp $2 "" noDotNet
        ReadRegStr $4 HKLM $1 "InstallRoot"
        ;Hopefully the install root isn't empty.
        StrCmp $4 "" noDotNet
        ;build the actuall directory path to mscorlib.dll.
        StrCpy $4 "$4$3.$2\mscorlib.dll"
    ;MessageBox MB_OK "Does $4 exists?"
        IfFileExists $4 yesDotNet noDotNet
    ;MessageBox MB_OK "DotNet was not found .."
        StrCpy $0 0
        Goto done
    ;MessageBox MB_OK "DotNet stuff was found!"
        StrCpy $0 1
        Pop $4
        Pop $3
        Pop $2
        Pop $1
        Exch $0
    Function ConnectInternet
      IfErrors noie3
      Pop $R0
      StrCmp $R0 "online" connected
        Strcpy $R0 "Cannot connect to the internet."
        MessageBox MB_OK|MB_ICONSTOP $R0
      ; IE3 not installed
      MessageBox MB_OK|MB_ICONINFORMATION "Please connect to the internet now."
    ; Based on Yazno's function, [url][/url]
    ; Returns on top of stack
    ; 1-6 (Installed IE Version)
    ; or
    ; '' (IE is not installed)
    ; Usage:
    ;   Call GetIEVersion
    ;   Pop $R0
    ;   ; at this point $R0 is "5" or whatnot
    Function GetIEVersion
       Push $R0
       ReadRegStr $R0 HKLM "Software\Microsoft\Internet Explorer" "Version"
       IfErrors lbl_123 lbl_456
       lbl_456: ; ie 4+
          ReadRegStr $R0 HKLM "Software\Microsoft\Internet Explorer\Version Vector" "IE"   
          Strcpy $R0 $R0 4
          Goto lbl_done
       lbl_123: ; older ie version
          ReadRegStr $R0 HKLM "Software\Microsoft\Internet Explorer" "IVer"
          IfErrors lbl_error
          StrCpy $R0 $R0 3
          StrCmp $R0 '100' lbl_ie1
          StrCmp $R0 '101' lbl_ie2
          StrCmp $R0 '102' lbl_ie2
          StrCpy $R0 '3' ; default to ie3 if not 100, 101, or 102.
          Goto lbl_done
             StrCpy $R0 '1'
             Goto lbl_done
             StrCpy $R0 '2'
             Goto lbl_done
             StrCpy $R0 ''
       Exch $R0
    ; Checks for current IE version and will try to call
    ; IE6Setup.exe if it exists, otherwise prompt the user
    ; to install it for himself (at least IE5.01 is required for .NET)
    Function CheckForCorrectIEVersion
       Call GetIEVersion
       Pop $R0
       Push $R1
       StrCpy $R1 $R0 1
       StrCmp $R1 '6' lbl_IEOK
       StrCmp $R1 '5' lbl_IE5
       StrCmp $R1 '4' lbl_IEKO
       StrCmp $R1 '2' lbl_IEKO
       StrCmp $R1 '3' lbl_IEKO
       StrCmp $R1 '1' lbl_IEKO
          StrCmp $R0 '5.00' lbl_IEKO
          Goto lbl_IEOK
    ;MessageBox MB_OK "IE5.01 or better was not found!"
          ; First check if ie6setup.exe exists
          IfFileExists "$EXEDIR\Setups\ie6sp1\ie6setup.exe" 0 IE6FileNotFound
          ExecWait '"$EXEDIR\Setups\ie6sp1\ie6setup.exe"'
          goto lbl_IEOK
          ; If DotNetFx.exe was not found, try downloading online
          MessageBox MB_YESNOCANCEL|MB_ICONQUESTION "IE5.01 or better was not found. .NET can't be installed without it! $\r$\nWould you like to automatically download and install it? $\r$\n $\r$\nChoose Yes for an automatic download and installation. $\r$\nChoose No, you want to select the download yourself (e.g. in another language than english). $\r$\nMicrosoft's .NET Framework Download page will open up! $\r$\nChoose cancel to abort any action here, you will have to install IE5.01 or better$\r$\nyourself, that can be done for example automatically by the Windows Update $\r$\n(just go to )" IDYES DL IDNO IndirectDL
          goto lbl_IEOK
          ExecShell open "" "" SW_SHOWNORMAL
          goto lbl_IEOK
          Call ConnectInternet ;Make an internet connection (if no connection available)
          StrCpy $2 "$TEMP\IE6Setup.exe"
          NSISdl::download $2
          Pop $0
          StrCmp $0 success success
          SetDetailsView show
          DetailPrint "download failed: $0"
          MessageBox MB_OK "IE6Setup could not be installed, download was aborted. Please install IE and .NET yourself! $\r$\nRest of the installation went ok, you just need IE for .NET to start XnaSkinningColladaModels!"
          goto lbl_IEOK
          ; Install, in quiet mode (will do everything automatically)
          ExecWait '"$2"'
          Delete $2
    ;MessageBox MB_OK "IE5.01 or better was found .."
    ; Check if DirectX9 or better is installed,
    ; will return $0 1 then, else $0 is 0.
    Function IsDirectX9Installed
      Push $0
      ReadRegStr $0 HKLM "SOFTWARE\Microsoft\DirectX" "Version"
      StrCpy $1 $0 4 3
      IntCmp $1 9 found.DirectX9 notFound.DirectX9 found.DirectX9
    ;MessageBox MB_OK "can't find direct9"
      StrCpy $0 0
      Goto done
    ;MessageBox MB_OK "found direct9 or better"
      StrCpy $0 1
    ;MessageBox MB_OK "direct9 found value: $0"
      StrCpy $R1 $0
      Exec $0
    ; Check if XNA 2.0 or better is installed,
    ; will return $0 1 then, else $0 is 0.
    Function IsXNAInstalled
      Push $0
      ;Enumerate the versions installed.
      EnumRegKey $0 HKCU "SOFTWARE\Microsoft\XNA\Game Studio" "v2.0"
        ;if the root directory doesn't exist XNA is not installed
      StrCmp $0 "" notFound.XNA found.XNA
    ;MessageBox MB_OK "can't find XNA"
      StrCpy $0 0
      Goto done
    ;MessageBox MB_OK "found XNA or better"
      StrCpy $0 1
    ;MessageBox MB_OK "XNA found value: $0"
      StrCpy $R1 $0
      Exec $0

  • And finally the uninstall section: This section will deinstall your game and get rid of all files in the directory that belong to the game, if there is more, it will not kill any other sub directories or even delete the game directory if there is other data present. If you want to be totally sure that only your game files are deleted, only include files that have been installed in this section via the Delete command. I used 2 RMDir /r commands to delete the Content and ColladaModels directories, which makes things much easier. But if for example the user made screenshots, they will be saved in a /Screenshots directory, which is not deleted here and will stay alive even after the uninstall is complete. There is also another check to make sure the game is still installed at this location by making sure the .exe file still exists. If the .exe file is missing, the uninstaller assumes the game is already uninstalled and it will only remove registry keys, but not any files.
    ; special uninstall section.
    Section "Uninstall"
      Delete $INSTDIR\uninstall.exe
      ; remove registry keys
      DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XnaSkinningColladaModels"
      DeleteRegKey HKLM "SOFTWARE\XnaSkinningColladaModels"
      ; remove shortcuts, if any.
      Delete "$SMPROGRAMS\XnaSkinningColladaModels\*.*"
      Delete "$DESKTOP\XnaSkinningColladaModels.lnk"
      ; remove directories used.
      RMDir "$SMPROGRAMS\XnaSkinningColladaModels"
      ; First check if rocket commander is located here, if not, dont kill stuff!
      IfFileExists "$INSTDIR\XnaSkinningColladaModels.exe" 0 RCNotFound
      ; remove files
      Delete "$INSTDIR\XnaSkinningColladaModels.*"
      RMDir /r "$INSTDIR\Content"
      RMDir /r "$INSTDIR\ColladaModels"
      ; Try to kill main folder, but this will fail if there are still some files in it
      RMDir "$INSTDIR"
      goto End
      MessageBox MB_OK "XnaSkinningColladaModels.exe was not found in $INSTDIR, won't delete any files, $\r$\nplease remove directory and files yourself (all registry keys were killed)."

Okay, we have now covered all code of the XnaSkinningColladaModelsSetup.nsi file, download it and check it out for yourself if you want to learn more about it or even use it in your projects. Good luck!
Disclaimer: The opinions expressed in this blog are own personal opinions and do not represent the companies view.
© 2000-2011 exDream GmbH & MobileBits GmbH. All rights reserved. Legal/Impressum


Which platform should Soulcraft be released on next?

Show Results Poll Archive

Recent Games



Jobs @ exDream


<<  July 2014  >>