示例#1
0
        public static async Task <IPartition> GetPartitionByVolumeLabel(this IDisk disk, string label)
        {
            var volumes = await disk.GetVolumes();

            var matching = from v in volumes
                           where string.Equals(v.Label, label, StringComparison.InvariantCultureIgnoreCase)
                           select v.Partition;

            return(matching.FirstOrDefault());
        }
示例#2
0
        public async Task Prepare(IDisk disk)
        {
            Log.Verbose("Preparing Micro SD...");

            var windowsPartition = await disk.CreatePartition(PartitionType.Basic, "Windows");

            var vol = await windowsPartition.GetVolume();

            await vol.Format(FileSystemFormat.Ntfs, PartitionLabels.Windows);

            var volumes = await disk.GetVolumes();

            var system = volumes.First(x => x.Label == PartitionLabels.System);
            await system.Partition.SetGptType(PartitionType.Esp);

            Log.Verbose("Micro SD ready");
        }
示例#3
0
        public static async Task <IVolume> GetVolume(this IDisk self, string label)
        {
            var volumes = await self.GetVolumes();

            return(volumes.FirstOrDefault(x => string.Equals(x.Label, label)));
        }