コード例 #1
0
        public async Task GetPartitions()
        {
            var sut        = new LowLevelApi();
            var partitions = await sut.GetPartitions(await sut.GetPhoneDisk());

            Assert.NotNull(partitions);
        }
コード例 #2
0
        public static MainViewModel GetMainViewModel(IObservable <LogEvent> logEvents)
        {
            var visualizerService = new ExtendedWpfUIVisualizerService();

            visualizerService.Register("TextViewer", typeof(TextViewerWindow));

            IDictionary <PhoneModel, IDeployer> deployerDict = new Dictionary <PhoneModel, IDeployer>
            {
                { PhoneModel.Lumia950Xl, GetDeployer(Path.Combine("Files", "Lumia 950 XL")) },
                { PhoneModel.Lumia950, GetDeployer(Path.Combine("Files", "Lumia 950")) },
            };

            var api            = new LowLevelApi();
            var deployersItems = deployerDict.Select(pair => new DeployerItem(pair.Key, pair.Value)).ToList();
            var importerItems  = new List <DriverPackageImporterItem>()
            {
                new DriverPackageImporterItem("7z",
                                              new DriverPackageImporter <SevenZipArchiveEntry, SevenZipVolume, SevenZipArchive>(
                                                  s => SevenZipArchive.Open(s), "Files")),
                new DriverPackageImporterItem("zip",
                                              new DriverPackageImporter <ZipArchiveEntry, ZipVolume, ZipArchive>(s => ZipArchive.Open(s), "Files"))
            };

            var mainViewModel = new MainViewModel(logEvents, deployersItems, importerItems,
                                                  new ViewServices(new WpfOpenFileService(), DialogCoordinator.Instance, visualizerService),
                                                  async() => new Phone(await api.GetPhoneDisk()));

            return(mainViewModel);
        }
コード例 #3
0
        public async Task GetPhoneDisk()
        {
            var sut  = new LowLevelApi();
            var disk = await sut.GetPhoneDisk();

            Assert.NotNull(disk);
        }
コード例 #4
0
        public async Task GetVolume()
        {
            var sut       = new LowLevelApi();
            var partition = (await sut.GetPartitions(await sut.GetPhoneDisk())).Skip(2).First();
            var volume    = await sut.GetVolume(partition);

            Assert.NotNull(volume);
        }
コード例 #5
0
        public async Task CheckOobeCompleted()
        {
            var sut = new LowLevelApi();

            var volume = await sut.GetWindowsVolume();

            var completed = sut.GetIsOobeCompleted(volume);
        }
コード例 #6
0
        public async Task <Partition> GetBootEfiEspPartition()
        {
            var parts = await LowLevelApi.GetPartitions(this);

            return(parts
                   .OrderByDescending(x => x.Number)
                   .FirstOrDefault(x => Equals(x.PartitionType, PartitionType.Esp)));
        }
コード例 #7
0
        public async Task ResizePartition()
        {
            var api       = new LowLevelApi();
            var phoneDisk = await api.GetPhoneDisk();

            var phone   = new Phone(phoneDisk);
            var dataVol = await phone.GetDataVolume();

            await dataVol.Partition.Resize(ByteSize.FromGigaBytes(10));
        }
コード例 #8
0
        public async Task InjectDrivers()
        {
            var sut      = new DismImageService();
            var lowlevel = new LowLevelApi();
            var volumes  = await lowlevel.GetVolumes(await lowlevel.GetPhoneDisk());

            var winVolume = volumes.Single(v => v.Label == "WindowsARM");

            await sut.InjectDrivers(@"C:\Users\super\source\repos\Install\Application\bin\Debug\bin\Debug\Files\Drivers\Stable", winVolume);
        }
コード例 #9
0
        public async Task Format()
        {
            var sut       = new LowLevelApi();
            var phoneDisk = await sut.GetPhoneDisk();

            var partitionToFormat = (await sut.GetPartitions(phoneDisk)).Single(x => x.Number == 6);
            var toFormat          = await sut.GetVolume(partitionToFormat);

            await sut.Format(toFormat, FileSystemFormat.Ntfs, "Test");
        }
コード例 #10
0
        public async Task AssignLetter()
        {
            var sut       = new LowLevelApi();
            var phoneDisk = await sut.GetPhoneDisk();

            var partitionToFormat = (await sut.GetPartitions(phoneDisk)).Single(x => x.Number == 6);
            var toAssign          = await sut.GetVolume(partitionToFormat);

            await sut.AssignDriveLetter(toAssign, 'I');
        }
コード例 #11
0
        public async Task SetPartitionType()
        {
            var sut  = new LowLevelApi();
            var disk = await sut.GetPhoneDisk();

            var volumes = await sut.GetVolumes(disk);

            var volume = volumes.Single(x => x.Label == "BOOT");

            await sut.SetPartitionType(volume.Partition, PartitionType.Esp);
        }
コード例 #12
0
        public override async Task <Disk> GetDeviceDisk()
        {
            if (disk == null)
            {
                var disks = await LowLevelApi.GetDisks();

                return(disks.First(x => x.Number == diskNumber));
            }

            return(disk);
        }
コード例 #13
0
        public async Task MakeBootable()
        {
            var lowLevelApi = new LowLevelApi();
            var sut         = new WindowsDeployer(new DismImageService(), new DriverPaths(""));

            var lowlevel = lowLevelApi;
            var volumes  = await lowlevel.GetVolumes(await lowlevel.GetPhoneDisk());

            var winVolume  = volumes.Single(v => v.Label == "WindowsARM");
            var bootVolume = volumes.Single(v => v.Label == "BOOT");

            //await sut.MakeBootable(new WindowsVolumes());
        }
コード例 #14
0
        public override async Task <Disk> GetDeviceDisk()
        {
            var disks = await LowLevelApi.GetDisks();

            foreach (var disk in disks.Where(x => x.Number != 0))
            {
                if (true)
                {
                    var volumes = await disk.GetVolumes();

                    var mainOsVol = volumes.FirstOrDefault(x => x.Label == MainOsLabel);
                    if (mainOsVol != null)
                    {
                        return(disk);
                    }
                }
            }

            throw new PhoneDiskNotFoundException("Cannot get the Phone Disk. Please, verify that the Phone is in Mass Storage Mode.");
        }
コード例 #15
0
 public async Task GetAvailableLetter()
 {
     var sut    = new LowLevelApi();
     var letter = sut.GetFreeDriveLetter();
 }
コード例 #16
0
        public async Task <IList <Volume> > GetVolumes()
        {
            var volumes = await LowLevelApi.GetVolumes(this);

            return(volumes);
        }
コード例 #17
0
 public Task <List <Partition> > GetPartitions()
 {
     return(LowLevelApi.GetPartitions(this));
 }
コード例 #18
0
 public Task <Partition> CreateReservedPartition(ulong sizeInBytes)
 {
     return(LowLevelApi.CreateReservedPartition(this, sizeInBytes));
 }
コード例 #19
0
        public async Task <Partition> GetReservedPartition()
        {
            var parts = await LowLevelApi.GetPartitions(this);

            return(parts.FirstOrDefault(x => Equals(x.PartitionType, PartitionType.Reserved)));
        }
コード例 #20
0
 public async Task DeployWindows()
 {
     var api      = new LowLevelApi();
     var deployer = new WindowsDeployer(new DismImageService(), new DriverPaths(""));
     await deployer.Deploy(new InstallOptions(@"F:\sources\install.wim"), new Phone(null));
 }