1.1 --- a/Hardware/Computer.cs Thu Aug 05 19:28:50 2010 +0000
1.2 +++ b/Hardware/Computer.cs Sun Aug 08 13:57:26 2010 +0000
1.3 @@ -50,8 +50,19 @@
1.4
1.5 private bool open = false;
1.6 private bool hddEnabled = false;
1.7 + private ISettings settings;
1.8
1.9 - public Computer() { }
1.10 + public Computer() {
1.11 + this.settings = new Settings();
1.12 + }
1.13 +
1.14 + public Computer(ISettings settings) {
1.15 + if (settings != null)
1.16 + this.settings = settings;
1.17 + else {
1.18 + this.settings = new Settings();
1.19 + }
1.20 + }
1.21
1.22 private void Add(IGroup group) {
1.23 if (groups.Contains(group))
1.24 @@ -79,14 +90,14 @@
1.25 if (open)
1.26 return;
1.27
1.28 - Add(new Mainboard.MainboardGroup());
1.29 - Add(new CPU.CPUGroup());
1.30 - Add(new ATI.ATIGroup());
1.31 - Add(new Nvidia.NvidiaGroup());
1.32 - Add(new TBalancer.TBalancerGroup());
1.33 + Add(new Mainboard.MainboardGroup(settings));
1.34 + Add(new CPU.CPUGroup(settings));
1.35 + Add(new ATI.ATIGroup(settings));
1.36 + Add(new Nvidia.NvidiaGroup(settings));
1.37 + Add(new TBalancer.TBalancerGroup(settings));
1.38
1.39 if (hddEnabled)
1.40 - Add(new HDD.HDDGroup());
1.41 + Add(new HDD.HDDGroup(settings));
1.42
1.43 open = true;
1.44 }
1.45 @@ -95,7 +106,7 @@
1.46 get { return hddEnabled; }
1.47 set {
1.48 if (open && value && !hddEnabled) {
1.49 - Add(new HDD.HDDGroup());
1.50 + Add(new HDD.HDDGroup(settings));
1.51 } else if (open && !value && hddEnabled) {
1.52 List<IGroup> list = new List<IGroup>();
1.53 foreach (IGroup group in groups)
1.54 @@ -263,5 +274,20 @@
1.55 foreach (IHardware hardware in group.Hardware)
1.56 hardware.Accept(visitor);
1.57 }
1.58 +
1.59 + private class Settings : ISettings {
1.60 +
1.61 + public bool Contains(string name) {
1.62 + return false;
1.63 + }
1.64 +
1.65 + public void Set(string name, string value) { }
1.66 +
1.67 + public string Get(string name, string value) {
1.68 + return value;
1.69 + }
1.70 +
1.71 + public void Remove(string name) { }
1.72 + }
1.73 }
1.74 }