moel@176: /*
moel@176:  
moel@344:   This Source Code Form is subject to the terms of the Mozilla Public
moel@344:   License, v. 2.0. If a copy of the MPL was not distributed with this
moel@344:   file, You can obtain one at http://mozilla.org/MPL/2.0/.
moel@176:  
moel@373:   Copyright (C) 2010-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
moel@344: 	
moel@176: */
moel@176: 
moel@176: using System;
moel@176: using System.Drawing;
moel@176: using System.Collections.Generic;
moel@176: using OpenHardwareMonitor.Hardware;
moel@176: 
moel@176: namespace OpenHardwareMonitor.GUI {
moel@176:   public class HardwareTypeImage {
moel@176:     private static HardwareTypeImage instance = new HardwareTypeImage();
moel@176: 
moel@176:     private IDictionary<HardwareType, Image> images = 
moel@176:       new Dictionary<HardwareType, Image>();
moel@176: 
moel@176:     private HardwareTypeImage() { }
moel@176: 
moel@176:     public static HardwareTypeImage Instance {
moel@176:       get { return instance; }
moel@176:     }
moel@176: 
moel@176:     public Image GetImage(HardwareType hardwareType) {
moel@176:       Image image;
moel@176:       if (images.TryGetValue(hardwareType, out image)) {
moel@176:         return image;
moel@176:       } else {
moel@176:         switch (hardwareType) {
moel@176:           case HardwareType.CPU:
moel@176:             image = Utilities.EmbeddedResources.GetImage("cpu.png");
moel@176:             break;
moel@176:           case HardwareType.GpuNvidia:
moel@176:             image = Utilities.EmbeddedResources.GetImage("nvidia.png");
moel@176:             break;
moel@176:           case HardwareType.GpuAti:
moel@176:             image = Utilities.EmbeddedResources.GetImage("ati.png");
moel@176:             break;
moel@176:           case HardwareType.HDD:
moel@176:             image = Utilities.EmbeddedResources.GetImage("hdd.png");
moel@176:             break;
moel@176:           case HardwareType.Heatmaster:
moel@176:             image = Utilities.EmbeddedResources.GetImage("bigng.png");
moel@176:             break;
moel@176:           case HardwareType.Mainboard:
moel@176:             image = Utilities.EmbeddedResources.GetImage("mainboard.png");
moel@176:             break;
moel@176:           case HardwareType.SuperIO:
moel@176:             image = Utilities.EmbeddedResources.GetImage("chip.png");
moel@176:             break;
moel@176:           case HardwareType.TBalancer:
moel@176:             image = Utilities.EmbeddedResources.GetImage("bigng.png");
moel@176:             break;
moel@370:           case HardwareType.RAM:
moel@373:             image = Utilities.EmbeddedResources.GetImage("ram.png");
moel@370:             break;
moel@176:           default:
moel@176:             image = new Bitmap(1, 1);
moel@176:             break;
moel@176:         }
moel@176:         images.Add(hardwareType, image);
moel@176:         return image;
moel@176:       }
moel@176:     }
moel@176:   }
moel@176: }