Пример #1
0
        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");
        }
Пример #2
0
        public bool GetVolumesStatus()
        {
            int possessedVolumes = Volumes.Where(x => x.VolumeStatus == VolumeStatus.possess).Count();

            if (possessedVolumes == Volumes.Count())
            {
                return(true);
            }
            return(false);
        }
Пример #3
0
Файл: CPU.cs Проект: vosechu/KOS
        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);
        }
Пример #4
0
 public double GetPorcentageOfTitles()
 {
     return(Volumes.Where(x => x.VolumeStatus == VolumeStatus.possess).Count() / Volumes.Count());
 }