Exemple #1
0
        public async Task GetVolumeByPartitionName()
        {
            var sut  = new DiskApi();
            var disk = await sut.GetDisk(3);

            var vols = await disk.GetVolumeByPartitionName("MainOS");
        }
Exemple #2
0
        public async Task GetDataByLabel()
        {
            var diskApi = new DiskApi();
            var disk    = await diskApi.GetDisk(3);

            var partition = await disk.GetPartition("Data");
        }
        private async Task <Disk> GetDeviceDiskCore()
        {
            var disks = await DiskApi.GetDisks();

            var disk = await disks
                       .ToObservable()
                       .SelectMany(async x => new { IsDevice = await IsDeviceDisk(x), Disk = x })
                       .Where(x => x.IsDevice)
                       .Select(x => x.Disk)
                       .FirstOrDefaultAsync();

            if (disk != null)
            {
                return(disk);
            }

            throw new PhoneDiskNotFoundException(
                      "Cannot get the Phone Disk. Please, verify that the Phone is in Mass Storage Mode.");
        }
        public override async Task <Disk> GetDeviceDisk()
        {
            var disks = await DiskApi.GetDisks();

            foreach (var disk in disks.Where(x => x.Number != 0))
            {
                if (true)
                {
                    var mainOs = await disk.GetRequiredPartition(PartitionName.MainOs);

                    if (mainOs != null)
                    {
                        return(disk);
                    }
                }
            }

            throw new PhoneDiskNotFoundException("Cannot get the Phone Disk. Please, verify that the Phone is in Mass Storage Mode.");
        }
        public async Task Prepare()
        {
            var api = new DiskApi();

            var allocators      = new [] { new DefaultSpaceAllocator() };
            var operations      = new FileSystemOperations();
            var optionsProvider = new WindowsDeploymentOptionsProvider
            {
                Options = new WindowsDeploymentOptions
                {
                    SizeReservedForWindows = ByteSize.FromMegaBytes(200),
                }
            };

            var phone    = new TestPhone(api, null, null);
            var preparer = new LumiaDiskLayoutPreparer(optionsProvider, operations, allocators, new PartitionCleaner(), phone);

            var disk = await api.GetDisk(3);

            await preparer.Prepare(disk);
        }
Exemple #6
0
        private async Task <Disk> GetDeviceDiskCore()
        {
            var disks = await DiskApi.GetDisks();

            foreach (var disk in disks.Where(x => x.Number != 0))
            {
                var hasCorrectSize = HasCorrectSize(disk);

                if (hasCorrectSize)
                {
                    var mainOs = await disk.GetPartition(PartitionName.MainOs);

                    if (mainOs != null)
                    {
                        return(disk);
                    }
                }
            }

            throw new PhoneDiskNotFoundException(
                      "Cannot get the Phone Disk. Please, verify that the Phone is in Mass Storage Mode.");
        }
 public Task Resize(ByteSize newSize)
 {
     return(DiskApi.ResizePartition(this, newSize));
 }
 public Task <Volume> GetVolume()
 {
     return(DiskApi.GetVolume(this));
 }
 public Task SetGptType(PartitionType basic)
 {
     return(DiskApi.SetGptType(this, basic));
 }
 public Task Format(FileSystemFormat fileSystemFormat, string label)
 {
     return(DiskApi.Format(this, fileSystemFormat, label));
 }
 public Task Remove()
 {
     return(DiskApi.RemovePartition(this));
 }
Exemple #12
0
 public Task SetGuid(Guid guid)
 {
     return(DiskApi.ChangeDiskId(this, guid));
 }
Exemple #13
0
 public Task Refresh()
 {
     return(DiskApi.RefreshDisk(this));
 }