Ejemplo n.º 1
0
        public async Task <BlazorPackage> Locate(string name)
        {
            using (var operation = Log.OnEnterAndExit())
            {
                var dotnet    = new Dotnet(_packagesDirectory);
                var toolNames = await dotnet.ToolList(_packagesDirectory);

                if (toolNames.Contains(name))
                {
                    operation.Info($"Checking tool {name}");
                    var result = await CommandLine.Execute(Path.Combine(_packagesDirectory.FullName, name), "locate-projects");

                    var directory = new DirectoryInfo(result.Output.First());
                    if (directory.Exists)
                    {
                        var runnerSubDirectory = directory.GetDirectories("runner-*").FirstOrDefault();
                        if (runnerSubDirectory?.Exists ?? false)
                        {
                            var path    = Path.Combine(runnerSubDirectory.FullName, "MLS.Blazor");
                            var package = new BlazorPackage(runnerSubDirectory.Name, null, new DirectoryInfo(path));
                            if (package.BlazorEntryPointAssemblyPath.Exists)
                            {
                                return(package);
                            }
                        }
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
        public async Task <WebAssemblyAsset> Locate(string name)
        {
            using (var operation = Log.OnEnterAndExit())
            {
                var dotnet    = new Dotnet(_packagesDirectory);
                var toolNames = await dotnet.ToolList(_packagesDirectory);

                if (toolNames.Contains(name))
                {
                    operation.Info($"Checking tool {name}");
                    var tool = new PackageTool(name, _packagesDirectory);
                    await tool.Prepare();

                    return(await tool.LocateWasmAsset());
                }
            }

            return(null);
        }