moel@176: /* moel@176: moel@176: Version: MPL 1.1/GPL 2.0/LGPL 2.1 moel@176: moel@176: The contents of this file are subject to the Mozilla Public License Version moel@176: 1.1 (the "License"); you may not use this file except in compliance with moel@176: the License. You may obtain a copy of the License at moel@176: moel@176: http://www.mozilla.org/MPL/ moel@176: moel@176: Software distributed under the License is distributed on an "AS IS" basis, moel@176: WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License moel@176: for the specific language governing rights and limitations under the License. moel@176: moel@176: The Original Code is the Open Hardware Monitor code. moel@176: moel@176: The Initial Developer of the Original Code is moel@176: Michael Möller . moel@176: Portions created by the Initial Developer are Copyright (C) 2010 moel@176: the Initial Developer. All Rights Reserved. moel@176: moel@176: Contributor(s): moel@176: moel@176: Alternatively, the contents of this file may be used under the terms of moel@176: either the GNU General Public License Version 2 or later (the "GPL"), or moel@176: the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), moel@176: in which case the provisions of the GPL or the LGPL are applicable instead moel@176: of those above. If you wish to allow use of your version of this file only moel@176: under the terms of either the GPL or the LGPL, and not to allow others to moel@176: use your version of this file under the terms of the MPL, indicate your moel@176: decision by deleting the provisions above and replace them with the notice moel@176: and other provisions required by the GPL or the LGPL. If you do not delete moel@176: the provisions above, a recipient may use your version of this file under moel@176: the terms of any one of the MPL, the GPL or the LGPL. moel@176: 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 images = moel@176: new Dictionary(); 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@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: }