public bool update(Win32Impl.Volumes volumes) { int changecount = WmiBase.Singleton.GetChangeCount(); Dictionary <string, StoredVolume> newVolumes = new Dictionary <string, StoredVolume>(); foreach (Win32Impl.Volume volume in volumes) { if (storedVolumes.ContainsKey(volume.Name)) { newVolumes[volume.Name] = storedVolumes[volume.Name].Change(volume); storedVolumes.Remove(volume.Name); } else { newVolumes[volume.Name] = new StoredVolume(volume, wmisession, nextid); nextid++; } } foreach (StoredVolume svol in storedVolumes.Values) { svol.Remove(); } storedVolumes = newVolumes; int newchangecount = WmiBase.Singleton.GetChangeCount(); if (newchangecount != changecount) { // This indicates that we may well have changed siomething in xenstore return(true); } // This indicates nothing in xenstore has changed return(false); }
public bool Refresh(bool force) { Win32Impl.Volumes newvols = new Win32Impl.Volumes(); bool needkick = storedVolumes.update(newvols); refreshCount = 0; return(needkick); }
List <string> ListXenVolumes() { List <string> list = new List <string>(); Win32Impl.Volumes volumes = new Win32Impl.Volumes(); foreach (Win32Impl.Volume volume in volumes) { list.Add(volume.Name); } return(list); }