private void ReleaseSettings(string projectPath, IThreadHandling threadHandling, IRProjectProperties propertes, bool save) { _semaphore.Wait(); try { var access = _settings[projectPath]; string settingsFile = null; if (string.IsNullOrEmpty(access.Settings.SourceFile)) { settingsFile = Path.Combine(projectPath, "Settings.R"); } if (save) { access.Settings.Save(settingsFile); } threadHandling?.ExecuteSynchronously(async() => { var currentSettingsFile = await propertes.GetSettingsFileAsync(); if (string.IsNullOrEmpty(currentSettingsFile)) { settingsFile = settingsFile.MakeRRelativePath(projectPath); await propertes.SetSettingsFileAsync(settingsFile); } }); _settings.Remove(projectPath); } finally { _semaphore.Release(); } }
private async Task <string> GetSettingsFilePathAsync(string projectFolder, IRProjectProperties properties) { var settingsFile = await properties.GetSettingsFileAsync(); if (!string.IsNullOrEmpty(settingsFile)) { return(settingsFile.MakeAbsolutePathFromRRelative(projectFolder)); } return(null); }
public ProjectSettingsControlTest(PackageTestFilesFixture files) { _files = files; _appShell = Substitute.For<IApplicationShell>(); _fs = Substitute.For<IFileSystem>(); _access = Substitute.For<IProjectConfigurationSettingsAccess>(); _access.Settings.Returns(_coll); _csp = Substitute.For<IProjectConfigurationSettingsProvider>(); _csp.OpenProjectSettingsAccessAsync(null, null).ReturnsForAnyArgs(Task.FromResult(_access)); _unconfiguredProject = Substitute.For<UnconfiguredProject>(); _unconfiguredProject.FullPath.Returns(@"C:\file.rproj"); _properties = Substitute.For<IRProjectProperties>(); _properties.GetSettingsFileAsync().Returns(Task.FromResult<string>(null)); }
public async Task SetProjectPathAsync(string projectPath, IRProjectProperties properties) { _projectPath = projectPath; _properties = properties; try { EnumerateSettingFiles(projectPath); } catch (COMException) { } catch (IOException) { } catch (UnauthorizedAccessException) { } if (_properties != null) { var file = await _properties.GetSettingsFileAsync(); if (!string.IsNullOrEmpty(file) && _filesMap.ContainsKey(file)) { CurrentFile = file; } } if (CurrentFile == null) { CurrentFile = _filesMap.Keys.FirstOrDefault(); } }
public ProjectSettingsControlTest(PackageTestFilesFixture files) { _files = files; _shell = Substitute.For <ICoreShell>(); _fs = Substitute.For <IFileSystem>(); _access = Substitute.For <IProjectConfigurationSettingsAccess>(); _access.Settings.Returns(_coll); _csp = Substitute.For <IProjectConfigurationSettingsProvider>(); _csp.OpenProjectSettingsAccessAsync(null, null).ReturnsForAnyArgs(Task.FromResult(_access)); _unconfiguredProject = Substitute.For <UnconfiguredProject>(); _unconfiguredProject.FullPath.Returns(@"C:\file.rproj"); _properties = Substitute.For <IRProjectProperties>(); _properties.GetSettingsFileAsync().Returns(Task.FromResult <string>(null)); }