moel@176
|
1 |
/*
|
moel@176
|
2 |
|
moel@344
|
3 |
This Source Code Form is subject to the terms of the Mozilla Public
|
moel@344
|
4 |
License, v. 2.0. If a copy of the MPL was not distributed with this
|
moel@344
|
5 |
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
moel@176
|
6 |
|
moel@373
|
7 |
Copyright (C) 2010-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
|
moel@344
|
8 |
|
moel@176
|
9 |
*/
|
moel@176
|
10 |
|
moel@176
|
11 |
using System;
|
moel@176
|
12 |
using System.Drawing;
|
moel@176
|
13 |
using System.Collections.Generic;
|
moel@176
|
14 |
using OpenHardwareMonitor.Hardware;
|
moel@176
|
15 |
|
moel@176
|
16 |
namespace OpenHardwareMonitor.GUI {
|
moel@176
|
17 |
public class HardwareTypeImage {
|
moel@176
|
18 |
private static HardwareTypeImage instance = new HardwareTypeImage();
|
moel@176
|
19 |
|
moel@176
|
20 |
private IDictionary<HardwareType, Image> images =
|
moel@176
|
21 |
new Dictionary<HardwareType, Image>();
|
moel@176
|
22 |
|
moel@176
|
23 |
private HardwareTypeImage() { }
|
moel@176
|
24 |
|
moel@176
|
25 |
public static HardwareTypeImage Instance {
|
moel@176
|
26 |
get { return instance; }
|
moel@176
|
27 |
}
|
moel@176
|
28 |
|
moel@176
|
29 |
public Image GetImage(HardwareType hardwareType) {
|
moel@176
|
30 |
Image image;
|
moel@176
|
31 |
if (images.TryGetValue(hardwareType, out image)) {
|
moel@176
|
32 |
return image;
|
moel@176
|
33 |
} else {
|
moel@176
|
34 |
switch (hardwareType) {
|
moel@176
|
35 |
case HardwareType.CPU:
|
moel@176
|
36 |
image = Utilities.EmbeddedResources.GetImage("cpu.png");
|
moel@176
|
37 |
break;
|
moel@176
|
38 |
case HardwareType.GpuNvidia:
|
moel@176
|
39 |
image = Utilities.EmbeddedResources.GetImage("nvidia.png");
|
moel@176
|
40 |
break;
|
moel@176
|
41 |
case HardwareType.GpuAti:
|
moel@176
|
42 |
image = Utilities.EmbeddedResources.GetImage("ati.png");
|
moel@176
|
43 |
break;
|
moel@176
|
44 |
case HardwareType.HDD:
|
moel@176
|
45 |
image = Utilities.EmbeddedResources.GetImage("hdd.png");
|
moel@176
|
46 |
break;
|
moel@176
|
47 |
case HardwareType.Heatmaster:
|
moel@176
|
48 |
image = Utilities.EmbeddedResources.GetImage("bigng.png");
|
moel@176
|
49 |
break;
|
moel@176
|
50 |
case HardwareType.Mainboard:
|
moel@176
|
51 |
image = Utilities.EmbeddedResources.GetImage("mainboard.png");
|
moel@176
|
52 |
break;
|
moel@176
|
53 |
case HardwareType.SuperIO:
|
moel@176
|
54 |
image = Utilities.EmbeddedResources.GetImage("chip.png");
|
moel@176
|
55 |
break;
|
moel@176
|
56 |
case HardwareType.TBalancer:
|
moel@176
|
57 |
image = Utilities.EmbeddedResources.GetImage("bigng.png");
|
moel@176
|
58 |
break;
|
moel@370
|
59 |
case HardwareType.RAM:
|
moel@373
|
60 |
image = Utilities.EmbeddedResources.GetImage("ram.png");
|
moel@370
|
61 |
break;
|
moel@176
|
62 |
default:
|
moel@176
|
63 |
image = new Bitmap(1, 1);
|
moel@176
|
64 |
break;
|
moel@176
|
65 |
}
|
moel@176
|
66 |
images.Add(hardwareType, image);
|
moel@176
|
67 |
return image;
|
moel@176
|
68 |
}
|
moel@176
|
69 |
}
|
moel@176
|
70 |
}
|
moel@176
|
71 |
}
|