Пример #1
0
 public CommandSpec Resolve(CommandResolverArguments commandResolverArguments)
 {
     if (commandResolverArguments.CommandName == null)
     {
         return(null);
     }
     if (commandResolverArguments.CommandName.EndsWith(FileNameSuffixes.DotNet.DynamicLib))
     {
         var localPath = Path.Combine(AppContext.BaseDirectory,
                                      commandResolverArguments.CommandName);
         if (File.Exists(localPath))
         {
             var escapedArgs = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(
                 new[] { localPath }
                 .Concat(commandResolverArguments.CommandArguments.OrEmptyIfNull()));
             return(new CommandSpec(
                        new Muxer().MuxerPath,
                        escapedArgs));
         }
     }
     return(null);
 }
Пример #2
0
        public CommandSpec Resolve(CommandResolverArguments arguments)
        {
            if (string.IsNullOrEmpty(arguments.CommandName))
            {
                return(null);
            }

            var packageId = new DirectoryInfo(Path.Combine(_dotnetToolPath, arguments.CommandName));

            if (!packageId.Exists)
            {
                return(null);
            }

            var version = packageId.GetDirectories()[0];
            var dll     = version.GetDirectories("tools")[0]
                          .GetDirectories()[0] // TFM
                          .GetDirectories()[0] // RID
                          .GetFiles($"{arguments.CommandName}.dll")[0];

            return(MuxerCommandSpecMaker.CreatePackageCommandSpecUsingMuxer(
                       dll.FullName,
                       arguments.CommandArguments));
        }
Пример #3
0
        public static CommandSpec TryResolveCommandSpec(
            ICommandResolverPolicy commandResolverPolicy,
            string commandName,
            IEnumerable <string> args,
            NuGetFramework framework = null,
            string configuration     = Constants.DefaultConfiguration,
            string outputPath        = null,
            string applicationName   = null)
        {
            var commandResolverArgs = new CommandResolverArguments
            {
                CommandName      = commandName,
                CommandArguments = args,
                Framework        = framework,
                ProjectDirectory = Directory.GetCurrentDirectory(),
                Configuration    = configuration,
                OutputPath       = outputPath,
                ApplicationName  = applicationName
            };

            var defaultCommandResolver = commandResolverPolicy.CreateCommandResolver();

            return(defaultCommandResolver.Resolve(commandResolverArgs));
        }
Пример #4
0
 internal override string ResolveCommandPath(CommandResolverArguments commandResolverArguments)
 {
     return(_environment.GetCommandPathFromRootPath(
                ApplicationEnvironment.ApplicationBasePath,
                commandResolverArguments.CommandName));
 }
Пример #5
0
 internal override string ResolveCommandPath(CommandResolverArguments commandResolverArguments)
 {
     return(_environment.GetCommandPathFromRootPath(
                AppContext.BaseDirectory,
                commandResolverArguments.CommandName));
 }
Пример #6
0
 internal abstract string ResolveCommandPath(CommandResolverArguments commandResolverArguments);
Пример #7
0
 internal override string ResolveCommandPath(CommandResolverArguments commandResolverArguments)
 {
     return(_environment.GetCommandPath(commandResolverArguments.CommandName));
 }