Added the option to enable/disable all hardware groups.
authormoel.mich
Wed, 11 Jul 2012 17:35:30 +0000
changeset 360c1a4377c11d1
parent 359 30bb76a1da24
child 361 0a386ef7d5bb
Added the option to enable/disable all hardware groups.
GUI/MainForm.Designer.cs
GUI/MainForm.cs
Hardware/Computer.cs
Properties/AssemblyVersion.cs
     1.1 --- a/GUI/MainForm.Designer.cs	Sun Jul 08 19:26:00 2012 +0000
     1.2 +++ b/GUI/MainForm.Designer.cs	Wed Jul 11 17:35:30 2012 +0000
     1.3 @@ -51,6 +51,12 @@
     1.4        this.sumbitReportMenuItem = new System.Windows.Forms.MenuItem();
     1.5        this.MenuItem2 = new System.Windows.Forms.MenuItem();
     1.6        this.resetMenuItem = new System.Windows.Forms.MenuItem();
     1.7 +      this.menuItem5 = new System.Windows.Forms.MenuItem();
     1.8 +      this.mainboardMenuItem = new System.Windows.Forms.MenuItem();
     1.9 +      this.cpuMenuItem = new System.Windows.Forms.MenuItem();
    1.10 +      this.gpuMenuItem = new System.Windows.Forms.MenuItem();
    1.11 +      this.fanControllerMenuItem = new System.Windows.Forms.MenuItem();
    1.12 +      this.hddMenuItem = new System.Windows.Forms.MenuItem();
    1.13        this.menuItem6 = new System.Windows.Forms.MenuItem();
    1.14        this.exitMenuItem = new System.Windows.Forms.MenuItem();
    1.15        this.viewMenuItem = new System.Windows.Forms.MenuItem();
    1.16 @@ -73,9 +79,12 @@
    1.17        this.temperatureUnitsMenuItem = new System.Windows.Forms.MenuItem();
    1.18        this.celsiusMenuItem = new System.Windows.Forms.MenuItem();
    1.19        this.fahrenheitMenuItem = new System.Windows.Forms.MenuItem();
    1.20 +      this.plotLocationMenuItem = new System.Windows.Forms.MenuItem();
    1.21 +      this.plotWindowMenuItem = new System.Windows.Forms.MenuItem();
    1.22 +      this.plotBottomMenuItem = new System.Windows.Forms.MenuItem();
    1.23 +      this.plotRightMenuItem = new System.Windows.Forms.MenuItem();
    1.24        this.MenuItem4 = new System.Windows.Forms.MenuItem();
    1.25 -      this.hddMenuItem = new System.Windows.Forms.MenuItem();
    1.26 -			this.webMenuItem = new System.Windows.Forms.MenuItem();
    1.27 +      this.webMenuItem = new System.Windows.Forms.MenuItem();
    1.28        this.runWebServerMenuItem = new System.Windows.Forms.MenuItem();
    1.29        this.serverPortMenuItem = new System.Windows.Forms.MenuItem();
    1.30        this.helpMenuItem = new System.Windows.Forms.MenuItem();
    1.31 @@ -84,13 +93,8 @@
    1.32        this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
    1.33        this.timer = new System.Windows.Forms.Timer(this.components);
    1.34        this.splitContainer = new OpenHardwareMonitor.GUI.SplitContainerAdv();
    1.35 -      this.treeView = new Aga.Controls.Tree.TreeViewAdv();      
    1.36 -      this.plotLocationMenuItem = new System.Windows.Forms.MenuItem();
    1.37 -      this.plotWindowMenuItem = new System.Windows.Forms.MenuItem();
    1.38 -      this.plotBottomMenuItem = new System.Windows.Forms.MenuItem();
    1.39 -      this.plotRightMenuItem = new System.Windows.Forms.MenuItem();
    1.40 +      this.treeView = new Aga.Controls.Tree.TreeViewAdv();
    1.41        this.splitContainer.Panel1.SuspendLayout();
    1.42 -      this.splitContainer.Panel2.SuspendLayout();
    1.43        this.splitContainer.SuspendLayout();
    1.44        this.SuspendLayout();
    1.45        // 
    1.46 @@ -189,6 +193,7 @@
    1.47              this.sumbitReportMenuItem,
    1.48              this.MenuItem2,
    1.49              this.resetMenuItem,
    1.50 +            this.menuItem5,
    1.51              this.menuItem6,
    1.52              this.exitMenuItem});
    1.53        this.fileMenuItem.Text = "File";
    1.54 @@ -216,14 +221,50 @@
    1.55        this.resetMenuItem.Text = "Reset";
    1.56        this.resetMenuItem.Click += new System.EventHandler(this.resetClick);
    1.57        // 
    1.58 +      // menuItem5
    1.59 +      // 
    1.60 +      this.menuItem5.Index = 4;
    1.61 +      this.menuItem5.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
    1.62 +            this.mainboardMenuItem,
    1.63 +            this.cpuMenuItem,
    1.64 +            this.gpuMenuItem,
    1.65 +            this.fanControllerMenuItem,
    1.66 +            this.hddMenuItem});
    1.67 +      this.menuItem5.Text = "Hardware";
    1.68 +      // 
    1.69 +      // mainboardMenuItem
    1.70 +      // 
    1.71 +      this.mainboardMenuItem.Index = 0;
    1.72 +      this.mainboardMenuItem.Text = "Mainboard";
    1.73 +      // 
    1.74 +      // cpuMenuItem
    1.75 +      // 
    1.76 +      this.cpuMenuItem.Index = 1;
    1.77 +      this.cpuMenuItem.Text = "CPU";
    1.78 +      // 
    1.79 +      // gpuMenuItem
    1.80 +      // 
    1.81 +      this.gpuMenuItem.Index = 2;
    1.82 +      this.gpuMenuItem.Text = "GPU";
    1.83 +      // 
    1.84 +      // fanControllerMenuItem
    1.85 +      // 
    1.86 +      this.fanControllerMenuItem.Index = 3;
    1.87 +      this.fanControllerMenuItem.Text = "Fan Controllers";
    1.88 +      // 
    1.89 +      // hddMenuItem
    1.90 +      // 
    1.91 +      this.hddMenuItem.Index = 4;
    1.92 +      this.hddMenuItem.Text = "Hard Disk Drives";
    1.93 +      // 
    1.94        // menuItem6
    1.95        // 
    1.96 -      this.menuItem6.Index = 4;
    1.97 +      this.menuItem6.Index = 5;
    1.98        this.menuItem6.Text = "-";
    1.99        // 
   1.100        // exitMenuItem
   1.101        // 
   1.102 -      this.exitMenuItem.Index = 5;
   1.103 +      this.exitMenuItem.Index = 6;
   1.104        this.exitMenuItem.Text = "Exit";
   1.105        this.exitMenuItem.Click += new System.EventHandler(this.exitClick);
   1.106        // 
   1.107 @@ -307,8 +348,7 @@
   1.108              this.temperatureUnitsMenuItem,
   1.109              this.plotLocationMenuItem,
   1.110              this.MenuItem4,
   1.111 -            this.hddMenuItem,
   1.112 -						this.webMenuItem});
   1.113 +            this.webMenuItem});
   1.114        this.optionsMenuItem.Text = "Options";
   1.115        // 
   1.116        // startMinMenuItem
   1.117 @@ -356,34 +396,53 @@
   1.118        this.fahrenheitMenuItem.Text = "Fahrenheit";
   1.119        this.fahrenheitMenuItem.Click += new System.EventHandler(this.fahrenheitMenuItem_Click);
   1.120        // 
   1.121 +      // plotLocationMenuItem
   1.122 +      // 
   1.123 +      this.plotLocationMenuItem.Index = 6;
   1.124 +      this.plotLocationMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
   1.125 +            this.plotWindowMenuItem,
   1.126 +            this.plotBottomMenuItem,
   1.127 +            this.plotRightMenuItem});
   1.128 +      this.plotLocationMenuItem.Text = "Plot Location";
   1.129 +      // 
   1.130 +      // plotWindowMenuItem
   1.131 +      // 
   1.132 +      this.plotWindowMenuItem.Index = 0;
   1.133 +      this.plotWindowMenuItem.Text = "Window";
   1.134 +      // 
   1.135 +      // plotBottomMenuItem
   1.136 +      // 
   1.137 +      this.plotBottomMenuItem.Index = 1;
   1.138 +      this.plotBottomMenuItem.Text = "Bottom";
   1.139 +      // 
   1.140 +      // plotRightMenuItem
   1.141 +      // 
   1.142 +      this.plotRightMenuItem.Index = 2;
   1.143 +      this.plotRightMenuItem.Text = "Right";
   1.144 +      // 
   1.145        // MenuItem4
   1.146        // 
   1.147        this.MenuItem4.Index = 7;
   1.148        this.MenuItem4.Text = "-";
   1.149        // 
   1.150 -      // hddMenuItem
   1.151 +      // webMenuItem
   1.152        // 
   1.153 -      this.hddMenuItem.Index = 8;
   1.154 -      this.hddMenuItem.Text = "Read HDD sensors";
   1.155 -			// 
   1.156 -			// webMenuItem
   1.157 -			// 
   1.158 -			this.webMenuItem.Index = 9;
   1.159 -			this.webMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
   1.160 -					this.runWebServerMenuItem,
   1.161 -					this.serverPortMenuItem});
   1.162 -			this.webMenuItem.Text = "Remote Web Server";
   1.163 +      this.webMenuItem.Index = 8;
   1.164 +      this.webMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
   1.165 +            this.runWebServerMenuItem,
   1.166 +            this.serverPortMenuItem});
   1.167 +      this.webMenuItem.Text = "Remote Web Server";
   1.168        // 
   1.169        // runWebServerMenuItem
   1.170        // 
   1.171        this.runWebServerMenuItem.Index = 0;
   1.172        this.runWebServerMenuItem.Text = "Run";
   1.173 -			// 
   1.174 -			// serverPortMenuItem
   1.175 -			// 
   1.176 -			this.serverPortMenuItem.Index = 1;
   1.177 -			this.serverPortMenuItem.Text = "Port";
   1.178 -			this.serverPortMenuItem.Click += new System.EventHandler(this.serverPortMenuItem_Click);
   1.179 +      // 
   1.180 +      // serverPortMenuItem
   1.181 +      // 
   1.182 +      this.serverPortMenuItem.Index = 1;
   1.183 +      this.serverPortMenuItem.Text = "Port";
   1.184 +      this.serverPortMenuItem.Click += new System.EventHandler(this.serverPortMenuItem_Click);
   1.185        // 
   1.186        // helpMenuItem
   1.187        // 
   1.188 @@ -466,30 +525,6 @@
   1.189        this.treeView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.treeView_MouseMove);
   1.190        this.treeView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.treeView_MouseUp);
   1.191        // 
   1.192 -      // plotLocationMenuItem
   1.193 -      // 
   1.194 -      this.plotLocationMenuItem.Index = 6;
   1.195 -      this.plotLocationMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
   1.196 -            this.plotWindowMenuItem,
   1.197 -            this.plotBottomMenuItem,
   1.198 -            this.plotRightMenuItem});
   1.199 -      this.plotLocationMenuItem.Text = "Plot Location";
   1.200 -      // 
   1.201 -      // plotWindowMenuItem
   1.202 -      // 
   1.203 -      this.plotWindowMenuItem.Index = 0;
   1.204 -      this.plotWindowMenuItem.Text = "Window";
   1.205 -      // 
   1.206 -      // plotBottomMenuItem
   1.207 -      // 
   1.208 -      this.plotBottomMenuItem.Index = 1;
   1.209 -      this.plotBottomMenuItem.Text = "Bottom";
   1.210 -      // 
   1.211 -      // plotRightMenuItem
   1.212 -      // 
   1.213 -      this.plotRightMenuItem.Index = 2;
   1.214 -      this.plotRightMenuItem.Text = "Right";
   1.215 -      // 
   1.216        // MainForm
   1.217        // 
   1.218        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
   1.219 @@ -506,7 +541,6 @@
   1.220        this.ResizeEnd += new System.EventHandler(this.MainForm_MoveOrResize);
   1.221        this.Move += new System.EventHandler(this.MainForm_MoveOrResize);
   1.222        this.splitContainer.Panel1.ResumeLayout(false);
   1.223 -      this.splitContainer.Panel2.ResumeLayout(false);
   1.224        this.splitContainer.ResumeLayout(false);
   1.225        this.ResumeLayout(false);
   1.226  
   1.227 @@ -568,6 +602,11 @@
   1.228  		private System.Windows.Forms.MenuItem webMenuItem;
   1.229      private System.Windows.Forms.MenuItem runWebServerMenuItem;
   1.230      private System.Windows.Forms.MenuItem serverPortMenuItem;
   1.231 +    private System.Windows.Forms.MenuItem menuItem5;
   1.232 +    private System.Windows.Forms.MenuItem mainboardMenuItem;
   1.233 +    private System.Windows.Forms.MenuItem cpuMenuItem;
   1.234 +    private System.Windows.Forms.MenuItem gpuMenuItem;
   1.235 +    private System.Windows.Forms.MenuItem fanControllerMenuItem;
   1.236    }
   1.237  }
   1.238  
     2.1 --- a/GUI/MainForm.cs	Sun Jul 08 19:26:00 2012 +0000
     2.2 +++ b/GUI/MainForm.cs	Wed Jul 11 17:35:30 2012 +0000
     2.3 @@ -12,6 +12,7 @@
     2.4  
     2.5  using System;
     2.6  using System.Collections.Generic;
     2.7 +using System.Collections.ObjectModel;
     2.8  using System.ComponentModel;
     2.9  using System.Drawing;
    2.10  using System.IO;
    2.11 @@ -50,7 +51,13 @@
    2.12      private UserOption minimizeToTray;
    2.13      private UserOption minimizeOnClose;
    2.14      private UserOption autoStart;
    2.15 +
    2.16 +    private UserOption readMainboardSensors;
    2.17 +    private UserOption readCpuSensors;
    2.18 +    private UserOption readGpuSensors;
    2.19 +    private UserOption readFanControllersSensors;
    2.20      private UserOption readHddSensors;
    2.21 +
    2.22      private UserOption showGadget;
    2.23      private UserRadioGroup plotLocation;
    2.24      private WmiProvider wmiProvider;
    2.25 @@ -207,6 +214,30 @@
    2.26          }
    2.27        };
    2.28  
    2.29 +      readMainboardSensors = new UserOption("mainboardMenuItem", true, 
    2.30 +        mainboardMenuItem, settings);
    2.31 +      readMainboardSensors.Changed += delegate(object sender, EventArgs e) {
    2.32 +        computer.MainboardEnabled = readMainboardSensors.Value;
    2.33 +      };
    2.34 +
    2.35 +      readCpuSensors = new UserOption("cpuMenuItem", true,
    2.36 +        cpuMenuItem, settings);
    2.37 +      readCpuSensors.Changed += delegate(object sender, EventArgs e) {
    2.38 +        computer.CPUEnabled = readCpuSensors.Value;
    2.39 +      };
    2.40 +
    2.41 +      readGpuSensors = new UserOption("gpuMenuItem", true,
    2.42 +        gpuMenuItem, settings);
    2.43 +      readGpuSensors.Changed += delegate(object sender, EventArgs e) {
    2.44 +        computer.GPUEnabled = readGpuSensors.Value;
    2.45 +      };
    2.46 +
    2.47 +      readFanControllersSensors = new UserOption("fanControllerMenuItem", true,
    2.48 +        fanControllerMenuItem, settings);
    2.49 +      readFanControllersSensors.Changed += delegate(object sender, EventArgs e) {
    2.50 +        computer.FanControllerEnabled = readFanControllersSensors.Value;
    2.51 +      };
    2.52 +
    2.53        readHddSensors = new UserOption("hddMenuItem", true, hddMenuItem,
    2.54          settings);
    2.55        readHddSensors.Changed += delegate(object sender, EventArgs e) {
    2.56 @@ -227,15 +258,13 @@
    2.57        server = new HttpServer(root, this.settings.GetValue("listenerPort", 8085));
    2.58        runWebServer = new UserOption("runWebServerMenuItem", false,
    2.59          runWebServerMenuItem, settings);
    2.60 -      runWebServer.Changed += delegate(object sender, EventArgs e)
    2.61 -      {
    2.62 -          if (runWebServer.Value)
    2.63 -              runWebServer.Value = server.startHTTPListener();
    2.64 -          else
    2.65 -              server.stopHTTPListener();
    2.66 +      runWebServer.Changed += delegate(object sender, EventArgs e) {
    2.67 +        if (runWebServer.Value)
    2.68 +          runWebServer.Value = server.startHTTPListener();
    2.69 +        else
    2.70 +          server.stopHTTPListener();
    2.71        };
    2.72  
    2.73 -
    2.74        InitializePlotForm();
    2.75  
    2.76        startupMenuItem.Visible = startupManager.IsAvailable;
    2.77 @@ -357,13 +386,23 @@
    2.78            plotForm.Hide();
    2.79        };
    2.80      }
    2.81 +
    2.82 +    private void InsertSorted(Collection<Node> nodes, HardwareNode node) {
    2.83 +      int i = 0;
    2.84 +      while (i < nodes.Count && nodes[i] is HardwareNode &&
    2.85 +        ((HardwareNode)nodes[i]).Hardware.HardwareType < 
    2.86 +          node.Hardware.HardwareType)
    2.87 +        i++;
    2.88 +      nodes.Insert(i, node);
    2.89 +    }
    2.90      
    2.91      private void SubHardwareAdded(IHardware hardware, Node node) {
    2.92        HardwareNode hardwareNode = 
    2.93          new HardwareNode(hardware, settings, unitManager);
    2.94        hardwareNode.PlotSelectionChanged += PlotSelectionChanged;
    2.95  
    2.96 -      node.Nodes.Add(hardwareNode);
    2.97 +      InsertSorted(node.Nodes, hardwareNode);
    2.98 +
    2.99        foreach (IHardware subHardware in hardware.SubHardware)
   2.100          SubHardwareAdded(subHardware, hardwareNode);  
   2.101      }
     3.1 --- a/Hardware/Computer.cs	Sun Jul 08 19:26:00 2012 +0000
     3.2 +++ b/Hardware/Computer.cs	Wed Jul 11 17:35:30 2012 +0000
     3.3 @@ -4,7 +4,7 @@
     3.4    License, v. 2.0. If a copy of the MPL was not distributed with this
     3.5    file, You can obtain one at http://mozilla.org/MPL/2.0/.
     3.6   
     3.7 -  Copyright (C) 2009-2011 Michael Möller <mmoeller@openhardwaremonitor.org>
     3.8 +  Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
     3.9  	
    3.10  */
    3.11  
    3.12 @@ -23,7 +23,12 @@
    3.13      private readonly ISettings settings;
    3.14  
    3.15      private bool open;
    3.16 -    private bool hddEnabled;    
    3.17 +
    3.18 +    private bool mainboardEnabled;
    3.19 +    private bool cpuEnabled;
    3.20 +    private bool gpuEnabled;
    3.21 +    private bool fanControllerEnabled;
    3.22 +    private bool hddEnabled;        
    3.23  
    3.24      public Computer() {
    3.25        this.settings = new Settings();
    3.26 @@ -53,6 +58,17 @@
    3.27        if (HardwareRemoved != null)
    3.28          foreach (IHardware hardware in group.Hardware)
    3.29            HardwareRemoved(hardware);
    3.30 +
    3.31 +      group.Close();
    3.32 +    }
    3.33 +
    3.34 +    private void RemoveType<T>() where T : IGroup {
    3.35 +      List<IGroup> list = new List<IGroup>();
    3.36 +      foreach (IGroup group in groups)
    3.37 +        if (group is T)
    3.38 +          list.Add(group);
    3.39 +      foreach (IGroup group in list)
    3.40 +        Remove(group);
    3.41      }
    3.42  
    3.43      [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
    3.44 @@ -63,33 +79,104 @@
    3.45        Ring0.Open();
    3.46        Opcode.Open();
    3.47  
    3.48 -      Add(new Mainboard.MainboardGroup(settings));
    3.49 -      Add(new CPU.CPUGroup(settings));
    3.50 -      Add(new ATI.ATIGroup(settings));
    3.51 -      Add(new Nvidia.NvidiaGroup(settings));      
    3.52 -      Add(new TBalancer.TBalancerGroup(settings));
    3.53 -      Add(new Heatmaster.HeatmasterGroup(settings));
    3.54 +      if (mainboardEnabled)
    3.55 +        Add(new Mainboard.MainboardGroup(settings));
    3.56 +      
    3.57 +      if (cpuEnabled)
    3.58 +        Add(new CPU.CPUGroup(settings));
    3.59 +
    3.60 +      if (gpuEnabled) {
    3.61 +        Add(new ATI.ATIGroup(settings));
    3.62 +        Add(new Nvidia.NvidiaGroup(settings));
    3.63 +      }
    3.64 +
    3.65 +      if (fanControllerEnabled) {
    3.66 +        Add(new TBalancer.TBalancerGroup(settings));
    3.67 +        Add(new Heatmaster.HeatmasterGroup(settings));
    3.68 +      }
    3.69  
    3.70        if (hddEnabled)
    3.71          Add(new HDD.HarddriveGroup(settings));
    3.72  
    3.73        open = true;
    3.74      }
    3.75 -    
    3.76 +
    3.77 +    public bool MainboardEnabled {
    3.78 +      get { return mainboardEnabled; }
    3.79 +
    3.80 +      [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
    3.81 +      set {
    3.82 +        if (open && value != mainboardEnabled) {
    3.83 +          if (value)
    3.84 +            Add(new Mainboard.MainboardGroup(settings));
    3.85 +          else
    3.86 +            RemoveType<Mainboard.MainboardGroup>();
    3.87 +        }
    3.88 +        mainboardEnabled = value;
    3.89 +      }
    3.90 +    }
    3.91 +
    3.92 +    public bool CPUEnabled {
    3.93 +      get { return cpuEnabled; }
    3.94 +
    3.95 +      [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
    3.96 +      set {
    3.97 +        if (open && value != cpuEnabled) {
    3.98 +          if (value)
    3.99 +            Add(new CPU.CPUGroup(settings));
   3.100 +          else
   3.101 +            RemoveType<CPU.CPUGroup>();
   3.102 +        }
   3.103 +        cpuEnabled = value;
   3.104 +      }
   3.105 +    }
   3.106 +
   3.107 +    public bool GPUEnabled {
   3.108 +      get { return gpuEnabled; }
   3.109 +
   3.110 +      [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
   3.111 +      set {
   3.112 +        if (open && value != gpuEnabled) {
   3.113 +          if (value) {
   3.114 +            Add(new ATI.ATIGroup(settings));
   3.115 +            Add(new Nvidia.NvidiaGroup(settings));
   3.116 +          } else {
   3.117 +            RemoveType<ATI.ATIGroup>();
   3.118 +            RemoveType<Nvidia.NvidiaGroup>();
   3.119 +          }
   3.120 +        }
   3.121 +        gpuEnabled = value;
   3.122 +      }
   3.123 +    }
   3.124 +
   3.125 +    public bool FanControllerEnabled {
   3.126 +      get { return fanControllerEnabled; }
   3.127 +
   3.128 +      [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
   3.129 +      set {
   3.130 +        if (open && value != fanControllerEnabled) {
   3.131 +          if (value) {
   3.132 +            Add(new TBalancer.TBalancerGroup(settings));
   3.133 +            Add(new Heatmaster.HeatmasterGroup(settings));
   3.134 +          } else {
   3.135 +            RemoveType<TBalancer.TBalancerGroup>();
   3.136 +            RemoveType<Heatmaster.HeatmasterGroup>();
   3.137 +          }
   3.138 +        }
   3.139 +        fanControllerEnabled = value;
   3.140 +      }
   3.141 +    }
   3.142 +
   3.143      public bool HDDEnabled {
   3.144        get { return hddEnabled; }
   3.145  
   3.146        [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
   3.147        set {
   3.148 -        if (open && value && !hddEnabled) {
   3.149 -          Add(new HDD.HarddriveGroup(settings));
   3.150 -        } else if (open && !value && hddEnabled) {
   3.151 -          List<IGroup> list = new List<IGroup>();
   3.152 -          foreach (IGroup group in groups)
   3.153 -            if (group is HDD.HarddriveGroup)
   3.154 -              list.Add(group);
   3.155 -          foreach (IGroup group in list)
   3.156 -            Remove(group);
   3.157 +        if (open && value != hddEnabled) {
   3.158 +          if (value)
   3.159 +            Add(new HDD.HarddriveGroup(settings));
   3.160 +          else
   3.161 +            RemoveType<HDD.HarddriveGroup>();
   3.162          }
   3.163          hddEnabled = value;
   3.164        }
   3.165 @@ -243,8 +330,7 @@
   3.166  
   3.167        while (groups.Count > 0) {
   3.168          IGroup group = groups[groups.Count - 1];
   3.169 -        Remove(group);
   3.170 -        group.Close(); 
   3.171 +        Remove(group);         
   3.172        } 
   3.173  
   3.174        Opcode.Close();
     4.1 --- a/Properties/AssemblyVersion.cs	Sun Jul 08 19:26:00 2012 +0000
     4.2 +++ b/Properties/AssemblyVersion.cs	Wed Jul 11 17:35:30 2012 +0000
     4.3 @@ -10,5 +10,5 @@
     4.4  
     4.5  using System.Reflection;
     4.6  
     4.7 -[assembly: AssemblyVersion("0.4.0.14")]
     4.8 -[assembly: AssemblyInformationalVersion("0.4.0.14 Alpha")]
     4.9 \ No newline at end of file
    4.10 +[assembly: AssemblyVersion("0.4.0.16")]
    4.11 +[assembly: AssemblyInformationalVersion("0.4.0.16 Alpha")]
    4.12 \ No newline at end of file