public ProjectDebuggerProvider(ConfiguredProject configuredProject, ILaunchSettingsProvider launchSettingsProvider,
                                OrderPrecedenceImportCollection <IDebugProfileLaunchTargetsProvider> providers)
     : base(configuredProject)
 {
     ProfileLaunchTargetsProviders = providers;
     LaunchSettingsProvider        = launchSettingsProvider;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// The initialization entry point for the page It also hooks into debug provider so that it can update when the profile changes
        /// </summary>
        protected void InitializePropertyPage()
        {
            if (_debugProfileProviderLink == null)
            {
                var debugProfilesBlock = new ActionBlock <ILaunchSettings>(
                    async(profiles) =>
                {
                    if (_firstSnapshotCompleteSource == null)
                    {
                        await ProjectThreadingService.SwitchToUIThread();
                    }
                    InitializeDebugTargetsCore(profiles);
                });

                ILaunchSettingsProvider profileProvider = GetDebugProfileProvider();
                _debugProfileProviderLink = profileProvider.SourceBlock.LinkTo(
                    debugProfilesBlock,
                    linkOptions: new DataflowLinkOptions {
                    PropagateCompletion = true
                });

                // We need to get the set of UI providers, if any.
                InitializeUIProviders();
            }
        }
        public LaunchProfileInitializer(UnconfiguredProject project, ILaunchSettingsProvider launchSettingsProvider)
        {
            Assumes.ThrowIfNull(project, nameof(project));
            Assumes.ThrowIfNull(launchSettingsProvider, nameof(launchSettingsProvider));

            _project = project;
            _launchSettingsProvider = launchSettingsProvider;
        }
 public LaunchTargetPropertyPageValueProvider(
     UnconfiguredProject project,
     ILaunchSettingsProvider launchSettingsProvider,
     IProjectThreadingService projectThreadingService)
 {
     _project = project;
     _launchSettingsProvider  = launchSettingsProvider;
     _projectThreadingService = projectThreadingService;
 }
        public ProjectDebuggerProvider(ConfiguredProject configuredProject, ILaunchSettingsProvider launchSettingsProvider)
            : base(configuredProject)
        {
            LaunchSettingsProvider = launchSettingsProvider;

            // We want it sorted so that higher numbers come first (is the default for these collections but explicitly expressed here)
            ProfileLaunchTargetsProviders = new OrderPrecedenceImportCollection <IDebugProfileLaunchTargetsProvider>(ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesFirst,
                                                                                                                     configuredProject.UnconfiguredProject);
        }
 public LaunchSettingsTracker(
     UnconfiguredProject project,
     ILaunchSettingsProvider launchSettingsProvider,
     LaunchSettingsQueryVersionProvider versionProvider)
 {
     _project = project;
     _launchSettingsProvider = launchSettingsProvider;
     _versionProvider        = versionProvider;
 }
Ejemplo n.º 7
0
        protected virtual ILaunchSettingsProvider GetDebugProfileProvider()
        {
            if (_launchSettingsProvider == null)
            {
                _launchSettingsProvider = Project.Services.ExportProvider.GetExportedValue <ILaunchSettingsProvider>();
            }

            return(_launchSettingsProvider);
        }
Ejemplo n.º 8
0
 public ProjectDebuggerProvider(ConfiguredProject configuredProject, ILaunchSettingsProvider launchSettingsProvider,
                                OrderPrecedenceImportCollection <IDebugProfileLaunchTargetsProvider> providers,
                                IVsService <SVsShellDebugger, IVsDebugger4> vsDebuggerService)
     : base(configuredProject)
 {
     ProfileLaunchTargetsProviders = providers;
     _vsDebuggerService            = vsDebuggerService;
     LaunchSettingsProvider        = launchSettingsProvider;
 }
Ejemplo n.º 9
0
 public ProjectLaunchProfileHandler(
     UnconfiguredProject project,
     ILaunchSettingsProvider launchSettingsProvider,
     LaunchSettingsTracker launchSettingsTracker)
 {
     _project = project;
     _launchSettingsProvider = launchSettingsProvider;
     _launchSettingsTracker  = launchSettingsTracker;
 }
Ejemplo n.º 10
0
 public DebugProfileDebugTargetGenerator(
     UnconfiguredProject project,
     ILaunchSettingsProvider launchSettingProvider,
     IProjectThreadingService threadingService)
     : base(project.Services)
 {
     LaunchSettingProvider   = launchSettingProvider;
     ProjectThreadingService = threadingService;
 }
Ejemplo n.º 11
0
        protected void InitializePropertyPage()
        {
            if (_debugProfileProviderLink == null)
            {
                ILaunchSettingsProvider profileProvider = GetDebugProfileProvider();
                _debugProfileProviderLink = profileProvider.SourceBlock.LinkToAsyncAction(OnLaunchSettingsChanged);

                InitializeUIProviders();
            }
        }
 protected override Task ExecuteAsync(ILaunchSettingsProvider launchSettingsProvider, CancellationToken cancellationToken)
 {
     return(launchSettingsProvider.AddOrUpdateProfileAsync(
                new WritableLaunchProfile
     {
         Name = _executableStep.NewProfileName,
         CommandName = _executableStep.CommandName
     }.ToLaunchProfile(),
                addToFront: false));
 }
        public LaunchProfilesDebugLaunchProvider(
            ConfiguredProject configuredProject,
            ILaunchSettingsProvider launchSettingsProvider,
            IVsService <IVsDebuggerLaunchAsync> vsDebuggerService)
            : base(configuredProject)
        {
            _launchSettingsProvider = launchSettingsProvider;
            _vsDebuggerService      = vsDebuggerService;

            LaunchTargetsProviders = new OrderPrecedenceImportCollection <IDebugProfileLaunchTargetsProvider>(projectCapabilityCheckProvider: configuredProject.UnconfiguredProject);
        }
Ejemplo n.º 14
0
        public LanguageSpecification(ILaunchSettingsProvider _launchSettingsProvider)
        {
            var languageSpecFile = _launchSettingsProvider.LaunchSettings.LanguageSpec;

            if (!File.Exists(languageSpecFile))
            {
                throw new FileNotFoundException();
            }

            var json = File.ReadAllText(languageSpecFile);

            _langSpec = JsonConvert.DeserializeObject <LanguageSpec>(json);
        }
Ejemplo n.º 15
0
        public LaunchProfilesDebugLaunchProvider(
            IProjectThreadingService threadingService,
            ConfiguredProject configuredProject,
            ILaunchSettingsProvider launchSettingsProvider,
            IVsService <SVsShellDebugger, IVsDebugger4> vsDebuggerService)
            : base(configuredProject)
        {
            _threadingService       = threadingService;
            _launchSettingsProvider = launchSettingsProvider;
            _vsDebuggerService      = vsDebuggerService;

            LaunchTargetsProviders = new OrderPrecedenceImportCollection <IDebugProfileLaunchTargetsProvider>(projectCapabilityCheckProvider: configuredProject.UnconfiguredProject);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Create a new instance of the class.
        /// </summary>
        internal DebugProfileEnumValuesGenerator(ILaunchSettingsProvider profileProvider)
        {
            listedValues = new AsyncLazy <ICollection <IEnumValue> >(delegate
            {
                var curSnapshot = profileProvider.CurrentSnapshot;
                if (curSnapshot != null)
                {
                    return(Task.FromResult(GetEnumeratorEnumValues(curSnapshot)));
                }

                ICollection <IEnumValue> emptyCollection = new List <IEnumValue>();
                return(Task.FromResult(emptyCollection));
            });
        }
        /// <summary>
        /// Functions which actually does the save of the settings. Persists the changes to the launch settings
        /// file and configures IIS if needed.
        /// </summary>
        public async virtual System.Threading.Tasks.Task SaveLaunchSettings()
        {
            ILaunchSettingsProvider provider = GetDebugProfileProvider();

            if (EnvironmentVariables != null && EnvironmentVariables.Count > 0)
            {
                SelectedDebugProfile.MutableEnvironmentVariables = EnvironmentVariables.CreateDictionary();
            }
            else if (SelectedDebugProfile != null)
            {
                SelectedDebugProfile.MutableEnvironmentVariables = null;
            }
            var globalSettings = provider.CurrentSnapshot.GlobalSettings;
            await provider.UpdateAndSaveSettingsAsync(new LaunchSettings(DebugProfiles, globalSettings, SelectedDebugProfile != null ? SelectedDebugProfile.Name : null)).ConfigureAwait(false);
        }
        /// <summary>
        /// Blocks until at least one snapshot has been generated.
        /// </summary>
        /// <param name="provider">The underlying provider to satisfy this request.</param>
        /// <param name="token">An optional token to signal cancellation of the request.</param>
        /// <returns>
        /// The current <see cref="ILaunchSettings"/> snapshot.
        /// </returns>
        public static async Task <ILaunchSettings> WaitForFirstSnapshot(this ILaunchSettingsProvider provider, CancellationToken token = default)
        {
            // With an infinite timeout, the provider is contractually obligated to return a non-null value.
            Task <ILaunchSettings?> task = provider.WaitForFirstSnapshot(Timeout.Infinite);

            if (token.CanBeCanceled)
            {
                task = task.WithCancellation(token);
            }

            ILaunchSettings?launchSettings = await task;

            Assumes.NotNull(launchSettings);

            return(launchSettings);
        }
        protected override async Task ExecuteAsync(ILaunchSettingsProvider launchSettingsProvider, CancellationToken cancellationToken)
        {
            ILaunchSettings?launchSettings = await launchSettingsProvider.WaitForFirstSnapshot(Timeout.Infinite).WithCancellation(cancellationToken);

            Assumes.NotNull(launchSettings);

            ILaunchProfile?existingProfile = launchSettings.Profiles.FirstOrDefault(p => StringComparers.LaunchProfileNames.Equals(p.Name, _executableStep.CurrentProfileName));

            if (existingProfile is not null)
            {
                var writableProfile = new WritableLaunchProfile(existingProfile);
                writableProfile.Name        = _executableStep.NewProfileName;
                writableProfile.CommandName = _executableStep.NewProfileCommandName;

                await launchSettingsProvider.AddOrUpdateProfileAsync(writableProfile.ToLaunchProfile(), addToFront : false);
            }
        }
        /// <summary>
        /// Create a new instance of the class.
        /// </summary>
        internal DebugProfileEnumValuesGenerator(
            ILaunchSettingsProvider profileProvider,
            IProjectThreadingService threadingService)
        {
            Requires.NotNull(profileProvider, nameof(profileProvider));
            Requires.NotNull(threadingService, nameof(threadingService));

            _listedValues = new AsyncLazy <ICollection <IEnumValue> >(delegate
            {
                ILaunchSettings?curSnapshot = profileProvider.CurrentSnapshot;
                if (curSnapshot != null)
                {
                    return(Task.FromResult(GetEnumeratorEnumValues(curSnapshot)));
                }

                ICollection <IEnumValue> emptyCollection = new List <IEnumValue>();
                return(Task.FromResult(emptyCollection));
            }, threadingService.JoinableTaskFactory);
        }
Ejemplo n.º 21
0
        public virtual async Task SaveLaunchSettings()
        {
            ILaunchSettingsProvider provider = GetDebugProfileProvider();

            if (EnvironmentVariables != null && EnvironmentVariables.Count > 0 && SelectedDebugProfile != null)
            {
                SelectedDebugProfile.EnvironmentVariables.Clear();
                foreach (NameValuePair kvp in EnvironmentVariables)
                {
                    SelectedDebugProfile.EnvironmentVariables.Add(kvp.Name, kvp.Value);
                }
            }
            else if (SelectedDebugProfile != null)
            {
                SelectedDebugProfile.EnvironmentVariables.Clear();
            }

            await provider.UpdateAndSaveSettingsAsync(CurrentLaunchSettings.ToLaunchSettings());
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Functions which actually does the save of the settings. Persists the changes to the launch settings
        /// file and configures IIS if needed.
        /// </summary>
        public async virtual System.Threading.Tasks.Task SaveLaunchSettings()
        {
            ILaunchSettingsProvider provider = GetDebugProfileProvider();

            if (EnvironmentVariables != null && EnvironmentVariables.Count > 0 && SelectedDebugProfile != null)
            {
                SelectedDebugProfile.EnvironmentVariables.Clear();
                foreach (var kvp in EnvironmentVariables)
                {
                    SelectedDebugProfile.EnvironmentVariables.Add(kvp.Name, kvp.Value);
                }
            }
            else if (SelectedDebugProfile != null)
            {
                SelectedDebugProfile.EnvironmentVariables.Clear();
            }

            await provider.UpdateAndSaveSettingsAsync(CurrentLaunchSettings.ToLaunchSettings()).ConfigureAwait(false);
        }
Ejemplo n.º 23
0
        public Lexicon(ILaunchSettingsProvider launchSettingsProvider)
        {
            var dictionaryFile = launchSettingsProvider.LaunchSettings.Lexicon;

            if (!File.Exists(dictionaryFile))
            {
                return;
            }

            var json       = File.ReadAllText(dictionaryFile);
            var dictionary = JsonConvert.DeserializeObject <LexiconDictionary>(json);

            _dictionary[TokenType.Verb]      = new HashSet <string>();
            _dictionary[TokenType.Noun]      = new HashSet <string>();
            _dictionary[TokenType.Direction] = new HashSet <string>();
            _dictionary[TokenType.Joiner]    = new HashSet <string>();

            _dictionary[TokenType.Verb].AddRange(dictionary.verbs);
            _dictionary[TokenType.Noun].AddRange(dictionary.nouns);
            _dictionary[TokenType.Direction].AddRange(dictionary.directions);
            _dictionary[TokenType.Joiner].AddRange(dictionary.joiners);
        }
Ejemplo n.º 24
0
 public ActiveLaunchProfileCommonValueProvider(ILaunchSettingsProvider launchSettingsProvider)
     : base(launchSettingsProvider)
 {
 }
Ejemplo n.º 25
0
 public WorkingDirectoryValueProvider(UnconfiguredProject project, ILaunchSettingsProvider launchSettingsProvider, IProjectThreadingService projectThreadingService)
     : base(project, launchSettingsProvider, projectThreadingService)
 {
 }
 public LaunchSettingsValueProviderBase(ILaunchSettingsProvider launchSettingsProvider)
 {
     _launchSettingsProvider = launchSettingsProvider;
 }
 public ActiveLaunchProfileCommonValueProvider(UnconfiguredProject project, ILaunchSettingsProvider launchSettingsProvider, IProjectThreadingService projectThreadingService)
     : base(project, launchSettingsProvider, projectThreadingService)
 {
 }
Ejemplo n.º 28
0
 private static bool TryLocateHandler(string commandName, out ILaunchSettingsProvider provider)
 {
     return(_providers.TryGetValue(commandName, out provider));
 }
Ejemplo n.º 29
0
 public ActiveLaunchProfileNameValueProvider(ILaunchSettingsProvider launchSettings)
 {
     _launchSettings = launchSettings;
 }
 public LaunchTargetValueProvider(UnconfiguredProject project, ILaunchSettingsProvider launchSettingsProvider, IProjectThreadingService projectThreadingService)
     : base(project, launchSettingsProvider, projectThreadingService)
 {
 }