protected void RemoveCodeFile(string fileName)
        {
            var oldFile = projectContent.GetFile(fileName);

            projectContent = projectContent.RemoveFiles(fileName);
            testProject.NotifyParseInformationChanged(oldFile, null);
        }
        protected void RemoveCodeFile(string fileName)
        {
            var oldFile = projectContent.GetFile(fileName);

            Assert.IsNotNull(oldFile, "Could not remove file (missing old file): " + fileName);
            projectContent = projectContent.RemoveFiles(fileName);
            assemblyModel.Update(oldFile, null);
        }
 public void ParseInformationUpdated(IUnresolvedFile oldFile, IUnresolvedFile newFile)
 {
     // This method is called by the parser service within the parser service (per-file) lock.
     lock (lockObj) {
         if (!disposed)
         {
             if (newFile != null)
             {
                 projectContent = projectContent.AddOrUpdateFiles(newFile);
             }
             else
             {
                 projectContent = projectContent.RemoveFiles(oldFile.FileName);
             }
             serializedProjectContentIsUpToDate = false;
             SD.ParserService.InvalidateCurrentSolutionSnapshot();
             SD.MainThread.InvokeAsyncAndForget(delegate { assemblyModel.Update(oldFile, newFile); });
         }
     }
 }
        static Task SerializeAsync(string cacheFileName, IProjectContent pc)
        {
            if (cacheFileName == null)
            {
                return(Task.FromResult <object>(null));
            }
            Task task = IOTaskScheduler.Factory.StartNew(
                delegate {
                pc = pc.RemoveAssemblyReferences(pc.AssemblyReferences);
                int serializableFileCount = 0;
                List <string> nonSerializableUnresolvedFiles = new List <string>();
                foreach (var unresolvedFile in pc.Files)
                {
                    if (IsSerializable(unresolvedFile))
                    {
                        serializableFileCount++;
                    }
                    else
                    {
                        nonSerializableUnresolvedFiles.Add(unresolvedFile.FileName);
                    }
                }
                // remove non-serializable parsed files
                if (nonSerializableUnresolvedFiles.Count > 0)
                {
                    pc = pc.RemoveFiles(nonSerializableUnresolvedFiles);
                }
                if (serializableFileCount > 3)
                {
                    LoggingService.Debug("Serializing " + serializableFileCount + " files to " + cacheFileName);
                    SaveToCache(cacheFileName, pc);
                }
                else
                {
                    RemoveCache(cacheFileName);
                }
            }, SD.ShutdownService.DelayedShutdownToken);

            SD.ShutdownService.AddBackgroundTask(task);
            return(task);
        }
		static Task SerializeAsync(string cacheFileName, IProjectContent pc)
		{
			if (cacheFileName == null)
				return Task.FromResult<object>(null);
			Task task = IOTaskScheduler.Factory.StartNew(
				delegate {
					pc = pc.RemoveAssemblyReferences(pc.AssemblyReferences);
					int serializableFileCount = 0;
					List<string> nonSerializableUnresolvedFiles = new List<string>();
					foreach (var unresolvedFile in pc.Files) {
						if (IsSerializable(unresolvedFile))
							serializableFileCount++;
						else
							nonSerializableUnresolvedFiles.Add(unresolvedFile.FileName);
					}
					// remove non-serializable parsed files
					if (nonSerializableUnresolvedFiles.Count > 0)
						pc = pc.RemoveFiles(nonSerializableUnresolvedFiles);
					if (serializableFileCount > 3) {
						LoggingService.Debug("Serializing " + serializableFileCount + " files to " + cacheFileName);
						SaveToCache(cacheFileName, pc);
					} else {
						RemoveCache(cacheFileName);
					}
				}, SD.ShutdownService.DelayedShutdownToken);
			SD.ShutdownService.AddBackgroundTask(task);
			return task;
		}