private void ReloadSeverities() { string realPath = _solutionDir + _path; DocumentLifetimeManager.WatchFile(realPath, _scoreFileName); LoadSeverities(realPath + _scoreFileName); }
private void WatchScoreFile() { string realPath = Path.GetDirectoryName(ScoreLocation) + '\\'; string filename = Path.GetFileName(ScoreLocation); DocumentLifetimeManager.WatchFile(realPath, filename); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> /// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param> /// <param name="progress">A provider for progress updates.</param> /// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns> protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // When initialized asynchronously, the current thread may be a background thread at this point. // Do any initialization that requires the UI thread after switching to the UI thread. await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); CompilerData.Instance.Initialize(this, this); DocumentLifetimeManager.Initialize(this); await CompileScore.Overview.OverviewWindowCommand.InitializeAsync(this); }
private void InitSystems() { var package = new CompileScorePackage(); var serviceProvider = new VSFakeServiceProvider(); OutputLog.Initialize(serviceProvider); CompilerData.Instance.Initialize(package, serviceProvider); Timeline.CompilerTimeline.Instance.Initialize(package); DocumentLifetimeManager.Initialize(serviceProvider); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> /// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param> /// <param name="progress">A provider for progress updates.</param> /// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns> protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // When initialized asynchronously, the current thread may be a background thread at this point. // Do any initialization that requires the UI thread after switching to the UI thread. await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); OutputLog.Initialize(this); DocumentLifetimeManager.Initialize(this); SettingsManager.Instance.Initialize(); CompilerData.Instance.Initialize(this, this); EditorUtils.Initialize(this, this); Profiler.Instance.Initialize(this); Timeline.CompilerTimeline.Instance.Initialize(this); EditorContext.Instance.Initialize(this); await CustomCommands.InitializeAsync(this); }
private async System.Threading.Tasks.Task GatherAsync() { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); OutputLog.Focus(); SetState(StateType.Gathering); DocumentLifetimeManager.UnWatchFile(); string inputPath = CompilerSource == Compiler.Clang ? FixPath(Evaluator.Evaluate(SettingsManager.Instance.Settings.ScoreGenerator.InputPath)) : ""; string inputCommand = inputPath.Length > 0 ? " -i " + inputPath : ""; string outputPath = Evaluator.Evaluate(SettingsManager.Instance.Settings.ScoreGenerator.OutputPath); string outputCommand = outputPath.Length > 0 ? " -o " + outputPath : ""; string detail = " -d " + (int)OverviewDetail; string timeline = TimelinePacking == 0 ? " -nt" : " -tp " + TimelinePacking + " -td " + (int)TimelineDetail; string commandLine = GetPlatformFlag() + " -stop" + timeline + detail + inputCommand + outputCommand; CreateDirectory(Path.GetDirectoryName(outputPath)); OutputLog.Log("Calling ScoreDataExtractor with " + commandLine); int exitCode = ExternalProcess.ExecuteSync(GetScoreExtractorToolPath(), commandLine); if (exitCode != 0) { DisplayError("Score Data Extractor process failed with code " + exitCode + ". Please check the output pane for more information."); } CompilerData.Instance.ForceLoadFromFilename(outputPath); EditorUtils.FocusOverviewWindow(); OutputLog.Log("Score generation completed!"); SetState(StateType.Idle); }
public void ForceLoadFromFilename(string filename) { ThreadHelper.ThrowIfNotOnUIThread(); bool locationChanged = SetScoreLocation(EditorUtils.NormalizePath(filename)); if (Source == DataSource.Default) { if (locationChanged) { //requested a force file different than current ( force it and disable file watching ) SetSource(DataSource.Forced); DocumentLifetimeManager.UnWatchFile(); } else { //if the forced file is the same as the current deafult file, then just reenabled the file watcher WatchScoreFile(); } LoadSeverities(ScoreLocation); } else { string defaultPath = GetSettingsScoreLocation(); if (defaultPath == filename) { //We are forcing back to default LoadDefaultSource(); } else { LoadSeverities(ScoreLocation); } } }
private async System.Threading.Tasks.Task GenerateClangScoreAsync() { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); if (CompilerSource != Compiler.Clang) { return; } //Stop watching as the data extractor might modify the watched file DocumentLifetimeManager.UnWatchFile(); //Process Data string inputPath = FixPath(Evaluator.Evaluate(SettingsManager.Instance.Settings.ScoreGenerator.InputPath)); string outputPath = Evaluator.Evaluate(SettingsManager.Instance.Settings.ScoreGenerator.OutputPath); CreateDirectory(Path.GetDirectoryName(outputPath)); string detail = " -d " + (int)OverviewDetail; string timeline = TimelinePacking == 0 ? " -nt" : " -tp " + TimelinePacking + " -td " + (int)TimelineDetail; string commandLine = "-clang -extract" + timeline + detail + " -i " + inputPath + " -o " + outputPath; OutputLog.Log("Calling ScoreDataExtractor with " + commandLine); int exitCode = await ExternalProcess.ExecuteAsync(GetScoreExtractorToolPath(), commandLine); if (exitCode != 0) { DisplayError("Compile Score Data Extractor process failed with code " + exitCode + ". Please check the output pane for more information."); } CompilerData.Instance.ForceLoadFromFilename(outputPath); EditorUtils.FocusOverviewWindow(); OutputLog.Log("Score generation completed!"); }