コード例 #1
0
        public async Task <string> Replace(string str)
        {
            IDictionary <string, Func <Task <string> > > mappings = new Dictionary <string, Func <Task <string> > >()
            {
                { @"\[EFIESP\]", async() =>
                  {
                      var volume = await phone.GetMainOsVolume();

                      return(Path.Combine(volume.Root, "EFIESP"));
                  } },
                { @"\[Windows\]", async() => (await phone.GetWindowsVolume()).Root },
                { @"\[MainOS\]", async() => (await phone.GetMainOsVolume()).Root },
                { @"\[System\]", async() => (await phone.GetSystemVolume()).Root },
            };

            foreach (var mapping in mappings)
            {
                if (Regex.IsMatch(str, mapping.Key))
                {
                    var mappingValue = await mapping.Value();

                    str = Regex.Replace(str, $"^{mapping.Key}", mappingValue, RegexOptions.IgnoreCase);
                    str = Regex.Replace(str, $@"\\+", @"\", RegexOptions.IgnoreCase);
                }
            }

            return(str);
        }
コード例 #2
0
        private async Task PatchBoot()
        {
            Log.Verbose("Patching boot");

            var mainOs = await phone.GetMainOsVolume();

            await fileOperations.Copy("Core\\Boot\\bootaa64.efi", Path.Combine(mainOs.Root, PartitionName.EfiEsp, "EFI", "Boot\\"));
        }
コード例 #3
0
        public async Task Execute()
        {
            var mainOs = await phone.GetMainOsVolume();

            var bcdPath    = Path.Combine(mainOs.Root, PartitionName.EfiEsp.CombineRelativeBcdPath());
            var bcdInvoker = bcdInvokerFactory.Create(bcdPath);

            new BcdConfigurator(bcdInvoker, mainOs).SetupBcd();
        }
コード例 #4
0
        public async Task Execute()
        {
            var mainOsVolume = await phone.GetMainOsVolume();

            var mainOsPath = mainOsVolume.Root;

            await CopyDevMenuFiles(mainOsPath);

            ConfigureBcd(mainOsPath);
        }
コード例 #5
0
        public async Task Execute()
        {
            var mainOsVolume = await phone.GetMainOsVolume();

            var rootDir    = mainOsVolume.Root;
            var bcdPath    = Path.Combine(mainOsVolume.Root, PartitionName.EfiEsp.CombineRelativeBcdPath());
            var bcdInvoker = bcdInvokerFactory.Create(bcdPath);

            var destination = Path.Combine(rootDir, "Windows", "System32", "BOOT");
            await fileSystemOperations.CopyDirectory(Path.Combine(rootFilesPath), destination);

            var guid = FormattingUtils.GetGuid(bcdInvoker.Invoke(@"/create /d ""Developer Menu"" /application BOOTAPP"));

            bcdInvoker.Invoke($@"/set {{{guid}}} path \Windows\System32\BOOT\developermenu.efi");
            bcdInvoker.Invoke($@"/set {{{guid}}} device partition={rootDir}");
            bcdInvoker.Invoke($@"/set {{{guid}}} testsigning on");
            bcdInvoker.Invoke($@"/set {{{guid}}} nointegritychecks on");
            bcdInvoker.Invoke($@"/displayorder {{{guid}}} /addlast");
        }