public void Badge ()
{
using (NSAutoreleasePool a = new NSAutoreleasePool ()) {
foreach (string path in this.paths) {
string extension = Path.GetExtension (path.ToLower ());
NSImage new_icon = new NSImage ();
if (!this.icons.ContainsKey (extension)) {
foreach (int size in this.sizes) {
NSImage file_icon = NSWorkspace.SharedWorkspace.IconForFileType (extension);
file_icon.Size = new SizeF (size, size);
// TODO: replace this with the sync icon
NSImage overlay_icon = NSWorkspace.SharedWorkspace.IconForFileType ("sln");
overlay_icon.Size = new SizeF (size / 2, size / 2);
file_icon.LockFocus ();
NSGraphicsContext.CurrentContext.ImageInterpolation = NSImageInterpolation.High;
overlay_icon.Draw (
new RectangleF (0, 0, file_icon.Size.Width / 3, file_icon.Size.Width / 3),
new RectangleF (), NSCompositingOperation.SourceOver, 1.0f);
file_icon.UnlockFocus ();
new_icon.AddRepresentation (file_icon.Representations () [0]);
}
this.icons.Add (extension, new_icon);
} else {
new_icon = this.icons [extension];
}
NSWorkspace.SharedWorkspace.SetIconforFile (new_icon, path, 0);
}
}
}