Esempio n. 1
0
        public JsonNetResult GetLocalDrives()
        {
            var list   = DriveInfo.GetDrives().ToList();
            var drives = new List <Drive>(list.Count + 1);

            foreach (DriveInfo d in list)
            {
                if (d.IsReady == true)
                {
                    drives.Add(new Drive()
                    {
                        Name        = d.Name,
                        VolumeLabel = d.VolumeLabel,
                        FreeSpace   = General.BytesToGigaBytes((ulong)d.AvailableFreeSpace),
                        TotalSpace  = General.BytesToGigaBytes((ulong)d.TotalSize)
                    });
                }
            }

            return(JsonNet.JsonOKRecords(drives, drives.Count()));
        }