Beispiel #1
0
        private static void ConfigureDotNetForFirstTimeUse(
            INuGetCacheSentinel nugetCacheSentinel,
            IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel,
            IAspNetCertificateSentinel aspNetCertificateSentinel,
            IFileSentinel toolPathSentinel,
            bool hasSuperUserAccess,
            DotnetFirstRunConfiguration dotnetFirstRunConfiguration,
            IEnvironmentProvider environmentProvider)
        {
            using (PerfTrace.Current.CaptureTiming())
            {
                var nugetPackagesArchiver = new NuGetPackagesArchiver();
                var environmentPath       = EnvironmentPathFactory.CreateEnvironmentPath(hasSuperUserAccess, environmentProvider);
                var commandFactory        = new DotNetCommandFactory(alwaysRunOutOfProc: true);
                var nugetCachePrimer      = new NuGetCachePrimer(
                    nugetPackagesArchiver,
                    nugetCacheSentinel);
                var aspnetCertificateGenerator = new AspNetCoreCertificateGenerator();
                var dotnetConfigurer           = new DotnetFirstTimeUseConfigurer(
                    nugetCachePrimer,
                    nugetCacheSentinel,
                    firstTimeUseNoticeSentinel,
                    aspNetCertificateSentinel,
                    aspnetCertificateGenerator,
                    toolPathSentinel,
                    dotnetFirstRunConfiguration,
                    Reporter.Output,
                    CliFolderPathCalculator.CliFallbackFolderPath,
                    environmentPath);

                dotnetConfigurer.Configure();
            }
        }
Beispiel #2
0
        private static void ConfigureDotNetForFirstTimeUse(
            INuGetCacheSentinel nugetCacheSentinel,
            IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel,
            CliFallbackFolderPathCalculator cliFallbackFolderPathCalculator)
        {
            using (PerfTrace.Current.CaptureTiming())
            {
                var nugetPackagesArchiver = new NuGetPackagesArchiver();
                var environmentProvider   = new EnvironmentProvider();
                var commandFactory        = new DotNetCommandFactory(alwaysRunOutOfProc: true);
                var nugetCachePrimer      = new NuGetCachePrimer(
                    nugetPackagesArchiver,
                    nugetCacheSentinel,
                    cliFallbackFolderPathCalculator);
                var dotnetConfigurer = new DotnetFirstTimeUseConfigurer(
                    nugetCachePrimer,
                    nugetCacheSentinel,
                    firstTimeUseNoticeSentinel,
                    environmentProvider,
                    Reporter.Output,
                    cliFallbackFolderPathCalculator.CliFallbackFolderPath);

                dotnetConfigurer.Configure();
            }
        }
Beispiel #3
0
        private bool PermissionExists(INuGetCacheSentinel sentinel)
        {
            if (sentinel == null)
            {
                return false;
            }

            return sentinel.Exists();
        }
 public DotnetFirstTimeUseConfigurer(
     INuGetCachePrimer nugetCachePrimer,
     INuGetCacheSentinel nugetCacheSentinel,
     IEnvironmentProvider environmentProvider)
 {
     _nugetCachePrimer    = nugetCachePrimer;
     _nugetCacheSentinel  = nugetCacheSentinel;
     _environmentProvider = environmentProvider;
 }
Beispiel #5
0
        private bool PermissionExists(INuGetCacheSentinel sentinel)
        {
            if (sentinel == null)
            {
                return(false);
            }

            return(sentinel.Exists());
        }
 public DotnetFirstTimeUseConfigurer(
     INuGetCachePrimer nugetCachePrimer,
     INuGetCacheSentinel nugetCacheSentinel,
     IEnvironmentProvider environmentProvider)
 {
     _nugetCachePrimer = nugetCachePrimer;
     _nugetCacheSentinel = nugetCacheSentinel;
     _environmentProvider = environmentProvider;
 }
Beispiel #7
0
 public NuGetCachePrimer(
     INuGetPackagesArchiver nugetPackagesArchiver,
     INuGetCacheSentinel nuGetCacheSentinel,
     CliFallbackFolderPathCalculator cliFallbackFolderPathCalculator)
     : this(nugetPackagesArchiver,
            nuGetCacheSentinel,
            cliFallbackFolderPathCalculator,
            FileSystemWrapper.Default.File)
 {
 }
 public NuGetCachePrimer(
     ICommandFactory commandFactory,
     INuGetPackagesArchiver nugetPackagesArchiver,
     INuGetCacheSentinel nuGetCacheSentinel)
     : this(commandFactory,
         nugetPackagesArchiver,
         nuGetCacheSentinel,
         FileSystemWrapper.Default.Directory,
         FileSystemWrapper.Default.File)
 {
 }
Beispiel #9
0
 public NuGetCachePrimer(
     ICommandFactory commandFactory,
     INuGetPackagesArchiver nugetPackagesArchiver,
     INuGetCacheSentinel nuGetCacheSentinel)
     : this(commandFactory,
            nugetPackagesArchiver,
            nuGetCacheSentinel,
            FileSystemWrapper.Default.Directory,
            FileSystemWrapper.Default.File)
 {
 }
Beispiel #10
0
        internal NuGetCachePrimer(
            INuGetPackagesArchiver nugetPackagesArchiver,
            INuGetCacheSentinel nuGetCacheSentinel,
            IFile file)
        {
            _nugetPackagesArchiver = nugetPackagesArchiver;

            _nuGetCacheSentinel = nuGetCacheSentinel;

            _file = file;
        }
Beispiel #11
0
        public Telemetry(INuGetCacheSentinel sentinel)
        {
            Enabled = !Env.GetEnvironmentVariableAsBool(TelemetryOptout) && PermissionExists(sentinel);

            if (!Enabled)
            {
                return;
            }

            //initialize in task to offload to parallel thread
            _trackEventTask = Task.Factory.StartNew(() => InitializeTelemetry());
        }
Beispiel #12
0
        public Telemetry(INuGetCacheSentinel sentinel)
        {
            Enabled = !Env.GetEnvironmentVariableAsBool(TelemetryOptout) && PermissionExists(sentinel);

            if (!Enabled)
            {
                return;
            }

            //initialize in task to offload to parallel thread
            _trackEventTask = Task.Factory.StartNew(() => InitializeTelemetry());
        }
Beispiel #13
0
 internal NuGetCachePrimer(
     ICommandFactory commandFactory,
     INuGetPackagesArchiver nugetPackagesArchiver,
     INuGetCacheSentinel nuGetCacheSentinel,
     IDirectory directory,
     IFile file)
 {
     _commandFactory        = commandFactory;
     _directory             = directory;
     _nugetPackagesArchiver = nugetPackagesArchiver;
     _nuGetCacheSentinel    = nuGetCacheSentinel;
     _file = file;
 }
Beispiel #14
0
 internal NuGetCachePrimer(
     ICommandFactory commandFactory,
     INuGetPackagesArchiver nugetPackagesArchiver,
     INuGetCacheSentinel nuGetCacheSentinel,
     IDirectory directory,
     IFile file)
 {
     _commandFactory = commandFactory;
     _directory = directory;
     _nugetPackagesArchiver = nugetPackagesArchiver;
     _nuGetCacheSentinel = nuGetCacheSentinel;
     _file = file;
 }
Beispiel #15
0
        internal NuGetCachePrimer(
            INuGetPackagesArchiver nugetPackagesArchiver,
            INuGetCacheSentinel nuGetCacheSentinel,
            CliFallbackFolderPathCalculator cliFallbackFolderPathCalculator,
            IFile file)
        {
            _nugetPackagesArchiver = nugetPackagesArchiver;

            _nuGetCacheSentinel = nuGetCacheSentinel;

            _cliFallbackFolderPathCalculator = cliFallbackFolderPathCalculator;

            _file = file;
        }
Beispiel #16
0
        public Telemetry(INuGetCacheSentinel sentinel, string sessionId)
        {
            Enabled = !Env.GetEnvironmentVariableAsBool(TelemetryOptout) && PermissionExists(sentinel);

            if (!Enabled)
            {
                return;
            }

            // Store the session ID in a static field so that it can be reused
            CurrentSessionId = sessionId ?? Guid.NewGuid().ToString();

            //initialize in task to offload to parallel thread
            _trackEventTask = Task.Factory.StartNew(() => InitializeTelemetry());
        }
 public DotnetFirstTimeUseConfigurer(
     INuGetCachePrimer nugetCachePrimer,
     INuGetCacheSentinel nugetCacheSentinel,
     IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel,
     IEnvironmentProvider environmentProvider,
     IReporter reporter,
     string cliFallbackFolderPath)
 {
     _nugetCachePrimer           = nugetCachePrimer;
     _nugetCacheSentinel         = nugetCacheSentinel;
     _firstTimeUseNoticeSentinel = firstTimeUseNoticeSentinel;
     _environmentProvider        = environmentProvider;
     _reporter = reporter;
     _cliFallbackFolderPath = cliFallbackFolderPath;
 }
Beispiel #18
0
 public DotnetFirstTimeUseConfigurer(
     INuGetCachePrimer nugetCachePrimer,
     INuGetCacheSentinel nugetCacheSentinel,
     IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel,
     IEnvironmentProvider environmentProvider,
     IReporter reporter,
     string cliFallbackFolderPath,
     IEnvironmentPath pathAdder)
 {
     _nugetCachePrimer           = nugetCachePrimer;
     _nugetCacheSentinel         = nugetCacheSentinel;
     _firstTimeUseNoticeSentinel = firstTimeUseNoticeSentinel;
     _environmentProvider        = environmentProvider;
     _reporter = reporter;
     _cliFallbackFolderPath = cliFallbackFolderPath;
     _pathAdder             = pathAdder ?? throw new ArgumentNullException(nameof(pathAdder));
 }
Beispiel #19
0
        private static void ConfigureDotNetForFirstTimeUse(INuGetCacheSentinel nugetCacheSentinel)
        {
            using (PerfTrace.Current.CaptureTiming())
            {
                using (var nugetPackagesArchiver = new NuGetPackagesArchiver())
                {
                    var environmentProvider = new EnvironmentProvider();
                    var commandFactory      = new DotNetCommandFactory();
                    var nugetCachePrimer    =
                        new NuGetCachePrimer(commandFactory, nugetPackagesArchiver, nugetCacheSentinel);
                    var dotnetConfigurer = new DotnetFirstTimeUseConfigurer(
                        nugetCachePrimer,
                        nugetCacheSentinel,
                        environmentProvider);

                    dotnetConfigurer.Configure();
                }
            }
        }
Beispiel #20
0
 public DotnetFirstTimeUseConfigurer(
     INuGetCachePrimer nugetCachePrimer,
     INuGetCacheSentinel nugetCacheSentinel,
     IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel,
     IAspNetCertificateSentinel aspNetCertificateSentinel,
     IAspNetCoreCertificateGenerator aspNetCoreCertificateGenerator,
     IFileSentinel toolPathSentinel,
     IEnvironmentProvider environmentProvider,
     IReporter reporter,
     string cliFallbackFolderPath,
     IEnvironmentPath pathAdder)
 {
     _nugetCachePrimer               = nugetCachePrimer;
     _nugetCacheSentinel             = nugetCacheSentinel;
     _firstTimeUseNoticeSentinel     = firstTimeUseNoticeSentinel;
     _aspNetCertificateSentinel      = aspNetCertificateSentinel;
     _aspNetCoreCertificateGenerator = aspNetCoreCertificateGenerator;
     _toolPathSentinel               = toolPathSentinel;
     _environmentProvider            = environmentProvider;
     _reporter = reporter;
     _cliFallbackFolderPath = cliFallbackFolderPath;
     _pathAdder             = pathAdder ?? throw new ArgumentNullException(nameof(pathAdder));
 }
Beispiel #21
0
 public Telemetry(INuGetCacheSentinel sentinel) : this(sentinel, null)
 {
 }
Beispiel #22
0
        private static void ConfigureDotNetForFirstTimeUse(INuGetCacheSentinel nugetCacheSentinel)
        {
            using (PerfTrace.Current.CaptureTiming())
            {
                using (var nugetPackagesArchiver = new NuGetPackagesArchiver())
                {
                    var environmentProvider = new EnvironmentProvider();
                    var commandFactory = new DotNetCommandFactory();
                    var nugetCachePrimer = 
                        new NuGetCachePrimer(commandFactory, nugetPackagesArchiver, nugetCacheSentinel);
                    var dotnetConfigurer = new DotnetFirstTimeUseConfigurer(
                        nugetCachePrimer,
                        nugetCacheSentinel,
                        environmentProvider);

                    dotnetConfigurer.Configure();
                }
            }
        }
Beispiel #23
0
 public NuGetCachePrimer(INuGetPackagesArchiver nugetPackagesArchiver, INuGetCacheSentinel nuGetCacheSentinel)
     : this(nugetPackagesArchiver, nuGetCacheSentinel, FileSystemWrapper.Default.File)
 {
 }