public virtual IVolume GetVolume(object volID) { if (volID is int) { if (Volumes.Count > (int)volID) { return(Volumes[(int)volID]); } } else if (volID is string) { var volName = volID.ToString().ToUpper(); foreach (var targetVolume in Volumes.Where(targetVolume => targetVolume.Name.ToUpper() == volName)) { return(targetVolume); } int outVal; if (int.TryParse((string)volID, out outVal)) { if (Volumes.Count > outVal) { return(Volumes[outVal]); } } } throw new KOSException("Volume '" + volID + "' not found"); }
public bool GetVolumesStatus() { int possessedVolumes = Volumes.Where(x => x.VolumeStatus == VolumeStatus.possess).Count(); if (possessedVolumes == Volumes.Count()) { return(true); } return(false); }
public override bool SwitchToVolume(string targetVolume) { foreach (var volume in Volumes.Where(volume => volume.Name.ToUpper() == targetVolume.ToUpper())) { if (volume.CheckRange()) { SelectedVolume = volume; return(true); } throw new KOSException("Volume disconnected - out of range"); } return(false); }
public double GetPorcentageOfTitles() { return(Volumes.Where(x => x.VolumeStatus == VolumeStatus.possess).Count() / Volumes.Count()); }