internal bool CheckSqlOdbcDriverVersion() { using (var hklm = _coreShell.GetService <IRegistry>().OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)) { using (var odbcKey = hklm.OpenSubKey(@"SOFTWARE\ODBC\ODBCINST.INI\ODBC Driver 13 for SQL Server")) { var driverPath = odbcKey.GetValue("Driver") as string; if (!string.IsNullOrEmpty(driverPath)) { var fs = _coreShell.FileSystem(); if (fs.FileExists(driverPath)) { var version = fs.GetFileVersion(driverPath); if (version >= new Version("2015.131.4413.46")) { return(true); } } } } } var app = _coreShell.GetService <IApplication>(); var link = FormatLocalizedLink(app.LocaleId, "https://www.microsoft.com/{0}/download/details.aspx?id=53339"); _coreShell.ShowErrorMessage(Resources.Error_OdbcDriver.FormatInvariant(link)); _coreShell.Process().Start(link); return(false); }
public SourceFilesCommand(ConfiguredProject configuredProject, IRInteractiveWorkflowVisualProvider interactiveWorkflowProvider, ICoreShell shell) : base(interactiveWorkflowProvider, shell.UI(), shell.FileSystem()) { _configuredProject = configuredProject; _interactiveWorkflowProvider = interactiveWorkflowProvider; _shell = shell; }
public RInteractiveEvaluator(IRSessionProvider sessionProvider, IRSession session, IRHistory history, IConnectionManager connections, ICoreShell coreShell, IRSettings settings, IConsole console) { History = history; Session = session; _sessionProvider = sessionProvider; _connections = connections; _coreShell = coreShell; _settings = settings; _console = console; _evaluatorRequest = new CountdownDisposable(); _fs = _coreShell.FileSystem(); _disposableBag .Add(() => Session.Output -= SessionOnOutput) .Add(() => Session.Connected -= SessionOnConnected) .Add(() => Session.Disconnected -= SessionOnDisconnected) .Add(() => Session.BeforeRequest -= SessionOnBeforeRequest) .Add(() => Session.AfterRequest -= SessionOnAfterRequest) .Add(() => _sessionProvider.BrokerChanging -= OnBrokerChanging); _sessionProvider.BrokerChanging += OnBrokerChanging; Session.Output += SessionOnOutput; Session.Connected += SessionOnConnected; Session.Disconnected += SessionOnDisconnected; Session.BeforeRequest += SessionOnBeforeRequest; Session.AfterRequest += SessionOnAfterRequest; }
public static async Task <SqlPublshOptionsDialog> CreateAsync( ICoreShell shell, IProjectSystemServices pss, IProjectConfigurationSettingsProvider pcsp, ISettingsStorage settings) { var dialog = new SqlPublshOptionsDialog(shell, pss, shell.FileSystem(), pcsp, settings); await dialog.InitializeModelAsync(); return(dialog); }
/// <summary> /// Given folder, prefix and extension generates unique file name in the project folder. /// </summary> public string GetUniqueFileName(string folder, string prefix, string extension, bool appendUnderscore = false) { string suffix = appendUnderscore ? "_" : string.Empty; string name = Path.ChangeExtension(Path.Combine(folder, prefix), extension); if (!_coreShell.FileSystem().FileExists(name)) { return(name); } for (int i = 1; ; i++) { name = Path.Combine(folder, Invariant($"{prefix}{suffix}{i}.{extension}")); if (!_coreShell.FileSystem().FileExists(name)) { return(name); } } }
public RHistoryProvider(ICoreShell coreShell) { _textBufferFactory = coreShell.GetService <ITextBufferFactoryService>(); _contentTypeRegistryService = coreShell.GetService <IContentTypeRegistryService>(); _editorOperationsFactory = coreShell.GetService <IEditorOperationsFactoryService>(); _rtfBuilderService = coreShell.GetService <IRtfBuilderService>(); _textSearchService = coreShell.GetService <ITextSearchService2>(); _settings = coreShell.GetService <IRSettings>(); _histories = new Dictionary <ITextBuffer, IRHistory>(); _fs = coreShell.FileSystem(); }
public async Task <bool> TryHandleCommandAsync(IImmutableSet <IProjectTree> nodes, long commandId, bool focused, long commandExecuteOptions, IntPtr variantArgIn, IntPtr variantArgOut) { if (commandId == RPackageCommandId.icmdSourceSelectedFiles || commandId == RPackageCommandId.icmdSourceSelectedFilesWithEcho) { bool echo = commandId == RPackageCommandId.icmdSourceSelectedFilesWithEcho; IFileSystem fs = _shell.FileSystem(); IEnumerable <string> rFiles = Enumerable.Empty <string>(); var workflow = _interactiveWorkflowProvider.GetOrCreate(); try { var session = workflow.RSession; if (session.IsRemote) { var files = nodes.GetSelectedNodesPaths().Where(x => Path.GetExtension(x).EqualsIgnoreCase(RContentTypeDefinition.FileExtension) && fs.FileExists(x)); var properties = _configuredProject.Services.ExportProvider.GetExportedValue <ProjectProperties>(); string projectDir = Path.GetDirectoryName(_configuredProject.UnconfiguredProject.FullPath); string projectName = properties.GetProjectName(); string remotePath = await properties.GetRemoteProjectPathAsync(); await SendToRemoteAsync(files, projectDir, projectName, remotePath); rFiles = files.Select(p => p.MakeRelativePath(projectDir).ProjectRelativePathToRemoteProjectPath(remotePath, projectName)); } else { rFiles = nodes.GetSelectedNodesPaths().Where(x => Path.GetExtension(x).EqualsIgnoreCase(RContentTypeDefinition.FileExtension) && fs.FileExists(x)); } workflow.Operations.SourceFiles(rFiles, echo); } catch (IOException ex) { _shell.ShowErrorMessage(string.Format(CultureInfo.InvariantCulture, Resources.Error_CannotTransferFile, ex.Message)); } catch (RHostDisconnectedException) { workflow.ActiveWindow.InteractiveWindow.WriteErrorLine(Resources.Error_CannotTransferNoRSession); } return(true); } return(false); }
public RInteractiveWorkflow(IConnectionManagerProvider connectionsProvider , IRHistoryProvider historyProvider , IRPackageManagerProvider packagesProvider , IRPlotManagerProvider plotsProvider , IActiveWpfTextViewTracker activeTextViewTracker , IDebuggerModeTracker debuggerModeTracker , ICoreShell coreShell) { _activeTextViewTracker = activeTextViewTracker; _debuggerModeTracker = debuggerModeTracker; _settings = coreShell.GetService <IRSettings>(); _mainThread = coreShell.MainThread(); Shell = coreShell; var console = new InteractiveWindowConsole(this); Console = console; RSessions = new RSessionProvider(coreShell.Services, Console); RSession = RSessions.GetOrCreate(SessionNames.InteractiveWindow); Connections = connectionsProvider.CreateConnectionManager(this); History = historyProvider.CreateRHistory(this); Packages = packagesProvider.CreateRPackageManager(_settings, this); Plots = plotsProvider.CreatePlotManager(_settings, this, coreShell.FileSystem()); _operations = new RInteractiveWorkflowOperations(this, _debuggerModeTracker, Shell); _activeTextViewTracker.LastActiveTextViewChanged += LastActiveTextViewChanged; RSession.Disconnected += RSessionDisconnected; _settings.PropertyChanged += OnSettingsChanged; _disposableBag = DisposableBag.Create <RInteractiveWorkflow>() .Add(() => _settings.PropertyChanged -= OnSettingsChanged) .Add(() => _activeTextViewTracker.LastActiveTextViewChanged -= LastActiveTextViewChanged) .Add(() => RSession.Disconnected -= RSessionDisconnected) .Add(RSessions) .Add(Operations) .Add(Connections) .Add(console); }
public RProjectLoadHooks(UnconfiguredProject unconfiguredProject , [ImportMany("Microsoft.VisualStudio.ProjectSystem.Microsoft.VisualStudio.Shell.Interop.IVsProject")] IEnumerable <Lazy <IVsProject> > cpsIVsProjects , IProjectLockService projectLockService , IThreadHandling threadHandling , [Import(AllowDefault = true)] IProjectItemDependencyProvider dependencyProvider , ICoreShell coreShell) { _unconfiguredProject = unconfiguredProject; _cpsIVsProjects = cpsIVsProjects; _projectLockService = projectLockService; _settings = coreShell.GetService <IRSettings>(); _threadHandling = threadHandling; _coreShell = coreShell; _projectDirectory = unconfiguredProject.GetProjectDirectory(); unconfiguredProject.ProjectRenamedOnWriter += ProjectRenamedOnWriter; unconfiguredProject.ProjectUnloading += ProjectUnloadingAsync; _fileWatcher = new MsBuildFileSystemWatcher(_projectDirectory, "*", 25, 1000, _coreShell.FileSystem(), new RMsBuildFileSystemFilter(), coreShell.Log()); _fileWatcher.Error += FileWatcherError; Project = new FileSystemMirroringProject(unconfiguredProject, projectLockService, _fileWatcher, dependencyProvider, coreShell.Log()); }
public PublishSProcCommand(ICoreShell shell, IProjectSystemServices pss, IDacPackageServicesProvider dacServicesProvider, ISettingsStorage settings) : this(shell, pss, shell.FileSystem(), dacServicesProvider, settings) { }
public RProjectLoadHooks(UnconfiguredProject unconfiguredProject , [ImportMany("Microsoft.VisualStudio.ProjectSystem.Microsoft.VisualStudio.Shell.Interop.IVsProject")] IEnumerable <Lazy <IVsProject> > cpsIVsProjects , IProjectLockService projectLockService , IRInteractiveWorkflowVisualProvider workflowProvider , IInteractiveWindowComponentContainerFactory componentContainerFactory , IRToolsSettings toolsSettings , IThreadHandling threadHandling , ISurveyNewsService surveyNews , [Import(AllowDefault = true)] IProjectItemDependencyProvider dependencyProvider , ICoreShell coreShell) { _unconfiguredProject = unconfiguredProject; _cpsIVsProjects = cpsIVsProjects; _projectLockService = projectLockService; _workflowProvider = workflowProvider; _toolsSettings = toolsSettings; _threadHandling = threadHandling; _surveyNews = surveyNews; _dependencyProvider = dependencyProvider; _coreShell = coreShell; _projectDirectory = unconfiguredProject.GetProjectDirectory(); unconfiguredProject.ProjectRenamedOnWriter += ProjectRenamedOnWriter; unconfiguredProject.ProjectUnloading += ProjectUnloading; _fileWatcher = new MsBuildFileSystemWatcher(_projectDirectory, "*", 25, 1000, _coreShell.FileSystem(), new RMsBuildFileSystemFilter(), coreShell.Log()); _fileWatcher.Error += FileWatcherError; Project = new FileSystemMirroringProject(unconfiguredProject, projectLockService, _fileWatcher, _dependencyProvider, coreShell.Log()); }