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()); }
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"); }
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))); }