Friday, 29 April 2011

Jeff Prosise's Blog : Silverlight 4's New Local File System Support and Problems with My Documents in Windows 7

While looking at the new restricted capabilities of Silverlight to deal with Files I came across this post Jeff Prosise's Blog : Silverlight 4's New Local File System Support. I downloaded the sample code an went to run it. It worked impressively in fact for the My Picture example. But I need to access folders in My Documents. So I tried that and oops it broke. The problem is that

string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

in windows 7 maps onto "C:\\Users\\name\\Documents" and the sub folders of that location have My Music, My Pictures and My Videos contained within and you cannot chain through these folders as you do not have permission to do so. So you have to skip over these thus

string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

foreach (string dir in Directory.EnumerateDirectories(path))
if (!dir.Contains("My Music") && !dir.Contains("My Pictures") && !dir.Contains("My Videos"))

Another Gotcha in Windows 7 and file permissions is that if you download a zip file from the web is that certain files will be blocked and you have to unblock each one before you can process the files programmatically.

Tuesday, 12 April 2011

A conveyor belt of sprites

This is an example of a set of wrap around (or Conveyor belt) sprites that can be used in a frogger type game. It is inspired by a problem that a student was having with the technique. It is an example of using a list to hold a list of sprites. It also demonstrates the idea of sub classing as it uses a sprite class that we developed previously. The key to the technique is that the original random spacing of conveyor sprites is maintained once they start moving and once they go off the lefthand side of the viewport you just need to reposition them at their width extent to the right of the viewport. The original random spacing is preserved. The ConveyorSprite class subclasses the Sprite Class which is a Drawable Game component and as such draws itself. The Update method is overridden to update the position of the Conveyor sprite so that it moves across the screen and if it goes off the left then it is repositioned to the right of the viewport. As the new Conveyor sprites are being added to List of Conveyor Sprites in the main game class, the start relative position of each off screen to the right is calculated.

The code can be downloaded at

Wednesday, 6 April 2011

Managing Complex Groups in Windows Live - Group Work for students

The Windows Live Group feature allows you to easily manage Group work for students. I have a group of about 70 students from 4 different courses in First year. These Groups are further split into groups for a game that they are designing and developing in Game Maker. I got them to set up groups with one person hosting the Group on their Sky Drive. I set up a new Windows Live ID to manage the group from my side. The Group owner invites the other members to the newly created group along with myself.

I manage the group by setting up Hotmail folders for each Course and then place the invites from each Game Group into these folders. 


This enables me to keep track of the groups within groups via the Email Invite which has a


Everyone in the Group has read write privileges on the folders in the group. This gives them a means to share content that they are developing for the game. It also allows me to keep an eye on the Progress of the group and comment or advice on the on going work.


There is a One Note web file that the group can use to document the sources of content and keep a group and individual schedule of tasks to be done and completed.

The group can contact me and each other using Instant messenger or by Emailing the group.