/Debugger/ILSpy.Debugger/Services/ImageService/ImageService.cs
http://github.com/icsharpcode/ILSpy · C# · 35 lines · 28 code · 4 blank · 3 comment · 2 complexity · 867a3671ebfa1a6b8621f6a79e22ebbf MD5 · raw file
- // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
- // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
- using System;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- namespace ICSharpCode.ILSpy.Debugger.Services
- {
- static class ImageService
- {
- static BitmapImage LoadBitmap(string name)
- {
- try {
- BitmapImage image = new BitmapImage(new Uri("pack://application:,,,/ILSpy.Debugger.Plugin;component/Images/" + name + ".png"));
- if (image == null)
- return null;
- image.Freeze();
- return image;
- }
- catch {
- // resource not found
- return null;
- }
- }
-
- public static readonly BitmapImage Breakpoint = LoadBitmap("Breakpoint");
- public static readonly BitmapImage CurrentLine = LoadBitmap("CurrentLine");
-
- public static ImageSource GetImage(string imageName)
- {
- return LoadBitmap(imageName);
- }
- }
- }