void AnalyzeFile(JobSlice item, IEnumerable <BaseCodeIssueProvider> codeIssueProviders)
        {
//			var file = item.File;
//
//			if (file.BuildAction != BuildAction.Compile)
//				return;
//
//			if (!(file.Project is DotNetProject))
//				return;
//
//			TextEditorData editor;
//			try {
//				editor = TextFileProvider.Instance.GetReadOnlyTextEditorData (file.FilePath);
//			} catch (FileNotFoundException) {
//				// Swallow exception and ignore this file
//				return;
//			}
//			var document = TypeSystemService.ParseFile (file.Project, editor);
//			if (document == null)
//				return;
//
//			var content = TypeSystemService.GetProjectContext (file.Project);
//			var compilation = content.AddOrUpdateFiles (document.ParsedFile).CreateCompilation ();
//
//			CSharpAstResolver resolver;
//			using (var timer = ExtensionMethods.ResolveCounter.BeginTiming ()) {
//				resolver = new CSharpAstResolver (compilation, document.GetAst<SyntaxTree> (), document.ParsedFile as ICSharpCode.NRefactory.CSharp.TypeSystem.CSharpUnresolvedFile);
//				try {
//					resolver.ApplyNavigator (new ExtensionMethods.ConstantModeResolveVisitorNavigator (ResolveVisitorNavigationMode.Resolve, null));
//				} catch (Exception e) {
//					LoggingService.LogError ("Error while applying navigator", e);
//				}
//			}
//			var context = document.CreateRefactoringContextWithEditor (editor, resolver, CancellationToken.None);
//
//			foreach (var provider in codeIssueProviders) {
//				if (item.CancellationToken.IsCancellationRequested)
//					break;
//				IList<IAnalysisJob> jobs;
//				lock (_lock)
//					jobs = item.GetJobs ().ToList ();
//				var jobsForProvider = jobs.Where (j => j.GetIssueProviders (file).Contains (provider)).ToList();
//				try {
//					var issues = provider.GetIssues (context, CancellationToken.None).ToList ();
//					foreach (var job in jobsForProvider) {
//						// Call AddResult even if issues.Count == 0, to enable a job implementation to keep
//						// track of progress information.
//						job.AddResult (file, provider, issues);
//					}
//				} catch (OperationCanceledException) {
//					// The operation was cancelled, no-op as the user-visible parts are
//					// handled elsewhere
//				} catch (Exception e) {
//					foreach (var job in jobsForProvider) {
//						job.AddError (file, provider);
//					}
//				}
//			}
        }
예제 #2
0
 /// <summary>
 /// Marks a slice of the job as complete and marks the job as completed if all slices have been completed.
 /// </summary>
 /// <param name="slice">The completed slice.</param>
 public void MarkAsComplete(JobSlice slice)
 {
     lock (_lock) {
         slices.Remove(slice);
         if (slices.Count == 0)
         {
             job.SetCompleted();
         }
     }
 }
예제 #3
0
 /// <summary>
 /// Adds the specified job to the queue.
 /// </summary>
 /// <param name="job">The job.</param>
 public void Add(IAnalysisJob job)
 {
     lock (_lock) {
         var jobStatus = new JobStatus(job);
         foreach (var file in job.GetFiles())
         {
             JobSlice slice = slices.FirstOrDefault(j => j.File == file);
             if (slice == null)
             {
                 slice = new JobSlice(file);
                 slices.Add(slice);
             }
             jobStatus.AddSlice(slice);
             slice.AddJob(job, jobStatus);
         }
         InvalidateSort();
     }
 }
예제 #4
0
 /// <summary>
 /// Remove the specified job from the queue.
 /// </summary>
 /// <param name="job">The job to remove.</param>
 public void Remove(IAnalysisJob job)
 {
     lock (_lock) {
         foreach (var file in job.GetFiles())
         {
             JobSlice queueItem = slices.FirstOrDefault(j => j.File == file);
             if (queueItem == null)
             {
                 // The file might have been processed already, carry on
                 continue;
             }
             queueItem.RemoveJob(job);
             if (!queueItem.GetJobs().Any())
             {
                 slices.Remove(queueItem);
             }
         }
         InvalidateSort();
     }
 }
예제 #5
0
 /// <summary>
 /// Adds another slice. This method should not be called after <see cref="MarkAsComplete"/> has been called.
 /// </summary>
 /// <param name="slice">Slice.</param>
 public void AddSlice(JobSlice slice)
 {
     lock (_lock) {
         slices.Add(slice);
     }
 }