static public int GetLockedBinaryIcon(string filename) { try { // Check to see if we can find this loced icon in our cache TstDictionaryEntry assetLocked = mAssetTypes.Find(Path.GetFileName(filename) + "_locked"); if (assetLocked != null && assetLocked.IsKey) { // Yup, return the index return((int)assetLocked.Value); } else { // Nope, We are going to have to create it // Setup some new containers Bitmap newLockedIcon = null; Bitmap lockIconSource = null; Bitmap assetIconSource = null; // Can we find the locked image TstDictionaryEntry nodeLocked = mAssetTypes.Find("locked"); if (nodeLocked != null && nodeLocked.IsKey) { // Great, get a copy of that lockIconSource = (Bitmap)mAssetTypeImages.Images[(int)nodeLocked.Value]; // Now try and get the icon of this asset // Have we seen this type of asset by its extension? if (mFileTypeManager.ExtensionListHasKey(filename)) { // Great get a copy of that assetIconSource = (Bitmap)mFileTypeManager.GetImage(filename); } else { // No, ok try and add it from the file its self if (File.Exists(filename)) { mFileTypeManager.AddFileIcon(filename); assetIconSource = (Bitmap)mFileTypeManager.GetImage(filename); } else { // Use the default icon assetIconSource = (Bitmap)mAssetTypeImages.Images[0]; } } // Ok, if we got a lockSource and a class source icon, lets attempt to overlay them if (assetIconSource != null && lockIconSource != null) { newLockedIcon = BitmapManipulator.OverlayBitmap(assetIconSource, lockIconSource, 100, BitmapManipulator.ImageCornerEnum.BottomRight); } // Did the overlay work? if (newLockedIcon != null) { lock (mAssetTypes) { // Add the image and the type to the arrayLists mAssetTypeImages.Images.Add(newLockedIcon); mAssetTypes.Add(Path.GetFileName(filename) + "_locked", mAssetTypeImages.Images.Count - 1); return(mAssetTypeImages.Images.Count - 1); } } } } } catch (Exception e) { MOG_Report.ReportMessage("Get Locked Binary Icon", e.Message, e.StackTrace, MOG_ALERT_LEVEL.CRITICAL); } return(0); }